MGUI::CTRL_TREE Class Reference

#include <mgui/tree.h>

Inheritance diagram for MGUI::CTRL_TREE:

Inheritance graph
[legend]
List of all members.

Public Types

enum  CHILDPRESENCE { CHILDPRESENCE_No = 0, CHILDPRESENCE_Yes = 1, CHILDPRESENCE_Ask = 2 }
enum  CHILDVISIBILITY { CHILDVISIBILITY_Expand, CHILDVISIBILITY_Collapse, CHILDVISIBILITY_CollapseReset, CHILDVISIBILITY_Toggle }
enum  CTRLSTYLE {
  CTRLSTYLE_Default = 0x0000, CTRLSTYLE_ShowLines = 0x0001, CTRLSTYLE_ShowLinesAtRoot = 0x0002, CTRLSTYLE_NoButtons = 0x0004,
  CTRLSTYLE_SingleExpand = 0x0008, CTRLSTYLE_NoToolTips = 0x0010, CTRLSTYLE_EditableText = 0x0020, CTRLSTYLE_NoScrollHorizontal = 0x0040
}
enum  FIND {
  FIND_Selected, FIND_DropHighlight, FIND_Parent, FIND_FirstChild,
  FIND_NextSibling, FIND_PreviousSibling, FIND_TopParent
}
enum  IMAGETYPE { IMAGETYPE_Primary, IMAGETYPE_State }
enum  ITEMHND { ITEMHND_Last = -2, ITEMHND_None = -1, ITEMHND_Root = 0 }
enum  ITEMSTATUS {
  ITEMSTATUS_None = 0x00, ITEMSTATUS_Bold = 0x01, ITEMSTATUS_DropHighlighted = 0x10, ITEMSTATUS_Expanded = 0x02,
  ITEMSTATUS_ExpandedOnce = 0x04, ITEMSTATUS_Selected = 0x08
}
enum  ITEMSTYLE { ITEMSTYLE_Default = 0x0000, ITEMSTYLE_OwnerText = 0x0001, ITEMSTYLE_OwnerImages = 0x0002, ITEMSTYLE_AllowChildReorder = 0x0004 }
enum  ITEMVALUES {
  ITEMVALUES_None = 0x0000, ITEMVALUE_ChildPresence = 0x0001, ITEMVALUE_ImageNormal = 0x0002, ITEMVALUE_ImageSelected = 0x0004,
  ITEMVALUE_ImageState = 0x0008, ITEMVALUE_Status = 0x0010, ITEMVALUE_Text = 0x0020, ITEMVALUE_ID = 0x0040,
  ITEMVALUE_Style = 0x0080, ITEMVALUE_HeightMult = 0x0100, ITEMVALUES_All = 0x0FFF
}

Public Member Functions

void Create (MGUI::LAYOUT_PANE_BASE &ParentPane, int height=20, int width=40, CTRLSTYLE style=CTRLSTYLE_Default, MGUI::LAYOUT_SIZEALIGN sizealign=MGUI::LAYOUT_SIZEALIGN_Expand)
 CTRL_TREE ()
void DeleteChildren (ITEMHND hndParent)
void DeleteItem (ITEMHND hndItem)
void EnsureVisible (ITEMHND hndItem)
ITEMHND FindChildByID (ITEMHND hndParent, ID id) const
ITEMHND FindItem (FIND find, ITEMHND hndItem=ITEMHND_None) const
int GetBaseItemHeight () const
CHILDPRESENCE GetChildPresence (ITEMHND hndItem) const
ITEMHND GetFirstChild (ITEMHND hndParent) const
ID GetItemID (ITEMHND hndItem) const
void GetItemInfo (ITEMHND hndItem, ITEMVALUES ItemValues, ITEMINFO &ItemInfo) const
ITEMSTATUS GetItemStatus (ITEMHND hndItem) const
ITEMHND GetNextSibling (ITEMHND hndItem) const
ITEMHND GetParent (ITEMHND hndChild) const
ITEMHND GetSelectedItem () const
ITEMHND InsertItem (ITEMHND hndParent, ITEMHND hndInsertAfter, ITEMINFO &ItemInfo)
ITEMHND InsertItem (ITEMHND hndParent, ITEMHND hndInsertAfter, const MISTRING text, ID id=0)
void RedrawDisable ()
void RedrawEnable ()
void SetBackgroundColor (const COLOR &color)
void SetBaseItemHeight (int baseheight)
void SetChildVisibility (ITEMHND hndParent, CHILDVISIBILITY visibility)
void SetImageList (IMAGELIST &ImageList, IMAGETYPE ImageType)
void SetItemInfo (const ITEMINFO &ItemInfo)
void SetItemInfo (ITEMHND hndItem, const ITEMINFO &ItemInfo)
void SetItemPosition (ITEMHND hndItem, ITEMHND hndInsertAfter)
void SetItemText (ITEMHND hndItem, const MISTRING &text)
void SetLineColor (const COLOR &color)
void SetSelectedItem (ITEMHND hndItem)
 ~CTRL_TREE ()

Protected Types

enum  HITRESULT {
  HITRESULT_Nowhere = 0x0001, HITRESULT_OnItemIcon = 0x0002, HITRESULT_OnItemText = 0x0004, HITRESULT_OnItemIndent = 0x0008,
  HITRESULT_OnItemButton = 0x0010, HITRESULT_OnItemRight = 0x0020, HITRESULT_OnItemStateIcon = 0x0040, HITRESULT_OnItem = (HITRESULT_OnItemIcon | HITRESULT_OnItemText | HITRESULT_OnItemStateIcon)
}

Protected Member Functions

ITEMHND HitTest (const LPOINT2D &point, HITRESULT *pHitResult=0) const
virtual void v_OnLeftButtonDown (ITEMHND hndItem, HITRESULT HitResult, const LPOINT2D &point)
virtual void v_OnLeftButtonUp (ITEMHND hndItem, HITRESULT HitResult, const LPOINT2D &point)
virtual void v_OnRightButtonDown (ITEMHND hndItem, HITRESULT HitResult, const LPOINT2D &point)
virtual void v_OnRightButtonUp (ITEMHND hndItem, HITRESULT HitResult, const LPOINT2D &point)

Private Member Functions

virtual void v_OnChildVisibilityChanged (ITEMHND hndItem, CHILDVISIBILITY visibility)
virtual bool v_OnChildVisibilityChanging (ITEMHND hndItem, CHILDVISIBILITY visibility)
virtual MGUI::CUSTOMDRAW::RETVALUE v_OnCustomDraw (CTRL_TREE::CUSTOMDRAW &CustomDraw)
virtual void v_OnGetItemInfo (ITEMVALUES RequestedValue, ITEMINFO &ItemInfo)
virtual void v_OnGetItemToolTip (ITEMHND hndItem, MISTRING &text)
virtual void v_OnItemDeselected (ITEMHND hndItem)
virtual void v_OnItemSelected (ITEMHND hndItem)
virtual void v_OnSetItemInfo (ITEMVALUES ChangedValue, const ITEMINFO &ItemInfo)

Member Enumeration Documentation

enum MGUI::CTRL_TREE::CHILDPRESENCE
 

Indicator for presence or absence of children for item.

Enumeration values:
CHILDPRESENCE_No  Item has no children.
CHILDPRESENCE_Yes  Item has children.
CHILDPRESENCE_Ask  Determine children via v_OnGetItemInfo when first expand item.

Definition at line 93 of file tree.h.

enum MGUI::CTRL_TREE::CHILDVISIBILITY
 

Child visibility setting.

Enumeration values:
CHILDVISIBILITY_Expand  Expand to show children.
CHILDVISIBILITY_Collapse  Collapse to hide children.
CHILDVISIBILITY_CollapseReset  Collapse and remove children, resets to CHILDPRESENCE_Ask.
CHILDVISIBILITY_Toggle  Toggle visibility.

Definition at line 100 of file tree.h.

enum MGUI::CTRL_TREE::CTRLSTYLE
 

Style for control specified when created.

Enumeration values:
CTRLSTYLE_Default 
CTRLSTYLE_ShowLines  Show lines linking child items to corresponding parent item.
CTRLSTYLE_ShowLinesAtRoot  Show lines linking root items, required if want buttons for root items.
CTRLSTYLE_NoButtons  Don't show buttons for expand/collapse.
CTRLSTYLE_SingleExpand  Only expand one item at a time, collapsing previously expanded item.
CTRLSTYLE_NoToolTips  Disable automatic tool tips for text items when not entirely visible.
CTRLSTYLE_EditableText  Allow in-place editing of text items.
CTRLSTYLE_NoScrollHorizontal  Disallow horizontal scrolling and don't show horizontal scrollbar.

Definition at line 45 of file tree.h.

enum MGUI::CTRL_TREE::FIND
 

Type of search or relationship, used in FindItem().

Enumeration values:
FIND_Selected  Currently selected item.
FIND_DropHighlight  Item which is target of drag-and-drop operation.
FIND_Parent  Parent of item.
FIND_FirstChild  First child item.
FIND_NextSibling  Next sibling item.
FIND_PreviousSibling  Previous sibling item.
FIND_TopParent  Topmost parent (child of root).

Definition at line 82 of file tree.h.

enum MGUI::CTRL_TREE::HITRESULT [protected]
 

Results of HitTest.

Enumeration values:
HITRESULT_Nowhere  Not on any item.
HITRESULT_OnItemIcon  On icon (primary image) for item.
HITRESULT_OnItemText  On text for item.
HITRESULT_OnItemIndent  On indentation for item.
HITRESULT_OnItemButton  On visibility toggle for item.
HITRESULT_OnItemRight  To right of item.
HITRESULT_OnItemStateIcon  On state icon.
HITRESULT_OnItem  On item icons or text.

Definition at line 472 of file tree.h.

enum MGUI::CTRL_TREE::IMAGETYPE
 

Image list type, used in SetImageList().

Enumeration values:
IMAGETYPE_Primary 
IMAGETYPE_State 

Definition at line 108 of file tree.h.

enum MGUI::CTRL_TREE::ITEMHND
 

'Handle' used to reference items in tree.

Enumeration values:
ITEMHND_Last  Indicates insertion as last item in child list.
ITEMHND_None  Indicates insertion as first child item, as well as non-existent item.
ITEMHND_Root  Indicates root of tree.

Definition at line 65 of file tree.h.

enum MGUI::CTRL_TREE::ITEMSTATUS
 

Item status values.

Enumeration values:
ITEMSTATUS_None 
ITEMSTATUS_Bold  Item text shown in bold.
ITEMSTATUS_DropHighlighted  Item is highlighted as target for drag-and-drop operation.
ITEMSTATUS_Expanded  Item is presently expanded.
ITEMSTATUS_ExpandedOnce  Item has been expanded at least once.
ITEMSTATUS_Selected  Item is 'selected'.

Definition at line 72 of file tree.h.

enum MGUI::CTRL_TREE::ITEMSTYLE
 

Style for item specified when created.

Enumeration values:
ITEMSTYLE_Default  Default style.
ITEMSTYLE_OwnerText  Call v_OnGetItemInfo to obtain text and v_OnSetDispInfo when text edited.
ITEMSTYLE_OwnerImages  Call v_OnGetItemInfo to obtain normal/selected images.
ITEMSTYLE_AllowChildReorder  Allow reordering of child items via drag-and-drop within parent.

Definition at line 57 of file tree.h.

enum MGUI::CTRL_TREE::ITEMVALUES
 

Values to set or request for item.

Enumeration values:
ITEMVALUES_None 
ITEMVALUE_ChildPresence 
ITEMVALUE_ImageNormal 
ITEMVALUE_ImageSelected 
ITEMVALUE_ImageState 
ITEMVALUE_Status 
ITEMVALUE_Text 
ITEMVALUE_ID 
ITEMVALUE_Style 
ITEMVALUE_HeightMult 
ITEMVALUES_All 

Definition at line 114 of file tree.h.


Constructor & Destructor Documentation

MGUI::CTRL_TREE::CTRL_TREE  ) 
 

Constructor.

MGUI::CTRL_TREE::~CTRL_TREE  ) 
 

Destructor.


Member Function Documentation

void MGUI::CTRL_TREE::Create MGUI::LAYOUT_PANE_BASE ParentPane,
int  height = 20,
int  width = 40,
CTRLSTYLE  style = CTRLSTYLE_Default,
MGUI::LAYOUT_SIZEALIGN  sizealign = MGUI::LAYOUT_SIZEALIGN_Expand
 

Create control.

Parameters:
ParentPane  Parent pane
height  Height in rows,
width  Width in 'em' characters
style  Control style

void MGUI::CTRL_TREE::DeleteChildren ITEMHND  hndParent  ) 
 

Delete all children of specified parent.

Parameters:
hndParent  Handle to parent item

void MGUI::CTRL_TREE::DeleteItem ITEMHND  hndItem  ) 
 

Delete item and all children.

Parameters:
hndItem  Item handle

void MGUI::CTRL_TREE::EnsureVisible ITEMHND  hndItem  ) 
 

Ensure that specified item is visible, expanding or scrolling as needed.

Parameters:
hndItem  Item handle

ITEMHND MGUI::CTRL_TREE::FindChildByID ITEMHND  hndParent,
ID  id
const
 

Find child using ID.

Parameters:
hndParent  Handle to parent item
id  Programmer-specified ID

ITEMHND MGUI::CTRL_TREE::FindItem FIND  find,
ITEMHND  hndItem = ITEMHND_None
const
 

Find item matching specified criteria or relationship.

Parameters:
find  Relationship for finding item
hndItem  Item to search from if needed

int MGUI::CTRL_TREE::GetBaseItemHeight  )  const
 

Get base item height.

Items must be integer multiple of the base height.

Returns:
Base height in pixels.

CHILDPRESENCE MGUI::CTRL_TREE::GetChildPresence ITEMHND  hndItem  )  const
 

Get child presence for item.

Parameters:
hndItem  Item handle

ITEMHND MGUI::CTRL_TREE::GetFirstChild ITEMHND  hndParent  )  const [inline]
 

Get first child for given parent.

Parameters:
hndParent  Handle to parent item

Definition at line 349 of file tree.h.

ID MGUI::CTRL_TREE::GetItemID ITEMHND  hndItem  )  const
 

Get item ID.

Parameters:
hndItem  Item handle

void MGUI::CTRL_TREE::GetItemInfo ITEMHND  hndItem,
ITEMVALUES  ItemValues,
ITEMINFO ItemInfo
const
 

Get information for item.

Parameters:
hndItem  Item handle
ItemValues  Values to retrieve
ItemInfo  Item information returned

ITEMSTATUS MGUI::CTRL_TREE::GetItemStatus ITEMHND  hndItem  )  const
 

Get item status.

Parameters:
hndItem  Item handle

ITEMHND MGUI::CTRL_TREE::GetNextSibling ITEMHND  hndItem  )  const [inline]
 

Get next "sibling" item.

Parameters:
hndItem  Item handle

Definition at line 371 of file tree.h.

ITEMHND MGUI::CTRL_TREE::GetParent ITEMHND  hndChild  )  const [inline]
 

Get parent of item.

Parameters:
hndChild  Child handle

Definition at line 376 of file tree.h.

ITEMHND MGUI::CTRL_TREE::GetSelectedItem  )  const [inline]
 

get 'selected' item.

Returns:
Handle to selected item, ITEMHND_None if none selected.

Definition at line 382 of file tree.h.

ITEMHND MGUI::CTRL_TREE::HitTest const LPOINT2D point,
HITRESULT pHitResult = 0
const [protected]
 

Determine location of point relative to tree control.

Returns:
Handle for item point is on or ITEMHND_None if none.
Parameters:
point  Point to test
pHitResult  Result of test, NULL if not needed

ITEMHND MGUI::CTRL_TREE::InsertItem ITEMHND  hndParent,
ITEMHND  hndInsertAfter,
ITEMINFO ItemInfo
 

Insert item into tree.

Returns:
Handle to ITEM added.
Parameters:
hndParent  Parent item, ITEMHND_Root to insert as root item
hndInsertAfter  Item to insert after, ITEMHND_None to insert at beginning, ITEMHND_Last to insert at end
ItemInfo  Item information, will be updated to contain handle and actual status on return

ITEMHND MGUI::CTRL_TREE::InsertItem ITEMHND  hndParent,
ITEMHND  hndInsertAfter,
const MISTRING  text,
ID  id = 0
 

Insert simple text item into tree.

Returns:
Handle to ITEM added.
Parameters:
hndParent  Parent item, ITEMHND_Root to insert as root item
hndInsertAfter  Item to insert after, ITEMHND_None to insert at beginning, ITEMHND_Last to insert at end
text  Item text
id  Item ID

void MGUI::CTRL_TREE::RedrawDisable  ) 
 

Disable redraw, incrementing disable count.

void MGUI::CTRL_TREE::RedrawEnable  ) 
 

Enable redraw, decrementing disable count.

Will redraw the control if was disabled and is no longer.

void MGUI::CTRL_TREE::SetBackgroundColor const COLOR color  ) 
 

Set background color.

Parameters:
color  Color to set

void MGUI::CTRL_TREE::SetBaseItemHeight int  baseheight  ) 
 

Set base item height.

Individual Items will be integer multiple of the base height.

Parameters:
baseheight  Base height in pixels

void MGUI::CTRL_TREE::SetChildVisibility ITEMHND  hndParent,
CHILDVISIBILITY  visibility
 

Set visibility for children of item.

Parameters:
hndParent  Parent handle
visibility  Child visibility

void MGUI::CTRL_TREE::SetImageList IMAGELIST ImageList,
IMAGETYPE  ImageType
 

Set primary or 'state' image list for control.

The 'state' image list may contain at most 16 entries, and the first entry is unused.

Parameters:
ImageList  Image list
ImageType  Image type

void MGUI::CTRL_TREE::SetItemInfo const ITEMINFO ItemInfo  )  [inline]
 

Set item information using handle from ITEMINFO.

Parameters:
ItemInfo  Item information to set

Definition at line 448 of file tree.h.

void MGUI::CTRL_TREE::SetItemInfo ITEMHND  hndItem,
const ITEMINFO ItemInfo
 

Set item information for specified ITEMHND.

Parameters:
hndItem  Item handle
ItemInfo  Item information to set

void MGUI::CTRL_TREE::SetItemPosition ITEMHND  hndItem,
ITEMHND  hndInsertAfter
 

Set item position in list.

Parameters:
hndItem  Item handle
hndInsertAfter  Handle for item to insert after

void MGUI::CTRL_TREE::SetItemText ITEMHND  hndItem,
const MISTRING text
 

Set text for item.

Parameters:
hndItem  Item handle
text  Text string to set

void MGUI::CTRL_TREE::SetLineColor const COLOR color  ) 
 

Set color for drawing lines linking children to parent.

Parameters:
color  Color to set

void MGUI::CTRL_TREE::SetSelectedItem ITEMHND  hndItem  ) 
 

Set selected item.

Parameters:
hndItem  Item handle

virtual void MGUI::CTRL_TREE::v_OnChildVisibilityChanged ITEMHND  hndItem,
CHILDVISIBILITY  visibility
[private, virtual]
 

Called when child visibility has changed.

Parameters:
hndItem  Handle to item
visibility  New child visibility

virtual bool MGUI::CTRL_TREE::v_OnChildVisibilityChanging ITEMHND  hndItem,
CHILDVISIBILITY  visibility
[private, virtual]
 

Called when child visibility is about to change.

Return 'false' to prevent action from occurring. Must be overridden to create child items if item has CHILDPRESENCE_Ask.

Parameters:
hndItem  Handle to item
visibility  New child visibility

virtual MGUI::CUSTOMDRAW::RETVALUE MGUI::CTRL_TREE::v_OnCustomDraw CTRL_TREE::CUSTOMDRAW CustomDraw  )  [private, virtual]
 

Called to perform custom drawing.

Default implementation simply returns RETVALUE_DoDefault.

Parameters:
CustomDraw  Custom drawing parameters

virtual void MGUI::CTRL_TREE::v_OnGetItemInfo ITEMVALUES  RequestedValue,
ITEMINFO ItemInfo
[private, virtual]
 

Called to obtain info for item stored externally to control.

Parameters:
RequestedValue  ITEMVALUE_ChildPresence, ITEMVALUE_ImageNormal, ITEMVALUE_ImageSelected or ITEMVALUE_Text
ItemInfo  Item information passed/returned

virtual void MGUI::CTRL_TREE::v_OnGetItemToolTip ITEMHND  hndItem,
MISTRING text
[private, virtual]
 

Called to override ToolTip for item.

Text will be initialized with item text, clear to not display any ToolTip.

Parameters:
hndItem  Item handle
text  Item ToolTip text passed/returned

virtual void MGUI::CTRL_TREE::v_OnItemDeselected ITEMHND  hndItem  )  [private, virtual]
 

Called when item becomes deselected.

Called after status changed before redrawing item.

Parameters:
hndItem  Item handle

virtual void MGUI::CTRL_TREE::v_OnItemSelected ITEMHND  hndItem  )  [private, virtual]
 

Called when item becomes selected.

Called after status changed before redrawing item.

Parameters:
hndItem  Item handle

virtual void MGUI::CTRL_TREE::v_OnLeftButtonDown ITEMHND  hndItem,
HITRESULT  HitResult,
const LPOINT2D point
[protected, virtual]
 

Called when left mouse button pressed.

Default behavior is to 'select' item if press anywhere in item.

Parameters:
hndItem  Item button event occurred over
HitResult  Location where event occurred
point  Point where event occurred

virtual void MGUI::CTRL_TREE::v_OnLeftButtonUp ITEMHND  hndItem,
HITRESULT  HitResult,
const LPOINT2D point
[protected, virtual]
 

Called when left mouse button released.

Default behavior supports visibility toggle, text editing, drag and drop, etc.

Parameters:
hndItem  Item button event occurred over
HitResult  Location where event occurred
point  Point where event occurred

virtual void MGUI::CTRL_TREE::v_OnRightButtonDown ITEMHND  hndItem,
HITRESULT  HitResult,
const LPOINT2D point
[protected, virtual]
 

Called when right mouse button pressed.

Default behavior is to 'select' item if press anywhere in item.

Parameters:
hndItem  Item button event occurred over
HitResult  Location where event occurred
point  Point where event occurred

virtual void MGUI::CTRL_TREE::v_OnRightButtonUp ITEMHND  hndItem,
HITRESULT  HitResult,
const LPOINT2D point
[protected, virtual]
 

Called when right mouse button released.

Default behavior is to toggle expanded/collapsed if press/release on appropriate button.

Parameters:
hndItem  Item button event occurred over
HitResult  Location where event occurred
point  Point where event occurred

virtual void MGUI::CTRL_TREE::v_OnSetItemInfo ITEMVALUES  ChangedValue,
const ITEMINFO ItemInfo
[private, virtual]
 

Called when change made to value stored external to control.

Only applies to text value and only if CTRLSTYLE_EditableText specified when control created.

Parameters:
ChangedValue  ITEMVALUE_Text
ItemInfo  Item information passed/returned


The documentation for this class was generated from the following file:
Generated on Tue Dec 14 13:20:48 2004 for TNTsdk by  doxygen 1.3.8-20040913