VkNode(3x) VkNode(3x)
VkNode - Base node class used by VkGraph
VkComponent
#include <Vk/VkNode.h>
PUBLIC PROTOCOL SUMMARY
Constructor/Destructor
VkNode(void);
VkNode(const char *name,const char *label);
VkNode(const char *name,
VkNode *parent,
const char *label);
virtual void ~VkNode(void);
Sorting [Toc] [Back]
static void setSortFunction(VkNodeSortFunction f);
void sortChildren(void);
Access Functions [Toc] [Back]
virtual char* label(void);
int nChildren(void);
int nParents(void);
Finding Parent/Children
VkNode* findChild(char* name);
VkNode* findParent(char* name);
VkNode* child(int index);
VkNode* parent(int index);
PROTECTED PROTOCOL SUMMARY [Toc] [Back] Building widgets
virtual void build(Widget parent);
Page 1
VkNode(3x) VkNode(3x)
_label
char* _label;
The VkNode class is used by the VkGraph class as a node in an
abstract graph that can create a widget for display on demand. By
default, this class creates an XmIconGadget as the widget displayed.
VkNode is often subclassed to alter the widgets used to display
nodes, as well as to maintain other data associated with a node.
Subclasses of VkNode can be created to provide a place to maintain
additional data, or to change the way the node displays itself in a
graph. The VkGraph widget calls the VkNode::build() function when it
needs a widget. Derived classes can override this virtual function
if desired. This function is expected to create a widget, or
widgets, assigning the widget or root of a widget hierarchy to the
_baseWidget member. Derived classes should call
installDestroyHandler() after creating the _baseWidget. See
VkComponent for details. The VkNode class supports a _label member
which may be used to specify a label for a node. If this makes sense
for the nodes created by a subclass, this member is available.
Derived classes must be prepared for widgets to be created and
destroyed dynamically, under the control of the graph widget.
FUNCTION DESCRIPTIONS [Toc] [Back] build()
virtual void build(Widget parent);
Create a widget as a child of the specified parent to be displayed
in a graph.
VkNode() [Toc] [Back]
VkNode(void);
Initialize a VkNode object. A unique name for the object is
generated automatically.
VkNode() [Toc] [Back]
VkNode(const char *name, const char *label);
Page 2
VkNode(3x) VkNode(3x)
Create a VkNode object with the given name and a label to be used
when the node is displayed.
VkNode() [Toc] [Back]
VkNode(const char *name,
VkNode *parent,
const char *label);
Create a VkNode object with a specified parent in a graph. The
widget has the given name and a label to be used when the node is
displayed.
setSortFunction()
static void setSortFunction(VkNodeSortFunction f);
Install a sort function to be used when sorting the graph. The form
of the sort function is
int (*VkNodeSortFunction)(VkNode *child1, VkNode *child2);
The function is expected to conform to qsort conventions: the
function must return an integer less than, equal to, or greater than
zero according to whether the first argument is to be considered be
less than, equal to, or greater than the second.
~VkNode()
virtual void ~VkNode(void);
Free all memory associated with a VkNode object. The widget is
destroyed, and all connections to other nodes are removed. The
object is also automatically removed from the VkGraph abstract
graph.
label()
virtual char* label(void);
Returns any label associated with this node.
nChildren()
int nChildren(void);
Returns the number of children connected to this node.
nParents()
Page 3
VkNode(3x) VkNode(3x)
int nParents(void);
Returns the number of parents connected to this node.
findChild()
VkNode* findChild(char *name);
Return the VkNode object for the named child. This function searches
only immediate children.
findParent()
VkNode* findParent(char* name);
Return the VkNode object for the named parent. This function
searches only immediate parents.
child()
VkNode* child(int index);
Returns a child VkNode object by index.
parent()
VkNode* parent(int index);
Returns a parent VkNode object by index.
sortChildren()
void sortChildren(void);
Apply the installed sort function to this node's immediate children.
DATA MEMBER DESCRIPTIONS [Toc] [Back] _label
char* _label;
A character string that can be used to label node, distinct from the
node's name.
INHERITED MEMBER FUNCTIONS [Toc] [Back] Inherited from VkComponent
installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(),
setDefaultResources(), getResources(), manage(), unmanage(),
baseWidget(), okToQuit(), _name, _baseWidget, _w, deleteCallback
Page 4
VkNode(3x) VkNode(3x)
Inherited from VkCallbackObject [Toc] [Back]
callCallbacks(), addCallback(), removeCallback(),
removeAllCallbacks()
KNOWN CLASSES THAT USE THIS CLASS [Toc] [Back] VkGraph
VkComponent, VkGraph, VkNode
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
PPPPaaaaggggeeee 5555 [ Back ]
|