- enum
- {
- TreeCtrlIcon_File,
- TreeCtrlIcon_Folder
- };
-
- MyTreeCtrl() { }
- MyTreeCtrl(wxWindow *parent, const wxWindowID id,
- const wxPoint& pos, const wxSize& size,
- long style);
- virtual ~MyTreeCtrl();
-
- void OnBeginDrag(wxTreeEvent& event);
- void OnBeginRDrag(wxTreeEvent& event);
- void OnBeginLabelEdit(wxTreeEvent& event);
- void OnEndLabelEdit(wxTreeEvent& event);
- void OnDeleteItem(wxTreeEvent& event);
- void OnGetInfo(wxTreeEvent& event);
- void OnSetInfo(wxTreeEvent& event);
- void OnItemExpanded(wxTreeEvent& event);
- void OnItemExpanding(wxTreeEvent& event);
- void OnItemCollapsed(wxTreeEvent& event);
- void OnItemCollapsing(wxTreeEvent& event);
- void OnSelChanged(wxTreeEvent& event);
- void OnSelChanging(wxTreeEvent& event);
- void OnTreeKeyDown(wxTreeEvent& event);
- void OnItemActivated(wxTreeEvent& event);
-
- void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
-
- void AddTestItemsToTree(size_t numChildren,
- size_t depth);
-
- void DoSortChildren(const wxTreeItemId& item, bool reverse = FALSE)
- { m_reverseSort = reverse; wxTreeCtrl::SortChildren(item); }
- void DoEnsureVisible() { EnsureVisible(m_lastItem); }
+ enum
+ {
+ TreeCtrlIcon_File,
+ TreeCtrlIcon_FileSelected,
+ TreeCtrlIcon_Folder,
+ TreeCtrlIcon_FolderSelected,
+ TreeCtrlIcon_FolderOpened
+ };
+
+ MyTreeCtrl() { m_alternateImages = false; m_alternateStates = false; }
+ MyTreeCtrl(wxWindow *parent, const wxWindowID id,
+ const wxPoint& pos, const wxSize& size,
+ long style);
+ virtual ~MyTreeCtrl(){};
+
+ void OnBeginDrag(wxTreeEvent& event);
+ void OnBeginRDrag(wxTreeEvent& event);
+ void OnEndDrag(wxTreeEvent& event);
+ void OnBeginLabelEdit(wxTreeEvent& event);
+ void OnEndLabelEdit(wxTreeEvent& event);
+ void OnDeleteItem(wxTreeEvent& event);
+ void OnContextMenu(wxContextMenuEvent& event);
+ void OnItemMenu(wxTreeEvent& event);
+ void OnGetInfo(wxTreeEvent& event);
+ void OnSetInfo(wxTreeEvent& event);
+ void OnItemExpanded(wxTreeEvent& event);
+ void OnItemExpanding(wxTreeEvent& event);
+ void OnItemCollapsed(wxTreeEvent& event);
+ void OnItemCollapsing(wxTreeEvent& event);
+ void OnSelChanged(wxTreeEvent& event);
+ void OnSelChanging(wxTreeEvent& event);
+ void OnTreeKeyDown(wxTreeEvent& event);
+ void OnItemActivated(wxTreeEvent& event);
+ void OnItemStateClick(wxTreeEvent& event);
+ void OnItemRClick(wxTreeEvent& event);
+
+ void OnRMouseDown(wxMouseEvent& event);
+ void OnRMouseUp(wxMouseEvent& event);
+ void OnRMouseDClick(wxMouseEvent& event);
+
+ void GetItemsRecursively(const wxTreeItemId& idParent,
+ wxTreeItemIdValue cookie = 0);
+
+ void CreateImageList(int size = 16);
+ void CreateButtonsImageList(int size = 11);
+ void CreateStateImageList(bool del = false);
+
+ void AddTestItemsToTree(size_t numChildren, size_t depth);
+
+ void DoSortChildren(const wxTreeItemId& item, bool reverse = false)
+ { m_reverseSort = reverse; wxTreeCtrl::SortChildren(item); }
+ void DoEnsureVisible() { if (m_lastItem.IsOk()) EnsureVisible(m_lastItem); }
+
+ void DoToggleIcon(const wxTreeItemId& item);
+ void DoToggleState(const wxTreeItemId& item);
+
+ void ShowMenu(wxTreeItemId id, const wxPoint& pt);
+
+ int ImageSize(void) const { return m_imageSize; }
+
+ void SetLastItem(wxTreeItemId id) { m_lastItem = id; }
+
+ void SetAlternateImages(bool show) { m_alternateImages = show; }
+ bool AlternateImages() const { return m_alternateImages; }
+
+ void SetAlternateStates(bool show) { m_alternateStates = show; }
+ bool AlternateStates() const { return m_alternateStates; }