]>
Commit | Line | Data |
---|---|---|
484523cf | 1 | ///////////////////////////////////////////////////////////////////////////// |
40ff126a | 2 | // Name: wx/treebase.h |
484523cf JS |
3 | // Purpose: wxTreeCtrl base classes and types |
4 | // Author: Julian Smart et al | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1997,1998 Robert Roebling | |
65571936 | 9 | // Licence: wxWindows licence |
484523cf JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_TREEBASE_H_ | |
13 | #define _WX_TREEBASE_H_ | |
14 | ||
484523cf JS |
15 | // ---------------------------------------------------------------------------- |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
2ecf902b WS |
19 | #include "wx/defs.h" |
20 | ||
1e6feb95 | 21 | #if wxUSE_TREECTRL |
33737618 | 22 | |
618a5e38 | 23 | #include "wx/window.h" // for wxClientData |
484523cf | 24 | #include "wx/event.h" |
ed39ff57 | 25 | #include "wx/dynarray.h" |
87df1c87 | 26 | #include "wx/itemid.h" |
484523cf | 27 | |
40ff126a WS |
28 | #if WXWIN_COMPATIBILITY_2_6 |
29 | ||
e2effeb9 WS |
30 | // flags for deprecated `Expand(int action)', will be removed in next versions |
31 | enum | |
32 | { | |
33 | wxTREE_EXPAND_EXPAND, | |
34 | wxTREE_EXPAND_COLLAPSE, | |
35 | wxTREE_EXPAND_COLLAPSE_RESET, | |
36 | wxTREE_EXPAND_TOGGLE | |
37 | }; | |
38 | ||
40ff126a WS |
39 | #endif // WXWIN_COMPATIBILITY_2_6 |
40 | ||
484523cf | 41 | // ---------------------------------------------------------------------------- |
87df1c87 VZ |
42 | // wxTreeItemId identifies an element of the tree. It's opaque for the |
43 | // application and the only method which can be used by user code is IsOk(). | |
484523cf JS |
44 | // ---------------------------------------------------------------------------- |
45 | ||
87df1c87 VZ |
46 | // This is a class and not a typedef because existing code may forward declare |
47 | // wxTreeItemId as a class and we don't want to break it without good reason. | |
48 | class wxTreeItemId : public wxItemId<void*> | |
484523cf | 49 | { |
484523cf | 50 | public: |
87df1c87 VZ |
51 | wxTreeItemId() : wxItemId<void*>() { } |
52 | wxTreeItemId(void* pItem) : wxItemId<void*>(pItem) { } | |
484523cf JS |
53 | }; |
54 | ||
55 | // ---------------------------------------------------------------------------- | |
56 | // wxTreeItemData is some (arbitrary) user class associated with some item. The | |
57 | // main advantage of having this class (compared to old untyped interface) is | |
58 | // that wxTreeItemData's are destroyed automatically by the tree and, as this | |
59 | // class has virtual dtor, it means that the memory will be automatically | |
60 | // freed. OTOH, we don't just use wxObject instead of wxTreeItemData because | |
61 | // the size of this class is critical: in any real application, each tree leaf | |
62 | // will have wxTreeItemData associated with it and number of leaves may be | |
63 | // quite big. | |
64 | // | |
65 | // Because the objects of this class are deleted by the tree, they should | |
66 | // always be allocated on the heap! | |
67 | // ---------------------------------------------------------------------------- | |
68 | ||
53a2db12 | 69 | class WXDLLIMPEXP_CORE wxTreeItemData: public wxClientData |
484523cf | 70 | { |
b5dbe15d VS |
71 | friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; |
72 | friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; | |
484523cf JS |
73 | public: |
74 | // creation/destruction | |
75 | // -------------------- | |
76 | // default ctor | |
77 | wxTreeItemData() { } | |
78 | ||
79 | // default copy ctor/assignment operator are ok | |
80 | ||
81 | // accessor: get the item associated with us | |
82 | const wxTreeItemId& GetId() const { return m_pItem; } | |
83 | void SetId(const wxTreeItemId& id) { m_pItem = id; } | |
84 | ||
85 | protected: | |
86 | wxTreeItemId m_pItem; | |
87 | }; | |
88 | ||
87df1c87 VZ |
89 | typedef void *wxTreeItemIdValue; |
90 | ||
d5d29b8a | 91 | WX_DEFINE_EXPORTED_ARRAY_PTR(wxTreeItemIdValue, wxArrayTreeItemIdsBase); |
f888d614 | 92 | |
14ba002a | 93 | // this is a wrapper around the array class defined above which allow to wok |
87df1c87 | 94 | // with values of natural wxTreeItemId type instead of using wxTreeItemIdValue |
14ba002a | 95 | // and does it without any loss of efficiency |
53a2db12 | 96 | class WXDLLIMPEXP_CORE wxArrayTreeItemIds : public wxArrayTreeItemIdsBase |
f888d614 VZ |
97 | { |
98 | public: | |
99 | void Add(const wxTreeItemId& id) | |
100 | { wxArrayTreeItemIdsBase::Add(id.m_pItem); } | |
14ba002a VZ |
101 | void Insert(const wxTreeItemId& id, size_t pos) |
102 | { wxArrayTreeItemIdsBase::Insert(id.m_pItem, pos); } | |
103 | wxTreeItemId Item(size_t i) const | |
104 | { return wxTreeItemId(wxArrayTreeItemIdsBase::Item(i)); } | |
105 | wxTreeItemId operator[](size_t i) const { return Item(i); } | |
f888d614 | 106 | }; |
484523cf JS |
107 | |
108 | // ---------------------------------------------------------------------------- | |
109 | // constants | |
110 | // ---------------------------------------------------------------------------- | |
111 | ||
112 | // enum for different images associated with a treectrl item | |
113 | enum wxTreeItemIcon | |
114 | { | |
115 | wxTreeItemIcon_Normal, // not selected, not expanded | |
116 | wxTreeItemIcon_Selected, // selected, not expanded | |
117 | wxTreeItemIcon_Expanded, // not selected, expanded | |
118 | wxTreeItemIcon_SelectedExpanded, // selected, expanded | |
119 | wxTreeItemIcon_Max | |
120 | }; | |
121 | ||
03966fcb RR |
122 | // special values for the 'state' parameter of wxTreeCtrl::SetItemState() |
123 | static const int wxTREE_ITEMSTATE_NONE = -1; // not state (no display state image) | |
124 | static const int wxTREE_ITEMSTATE_NEXT = -2; // cycle to the next state | |
125 | static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state | |
126 | ||
9c7f49f5 VZ |
127 | // ---------------------------------------------------------------------------- |
128 | // wxTreeCtrl flags | |
129 | // ---------------------------------------------------------------------------- | |
130 | ||
c6f4913a | 131 | #define wxTR_NO_BUTTONS 0x0000 // for convenience |
9c7f49f5 VZ |
132 | #define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns |
133 | #define wxTR_NO_LINES 0x0004 // don't draw lines at all | |
c6f4913a | 134 | #define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes |
99cea4b3 | 135 | #define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl |
c6f4913a VS |
136 | |
137 | #define wxTR_SINGLE 0x0000 // for convenience | |
138 | #define wxTR_MULTIPLE 0x0020 // can select multiple items | |
d642a722 VZ |
139 | |
140 | #if WXWIN_COMPATIBILITY_2_8 | |
141 | #define wxTR_EXTENDED 0x0040 // deprecated, don't use | |
142 | #endif // WXWIN_COMPATIBILITY_2_8 | |
143 | ||
9c7f49f5 | 144 | #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says |
c6f4913a VS |
145 | |
146 | #define wxTR_EDIT_LABELS 0x0200 // can edit item labels | |
147 | #define wxTR_ROW_LINES 0x0400 // put border around items | |
148 | #define wxTR_HIDE_ROOT 0x0800 // don't display root node | |
618a5e38 | 149 | |
9c7f49f5 VZ |
150 | #define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space |
151 | ||
6621957f VZ |
152 | // make the default control appearance look more native-like depending on the |
153 | // platform | |
154 | #if defined(__WXGTK20__) | |
155 | #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_NO_LINES) | |
156 | #elif defined(__WXMAC__) | |
157 | #define wxTR_DEFAULT_STYLE \ | |
158 | (wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxTR_FULL_ROW_HIGHLIGHT) | |
c7f73af4 | 159 | #else |
6621957f | 160 | #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) |
c7f73af4 | 161 | #endif |
9c7f49f5 | 162 | |
40ff126a | 163 | #if WXWIN_COMPATIBILITY_2_6 |
9c7f49f5 | 164 | // deprecated, don't use |
9c7f49f5 VZ |
165 | #define wxTR_MAC_BUTTONS 0 |
166 | #define wxTR_AQUA_BUTTONS 0 | |
40ff126a | 167 | #endif // WXWIN_COMPATIBILITY_2_6 |
9c7f49f5 | 168 | |
484523cf JS |
169 | |
170 | // values for the `flags' parameter of wxTreeCtrl::HitTest() which determine | |
171 | // where exactly the specified point is situated: | |
172 | ||
173 | static const int wxTREE_HITTEST_ABOVE = 0x0001; | |
174 | static const int wxTREE_HITTEST_BELOW = 0x0002; | |
175 | static const int wxTREE_HITTEST_NOWHERE = 0x0004; | |
176 | // on the button associated with an item. | |
177 | static const int wxTREE_HITTEST_ONITEMBUTTON = 0x0008; | |
178 | // on the bitmap associated with an item. | |
179 | static const int wxTREE_HITTEST_ONITEMICON = 0x0010; | |
180 | // on the indent associated with an item. | |
181 | static const int wxTREE_HITTEST_ONITEMINDENT = 0x0020; | |
182 | // on the label (string) associated with an item. | |
183 | static const int wxTREE_HITTEST_ONITEMLABEL = 0x0040; | |
184 | // on the right of the label associated with an item. | |
185 | static const int wxTREE_HITTEST_ONITEMRIGHT = 0x0080; | |
186 | // on the label (string) associated with an item. | |
187 | static const int wxTREE_HITTEST_ONITEMSTATEICON = 0x0100; | |
188 | // on the left of the wxTreeCtrl. | |
189 | static const int wxTREE_HITTEST_TOLEFT = 0x0200; | |
190 | // on the right of the wxTreeCtrl. | |
191 | static const int wxTREE_HITTEST_TORIGHT = 0x0400; | |
192 | // on the upper part (first half) of the item. | |
193 | static const int wxTREE_HITTEST_ONITEMUPPERPART = 0x0800; | |
194 | // on the lower part (second half) of the item. | |
195 | static const int wxTREE_HITTEST_ONITEMLOWERPART = 0x1000; | |
196 | ||
197 | // anywhere on the item | |
198 | static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | | |
199 | wxTREE_HITTEST_ONITEMLABEL; | |
200 | ||
201 | // tree ctrl default name | |
53a2db12 | 202 | extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeCtrlNameStr[]; |
484523cf JS |
203 | |
204 | // ---------------------------------------------------------------------------- | |
205 | // wxTreeItemAttr: a structure containing the visual attributes of an item | |
206 | // ---------------------------------------------------------------------------- | |
207 | ||
53a2db12 | 208 | class WXDLLIMPEXP_CORE wxTreeItemAttr |
484523cf JS |
209 | { |
210 | public: | |
211 | // ctors | |
212 | wxTreeItemAttr() { } | |
213 | wxTreeItemAttr(const wxColour& colText, | |
214 | const wxColour& colBack, | |
215 | const wxFont& font) | |
216 | : m_colText(colText), m_colBack(colBack), m_font(font) { } | |
217 | ||
218 | // setters | |
219 | void SetTextColour(const wxColour& colText) { m_colText = colText; } | |
220 | void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; } | |
221 | void SetFont(const wxFont& font) { m_font = font; } | |
222 | ||
223 | // accessors | |
a1b806b9 DS |
224 | bool HasTextColour() const { return m_colText.IsOk(); } |
225 | bool HasBackgroundColour() const { return m_colBack.IsOk(); } | |
226 | bool HasFont() const { return m_font.IsOk(); } | |
484523cf JS |
227 | |
228 | const wxColour& GetTextColour() const { return m_colText; } | |
229 | const wxColour& GetBackgroundColour() const { return m_colBack; } | |
230 | const wxFont& GetFont() const { return m_font; } | |
231 | ||
232 | private: | |
233 | wxColour m_colText, | |
234 | m_colBack; | |
235 | wxFont m_font; | |
236 | }; | |
237 | ||
238 | // ---------------------------------------------------------------------------- | |
239 | // wxTreeEvent is a special class for all events associated with tree controls | |
240 | // | |
241 | // NB: note that not all accessors make sense for all events, see the event | |
242 | // descriptions below | |
243 | // ---------------------------------------------------------------------------- | |
244 | ||
b5dbe15d | 245 | class WXDLLIMPEXP_FWD_CORE wxTreeCtrlBase; |
2388d9b3 | 246 | |
53a2db12 | 247 | class WXDLLIMPEXP_CORE wxTreeEvent : public wxNotifyEvent |
484523cf | 248 | { |
484523cf | 249 | public: |
e47859da | 250 | wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); |
2388d9b3 VZ |
251 | wxTreeEvent(wxEventType commandType, |
252 | wxTreeCtrlBase *tree, | |
253 | const wxTreeItemId &item = wxTreeItemId()); | |
254 | wxTreeEvent(const wxTreeEvent& event); | |
0cd936a4 WS |
255 | |
256 | virtual wxEvent *Clone() const { return new wxTreeEvent(*this); } | |
484523cf JS |
257 | |
258 | // accessors | |
259 | // get the item on which the operation was performed or the newly | |
260 | // selected item for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events | |
261 | wxTreeItemId GetItem() const { return m_item; } | |
8adb5d45 | 262 | void SetItem(const wxTreeItemId& item) { m_item = item; } |
484523cf JS |
263 | |
264 | // for wxEVT_COMMAND_TREE_SEL_CHANGED/ING events, get the previously | |
265 | // selected item | |
266 | wxTreeItemId GetOldItem() const { return m_itemOld; } | |
8adb5d45 | 267 | void SetOldItem(const wxTreeItemId& item) { m_itemOld = item; } |
484523cf JS |
268 | |
269 | // the point where the mouse was when the drag operation started (for | |
33737618 | 270 | // wxEVT_COMMAND_TREE_BEGIN_(R)DRAG events only) or click position |
484523cf | 271 | wxPoint GetPoint() const { return m_pointDrag; } |
8adb5d45 | 272 | void SetPoint(const wxPoint& pt) { m_pointDrag = pt; } |
484523cf | 273 | |
b09bda68 VZ |
274 | // keyboard data (for wxEVT_COMMAND_TREE_KEY_DOWN only) |
275 | const wxKeyEvent& GetKeyEvent() const { return m_evtKey; } | |
1944ad76 | 276 | int GetKeyCode() const { return m_evtKey.GetKeyCode(); } |
8adb5d45 | 277 | void SetKeyEvent(const wxKeyEvent& evt) { m_evtKey = evt; } |
484523cf JS |
278 | |
279 | // label (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) | |
280 | const wxString& GetLabel() const { return m_label; } | |
8adb5d45 | 281 | void SetLabel(const wxString& label) { m_label = label; } |
484523cf | 282 | |
dd23c25c JS |
283 | // edit cancel flag (for EVT_TREE_{BEGIN|END}_LABEL_EDIT only) |
284 | bool IsEditCancelled() const { return m_editCancelled; } | |
8adb5d45 | 285 | void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } |
dd23c25c | 286 | |
156194e1 JS |
287 | // Set the tooltip for the item (for EVT\_TREE\_ITEM\_GETTOOLTIP events) |
288 | void SetToolTip(const wxString& toolTip) { m_label = toolTip; } | |
3dd67a18 | 289 | wxString GetToolTip() { return m_label; } |
8bc3ec1f | 290 | |
484523cf | 291 | private: |
b09bda68 VZ |
292 | // not all of the members are used (or initialized) for all events |
293 | wxKeyEvent m_evtKey; | |
484523cf JS |
294 | wxTreeItemId m_item, |
295 | m_itemOld; | |
296 | wxPoint m_pointDrag; | |
297 | wxString m_label; | |
dd23c25c | 298 | bool m_editCancelled; |
b09bda68 | 299 | |
b5dbe15d VS |
300 | friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; |
301 | friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; | |
b09bda68 | 302 | |
0cd936a4 | 303 | DECLARE_DYNAMIC_CLASS(wxTreeEvent) |
484523cf JS |
304 | }; |
305 | ||
306 | typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); | |
307 | ||
308 | // ---------------------------------------------------------------------------- | |
2e4df4bf | 309 | // tree control events and macros for handling them |
484523cf JS |
310 | // ---------------------------------------------------------------------------- |
311 | ||
9b11752c VZ |
312 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_BEGIN_DRAG, wxTreeEvent ); |
313 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_BEGIN_RDRAG, wxTreeEvent ); | |
314 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEvent ); | |
315 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_END_LABEL_EDIT, wxTreeEvent ); | |
316 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_DELETE_ITEM, wxTreeEvent ); | |
317 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_GET_INFO, wxTreeEvent ); | |
318 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_SET_INFO, wxTreeEvent ); | |
319 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxTreeEvent ); | |
320 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_EXPANDING, wxTreeEvent ); | |
321 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxTreeEvent ); | |
322 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, wxTreeEvent ); | |
323 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEvent ); | |
324 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEvent ); | |
325 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_KEY_DOWN, wxTreeEvent ); | |
326 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEvent ); | |
327 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, wxTreeEvent ); | |
328 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, wxTreeEvent ); | |
329 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_END_DRAG, wxTreeEvent ); | |
330 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, wxTreeEvent ); | |
331 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, wxTreeEvent ); | |
332 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_TREE_ITEM_MENU, wxTreeEvent ); | |
2e4df4bf | 333 | |
7fa03f04 | 334 | #define wxTreeEventHandler(func) \ |
3c778901 | 335 | wxEVENT_HANDLER_CAST(wxTreeEventFunction, func) |
7fa03f04 VZ |
336 | |
337 | #define wx__DECLARE_TREEEVT(evt, id, fn) \ | |
338 | wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_ ## evt, id, wxTreeEventHandler(fn)) | |
339 | ||
484523cf JS |
340 | // GetItem() returns the item being dragged, GetPoint() the mouse coords |
341 | // | |
342 | // if you call event.Allow(), the drag operation will start and a | |
343 | // EVT_TREE_END_DRAG event will be sent when the drag is over. | |
7fa03f04 VZ |
344 | #define EVT_TREE_BEGIN_DRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_DRAG, id, fn) |
345 | #define EVT_TREE_BEGIN_RDRAG(id, fn) wx__DECLARE_TREEEVT(BEGIN_RDRAG, id, fn) | |
484523cf | 346 | |
3103e8a9 | 347 | // GetItem() is the item on which the drop occurred (if any) and GetPoint() the |
484523cf | 348 | // current mouse coords |
7fa03f04 | 349 | #define EVT_TREE_END_DRAG(id, fn) wx__DECLARE_TREEEVT(END_DRAG, id, fn) |
484523cf JS |
350 | |
351 | // GetItem() returns the itme whose label is being edited, GetLabel() returns | |
352 | // the current item label for BEGIN and the would be new one for END. | |
353 | // | |
354 | // Vetoing BEGIN event means that label editing won't happen at all, | |
355 | // vetoing END means that the new value is discarded and the old one kept | |
7fa03f04 VZ |
356 | #define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(BEGIN_LABEL_EDIT, id, fn) |
357 | #define EVT_TREE_END_LABEL_EDIT(id, fn) wx__DECLARE_TREEEVT(END_LABEL_EDIT, id, fn) | |
484523cf JS |
358 | |
359 | // provide/update information about GetItem() item | |
7fa03f04 VZ |
360 | #define EVT_TREE_GET_INFO(id, fn) wx__DECLARE_TREEEVT(GET_INFO, id, fn) |
361 | #define EVT_TREE_SET_INFO(id, fn) wx__DECLARE_TREEEVT(SET_INFO, id, fn) | |
484523cf JS |
362 | |
363 | // GetItem() is the item being expanded/collapsed, the "ING" versions can use | |
7fa03f04 VZ |
364 | #define EVT_TREE_ITEM_EXPANDED(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDED, id, fn) |
365 | #define EVT_TREE_ITEM_EXPANDING(id, fn) wx__DECLARE_TREEEVT(ITEM_EXPANDING, id, fn) | |
366 | #define EVT_TREE_ITEM_COLLAPSED(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSED, id, fn) | |
367 | #define EVT_TREE_ITEM_COLLAPSING(id, fn) wx__DECLARE_TREEEVT(ITEM_COLLAPSING, id, fn) | |
484523cf JS |
368 | |
369 | // GetOldItem() is the item which had the selection previously, GetItem() is | |
370 | // the item which acquires selection | |
7fa03f04 VZ |
371 | #define EVT_TREE_SEL_CHANGED(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGED, id, fn) |
372 | #define EVT_TREE_SEL_CHANGING(id, fn) wx__DECLARE_TREEEVT(SEL_CHANGING, id, fn) | |
484523cf | 373 | |
1944ad76 | 374 | // GetKeyCode() returns the key code |
484523cf JS |
375 | // NB: this is the only message for which GetItem() is invalid (you may get the |
376 | // item from GetSelection()) | |
7fa03f04 | 377 | #define EVT_TREE_KEY_DOWN(id, fn) wx__DECLARE_TREEEVT(KEY_DOWN, id, fn) |
484523cf JS |
378 | |
379 | // GetItem() returns the item being deleted, the associated data (if any) will | |
380 | // be deleted just after the return of this event handler (if any) | |
7fa03f04 | 381 | #define EVT_TREE_DELETE_ITEM(id, fn) wx__DECLARE_TREEEVT(DELETE_ITEM, id, fn) |
484523cf JS |
382 | |
383 | // GetItem() returns the item that was activated (double click, enter, space) | |
7fa03f04 | 384 | #define EVT_TREE_ITEM_ACTIVATED(id, fn) wx__DECLARE_TREEEVT(ITEM_ACTIVATED, id, fn) |
484523cf | 385 | |
f7c6f947 | 386 | // GetItem() returns the item for which the context menu shall be shown |
7fa03f04 | 387 | #define EVT_TREE_ITEM_MENU(id, fn) wx__DECLARE_TREEEVT(ITEM_MENU, id, fn) |
f7c6f947 | 388 | |
484523cf | 389 | // GetItem() returns the item that was clicked on |
7fa03f04 VZ |
390 | #define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_RIGHT_CLICK, id, fn) |
391 | #define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_TREEEVT(ITEM_MIDDLE_CLICK, id, fn) | |
484523cf | 392 | |
ae8c4b33 | 393 | // GetItem() returns the item whose state image was clicked on |
7fa03f04 | 394 | #define EVT_TREE_STATE_IMAGE_CLICK(id, fn) wx__DECLARE_TREEEVT(STATE_IMAGE_CLICK, id, fn) |
ae8c4b33 | 395 | |
156194e1 | 396 | // GetItem() is the item for which the tooltip is being requested |
7fa03f04 | 397 | #define EVT_TREE_ITEM_GETTOOLTIP(id, fn) wx__DECLARE_TREEEVT(ITEM_GETTOOLTIP, id, fn) |
156194e1 | 398 | |
1e6feb95 | 399 | #endif // wxUSE_TREECTRL |
33737618 | 400 | |
618a5e38 | 401 | #endif // _WX_TREEBASE_H_ |