Tree control with support for expand/collapse. More...
#include <mgui/tree.h>

Tree control with support for expand/collapse.
| typedef fastdelegate::FastDelegate<void(ITEMHND, CHILDVISIBILITY)> MGUI::CTRL_TREE::DELEGATE_ONCHILDVISIBILITYCHANGED |
Delegate called when the visibility of a child has changed.
| typedef fastdelegate::FastDelegate<bool(ITEMHND, CHILDVISIBILITY)> MGUI::CTRL_TREE::DELEGATE_ONCHILDVISIBILITYCHANGING |
Delegate called when the visibility of a child is about to change.
Return 'false' to prevent action for occuring. Must be used to create chiltd items if item has CHILDPRESENCE_Ask
| typedef fastdelegate::FastDelegate<MGUI::CUSTOMDRAW::RETVALUE(CUSTOMDRAW_TREE&)> MGUI::CTRL_TREE::DELEGATE_ONCUSTOMDRAW |
Called to perform custom drawing.
| typedef fastdelegate::FastDelegate<void(CTRL_TREE::ITEMVALUES, CTRL_TREE::ITEMINFO&)> MGUI::CTRL_TREE::DELEGATE_ONGETITEMINFO |
Delegate called to obtain info for item stored externally to control.
| typedef fastdelegate::FastDelegate<void(ITEMHND)> MGUI::CTRL_TREE::DELEGATE_ONITEM |
Delegate for various item events.
OnDestroyItem, OnItemDeselected, OnItemSelected all use this delegate
| typedef fastdelegate::FastDelegate<void(ITEMHND, HITRESULT, const LPOINT2D&, MGUI::KEYSTATE, MGUI::KEYCODE)> MGUI::CTRL_TREE::DELEGATE_ONKEY |
Delegate for Key presses.
| typedef fastdelegate::FastDelegate<bool(ITEMHND, HITRESULT, const LPOINT2D&, MGUI::KEYSTATE)> MGUI::CTRL_TREE::DELEGATE_ONMOUSE |
Delegate for mouse clicks.
Delegate should return 'true' to accept the default behaviour, or false to prevent it. The default behaviour for left click is to select the item clicked.
| typedef fastdelegate::FastDelegate<bool(ITEMHND, HITRESULT, const LPOINT2D&, MGUI::POINTERBUTTON, MGUI::KEYSTATE)> MGUI::CTRL_TREE::DELEGATE_ONPOINTER |
Delegate for pointer messages.
Delegate should return 'true' to accept the default behaviour or false to prevent it. The default behaviour for left click is to select the item clicked.
| typedef fastdelegate::FastDelegate<void(ITEMINFO&)> MGUI::CTRL_TREE::DELEGATE_ONPREINSERTITEM |
Delegate called before an item is created.
| typedef fastdelegate::FastDelegate<void(CTRL_TREE::ITEMVALUES, const CTRL_TREE::ITEMINFO&)> MGUI::CTRL_TREE::DELEGATE_ONSETITEMINFO |
Delegate called to obtain info for item stored externally to control.
Only applies to text value and only if CTRLSTYLE_EditableText specified when control created
| typedef fastdelegate::FastDelegate<bool(ITEMHND, HITRESULT, const LPOINT2D&, MGUI::CTRL_TOOLTIP&)> MGUI::CTRL_TREE::DELEGATE_ONTOOLTIPREQUEST |
Delegate for tooltips.
Style for control specified when created.
Type of search or relationship, used in FindItem().
Results of HitTest.
Image list type, used in SetImageList().
Item status values.
Style for item specified when created.
| MGUI::CTRL_TREE::CTRL_TREE | ( | ) |
Constructor.
| MGUI::CTRL_TREE::~CTRL_TREE | ( | ) |
Destructor.
| 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.
| ParentPane | Parent pane | |
| height | Height in rows (or pixels if CTRLSTYLE_SizeInPixels) | |
| width | Width in 'em' characters (or pixels if CTRLSTYLE_SizeInPixels) | |
| style | Control style |
| void MGUI::CTRL_TREE::DeleteChildren | ( | ITEMHND | hndParent | ) |
Delete all children of specified parent.
| hndParent | Handle to parent item |
| void MGUI::CTRL_TREE::DeleteItem | ( | ITEMHND | hndItem | ) |
Delete item and all children.
| hndItem | Item handle |
| void MGUI::CTRL_TREE::DrawItem | ( | ITEMHND | hndItem, | |
| bool | erase = true | |||
| ) |
Draw single item.
| hndItem | Item handle | |
| erase | Erase existing item |
| void MGUI::CTRL_TREE::EnsureVisible | ( | ITEMHND | hndItem, | |
| bool | ScrollToShow = true | |||
| ) |
Ensure that specified item is visible, expanding or scrolling as needed.
| hndItem | Item handle | |
| ScrollToShow | Scroll if needed to show item |
Find child using ID.
| hndParent | Handle to parent item | |
| id | Programmer-specified ID | |
| recursive | Search descendents recursively if not found directly under parent |
Find item matching specified criteria or relationship.
| 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.
| CHILDPRESENCE MGUI::CTRL_TREE::GetChildPresence | ( | ITEMHND | hndItem | ) | const |
Get child presence for item.
| hndItem | Item handle |
Get first child for given parent.
| hndParent | Handle to parent item |
Get item ID.
| hndItem | Item handle |
| void MGUI::CTRL_TREE::GetItemInfo | ( | ITEMHND | hndItem, | |
| ITEMVALUES | ItemValues, | |||
| ITEMINFO & | ItemInfo | |||
| ) | const |
Get information for item.
| hndItem | Item handle | |
| ItemValues | Values to retrieve | |
| ItemInfo | Item information returned |
| ITEMSTATUS MGUI::CTRL_TREE::GetItemStatus | ( | ITEMHND | hndItem | ) | const |
Get item status.
| hndItem | Item handle |
Get next "sibling" item.
| hndItem | Item handle |
Get parent of item.
| hndChild | Child handle |
| ITEMHND MGUI::CTRL_TREE::GetSelectedItem | ( | ) | const [inline] |
get 'selected' item.
| ITEMHND MGUI::CTRL_TREE::HitTest | ( | const LPOINT2D & | point, | |
| HITRESULT * | pHitResult = 0 | |||
| ) | const [protected] |
Determine location of point relative to tree control.
| 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.
| 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.
| 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 |
| bool MGUI::CTRL_TREE::IsRedrawDisabled | ( | ) | const |
Determine if redraw is disabled.
| void MGUI::CTRL_TREE::Redraw | ( | bool | erase = true |
) |
Redraw entire control.
| erase | Erase before redraw |
| 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::SetAutoSelectOnClick | ( | bool | AutoSelectOnClick | ) |
Set whether to autoselect item when click on.
| void MGUI::CTRL_TREE::SetBackgroundColor | ( | const COLOR & | color | ) |
| void MGUI::CTRL_TREE::SetBaseItemHeight | ( | int | baseheight | ) |
Set base item height.
Individual Items will be integer multiple of the base height.
| baseheight | Base height in pixels |
| void MGUI::CTRL_TREE::SetChildVisibility | ( | ITEMHND | hndParent, | |
| CHILDVISIBILITY | visibility | |||
| ) |
Set visibility for children of item.
| hndParent | Parent handle | |
| visibility | Child visibility |
| void MGUI::CTRL_TREE::SetDelegateOnChildVisibilityChanged | ( | DELEGATE_ONCHILDVISIBILITYCHANGED | ) |
Delegate called when the visibility of a child has changed.
| void MGUI::CTRL_TREE::SetDelegateOnChildVisibilityChanging | ( | DELEGATE_ONCHILDVISIBILITYCHANGING | ) |
Set the delegate to call when the visibility of a child is about to change.
Return 'false' to prevent action for occuring. Must be used to create chiltd items if item has CHILDPRESENCE_Ask
| void MGUI::CTRL_TREE::SetDelegateOnCustomDraw | ( | DELEGATE_ONCUSTOMDRAW | ) |
Set delegate to perform custom drawing.
| void MGUI::CTRL_TREE::SetDelegateOnDestroyItem | ( | DELEGATE_ONITEM | ) |
| void MGUI::CTRL_TREE::SetDelegateOnGetItemInfo | ( | DELEGATE_ONGETITEMINFO | ) |
Delegate called to obtain info for item stored externally to control.
| void MGUI::CTRL_TREE::SetDelegateOnItemChangePosition | ( | DELEGATE_ONITEM | delegate | ) | [inline] |
| void MGUI::CTRL_TREE::SetDelegateOnItemDeselected | ( | DELEGATE_ONITEM | delegate | ) | [inline] |
| void MGUI::CTRL_TREE::SetDelegateOnItemSelected | ( | DELEGATE_ONITEM | delegate | ) | [inline] |
| void MGUI::CTRL_TREE::SetDelegateOnKeyPress | ( | DELEGATE_ONKEY | ) |
Set the delegate to call on a key press.
| void MGUI::CTRL_TREE::SetDelegateOnLeftButtonDoubleClick | ( | DELEGATE_ONMOUSE | ) |
Set the delegate to call on left mouse button double-click The return value of the delegate is ignored (there is no default action).
| void MGUI::CTRL_TREE::SetDelegateOnPointerButtonDown | ( | DELEGATE_ONPOINTER | delegate | ) | [inline] |
Set the delegate to call on pointer button down Delegate should return to accept the default action.
| void MGUI::CTRL_TREE::SetDelegateOnPointerButtonUp | ( | DELEGATE_ONPOINTER | delegate | ) | [inline] |
Set the delegate to call on pointer button up Delegate should return to accept the default action.
| void MGUI::CTRL_TREE::SetDelegateOnPreInsertItem | ( | DELEGATE_ONPREINSERTITEM | ) |
| void MGUI::CTRL_TREE::SetDelegateOnSetItemInfo | ( | DELEGATE_ONSETITEMINFO | ) |
Delegate called to obtain info for item stored externally to control.
Only applies to text value and only if CTRLSTYLE_EditableText specified when control created
| void MGUI::CTRL_TREE::SetDelegateOnSize | ( | DELEGATE_ONSIZE | delegate | ) |
Set delegate to call when control resized.
| void MGUI::CTRL_TREE::SetDelegateOnToolTipRequest | ( | DELEGATE_ONTOOLTIPREQUEST | ) |
Set the delegate for tooltip requests.
Set primary or 'state' image list for control.
The 'state' image list may contain at most 16 entries, and the first entry is unused.
| ImageList | Image list | |
| ImageType | Image type |
| void MGUI::CTRL_TREE::SetItemBold | ( | ITEMHND | hndItem, | |
| bool | bold | |||
| ) |
Set item to be bold or not.
| hndItem | Item handle | |
| bold | True to make bold, false for normal |
| void MGUI::CTRL_TREE::SetItemImageNormal | ( | ITEMHND | hndItem, | |
| int | IdxNormal | |||
| ) |
Set index for "normal" image.
| hndItem | Item handle | |
| IdxNormal | Image index, -1 for none |
| void MGUI::CTRL_TREE::SetItemImageState | ( | ITEMHND | hndItem, | |
| unsigned int | IdxState | |||
| ) |
Set item image for state.
| hndItem | Item handle | |
| IdxState | Index in 'state' image list (1-15) or 0 for none |
| void MGUI::CTRL_TREE::SetItemInfo | ( | const ITEMINFO & | ItemInfo | ) | [inline] |
Set item information using handle from ITEMINFO.
| ItemInfo | Item information to set |
Set item information for specified ITEMHND.
| hndItem | Item handle | |
| ItemInfo | Item information to set |
Set item position in list.
| hndItem | Item handle | |
| hndInsertAfter | Handle for item to insert after |
Set text for item.
| 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.
| color | Color to set |
| void MGUI::CTRL_TREE::SetSelectedItem | ( | ITEMHND | hndItem | ) |
Set selected item.
| hndItem | Item handle |
| virtual void MGUI::CTRL_TREE::v_OnChildVisibilityChanged | ( | ITEMHND | hndItem, | |
| CHILDVISIBILITY | visibility | |||
| ) | [private, virtual] |
Called when child visibility has changed.
| 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.
| hndItem | Handle to item | |
| visibility | New child visibility |
| virtual void MGUI::CTRL_TREE::v_OnCreateEnd | ( | ) | [private, virtual] |
Called at end of create.
| virtual MGUI::CUSTOMDRAW::RETVALUE MGUI::CTRL_TREE::v_OnCustomDraw | ( | CUSTOMDRAW_TREE & | CustomDraw | ) | [private, virtual] |
Called to perform custom drawing.
Default implementation simply returns RETVALUE_DoDefault.
| CustomDraw | Custom drawing parameters |
| virtual void MGUI::CTRL_TREE::v_OnDestroyItem | ( | ITEMHND | hndItem | ) | [private, virtual] |
Called when item about to be destroyed.
| hndItem | Item handle |
| virtual void MGUI::CTRL_TREE::v_OnGetItemInfo | ( | ITEMVALUES | RequestedValue, | |
| ITEMINFO & | ItemInfo | |||
| ) | [private, virtual] |
Called to obtain info for item stored externally to control.
| RequestedValue | ITEMVALUE_ChildPresence, ITEMVALUE_ImageNormal, ITEMVALUE_ImageSelected or ITEMVALUE_Text | |
| ItemInfo | Item information passed/returned |
| virtual void MGUI::CTRL_TREE::v_OnItemChangePosition | ( | ITEMHND | hndItem | ) | [protected, virtual] |
Called when item position changed.
Called after position changed before redrawing. Default behavior is to call delegate.
| hndItem | Item handle |
| virtual void MGUI::CTRL_TREE::v_OnItemDeselected | ( | ITEMHND | hndItem | ) | [private, virtual] |
Called when item becomes deselected.
Called after status changed before redrawing item.
| 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.
| hndItem | Item handle |
| virtual void MGUI::CTRL_TREE::v_OnLeftButtonDown | ( | ITEMHND | hndItem, | |
| HITRESULT | HitResult, | |||
| const LPOINT2D & | point, | |||
| KEYSTATE | keystate | |||
| ) | [protected, virtual] |
Called when left mouse button pressed.
Default behavior is to 'select' item if press anywhere in item.
| hndItem | Item button event occurred over | |
| HitResult | Location where event occurred | |
| point | Point where event occurred | |
| keystate | Modifier key state at time of event |
| virtual void MGUI::CTRL_TREE::v_OnLeftButtonUp | ( | ITEMHND | hndItem, | |
| HITRESULT | HitResult, | |||
| const LPOINT2D & | point, | |||
| KEYSTATE | keystate | |||
| ) | [protected, virtual] |
Called when left mouse button released.
Default behavior supports visibility toggle, text editing, drag and drop, etc.
| hndItem | Item button event occurred over | |
| HitResult | Location where event occurred | |
| point | Point where event occurred | |
| keystate | Modifier key state at time of event |
| virtual void MGUI::CTRL_TREE::v_OnPointerButtonDown | ( | ITEMHND | hndItem, | |
| HITRESULT | HitResult, | |||
| const LPOINT2D & | point, | |||
| POINTERBUTTON | button, | |||
| KEYSTATE | keystate | |||
| ) | [protected, virtual] |
Called when pointer button pressed.
Default behavior is to 'select' item if press anywhere in item.
| hndItem | Item button event occurred over | |
| HitResult | Location where event occurred | |
| point | Point where event occurred | |
| button | Button that was pressed | |
| keystate | Modifier key state at time of event |
| virtual void MGUI::CTRL_TREE::v_OnPointerButtonUp | ( | ITEMHND | hndItem, | |
| HITRESULT | HitResult, | |||
| const LPOINT2D & | point, | |||
| POINTERBUTTON | button, | |||
| KEYSTATE | keystate | |||
| ) | [protected, virtual] |
Called when pointer button released.
Default behavior supports visibility toggle, text editing, drag and drop, etc.
| hndItem | Item button event occurred over | |
| HitResult | Location where event occurred | |
| point | Point where event occurred | |
| button | Button that was released | |
| keystate | Modifier key state at time of event |
| virtual void MGUI::CTRL_TREE::v_OnPreInsertItem | ( | ITEMINFO & | ItemInfo | ) | [private, virtual] |
Called before item created.
| ItemInfo | Item information passed/returned |
| virtual void MGUI::CTRL_TREE::v_OnRightButtonDown | ( | ITEMHND | hndItem, | |
| HITRESULT | HitResult, | |||
| const LPOINT2D & | point, | |||
| KEYSTATE | keystate | |||
| ) | [protected, virtual] |
Called when right mouse button pressed.
Default behavior is to 'select' item if press anywhere in item.
| hndItem | Item button event occurred over | |
| HitResult | Location where event occurred | |
| point | Point where event occurred | |
| keystate | Modifier key state at time of event |
| virtual void MGUI::CTRL_TREE::v_OnRightButtonUp | ( | ITEMHND | hndItem, | |
| HITRESULT | HitResult, | |||
| const LPOINT2D & | point, | |||
| KEYSTATE | keystate | |||
| ) | [protected, virtual] |
Called when right mouse button released.
Default behavior is to toggle expanded/collapsed if press/release on appropriate button.
| hndItem | Item button event occurred over | |
| HitResult | Location where event occurred | |
| point | Point where event occurred | |
| keystate | Modifier key state at time of event |
| 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.
| ChangedValue | ITEMVALUE_Text | |
| ItemInfo | Item information passed/returned |
| virtual bool MGUI::CTRL_TREE::v_OnToolTipRequest | ( | ITEMHND | hndItem, | |
| HITRESULT | HitResult, | |||
| const LPOINT2D & | point, | |||
| MGUI::CTRL_TOOLTIP & | ToolTipCtrl | |||
| ) | [protected, virtual] |
Called to obtain ToolTip.
Will not be called if CTRLSTYLE_NoToolTips specified in creation. Default implementation sets ToolTip text to match item text for HITRESULT_OnItem and return true, otherwise returns false.
| hndItem | Item cursor was over | |
| HitResult | Location where event occurred | |
| point | Point where event occurred | |
| ToolTipCtrl | ToolTip control |
1.6.1