X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ee4b27218975753b6f9aca302f38793ed497ded3..b3c35859d85c0771516a378bcd8cb9f45d3837d0:/include/wx/generic/treectlg.h diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index a76a4dde38..f82e154ac7 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -12,7 +12,7 @@ #ifndef _GENERIC_TREECTRL_H_ #define _GENERIC_TREECTRL_H_ -#if defined(__GNUG__) && !defined(__APPLE__) +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma interface "treectlg.h" #endif @@ -301,9 +301,18 @@ public: // remove the selection from currently selected item (if any) void Unselect(); + // or from the given one (multiselect mode only) + void UnselectItem(const wxTreeItemId& item) { SelectItem(item, false); } + // or from all void UnselectAll(); // select this item - void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE, bool extended_select=FALSE); + void SelectItem(const wxTreeItemId& item, bool select = true); + // toggle the item selection + void ToggleItemSelection(const wxTreeItemId& item) + { + SelectItem(item, !IsSelected(item)); + } + // make sure this item is visible (expanding the parent item and/or // scrolling to this item if necessary) void EnsureVisible(const wxTreeItemId& item); @@ -351,13 +360,17 @@ public: void SetItemSelectedImage(const wxTreeItemId& item, int image) { SetItemImage(item, image, wxTreeItemIcon_Selected); } - // use the versions taking wxTreeItemIdValue cookies + // use the versions taking wxTreeItemIdValue cookies (note that + // GetNextChild() is not inside wxDEPRECATED on purpose, as otherwise we + // get twice as many warnings without any added benefit: it is always used + // with GetFirstChild() anyhow) wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const ); - wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, - long& cookie) const ); + wxTreeItemId GetNextChild(const wxTreeItemId& item, + long& cookie) const; #endif // WXWIN_COMPATIBILITY_2_4 + virtual bool ShouldInheritColours() const { return false; } // implementation only from now on @@ -371,6 +384,7 @@ public: void OnKillFocus( wxFocusEvent &event ); void OnChar( wxKeyEvent &event ); void OnMouse( wxMouseEvent &event ); + void OnGetToolTip( wxTreeEvent &event ); void OnInternalIdle( ); // implementation helpers @@ -410,13 +424,11 @@ protected: wxGenericTreeItem *m_dropTarget; wxCursor m_oldCursor; // cursor is changed while dragging wxGenericTreeItem *m_oldSelection; + wxGenericTreeItem *m_underMouse; // for visual effects wxTreeTextCtrl *m_textCtrl; wxTimer *m_renameTimer; - wxBitmap *m_arrowRight, - *m_arrowDown; - // incremental search data wxString m_findPrefix; wxTimer *m_findTimer; @@ -431,6 +443,10 @@ protected: void DrawLine(const wxTreeItemId& item, bool below); void DrawDropEffect(wxGenericTreeItem *item); + void DoSelectItem(const wxTreeItemId& id, + bool unselect_others = TRUE, + bool extended_select = FALSE); + wxTreeItemId DoInsertItem(const wxTreeItemId& parent, size_t previous, const wxString& text, @@ -443,9 +459,7 @@ protected: // find the first item starting with the given prefix after the given item wxTreeItemId FindItem(const wxTreeItemId& id, const wxString& prefix) const; - bool HasButtons(void) const - { return (m_imageListButtons != NULL) - || HasFlag(wxTR_TWIST_BUTTONS|wxTR_HAS_BUTTONS); } + bool HasButtons() const { return HasFlag(wxTR_HAS_BUTTONS); } void CalculateLineHeight(); int GetLineHeight(wxGenericTreeItem *item) const;