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

CmTree Class Reference

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

Inheritance diagram for CmTree:

CmObject CmMGUI

Public Methods

 CmTree (CmContainer *parent, MTFont font, int width, int height, int n_types)
 CmTree widget.

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

void setImages (int type, CmImage *norm, CmImage *open, CmImage *sel)
 Sets the images to be associated to a give node type.

void setHighLightColors (CmColor *bgc, CmColor *fgc)
 Sets the text foreground and background colors to be used to highlight a selected node.

void setHighLightFGColor (CmColor *fgc)
 Sets the text foreground color to be used to highlight a selected node.

void setLineColor (CmColor *color)
 Sets the color to be used to draw node connecting lines.

void setSliderColor (CmColor *color)
 Sets the color of the sliders in the scrollbars of a CmTree object.

void setSliderColorShift (int percentage)
 Sets the color of the sliders in the scrollbars of a CmTree object as a percentage of their normal color.

void enableAutoSliderColor (void)
 Enables the automatic slider color setting on the scrollbar sliders.

void disableAutoSliderColor (void)
 Disables the automatic slider color setting on the scrollbar sliders.

CmTreeNodegetSelectedNode (void)
 Returns a reference to the currently selected node.

CmTreeNodegetFirstNode (void)
 Returns a reference to the the first node in the tree.

void setOpenCallback (CmCallback *owner, MTREENODE_CB cb)
 Sets the node open callback at Tree level (same callback for all nodes).

void setCloseCallback (CmCallback *owner, MTREENODE_CB cb)
 Sets the node close callback at Tree level (same callback for all nodes).

void setSelectCallback (CmCallback *owner, MTREENODE_CB cb)
 Sets the node select callback at Tree level (same callback for all nodes).

void setPopupCallback (CmCallback *owner, MTREEPOPUP_CB cb)
 Sets the node popup callback at Tree level (same callback for all nodes).

void setRenameCallback (CmCallback *owner, MTREERENAME_CB cb)
 Sets the node rename callback at Tree level (same callback for all nodes).

void setDeleteCallback (CmCallback *owner, MTREEDELETE_CB cb)
 Sets the node delete callback at Tree level (same callback for all nodes).


Detailed Description

MTree Class 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.


Constructor & Destructor Documentation

CmTree::CmTree CmContainer   parent,
MTFont    font,
int    width,
int    height,
int    n_types
 

CmTree 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:
CmTreeNode


Member Function Documentation

void CmTree::disableAutoSliderColor void   
 

Disables the automatic slider color setting on the scrollbar sliders.

This function has the effect of reverting to gray the color of the arrow buttons and the slider in the object's scrollbars.

See also:
enableAutoSliderColor

void CmTree::enableAutoSliderColor void   
 

Enables the automatic slider color setting on the scrollbar sliders.

By default arrow buttons and slider in the scrollbars control are gray. Using this function you can force the object to set a suitable color on its scrollbars. The computed color is based on the object's background color and has a reasonable brightness. The standard gray will result as the computed color if black or white is used on the main object.

See also:
disableAutoSliderColor

CmTreeNode* CmTree::getFirstNode void   
 

Returns a reference to the the first node in the tree.

CmTreeNode* CmTree::getSelectedNode void   
 

Returns a reference to the currently selected node.

void CmTree::setCloseCallback CmCallback   owner,
MTREENODE_CB    cb
 

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

Parameters:
owner Reference to the object providing the callback method.
cb The node close callback.

void CmTree::setDeleteCallback CmCallback   owner,
MTREEDELETE_CB    cb
 

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

This callback is called by the CmTree object when the user presses the DEL key over the selected node. Via the return value of this callback the user can validate (non zero value) or reject (zero value) the node deletion.

Parameters:
cb The delete callback.
See also:
CmTreeNode::setDeleteCallback

void CmTree::setHighLightColors CmColor   bgc,
CmColor   fgc
 

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

Parameters:
bgc Background color.
fgc Foreground color.

void CmTree::setHighLightFGColor CmColor   fgc
 

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

Parameters:
fgc Foreground color.

void CmTree::setImages int    type,
CmImage   norm,
CmImage   open,
CmImage   sel
 

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

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

Parameters:
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:
CmTreeNode::setImages

void CmTree::setImages 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:
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:
CmTreeNode::setImages

void CmTree::setLineColor CmColor   color
 

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

Parameters:
color Background color.

void CmTree::setOpenCallback CmCallback   owner,
MTREENODE_CB    cb
 

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

Parameters:
owner Reference to the object providing the callback method.
cb The node open callback.

void CmTree::setPopupCallback CmCallback   owner,
MTREEPOPUP_CB    cb
 

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

This callback is called by the CmTree object when the right mouse button is pressed over a node. The callback receives the (x,y) coordinates for the menu position and is responsibile of managing the popup menu entirely.

Parameters:
cb The popup callback.
See also:
CmTreeNode::setPopupCallback

void CmTree::setRenameCallback CmCallback   owner,
MTREERENAME_CB    cb
 

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

This callback is called by the CmTree object when the user changes the text on a node. Via the return value of this callback the user can validate (non zero value) or reject (zero value) the new text. A tree node can be set in edit mode via a single mouse click over an already selected node or by a program call to MTreeNodeEdit().

Parameters:
cb The rename callback.
See also:
CmTreeNode::setRenameCallback

void CmTree::setSelectCallback CmCallback   owner,
MTREENODE_CB    cb
 

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

Parameters:
owner Reference to the object providing the callback method.
cb The node select callback.

void CmTree::setSliderColor CmColor   color
 

Sets the color of the sliders in the scrollbars of a CmTree object.

Parameters:
color Color to apply.

void CmTree::setSliderColorShift int    percentage
 

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

Parameters:
percentage Percentage to apply.


Generated on Sun Aug 17 17:29:27 2003 for MGui API by doxygen1.3-rc2