9#if !defined(OWL_TREEVIEWCTRL_H)
10#define OWL_TREEVIEWCTRL_H
13#if defined(BI_HAS_PRAGMA_ONCE)
54 TTvItem(LPCTSTR,
int index,
int selIndex);
58 void SetText(LPCTSTR,
int len = -1);
96 virtual int Compare(LPARAM item1, LPARAM item2, LPARAM lParam)
const;
118 First =
reinterpret_cast<INT_PTR
>(TVI_FIRST),
119 Last =
reinterpret_cast<INT_PTR
>(TVI_LAST),
120 Sort =
reinterpret_cast<INT_PTR
>(TVI_SORT)
196 void SetMask(
uint mask);
197 uint GetMask(
void)
const;
198 void SetStateMask(
uint mask);
199 uint GetStateMask(
void)
const;
200 void SetHTreeItem(HTREEITEM hItem);
201 HTREEITEM GetHTreeItem()
const;
206 bool SetHasChildren(
int hasChildren,
bool sendNow =
true);
207 bool GetHasChildren(
int& hasChildren,
bool getNew =
true);
208 bool SetState(
uint state,
bool sendNow =
true);
209 bool GetState(
uint& state,
bool getNew =
true);
210 bool SetImageIndex(
int index,
bool sendNow =
true);
211 bool SetSelectedImageIndex(
int index,
bool sendNow =
true);
212 bool SetItemData(LPARAM data,
bool sendNow =
true);
213 bool GetItemData(LPARAM& data,
bool getNew =
true);
214 bool GetItemRect(
TRect& rect,
bool textOnly =
true)
const;
215 void Check(
bool state =
true);
222 bool SetText(LPCTSTR text,
bool sendNow =
true);
227 bool GetText(LPTSTR text,
uint length,
bool getNew =
false);
231 LPCTSTR GetText(
bool getNew =
false);
284 operator HTREEITEM()
const;
358 void SetStyle(
uint32 style);
359 bool HasStyle(
uint32 style);
371 void SetIndent(
uint);
375 HIMAGELIST GetImageList(TImageListType type);
376 HIMAGELIST SetImageList(TImageListType type, HIMAGELIST newList);
380 bool DeleteAllItems();
382 uint GetVisibleCount();
383 HWND GetEditControl();
387 TColor GetBkColor()
const;
388 void SetBkColor(
const TColor& clr);
390 TColor GetTextColor()
const;
391 void SetTextColor(
const TColor& clr);
393 TColor GetInsertMarkColor()
const;
394 void SetInsertMarkColor(
const TColor& clr);
396 int GetItemHeight(
int )
const;
397 int SetItemHeight(
int ,
int height=-1);
399 HWND GetToolTips()
const;
400 void SetToolTips(HWND tooltip);
402 bool SetInsertMark(HTREEITEM,
bool after =
true);
409 bool SortChildren(PFNTVCOMPARE, HTREEITEM parent,
bool recurse =
false, LPARAM lParam = 0);
410 bool SortChildren(HTREEITEM item,
bool recurse =
false);
411 bool Delete(HTREEITEM);
412 bool EnsureVisible(HTREEITEM);
413 bool ExpandItem(
uint32 flag, HTREEITEM);
414 bool SelectItem(
uint32 flag, HTREEITEM hItem);
415 HWND EditLabel(HTREEITEM item);
417 HTREEITEM GetNextItem(
uint32 nc, HTREEITEM);
418 HTREEITEM InsertItem(TV_INSERTSTRUCT *);
419 HIMAGELIST CreateDragImage(HTREEITEM item);
450 void EvSysKeyDown(
uint key,
uint repeatCount,
uint flags);
489TTreeNode::operator HTREEITEM()
const
769 return reinterpret_cast<HIMAGELIST
>(
SendMessage(TVM_CREATEDRAGIMAGE, 0,
TParam2(item)));
778 return reinterpret_cast<HWND
>(
SendMessage(TVM_GETEDITCONTROL));
873 if (hItem == TVI_ROOT)
#define PRECONDITION(condition)
Pointer to an array of type T.
Class wrapper for management of color values.
COLORREF GetValue() const
Get a 32bit COLORREF type from this color object.
TControl(TWindow *parent, int id, LPCTSTR title, int x, int y, int w, int h, TModule *module=nullptr)
Invokes TWindow's constructor, passing it parent (parent window), title (caption text),...
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TRect is a mathematical class derived from tagRect.
Use this class to navigate the TTreeViewCtrl.
TTreeNode InsertChild(const TTreeNode &node, THowToInsert how) const
HWND EditLabel()
Return the HWND of the edit control to change the text.
TTreeViewCtrl * TreeView
wrapper for item of this tree
TExpandCode
How to expand the item.
@ CollapseReset
Collapse this node and all children.
@ Collapse
Always collapse.
@ Toggle
Toggle between collapse and expand.
HIMAGELIST CreateDragImage()
Return the image list used for a dragging purposes.
TTvItem ItemStruct
contains a TVITEM with HTREEITEM
THowToInsert
Specifies how to insert a new item into a Tree-View control.
bool ExpandItem(uint32 flag)
Expand or contract a parent node.
bool GetItem(void)
Update the item information in the node.
bool SelectItem(uint32 flag)
Make the next item selected.
void SetStateMask(uint mask)
void SetHTreeItem(HTREEITEM hItem)
Set and Get the node's item handle.
TTreeNode GetPrevSibling() const
Return the previous sibling.
TTreeNode AddChild(const TTreeNode &node) const
Inserts a new child item into the Tree-View (TreeView) control.
TTreeViewCtrl & GetTreeView() const
Returns a reference to the associated tree view.
bool SortChildren(bool recurse=false)
Sort the children of this node.
TTreeNode(TTreeViewCtrl &tree, LPCTSTR text)
Construct a new node given the node's text.
TTreeNode GetChild() const
Get the first child of the current node.
TTreeNode GetNextSibling() const
Return the next sibling.
TTreeNode GetNextVisible() const
Return the next visible item.
TTreeNode GetNextItem(uint32 flag) const
Return the next item.
TNextCode
How to retrieve the next node.
@ Previous
Get the prev sibling.
@ PreviousVisible
Get the prev visible item.
@ Caret
Get the item with the caret.
@ Parent
Get the parent of this node.
@ FirstVisible
Get the first visible item.
@ Child
Get the first child.
@ Next
Get the next sibling.
@ DropHilite
Get the item that is the drop target.
@ NextVisible
Get the next visible item.
void SetCacheSize(uint size)
uint GetStateMask(void) const
HTREEITEM GetHTreeItem() const
bool SetText(const tstring &text, bool sendNow=true)
TTreeNode GetParent() const
Return the parent of the current node.
TTreeNode InsertItem(const TTreeNode &node) const
TTreeNode GetPrevVisible() const
Return the next previous item.
bool EnsureVisible()
Makes sure the item is visible.
Encapsulates the TreeView common control.
HTREEITEM GetNextItem(uint32 nc, HTREEITEM)
Return the next item.
HTREEITEM InsertItem(TV_INSERTSTRUCT *)
Insert an item.
HIMAGELIST GetImageList(TImageListType type)
Return the image list used by the control.
HIMAGELIST CreateDragImage(HTREEITEM item)
Create a drag image.
void SetTextColor(const TColor &clr)
int GetItemHeight(int) const
void SetBkColor(const TColor &clr)
TStyle
Styles for TTreeViewCtrl.
@ twsEditLabels
Text labels for items can be edited.
@ twsHasLines
There are lines between nodes.
@ twsLinesAtRoot
There are lines at the root.
@ twsShowSelAlways
Always keep the selection visible scroll if needed.
@ twsHasButtons
Each parent has a button for toggling collapse and expand.
@ twsDisableDragDrop
Do not allow drag and drop.
bool Delete(HTREEITEM)
Delete the item.
uint GetIndent()
Return the number of pixels per indent level.
bool DeleteAllItems()
Remove all items from the control.
TTreeViewCtrl(TWindow *parent, int id, int x, int y, int w, int h, uint32 style=0, TModule *module=0)
bool EnsureVisible(HTREEITEM)
Makes sure the item is visible.
void Update()
Compatability for Win32.
TColor GetBkColor() const
void SetInsertMarkColor(const TColor &clr)
HWND EditLabel(HTREEITEM item)
Enable the user to edit the text of an item.
void SetToolTips(HWND tooltip)
HTREEITEM HitTest(TTvHitTestInfo *info)
Return the item that contains the point.
bool SelectItem(uint32 flag, HTREEITEM hItem)
Select the next item.
int SetItemHeight(int, int height=-1)
HWND GetEditControl()
Return the edit control used for editing the text.
HIMAGELIST SetImageList(TImageListType type, HIMAGELIST newList)
Set the image list used by the control.
uint GetVisibleCount()
Return the number of the fully visible items in the control.
TColor GetInsertMarkColor() const
TImageListType
The type of the image list.
@ State
Imagelist contains images for user-defined states.
@ Normal
Normal imagelist for selected and non-selected items.
void SetIndent(uint)
Set the number of pixels per indent level.
TTreeNode GetRoot()
Return the root node.
uint GetItemCount()
Return the number of items in the control.
bool SetInsertMark(HTREEITEM, bool after=true)
bool SortChildren(PFNTVCOMPARE, HTREEITEM parent, bool recurse=false, LPARAM lParam=0)
bool ExpandItem(uint32 flag, HTREEITEM)
Expand and contract the parent node.
TColor GetTextColor() const
Base class for comparing tree nodes.
virtual int Compare(LPARAM item1, LPARAM item2, LPARAM lParam) const
Returns a value < 0 if item1 < item2, 0 if item1 == item2, or > 0 if item1 > item2.
A TTreeViewCtrl notification for hit-testing.
Used to represent the data to be stored in the TTreeViewCtrl.
void SetText(LPCTSTR, int len=-1)
Initialize the text.
void SetItemData(LPARAM)
Store additional information.
void SetHTreeItem(HTREEITEM hItem)
TTvItem()
this is called by some TTreeNode constructors
void GetText(TCHAR *, int len)
LPARAM GetItemData() const
void SetSelectedImageIndex(int index)
Set the selected image index.
void SetImageIndex(int index)
Set the imagelist index.
HTREEITEM GetHTreeitem() const
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
Definition of classes for CommonControl encapsulation.
Definition of class TControl.
#define DECLARE_RESPONSE_TABLE(cls)
#define DECLARE_STREAMABLE_OWL(cls, ver)
#define DECLARE_STREAMABLE_INLINES(cls)
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
Object Windows Library (OWLNext Core).
LPARAM TParam2
Second parameter type.
TTvComparator TTwComparator
WPARAM TParam1
First parameter type.
bool IsChecked(HWND ctrl)
Returns true if the given control has BST_CHECKED state.
#define CONST_CAST(targetType, object)