X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e1ee62bd793bc1173ac36fd429a6f54a877b37f7..85833f5c6c5c136d16ccd01c90cc243d5d025e0a:/include/wx/generic/treectrl.h diff --git a/include/wx/generic/treectrl.h b/include/wx/generic/treectrl.h index 2550b4a5cd..9e57b50785 100644 --- a/include/wx/generic/treectrl.h +++ b/include/wx/generic/treectrl.h @@ -16,12 +16,19 @@ #pragma interface "treectrl.h" #endif +#ifdef __WXMSW__ +WXDLLEXPORT_DATA(extern const char*) wxTreeCtrlNameStr; +#else +#define wxTreeCtrlNameStr "wxTreeCtrl" +#endif + #include "wx/defs.h" #include "wx/string.h" #include "wx/object.h" #include "wx/event.h" #include "wx/scrolwin.h" #include "wx/textctrl.h" +#include "wx/pen.h" // ----------------------------------------------------------------------------- // constants @@ -37,7 +44,7 @@ static const int wxTREE_HITTEST_ONITEMLABEL = 0x0080; // anywhere on the item static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | wxTREE_HITTEST_ONITEMLABEL; - + // ----------------------------------------------------------------------------- // forward declaration // ----------------------------------------------------------------------------- @@ -200,8 +207,8 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = "wxTreeCtrl") + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr) { Create(parent, id, pos, size, style, validator, name); } @@ -212,8 +219,8 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - const wxValidator &validator = wxDefaultValidator, - const wxString& name = "wxTreeCtrl"); + const wxValidator &validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr); // accessors // --------- @@ -227,6 +234,10 @@ public: unsigned int GetIndent() const { return m_indent; } void SetIndent(unsigned int indent); + // spacing is the number of pixels between the start and the Text + unsigned int GetSpacing() const { return m_spacing; } + void SetSpacing(unsigned int spacing); + // image list: these functions allow to associate an image list with // the control and retrieve it. Note that the control does _not_ delete // the associated image list when it's deleted in order to allow image @@ -312,6 +323,9 @@ public: // get the item currently selected (may return NULL if no selection) wxTreeItemId GetSelection() const { return m_current; } + // get the items currently selected, return the number of such item + //size_t GetSelections(wxArrayTreeItems*) const; + // get the parent of this item (may return NULL if root) wxTreeItemId GetParent(const wxTreeItemId& item) const; @@ -326,6 +340,8 @@ public: wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const; // get the next child wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const; + // get the last child of this item - this method doesn't use cookies + wxTreeItemId GetLastChild(const wxTreeItemId& item) const; // get the next sibling of this item wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; @@ -387,8 +403,9 @@ public: // remove the selection from currently selected item (if any) void Unselect(); + void UnselectAll(); // select this item - void SelectItem(const wxTreeItemId& item); + void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE, bool extended_select=FALSE); // make sure this item is visible (expanding the parent item and/or // scrolling to this item if necessary) void EnsureVisible(const wxTreeItemId& item); @@ -400,7 +417,7 @@ public: wxTreeItemId HitTest(const wxPoint& point) { int dummy; return HitTest(point, dummy); } wxTreeItemId HitTest(const wxPoint& point, int& flags); - + // start editing the item label: this (temporarily) replaces the item // with a one line edit control. The item will be selected if it hadn't // been before. textCtrlClass parameter allows you to create an edit @@ -444,11 +461,13 @@ protected: bool m_dirty; int m_xScroll,m_yScroll; unsigned int m_indent; + unsigned int m_spacing; int m_lineHeight; wxPen m_dottedPen; wxBrush *m_hilightBrush; wxImageList *m_imageListNormal, *m_imageListState; + int m_dragCount; // the common part of all ctors void Init(); @@ -470,6 +489,11 @@ protected: void RefreshSubtree( wxGenericTreeItem *item ); void RefreshLine( wxGenericTreeItem *item ); + void SelectItemRange( wxGenericTreeItem *item1, wxGenericTreeItem *item2 ); + bool TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); + bool TagNextChildren(wxGenericTreeItem *crt_item, wxGenericTreeItem *last_item, bool select); + void UnselectAllChildren( wxGenericTreeItem *item ); + private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxTreeCtrl)