Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

MTree Object

This Object allows the creation of a graphical tree. More...

Functions

MOBJECT MCreateTree (MOBJECT parent, MTFont font, int width, int height, int n_types)
 Create an empty MTree widget.

MTNODE MTreeCreateNode (MOBJECT tree, MTNODE parent, CARD16 type, CARD16 flags, const char *text, void *ud)
 Adds a node to the MTree.

void MTreeDestroyNode (MTNODE node, int notify)
 Destroys a node and all its contained nodes.

void MTreeDestroyNodeContainee (MTNODE node, int notify)
 Destroys all contained nodes, but not the node itself.

void MTreeOpenNode (MTNODE node, int notify)
 Opens a node making its children available.

void MTreeCloseNode (MTNODE node, int notify)
 Closes a node making its children unavailable.

void MTreeSelectNode (MTNODE node, int notify)
 Selects a node (passing it the input focus).

void MTreeSetOpenCallback (MOBJECT tree, MTREE_NODE_CB cb, void *ud)
 Sets the node open callback at Tree level (same callback for all nodes).

void MTreeSetCloseCallback (MOBJECT tree, MTREE_NODE_CB cb, void *ud)
 Sets the node close callback at Tree level (same callback for all nodes).

void MTreeSetSelectCallback (MOBJECT tree, MTREE_NODE_CB cb, void *ud)
 Sets the node select callback at Tree level (same callback for all nodes).

void MTreeSetDestroyCallback (MOBJECT tree, MTREE_NODE_CB cb, void *ud)
 Sets the node close callback at Tree level (same callback for all nodes).

void MTreeSetImagesByName (MOBJECT tree, int type, const char *norm, const char *open, const char *sel)
 Sets the images to be associated to a given node type.

void MTreeSetImagesByData (MOBJECT tree, int type, MIMAGE norm, MIMAGE open, MIMAGE sel)
 Sets the images to be associated to a give node type.

void MTreeSetHighLightColors (MOBJECT tree, MTColor bgc, MTColor fgc)
 Sets the text foreground and background colors to be used to highlight a selected node.

void MTreeSetHighLightFGColor (MOBJECT tree, MTColor fgc)
 Sets the text foreground color to be used to highlight a selected node.

void MTreeSetLineColor (MOBJECT tree, MTColor color)
 Sets the color to be used to draw node connecting lines.

MOBJECT MTreeGetVScrollBar (MOBJECT tree)
 Returns the widget identifier of the vertical scrollbar in an MTree object.

MOBJECT MTreeGetHScrollBar (MOBJECT tree)
 Returns the widget identifier of the horizontal scrollbar in an MTree object.

void MTreeSetSliderColor (MOBJECT tree, MTColor color)
 Sets the color of the sliders in the scrollbars of an MTree object.

void MTreeSetSliderColorShift (MOBJECT tree, int percentage)
 Sets the color of the sliders in the scrollbars of an MTree object as a percentage of their normal color.

MTNODE MTreeGetSelectedNode (MOBJECT tree)
 Returns the identifier of the currently selected node.

MTNODE MTreeGetFirstNode (MOBJECT tree)
 Returns the identifier of the first node in an MTree object.

MTNODE MTreeNodeGetNext (MTNODE node)
 Returns the identifier of the node following the one specified as argument.

MTNODE MTreeNodeGetFirstChild (MTNODE node)
 Returns the identifier of the first node contained inside the one specified as argument.

MTNODE MTreeNodeGetParent (MTNODE node)
 Returns the identifier of the parent node of the one specified as argument.

char * MTreeNodeGetPath (MTNODE node, char separator, char *buff)
 Creates a path composed by concatenating the name of all nodes starting from the root up to the node specified as argument.

void MTreeNodeSetImages (MTNODE node, MIMAGE norm, MIMAGE open, MIMAGE sel)
 Sets the images to be associated to a specific node.

void MTreeNodeSetText (MTNODE node, const char *text)
 Changes the text associated to a node.

char * MTreeNodeGetText (MTNODE node, char *text)
 Retrieves the text associated to a node.

void MTreeNodeSetUserData (MTNODE node, void *ud)
 Sets the user data associated to a node.

void * MTreeNodeGetUserData (MTNODE node)
 Retrieves the value of the user data for node callbacks.

MOBJECT MTreeNodeGetMTree (MTNODE node)
 Retrieves the MTree container for a node.

CARD16 MTreeNodeGetType (MTNODE node)
 Retrieves the type of the specified node.

void MTreeNodeSetOpenCallback (MTNODE node, MTREE_NODE_CB cb, void *ud)
 Sets the node open callback at local level (callback applies to this node only).

void MTreeNodeSetCloseCallback (MTNODE node, MTREE_NODE_CB cb, void *ud)
 Sets the node close callback at local level (callback applies to this node only).

void MTreeNodeSetSelectCallback (MTNODE node, MTREE_NODE_CB cb, void *ud)
 Sets the node select callback at local level (callback applies to this node only).

void MTreeNodeSetDestroyCallback (MTNODE node, MTREE_NODE_CB cb, void *ud)
 Sets the node destroy callback at local level (callback applies to this node only).


Detailed Description

This Object allows the creation of a graphical tree.

It is used by the MFileBrowse utility function. It was made up using the standard MGui API.


Function Documentation

MOBJECT MCreateTree MOBJECT    parent,
MTFont    font,
int    width,
int    height,
int    n_types
 

Create an empty MTree widget.

Parameters:
parent Container parent widget.
font Fonts to be used for displaying node names.
width initial desired width (in pixel units).
height initial desired height (in pixel units).
n_types number of node types (used internally to pre-allocate structures).
See also:
MTreeCreateNode

void MTreeCloseNode MTNODE    node,
int    notify
 

Closes a node making its children unavailable.

Parameters:
node The node to be closed.
notify Boolean value stating whether or not to call the node close callback.

MTNODE MTreeCreateNode MOBJECT    tree,
MTNODE    parent,
CARD16    type,
CARD16    flags,
const char *    text,
void *    ud
 

Adds a node to the MTree.

Parameters:
tree MTree object which to add the node to.
parent The node containing the one being created (NULL for 1st level node).
type An integer value identifying the node type. Must be less than the n_types used when the MTree object was created.
flags Currently supported flags include the value NF_CONTAINER.
text Text associated to the node.
ud User data that will be returned back in tree/node callbacks.
See also:
MCreateTree

void MTreeDestroyNode MTNODE    node,
int    notify
 

Destroys a node and all its contained nodes.

Parameters:
node The node to be destroyed.
notify Boolean value stating whether or not to call the destroy callback for the node itself and all contained nodes.
See also:
MTreeCreateNode, MTreeDestroyNodeContainee

void MTreeDestroyNodeContainee MTNODE    node,
int    notify
 

Destroys all contained nodes, but not the node itself.

Parameters:
node The node to be emptied.
notify Boolean value stating whether or not to call the destroy callback for all contained nodes.
See also:
MTreeCreateNode, MTreeDestroyNode

MTNODE MTreeGetFirstNode MOBJECT    tree
 

Returns the identifier of the first node in an MTree object.

Parameters:
tree The MTree object.
See also:
MTreeNodeGetNext, MTreeNodeGetFirstChild

MOBJECT MTreeGetHScrollBar MOBJECT    tree
 

Returns the widget identifier of the horizontal scrollbar in an MTree object.

Parameters:
tree The MTree object.
See also:
MTreeGetVScrollBar

MTNODE MTreeGetSelectedNode MOBJECT    tree
 

Returns the identifier of the currently selected node.

Parameters:
tree The MTree object.
See also:
MTreeSelectNode

MOBJECT MTreeGetVScrollBar MOBJECT    tree
 

Returns the widget identifier of the vertical scrollbar in an MTree object.

Parameters:
tree The MTree object.
See also:
MTreeGetHScrollBar

MTNODE MTreeNodeGetFirstChild MTNODE    node
 

Returns the identifier of the first node contained inside the one specified as argument.

Parameters:
node The node which to get the first child for.
See also:
MTreeNodeGetNext

MOBJECT MTreeNodeGetMTree MTNODE    node
 

Retrieves the MTree container for a node.

Parameters:
node The node which to get information for.

MTNODE MTreeNodeGetNext MTNODE    node
 

Returns the identifier of the node following the one specified as argument.

Parameters:
node The node which to get the next for.
See also:
MTreeGetFirstNode, MTreeNodeGetFirstChild

MTNODE MTreeNodeGetParent MTNODE    node
 

Returns the identifier of the parent node of the one specified as argument.

Parameters:
node The node which to get the parent for.

char* MTreeNodeGetPath MTNODE    node,
char    separator,
char *    buff
 

Creates a path composed by concatenating the name of all nodes starting from the root up to the node specified as argument.

Parameters:
node The node which to get the path for.
separator Character to be used to concatenate two consecutive node names.
buff Return buffer, used to store the path string and returned as value. If NULL is passed, then a suitable buffer is allocated and returned instead. In this case, the application is responsible of freeing the allocated memory.

char* MTreeNodeGetText MTNODE    node,
char *    text
 

Retrieves the text associated to a node.

Parameters:
node The node object to change text to.
text The buffer where to store the node text (returned as value if not NULL).
If NULL is passed, then a suitable buffer is allocated and returned. In this case the application is responsible of freeing the internally allocated buffer.

CARD16 MTreeNodeGetType MTNODE    node
 

Retrieves the type of the specified node.

Parameters:
node The node which to get the type for.

void* MTreeNodeGetUserData MTNODE    node
 

Retrieves the value of the user data for node callbacks.

Parameters:
node The node which to get information for.
See also:
MTreeNodeSetUserData

void MTreeNodeSetCloseCallback MTNODE    node,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node close callback at local level (callback applies to this node only).

Parameters:
node The node which to set the callback for.
cb The node close callback.
ud The callback user data.
See also:
MTreeNodeSetOpenCallback, MTreeNodeSetSelectCallback, MTreeNodeSetDestroyCallback, MTreeSetCloseCallback

void MTreeNodeSetDestroyCallback MTNODE    node,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node destroy callback at local level (callback applies to this node only).

Parameters:
node The node which to set the callback for.
cb The node close callback.
ud The callback user data.
See also:
MTreeNodeSetOpenCallback, MTreeNodeSetSelectCallback, MTreeNodeSetCloseCallback, MTreeSetDestroyCallback

void MTreeNodeSetImages MTNODE    node,
MIMAGE    norm,
MIMAGE    open,
MIMAGE    sel
 

Sets the images to be associated to a specific node.

The set images are used only for the node specified as argument.

Parameters:
node The node object.
norm The image to be used when the node is not opened nor selected.
open The image to be used when the node is opened. If NULL is passed then the norm image will be used instead.
sel The image to be used when the node is selected. If NULL is passed then the norm image will be used instead.
See also:
MTreeSetImagesByName, MTreeNodeSetImages

void MTreeNodeSetOpenCallback MTNODE    node,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node open callback at local level (callback applies to this node only).

Parameters:
node The node which to set the callback for.
cb The node open callback.
ud The callback user data.
See also:
MTreeSetNodeCloseCallback, MTreeNodeSetSelectCallback, MTreeNodeSetDestroyCallback, MTreeSetOpenCallback

void MTreeNodeSetSelectCallback MTNODE    node,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node select callback at local level (callback applies to this node only).

Parameters:
node The node which to set the callback for.
cb The node select callback.
ud The callback user data.
See also:
MTreeNodeSetOpenCallback, MTreeNodeSetCloseCallback, MTreeNodeSetDestroyCallback, MTreeSetSelectCallback

void MTreeNodeSetText MTNODE    node,
const char *    text
 

Changes the text associated to a node.

Parameters:
node The node object to change text to.
text The new text.
See also:
MTreeNodeGetText

void MTreeNodeSetUserData MTNODE    node,
void *    ud
 

Sets the user data associated to a node.

This value is passed back to the application whenever one of the MTree callbacks is called for the given node. There is no global value for user data, you have to supply it for all nodes individually if you're interested in getting a not NULL value as the userd data in the callbacks.

Parameters:
node The node which to assign the new user data value.
ud The user data value.
See also:
MTreeNodeGetUserData

void MTreeOpenNode MTNODE    node,
int    notify
 

Opens a node making its children available.

Parameters:
node The node to be opened.
notify Boolean value stating whether or not to call the node open callback.

void MTreeSelectNode MTNODE    node,
int    notify
 

Selects a node (passing it the input focus).

Parameters:
node The node to be selected.
notify Boolean value stating whether or not to call the node select callback.

void MTreeSetCloseCallback MOBJECT    tree,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node close callback at Tree level (same callback for all nodes).

Parameters:
tree The MTree object.
cb The node close callback.
ud The callback user data.
See also:
MTreeSetOpenCallback, MTreeSetSelectCallback, MTreeSetDestroyCallback, MTreeNodeSetCloseCallback

void MTreeSetDestroyCallback MOBJECT    tree,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node close callback at Tree level (same callback for all nodes).

Parameters:
tree The MTree object.
cb The node destroy callback.
ud The callback user data.
See also:
MTreeSetOpenCallback, MTreeSetSelectCallback, MTreeSetCloseCallback, MTreeNodeSetDestroyCallback

void MTreeSetHighLightColors MOBJECT    tree,
MTColor    bgc,
MTColor    fgc
 

Sets the text foreground and background colors to be used to highlight a selected node.

Parameters:
tree The MTree object.
bgc Background color.
fgc Foreground color.

void MTreeSetHighLightFGColor MOBJECT    tree,
MTColor    fgc
 

Sets the text foreground color to be used to highlight a selected node.

Parameters:
tree The MTree object.
fgc Foreground color.

void MTreeSetImagesByData MOBJECT    tree,
int    type,
MIMAGE    norm,
MIMAGE    open,
MIMAGE    sel
 

Sets the images to be associated to a give node type.

The set images are used by default to draw node icons.

Parameters:
tree The MTree object.
type The node type which to bind images to.
norm The image to be used when the node is not opened nor selected.
open The image to be used when the node is opened. If NULL is passed then the norm BMP will be used instead.
sel The image to be used when the node is selected. If NULL is passed then the norm BMP will be used instead.
See also:
MTreeSetImagesByName, MTreeNodeSetImages

void MTreeSetImagesByName MOBJECT    tree,
int    type,
const char *    norm,
const char *    open,
const char *    sel
 

Sets the images to be associated to a given node type.

The set images are used by default to draw icons for all nodes of the same type.

Parameters:
tree The MTree object.
type The node type which to bind images to.
norm Filename of the BMP image to be used when the node is not opened nor selected.
open Filename of the BMP image to be used when the node is opened. If NULL is passed then the norm BMP will be used instead.
sel Filename of the BMP image to be used when the node is selected. If NULL is passed then the norm BMP will be used instead.
See also:
MTreeSetImagesByData, MTreeNodeSetImages

void MTreeSetLineColor MOBJECT    tree,
MTColor    color
 

Sets the color to be used to draw node connecting lines.

Parameters:
tree The MTree object.
color Background color.

void MTreeSetOpenCallback MOBJECT    tree,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node open callback at Tree level (same callback for all nodes).

Parameters:
tree The MTree object.
cb The node open callback.
ud The callback user data.
See also:
MTreeSetCloseCallback, MTreeSetSelectCallback, MTreeSetDestroyCallback, MTreeNodeSetOpenCallback

void MTreeSetSelectCallback MOBJECT    tree,
MTREE_NODE_CB    cb,
void *    ud
 

Sets the node select callback at Tree level (same callback for all nodes).

Parameters:
tree The MTree object.
cb The node select callback.
ud The callback user data.
See also:
MTreeSetOpenCallback, MTreeSetCloseCallback, MTreeSetDestroyCallback, MTreeNodeSetSelectCallback

void MTreeSetSliderColor MOBJECT    tree,
MTColor    color
 

Sets the color of the sliders in the scrollbars of an MTree object.

Parameters:
tree The MTree object.
color Color to apply.
See also:
MTreeSetSliderColorShift

void MTreeSetSliderColorShift MOBJECT    tree,
int    percentage
 

Sets the color of the sliders in the scrollbars of an MTree object as a percentage of their normal color.

Parameters:
tree The MTree object.
percentage Percentage to apply.
See also:
MTreeSetSliderColor


Generated on Sun Jun 29 13:03:09 2003 for MGui API by doxygen1.3-rc2