X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c7d9c476ea807927781813bca979e9f793599229..438959cca892a7651634cc3a7aad4819ac49b23c:/include/wx/msw/treectrl.h diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index a2a86df75a..2be605fa2f 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -127,6 +127,11 @@ public: virtual wxTreeItemId GetRootItem() const; virtual wxTreeItemId GetSelection() const; virtual size_t GetSelections(wxArrayTreeItemIds& selections) const; + virtual wxTreeItemId GetFocusedItem() const; + + virtual void ClearFocusedItem(); + virtual void SetFocusedItem(const wxTreeItemId& item); + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, @@ -161,12 +166,13 @@ public: virtual void Unselect(); virtual void UnselectAll(); virtual void SelectItem(const wxTreeItemId& item, bool select = true); + virtual void SelectChildren(const wxTreeItemId& parent); virtual void EnsureVisible(const wxTreeItemId& item); virtual void ScrollTo(const wxTreeItemId& item); virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); virtual wxTextCtrl *GetEditControl() const; virtual void EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges = false) @@ -206,6 +212,10 @@ public: virtual bool CanApplyThemeBorder() const { return false; } protected: + // Implement "update locking" in a custom way for this control. + virtual void DoFreeze(); + virtual void DoThaw(); + // SetImageList helper void SetAnyImageList(wxImageList *imageList, int which); @@ -244,10 +254,16 @@ protected: return !HandleTreeEvent(event) || event.IsAllowed(); } - // handle a key event in a multi-selection control + // generate a wxEVT_KEY_DOWN event from the specified WPARAM/LPARAM values + // having the same meaning as for WM_KEYDOWN, return true if it was + // processed + bool MSWHandleTreeKeyDownEvent(WXWPARAM wParam, WXLPARAM lParam); + + // handle a key event in a multi-selection control, should be only called + // for keys which can be used to change the selection // // return true if the key was processed, false otherwise - bool MSWHandleSelectionKey(WPARAM vkey); + bool MSWHandleSelectionKey(unsigned vkey); // data used only while editing the item label: @@ -264,7 +280,12 @@ private: void DoExpand(const wxTreeItemId& item, int flag); + void DoSelectItem(const wxTreeItemId& item, bool select = true); + void DoUnselectItem(const wxTreeItemId& item); + void DoToggleItemSelection(const wxTreeItemId& item); + void DoUnselectAll(); + void DoSelectChildren(const wxTreeItemId& parent); void DeleteTextCtrl(); @@ -273,6 +294,14 @@ private: bool IsHiddenRoot(const wxTreeItemId& item) const; + // check if the given flags (taken from TV_HITTESTINFO structure) + // indicate a position "on item": this is less trivial than just checking + // for TVHT_ONITEM because we consider that points to the left and right of + // item text are also "on item" when wxTR_FULL_ROW_HIGHLIGHT is used as the + // item visually spans the entire breadth of the window then + bool MSWIsOnItem(unsigned flags) const; + + // the hash storing the items attributes (indexed by item ids) wxMapTreeAttr m_attrs; @@ -297,9 +326,16 @@ private: // whether focus was lost between subsequent clicks of a single item bool m_focusLost; + // set when we are changing selection ourselves (only used in multi + // selection mode) + bool m_changingSelection; + // whether we need to trigger a state image click event bool m_triggerStateImageClick; + // whether we need to deselect other items on mouse up + bool m_mouseUpDeselect; + friend class wxTreeItemIndirectData; friend class wxTreeSortHelper;