]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
3f7bc32b | 2 | // Name: wx/msw/treectrl.h |
2bda0e17 KB |
3 | // Purpose: wxTreeCtrl class |
4 | // Author: Julian Smart | |
08b7c251 | 5 | // Modified by: Vadim Zeitlin to be less MSW-specific on 10/10/98 |
2bda0e17 KB |
6 | // Created: 01/02/97 |
7 | // RCS-ID: $Id$ | |
371a5b4e | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_TREECTRL_H_ |
13 | #define _WX_TREECTRL_H_ | |
2bda0e17 | 14 | |
08b7c251 VZ |
15 | // ---------------------------------------------------------------------------- |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
d427503c | 18 | |
1e6feb95 VZ |
19 | #if wxUSE_TREECTRL |
20 | ||
ad5c34f3 | 21 | #include "wx/textctrl.h" |
2899e223 | 22 | #include "wx/dynarray.h" |
484523cf | 23 | #include "wx/treebase.h" |
ee4b2721 | 24 | #include "wx/hashmap.h" |
2bda0e17 | 25 | |
d427503c VZ |
26 | #ifdef __GNUWIN32__ |
27 | // Cygwin windows.h defines these identifiers | |
28 | #undef GetFirstChild | |
29 | #undef GetNextSibling | |
30 | #endif // Cygwin | |
31 | ||
08b7c251 | 32 | // fwd decl |
06e38c8e | 33 | class WXDLLEXPORT wxImageList; |
23f681ec | 34 | class WXDLLEXPORT wxDragImage; |
06e38c8e | 35 | struct WXDLLEXPORT wxTreeViewItem; |
08b7c251 | 36 | |
08b7c251 VZ |
37 | // NB: all the following flags are for compatbility only and will be removed in the |
38 | // next versions | |
39 | ||
ee4b2721 VZ |
40 | // flags for deprecated InsertItem() variant (their values are the same as of |
41 | // TVI_FIRST and TVI_LAST) | |
3197ed26 VZ |
42 | #define wxTREE_INSERT_FIRST 0xFFFF0001 |
43 | #define wxTREE_INSERT_LAST 0xFFFF0002 | |
2bda0e17 | 44 | |
ee4b2721 VZ |
45 | // hash storing attributes for our items |
46 | WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); | |
47 | ||
08b7c251 VZ |
48 | // ---------------------------------------------------------------------------- |
49 | // wxTreeCtrl | |
50 | // ---------------------------------------------------------------------------- | |
ee4b2721 | 51 | |
08b7c251 | 52 | class WXDLLEXPORT wxTreeCtrl : public wxControl |
2bda0e17 | 53 | { |
092bddef | 54 | public: |
092bddef VZ |
55 | // creation |
56 | // -------- | |
08b7c251 VZ |
57 | wxTreeCtrl() { Init(); } |
58 | ||
dabbc6a5 | 59 | wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, |
08b7c251 VZ |
60 | const wxPoint& pos = wxDefaultPosition, |
61 | const wxSize& size = wxDefaultSize, | |
62 | long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, | |
63 | const wxValidator& validator = wxDefaultValidator, | |
2b5f62a0 | 64 | const wxString& name = wxTreeCtrlNameStr) |
092bddef VZ |
65 | { |
66 | Create(parent, id, pos, size, style, validator, name); | |
67 | } | |
08b7c251 VZ |
68 | |
69 | virtual ~wxTreeCtrl(); | |
70 | ||
dabbc6a5 | 71 | bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, |
092bddef VZ |
72 | const wxPoint& pos = wxDefaultPosition, |
73 | const wxSize& size = wxDefaultSize, | |
08b7c251 | 74 | long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, |
092bddef | 75 | const wxValidator& validator = wxDefaultValidator, |
2b5f62a0 | 76 | const wxString& name = wxTreeCtrlNameStr); |
08b7c251 | 77 | |
092bddef VZ |
78 | // accessors |
79 | // --------- | |
092bddef | 80 | |
08b7c251 VZ |
81 | // get the total number of items in the control |
82 | size_t GetCount() const; | |
83 | ||
84 | // indent is the number of pixels the children are indented relative to | |
85 | // the parents position. SetIndent() also redraws the control | |
86 | // immediately. | |
87 | unsigned int GetIndent() const; | |
88 | void SetIndent(unsigned int indent); | |
89 | ||
74b31181 VZ |
90 | // spacing is the number of pixels between the start and the Text |
91 | // not implemented under wxMSW | |
cf724bce | 92 | unsigned int GetSpacing() const { return 18; } // return wxGTK default |
74b31181 | 93 | void SetSpacing(unsigned int WXUNUSED(spacing)) { } |
cf724bce | 94 | |
08b7c251 VZ |
95 | // image list: these functions allow to associate an image list with |
96 | // the control and retrieve it. Note that the control does _not_ delete | |
97 | // the associated image list when it's deleted in order to allow image | |
98 | // lists to be shared between different controls. | |
99 | // | |
100 | // The normal image list is for the icons which correspond to the | |
101 | // normal tree item state (whether it is selected or not). | |
102 | // Additionally, the application might choose to show a state icon | |
103 | // which corresponds to an app-defined item state (for example, | |
104 | // checked/unchecked) which are taken from the state image list. | |
a78955e3 VS |
105 | virtual wxImageList *GetImageList() const; |
106 | virtual wxImageList *GetStateImageList() const; | |
08b7c251 | 107 | |
a78955e3 VS |
108 | virtual void SetImageList(wxImageList *imageList); |
109 | virtual void SetStateImageList(wxImageList *imageList); | |
110 | virtual void AssignImageList(wxImageList *imageList); | |
111 | virtual void AssignStateImageList(wxImageList *imageList); | |
08b7c251 VZ |
112 | |
113 | // Functions to work with tree ctrl items. Unfortunately, they can _not_ be | |
114 | // member functions of wxTreeItem because they must know the tree the item | |
115 | // belongs to for Windows implementation and storing the pointer to | |
116 | // wxTreeCtrl in each wxTreeItem is just too much waste. | |
117 | ||
118 | // accessors | |
119 | // --------- | |
120 | ||
121 | // retrieve items label | |
122 | wxString GetItemText(const wxTreeItemId& item) const; | |
74b31181 | 123 | // get one of the images associated with the item (normal by default) |
a78955e3 | 124 | virtual int GetItemImage(const wxTreeItemId& item, |
74b31181 | 125 | wxTreeItemIcon which = wxTreeItemIcon_Normal) const; |
08b7c251 VZ |
126 | // get the data associated with the item |
127 | wxTreeItemData *GetItemData(const wxTreeItemId& item) const; | |
128 | ||
2b5f62a0 VZ |
129 | // get the item's text colour |
130 | wxColour GetItemTextColour(const wxTreeItemId& item) const; | |
131 | ||
132 | // get the item's background colour | |
133 | wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; | |
134 | ||
135 | // get the item's font | |
136 | wxFont GetItemFont(const wxTreeItemId& item) const; | |
137 | ||
08b7c251 VZ |
138 | // modifiers |
139 | // --------- | |
140 | ||
141 | // set items label | |
142 | void SetItemText(const wxTreeItemId& item, const wxString& text); | |
74b31181 | 143 | // get one of the images associated with the item (normal by default) |
a78955e3 | 144 | virtual void SetItemImage(const wxTreeItemId& item, int image, |
74b31181 | 145 | wxTreeItemIcon which = wxTreeItemIcon_Normal); |
08b7c251 VZ |
146 | // associate some data with the item |
147 | void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); | |
148 | ||
3a5a2f56 VZ |
149 | // force appearance of [+] button near the item. This is useful to |
150 | // allow the user to expand the items which don't have any children now | |
151 | // - but instead add them only when needed, thus minimizing memory | |
152 | // usage and loading time. | |
dabbc6a5 | 153 | void SetItemHasChildren(const wxTreeItemId& item, bool has = true); |
3a5a2f56 | 154 | |
add28c55 | 155 | // the item will be shown in bold |
dabbc6a5 | 156 | void SetItemBold(const wxTreeItemId& item, bool bold = true); |
add28c55 | 157 | |
58a8ab88 | 158 | // the item will be shown with a drop highlight |
dabbc6a5 | 159 | void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true); |
58a8ab88 | 160 | |
9ec64fa7 VZ |
161 | // set the items text colour |
162 | void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); | |
163 | ||
164 | // set the items background colour | |
165 | void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); | |
166 | ||
167 | // set the items font (should be of the same height for all items) | |
168 | void SetItemFont(const wxTreeItemId& item, const wxFont& font); | |
169 | ||
08b7c251 VZ |
170 | // item status inquiries |
171 | // --------------------- | |
172 | ||
173 | // is the item visible (it might be outside the view or not expanded)? | |
174 | bool IsVisible(const wxTreeItemId& item) const; | |
175 | // does the item has any children? | |
176 | bool ItemHasChildren(const wxTreeItemId& item) const; | |
177 | // is the item expanded (only makes sense if HasChildren())? | |
178 | bool IsExpanded(const wxTreeItemId& item) const; | |
179 | // is this item currently selected (the same as has focus)? | |
180 | bool IsSelected(const wxTreeItemId& item) const; | |
add28c55 VZ |
181 | // is item text in bold font? |
182 | bool IsBold(const wxTreeItemId& item) const; | |
08b7c251 | 183 | |
4832f7c0 VZ |
184 | // number of children |
185 | // ------------------ | |
186 | ||
dabbc6a5 | 187 | // if 'recursively' is false, only immediate children count, otherwise |
4832f7c0 | 188 | // the returned number is the number of all items in this branch |
9dfbf520 | 189 | size_t GetChildrenCount(const wxTreeItemId& item, |
dabbc6a5 | 190 | bool recursively = true) const; |
4832f7c0 | 191 | |
08b7c251 VZ |
192 | // navigation |
193 | // ---------- | |
194 | ||
dabbc6a5 | 195 | // wxTreeItemId.IsOk() will return false if there is no such item |
08b7c251 VZ |
196 | |
197 | // get the root tree item | |
198 | wxTreeItemId GetRootItem() const; | |
199 | ||
200 | // get the item currently selected (may return NULL if no selection) | |
201 | wxTreeItemId GetSelection() const; | |
202 | ||
9dfbf520 VZ |
203 | // get the items currently selected, return the number of such item |
204 | // | |
205 | // NB: this operation is expensive and can take a long time for a | |
206 | // control with a lot of items (~ O(number of items)). | |
207 | size_t GetSelections(wxArrayTreeItemIds& selections) const; | |
208 | ||
08b7c251 | 209 | // get the parent of this item (may return NULL if root) |
99006e44 RL |
210 | wxTreeItemId GetItemParent(const wxTreeItemId& item) const; |
211 | ||
08b7c251 VZ |
212 | // for this enumeration function you must pass in a "cookie" parameter |
213 | // which is opaque for the application but is necessary for the library | |
214 | // to make these functions reentrant (i.e. allow more than one | |
215 | // enumeration on one and the same object simultaneously). Of course, | |
216 | // the "cookie" passed to GetFirstChild() and GetNextChild() should be | |
217 | // the same! | |
218 | ||
219 | // get the first child of this item | |
ee4b2721 VZ |
220 | wxTreeItemId GetFirstChild(const wxTreeItemId& item, |
221 | wxTreeItemIdValue& cookie) const; | |
08b7c251 | 222 | // get the next child |
ee4b2721 VZ |
223 | wxTreeItemId GetNextChild(const wxTreeItemId& item, |
224 | wxTreeItemIdValue& cookie) const; | |
978f38c2 VZ |
225 | // get the last child of this item - this method doesn't use cookies |
226 | wxTreeItemId GetLastChild(const wxTreeItemId& item) const; | |
08b7c251 VZ |
227 | |
228 | // get the next sibling of this item | |
229 | wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; | |
230 | // get the previous sibling | |
231 | wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; | |
232 | ||
233 | // get first visible item | |
234 | wxTreeItemId GetFirstVisibleItem() const; | |
235 | // get the next visible item: item must be visible itself! | |
236 | // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() | |
237 | wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; | |
238 | // get the previous visible item: item must be visible itself! | |
239 | wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; | |
240 | ||
092bddef VZ |
241 | // operations |
242 | // ---------- | |
08b7c251 VZ |
243 | |
244 | // add the root node to the tree | |
a78955e3 | 245 | virtual wxTreeItemId AddRoot(const wxString& text, |
08b7c251 VZ |
246 | int image = -1, int selectedImage = -1, |
247 | wxTreeItemData *data = NULL); | |
248 | ||
249 | // insert a new item in as the first child of the parent | |
a78955e3 | 250 | virtual wxTreeItemId PrependItem(const wxTreeItemId& parent, |
08b7c251 VZ |
251 | const wxString& text, |
252 | int image = -1, int selectedImage = -1, | |
253 | wxTreeItemData *data = NULL); | |
254 | ||
255 | // insert a new item after a given one | |
a78955e3 | 256 | virtual wxTreeItemId InsertItem(const wxTreeItemId& parent, |
08b7c251 VZ |
257 | const wxTreeItemId& idPrevious, |
258 | const wxString& text, | |
259 | int image = -1, int selectedImage = -1, | |
260 | wxTreeItemData *data = NULL); | |
261 | ||
2ef31e80 | 262 | // insert a new item before the one with the given index |
a78955e3 | 263 | virtual wxTreeItemId InsertItem(const wxTreeItemId& parent, |
2ef31e80 VZ |
264 | size_t index, |
265 | const wxString& text, | |
266 | int image = -1, int selectedImage = -1, | |
267 | wxTreeItemData *data = NULL); | |
268 | ||
08b7c251 | 269 | // insert a new item in as the last child of the parent |
a78955e3 | 270 | virtual wxTreeItemId AppendItem(const wxTreeItemId& parent, |
08b7c251 VZ |
271 | const wxString& text, |
272 | int image = -1, int selectedImage = -1, | |
273 | wxTreeItemData *data = NULL); | |
274 | ||
275 | // delete this item and associated data if any | |
276 | void Delete(const wxTreeItemId& item); | |
372edb9d VZ |
277 | // delete all children (but don't delete the item itself) |
278 | // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events | |
279 | void DeleteChildren(const wxTreeItemId& item); | |
08b7c251 | 280 | // delete all items from the tree |
372edb9d | 281 | // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events |
08b7c251 VZ |
282 | void DeleteAllItems(); |
283 | ||
284 | // expand this item | |
285 | void Expand(const wxTreeItemId& item); | |
286 | // collapse the item without removing its children | |
287 | void Collapse(const wxTreeItemId& item); | |
288 | // collapse the item and remove all children | |
289 | void CollapseAndReset(const wxTreeItemId& item); | |
290 | // toggles the current state | |
291 | void Toggle(const wxTreeItemId& item); | |
292 | ||
293 | // remove the selection from currently selected item (if any) | |
294 | void Unselect(); | |
9dfbf520 VZ |
295 | // unselect all items (only makes sense for multiple selection control) |
296 | void UnselectAll(); | |
08b7c251 | 297 | // select this item |
3e9af289 VZ |
298 | void SelectItem(const wxTreeItemId& item, bool select = true); |
299 | // unselect this item | |
300 | void UnselectItem(const wxTreeItemId& item); | |
301 | // toggle item selection | |
302 | void ToggleItemSelection(const wxTreeItemId& item); | |
303 | ||
08b7c251 VZ |
304 | // make sure this item is visible (expanding the parent item and/or |
305 | // scrolling to this item if necessary) | |
306 | void EnsureVisible(const wxTreeItemId& item); | |
307 | // scroll to this item (but don't expand its parent) | |
308 | void ScrollTo(const wxTreeItemId& item); | |
309 | ||
310 | // start editing the item label: this (temporarily) replaces the item | |
311 | // with a one line edit control. The item will be selected if it hadn't | |
312 | // been before. textCtrlClass parameter allows you to create an edit | |
313 | // control of arbitrary user-defined class deriving from wxTextCtrl. | |
314 | wxTextCtrl* EditLabel(const wxTreeItemId& item, | |
315 | wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); | |
316 | // returns the same pointer as StartEdit() if the item is being edited, | |
317 | // NULL otherwise (it's assumed that no more than one item may be | |
318 | // edited simultaneously) | |
319 | wxTextCtrl* GetEditControl() const; | |
320 | // end editing and accept or discard the changes to item label | |
d35dce3a VZ |
321 | void EndEditLabel(const wxTreeItemId& WXUNUSED(item), |
322 | bool discardChanges = false) | |
323 | { | |
324 | DoEndEditLabel(discardChanges); | |
325 | } | |
08b7c251 | 326 | |
95aabccc VZ |
327 | // sorting |
328 | // this function is called to compare 2 items and should return -1, 0 | |
329 | // or +1 if the first item is less than, equal to or greater than the | |
330 | // second one. The base class version performs alphabetic comparaison | |
331 | // of item labels (GetText) | |
332 | virtual int OnCompareItems(const wxTreeItemId& item1, | |
333 | const wxTreeItemId& item2); | |
334 | // sort the children of this item using OnCompareItems | |
08b7c251 | 335 | // |
95aabccc VZ |
336 | // NB: this function is not reentrant and not MT-safe (FIXME)! |
337 | void SortChildren(const wxTreeItemId& item); | |
08b7c251 VZ |
338 | |
339 | // helpers | |
340 | // ------- | |
341 | ||
add28c55 VZ |
342 | // determine to which item (if any) belongs the given point (the |
343 | // coordinates specified are relative to the client area of tree ctrl) | |
344 | // and fill the flags parameter with a bitmask of wxTREE_HITTEST_xxx | |
345 | // constants. | |
346 | // | |
347 | // The first function is more portable (because easier to implement | |
348 | // on other platforms), but the second one returns some extra info. | |
349 | wxTreeItemId HitTest(const wxPoint& point) | |
350 | { int dummy; return HitTest(point, dummy); } | |
351 | wxTreeItemId HitTest(const wxPoint& point, int& flags); | |
08b7c251 VZ |
352 | |
353 | // get the bounding rectangle of the item (or of its label only) | |
f7c832a7 | 354 | bool GetBoundingRect(const wxTreeItemId& item, |
16e93305 | 355 | wxRect& rect, |
dabbc6a5 | 356 | bool textOnly = false) const; |
08b7c251 | 357 | |
08b7c251 VZ |
358 | // deprecated |
359 | // ---------- | |
360 | ||
ee4b2721 | 361 | #if WXWIN_COMPATIBILITY_2_4 |
08b7c251 | 362 | // these methods are deprecated and will be removed in future versions of |
77ffb593 | 363 | // wxWidgets, they're here for compatibility only, don't use them in new |
08b7c251 VZ |
364 | // code (the comments indicate why these methods are now useless and how to |
365 | // replace them) | |
366 | ||
367 | // use Expand, Collapse, CollapseAndReset or Toggle | |
ee4b2721 | 368 | wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) ); |
08b7c251 VZ |
369 | |
370 | // use AddRoot, PrependItem or AppendItem | |
ee4b2721 | 371 | wxDEPRECATED( wxTreeItemId InsertItem(const wxTreeItemId& parent, |
08b7c251 VZ |
372 | const wxString& text, |
373 | int image = -1, int selImage = -1, | |
ee4b2721 | 374 | long insertAfter = wxTREE_INSERT_LAST) ); |
08b7c251 VZ |
375 | |
376 | // use Set/GetImageList and Set/GetStateImageList | |
a6fb8636 WS |
377 | wxDEPRECATED( wxImageList *GetImageList(int) const ); |
378 | wxDEPRECATED( void SetImageList(wxImageList *imageList, int) ); | |
08b7c251 | 379 | |
74b31181 | 380 | // use Set/GetItemImage directly |
a6fb8636 WS |
381 | wxDEPRECATED( int GetItemSelectedImage(const wxTreeItemId& item) const ); |
382 | wxDEPRECATED( void SetItemSelectedImage(const wxTreeItemId& item, int image) ); | |
74b31181 | 383 | |
ee4b2721 VZ |
384 | // use the versions taking wxTreeItemIdValue cookies |
385 | wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, | |
386 | long& cookie) const ); | |
387 | wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, | |
388 | long& cookie) const ); | |
389 | #endif // WXWIN_COMPATIBILITY_2_4 | |
390 | ||
d4864e97 | 391 | |
08b7c251 VZ |
392 | // implementation |
393 | // -------------- | |
3f7bc32b | 394 | |
39c7a53c VZ |
395 | virtual bool ShouldInheritColours() const { return false; } |
396 | ||
397 | virtual wxVisualAttributes GetDefaultAttributes() const | |
398 | { | |
399 | return GetClassDefaultAttributes(GetWindowVariant()); | |
400 | } | |
401 | ||
402 | static wxVisualAttributes | |
403 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
404 | ||
405 | ||
c140b7e7 | 406 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
fbd8ac52 | 407 | virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
fd3f686c | 408 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
a23fd0e1 | 409 | virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); |
08b7c251 | 410 | |
bb448552 VZ |
411 | // override some base class virtuals |
412 | virtual bool SetBackgroundColour(const wxColour &colour); | |
413 | virtual bool SetForegroundColour(const wxColour &colour); | |
414 | ||
9dfbf520 VZ |
415 | // get/set the check state for the item (only for wxTR_MULTIPLE) |
416 | bool IsItemChecked(const wxTreeItemId& item) const; | |
dabbc6a5 | 417 | void SetItemCheck(const wxTreeItemId& item, bool check = true); |
9dfbf520 | 418 | |
8a000b6b VZ |
419 | // set/get the item state.image (state == -1 means cycle to the next one) |
420 | void SetState(const wxTreeItemId& node, int state); | |
421 | int GetState(const wxTreeItemId& node); | |
422 | ||
2bda0e17 | 423 | protected: |
96d8f920 VZ |
424 | virtual wxSize DoGetBestSize() const; |
425 | ||
426 | ||
08b7c251 VZ |
427 | // SetImageList helper |
428 | void SetAnyImageList(wxImageList *imageList, int which); | |
429 | ||
d00407b2 VZ |
430 | // refresh a single item |
431 | void RefreshItem(const wxTreeItemId& item); | |
432 | ||
d35dce3a VZ |
433 | // end edit label |
434 | void DoEndEditLabel(bool discardChanges = false); | |
435 | ||
436 | ||
329eeca9 VZ |
437 | // data used only while editing the item label: |
438 | wxTextCtrl *m_textCtrl; // text control in which it is edited | |
439 | wxTreeItemId m_idEdited; // the item being edited | |
440 | ||
08b7c251 VZ |
441 | wxImageList *m_imageListNormal, // images for tree elements |
442 | *m_imageListState; // special images for app defined states | |
329eeca9 VZ |
443 | bool m_ownsImageListNormal, |
444 | m_ownsImageListState; | |
08b7c251 VZ |
445 | |
446 | private: | |
447 | // the common part of all ctors | |
448 | void Init(); | |
449 | ||
450 | // helper functions | |
451 | inline bool DoGetItem(wxTreeViewItem *tvItem) const; | |
452 | inline void DoSetItem(wxTreeViewItem *tvItem); | |
453 | ||
454 | inline void DoExpand(const wxTreeItemId& item, int flag); | |
455 | ||
456 | wxTreeItemId DoInsertItem(const wxTreeItemId& parent, | |
457 | wxTreeItemId hInsertAfter, | |
458 | const wxString& text, | |
459 | int image, int selectedImage, | |
460 | wxTreeItemData *data); | |
461 | ||
74b31181 VZ |
462 | int DoGetItemImageFromData(const wxTreeItemId& item, |
463 | wxTreeItemIcon which) const; | |
464 | void DoSetItemImageFromData(const wxTreeItemId& item, | |
465 | int image, | |
466 | wxTreeItemIcon which) const; | |
9dfbf520 VZ |
467 | void DoSetItemImages(const wxTreeItemId& item, int image, int imageSel); |
468 | ||
08b7c251 | 469 | void DeleteTextCtrl(); |
092bddef | 470 | |
502a2b18 VZ |
471 | // support for additional item images which we implement using |
472 | // wxTreeItemIndirectData technique - see the comments in msw/treectrl.cpp | |
74b31181 | 473 | void SetIndirectItemData(const wxTreeItemId& item, |
502a2b18 | 474 | class wxTreeItemIndirectData *data); |
74b31181 | 475 | bool HasIndirectData(const wxTreeItemId& item) const; |
502a2b18 | 476 | bool IsDataIndirect(wxTreeItemData *data) const |
8b4a9377 | 477 | { return data && data->GetId().m_pItem == 0; } |
74b31181 | 478 | |
ee4b2721 VZ |
479 | // the hash storing the items attributes (indexed by item ids) |
480 | wxMapTreeAttr m_attrs; | |
696e1ea0 | 481 | |
dabbc6a5 | 482 | // true if the hash above is not empty |
696e1ea0 VZ |
483 | bool m_hasAnyAttr; |
484 | ||
23f681ec VZ |
485 | // used for dragging |
486 | wxDragImage *m_dragImage; | |
487 | ||
a9c1265f VZ |
488 | // Virtual root item, if wxTR_HIDE_ROOT is set. |
489 | void* m_pVirtualRoot; | |
490 | ||
3f7bc32b | 491 | // the starting item for selection with Shift |
e3ad5702 JS |
492 | wxTreeItemId m_htSelStart, m_htClickedItem; |
493 | wxPoint m_ptClick; | |
3f7bc32b | 494 | |
502a2b18 VZ |
495 | friend class wxTreeItemIndirectData; |
496 | friend class wxTreeSortHelper; | |
497 | ||
092bddef | 498 | DECLARE_DYNAMIC_CLASS(wxTreeCtrl) |
22f3361e | 499 | DECLARE_NO_COPY_CLASS(wxTreeCtrl) |
2bda0e17 KB |
500 | }; |
501 | ||
1e6feb95 VZ |
502 | #endif // wxUSE_TREECTRL |
503 | ||
2bda0e17 | 504 | #endif |
bbcdf8bc | 505 | // _WX_TREECTRL_H_ |