VkOutline(3x)
VkOutline - A simple outliner
As shipped in IRIX 6.5.22. Unchanged since IRIX 6.5.
NAME VkOutline - A simple outliner INHERITS FROM VkComponent : VkCallbackObject HEADER FILE #include <Vk/VkOutline.h> PUBLIC PROTOCOL SUMMARY Constructor/Destructor VkOutline (const char *name, Widget parent); virtual void ~VkOutline(void); Public Member Functions void reset(void); Access Functions Widget listWidget(void); Adding elements void add(char* parent, char* child); void addChildren(char** parentPath, char** children); void addChildren(char** parentPath, char** children, char** keys, void** childrenHooks); void createPath(char** names, char** keys); Displaying void displayAll(void); void displayAsKeyword(char** path); void highlight(char** items, int attrIndex); void highlight(int itemPos, int attrIndex); void unhighlight(int attrIndex); Attribute setting void setIndentationWidth(int width); void setKeywordAttributes(Pixel fg, Pixel bg, XmFontList font); int setHighlightAttributes(Pixel fg, Pixel bg, XmFontList font); Toggling void closePath(char** path); int effectOfLastToggle(int& from, int& count); int isPathClosed(char** path); virtual void toggleChildren(int position); Utility void getHookAt(int position); void printTree(void); void select(int itemPos); void walkAllKeywords(void* data, void (func*) (void*, VkOlNode*)); CLASS DESCRIPTION The VkOutline class provides an ability to display a tree of strings in an outline fashion. Each string is displayed in a line with an indentation proportional to its depth in the tree. Each non-leaf string has a control icon displayed to its left. The control icon denotes whether the sub-tree under the string is displayed (open) or not (closed). Control icons can be left-clicked by users to toggle between open and closed states. You can build the tree of strings using the add methods, which accept names of parent and children). Some add methods allow you to provide an additional string for display only, while the name is used for searching purpose. Some add methods allow you to associate a user-defined data pointer (hook) with the children. Note that you can display more than one tree in the outline. You can treat some strings as "keywords" and display them with a different set of attributes (foreground, background, font). You can create (up to 4) different display resource ids (by giving foreground, background, font) and use them to display a subset of strings in the tree. VkOutline uses VkList to do the actual display. FUNCTION DESCRIPTIONS VkOutline() VkOutline(const char* name, Widget parent); Instantiate a VkOutline object given its name and a widget to act as its parent. ~VkOutline() virtual void ~VkOutline(void); Destroy a VkOutline object. reset() void reset(void); Re-initialize the object. Destroys trees built so far. Retains any display resources created. listWidget() Widget listWidget(void); Provide a handle to the underlying VkList widget used for display. add() void add(char* parent, char* child); Add a parent-child relation to the tree. addChildren() void addChildren(char** path, char** children); Add several children under the given path. Noop if path does not exist. char* tables should be terminated by NULL pointers. addChildren() void addChildren(char** path, char** display_names, char** children, void* hooks); Add several children under the given path. Names of children displayed are taken from display_names, their corresponding search names are taken from children and their corresponding user defined data (hooks) are taken from hooks. All pointer tables are to be followed by a NULL pointer and should be of same size. No op if path does not exist. createPath() void createPath(char** display_names, char** path); Create or extend a given path. If path does not exist then a new tree is created with first element in path as the root. Otherwise if a partial match is found in the existing set of trees by treating the first element in the path as the root, then the rest of the elements in the path are used to extend the path. No op if complete match is found. Display names are used when fresh strings are added to the tree. printTree() void printTree(void); Prints all the trees to stdout. toggleChildren() virtual void toggleChildren(int position); Given the position of the item in the outline display, the subtree under that position is closed if already open or opened if already closed. displayAll() void displayAll(void); All trees in the outline are redisplayed with the default attributes. setIndentationWidth() void setIndentationWidth(int width); Sets indentation width for future displays. Indentation width gives the number of pixels which a child string will be right offset from its parent. setKeywordAttributes() void setKeywordAttributes(Pixel fg, Pixel bg, XmFontList font); Set display attributes for strings treated as keywords. setHighlightAttributes() int setHighlightAttributes(Pixel fg, Pixel bg, Pixel scrollbar_bg, XmFontList font); Create a display resource given a set of display parameters. Returns an id which you can use in highlight methods. You can create up to 4 resource ids. displayAsKeyword() void displayAsKeyword(char** path); Treats the string at the end of given path as a keyword and whenever it is displayed the parameters set using the setKeywordAttributes methods are used. highlight() void highlight(char** children, int id); All children nodes if found will be displayed with the resources associated with the given resource id. highlight() void highlight(int item, int id); The node at the given position if valid will be displayed with the resources associated with the given resource id. unhighlight() void unhighlight(int id); All strings displayed using the given resource id is displayed with default resources. getHookAt() void getHookAt(int position); Get the user defined data associated with string in the given display position. closePath() void closePath(char** path); Given the path of a string (last item in the path), close the sub- tree under the string. isPathClosed() int isPathClosed(char** path); Given the path of a string (last item in the path), test whether sub-tree under the string is closed. Returns 1 if closed. effectOfLastToggle() int effectOfLastToggle(int& position, int& count); A toggle operation inserts or deletes a set of contiguous strings from the outline display. This method returns the position and the extent (count) of insertion (return value 1) or deletion (return value 0) done as a result of most recent toggle operation on the outline (by user or by program). select() void select(int itemPos); Select (in the XmList sense) the string displayed at the given position walkAllKeywords() void walkAllKeywords(void* data, void (*func) (void*, VkOlNode*)) Traverses all the strings displayed as keywords to invoke the function func. func is passed two arguments - the first argument is the data that is passed to walkAllKeywords and the second argument is the pointer to the object (of type VkOlNode) which represents an outline item treated as a keyword. See VkOlNode for accessing information about the outline item. init() void init(void); Initialization of outline object. All trees created so far are lost. INHERITED MEMBER FUNCTIONS Inherited from VkComponent installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(), setDefaultResources(), getResources(), manage(), unmanage(), baseWidget(), okToQuit(), _name, _baseWidget, _w, deleteCallback Inherited from VkCallbackObject callCallbacks(), addCallback(), removeCallback(), removeAllCallbacks() SEE ALSO VkComponent, VkCallbackObject ViewKit Programmer's Guide The X Window System, DEC Press, Bob Sheifler and Jim Gettys The X Window System Toolkit, DEC Press, Paul Asente and Ralph Swick The OSF/Motif Programmers Reference, Prentice Hall, OSF