]> git.saurik.com Git - wxWidgets.git/blob - include/wx/listbase.h
Add wxTranslations::GetBestTranslation().
[wxWidgets.git] / include / wx / listbase.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/listbase.h
3 // Purpose: wxListCtrl class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 04.12.99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_LISTBASE_H_BASE_
13 #define _WX_LISTBASE_H_BASE_
14
15 #include "wx/colour.h"
16 #include "wx/font.h"
17 #include "wx/gdicmn.h"
18 #include "wx/event.h"
19 #include "wx/control.h"
20
21 class WXDLLIMPEXP_FWD_CORE wxImageList;
22
23 // ----------------------------------------------------------------------------
24 // types
25 // ----------------------------------------------------------------------------
26
27 // type of compare function for wxListCtrl sort operation
28 typedef
29 int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData);
30
31 // ----------------------------------------------------------------------------
32 // wxListCtrl constants
33 // ----------------------------------------------------------------------------
34
35 // style flags
36 #define wxLC_VRULES 0x0001
37 #define wxLC_HRULES 0x0002
38
39 #define wxLC_ICON 0x0004
40 #define wxLC_SMALL_ICON 0x0008
41 #define wxLC_LIST 0x0010
42 #define wxLC_REPORT 0x0020
43
44 #define wxLC_ALIGN_TOP 0x0040
45 #define wxLC_ALIGN_LEFT 0x0080
46 #define wxLC_AUTOARRANGE 0x0100
47 #define wxLC_VIRTUAL 0x0200
48 #define wxLC_EDIT_LABELS 0x0400
49 #define wxLC_NO_HEADER 0x0800
50 #define wxLC_NO_SORT_HEADER 0x1000
51 #define wxLC_SINGLE_SEL 0x2000
52 #define wxLC_SORT_ASCENDING 0x4000
53 #define wxLC_SORT_DESCENDING 0x8000
54
55 #define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
56 #define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
57 #define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
58
59 // for compatibility only
60 #define wxLC_USER_TEXT wxLC_VIRTUAL
61
62 // Omitted because
63 // (a) too much detail
64 // (b) not enough style flags
65 // (c) not implemented anyhow in the generic version
66 //
67 // #define wxLC_NO_SCROLL
68 // #define wxLC_NO_LABEL_WRAP
69 // #define wxLC_OWNERDRAW_FIXED
70 // #define wxLC_SHOW_SEL_ALWAYS
71
72 // Mask flags to tell app/GUI what fields of wxListItem are valid
73 #define wxLIST_MASK_STATE 0x0001
74 #define wxLIST_MASK_TEXT 0x0002
75 #define wxLIST_MASK_IMAGE 0x0004
76 #define wxLIST_MASK_DATA 0x0008
77 #define wxLIST_SET_ITEM 0x0010
78 #define wxLIST_MASK_WIDTH 0x0020
79 #define wxLIST_MASK_FORMAT 0x0040
80
81 // State flags for indicating the state of an item
82 #define wxLIST_STATE_DONTCARE 0x0000
83 #define wxLIST_STATE_DROPHILITED 0x0001 // MSW only
84 #define wxLIST_STATE_FOCUSED 0x0002
85 #define wxLIST_STATE_SELECTED 0x0004
86 #define wxLIST_STATE_CUT 0x0008 // MSW only
87 #define wxLIST_STATE_DISABLED 0x0010 // OS2 only
88 #define wxLIST_STATE_FILTERED 0x0020 // OS2 only
89 #define wxLIST_STATE_INUSE 0x0040 // OS2 only
90 #define wxLIST_STATE_PICKED 0x0080 // OS2 only
91 #define wxLIST_STATE_SOURCE 0x0100 // OS2 only
92
93 // Hit test flags, used in HitTest
94 #define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
95 #define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
96 #define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
97 #define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
98 #define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
99 #define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
100 #define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
101 #define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area.
102 #define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area.
103
104 #define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
105
106 // GetSubItemRect constants
107 #define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l
108
109 // Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL)
110 enum
111 {
112 wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
113 wxLIST_NEXT_ALL, // Searches for subsequent item by index
114 wxLIST_NEXT_BELOW, // Searches for an item below the specified item
115 wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
116 wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
117 };
118
119 // Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT)
120 enum
121 {
122 wxLIST_ALIGN_DEFAULT,
123 wxLIST_ALIGN_LEFT,
124 wxLIST_ALIGN_TOP,
125 wxLIST_ALIGN_SNAP_TO_GRID
126 };
127
128 // Column format (MSW only except wxLIST_FORMAT_LEFT)
129 enum wxListColumnFormat
130 {
131 wxLIST_FORMAT_LEFT,
132 wxLIST_FORMAT_RIGHT,
133 wxLIST_FORMAT_CENTRE,
134 wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
135 };
136
137 // Autosize values for SetColumnWidth
138 enum
139 {
140 wxLIST_AUTOSIZE = -1,
141 wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version
142 };
143
144 // Flag values for GetItemRect
145 enum
146 {
147 wxLIST_RECT_BOUNDS,
148 wxLIST_RECT_ICON,
149 wxLIST_RECT_LABEL
150 };
151
152 // Flag values for FindItem (MSW only)
153 enum
154 {
155 wxLIST_FIND_UP,
156 wxLIST_FIND_DOWN,
157 wxLIST_FIND_LEFT,
158 wxLIST_FIND_RIGHT
159 };
160
161 // ----------------------------------------------------------------------------
162 // wxListItemAttr: a structure containing the visual attributes of an item
163 // ----------------------------------------------------------------------------
164
165 // TODO: this should be renamed to wxItemAttr or something general like this
166 // and used as base class for wxTextAttr which duplicates this class
167 // entirely currently
168 class WXDLLIMPEXP_CORE wxListItemAttr
169 {
170 public:
171 // ctors
172 wxListItemAttr() { }
173 wxListItemAttr(const wxColour& colText,
174 const wxColour& colBack,
175 const wxFont& font)
176 : m_colText(colText), m_colBack(colBack), m_font(font)
177 {
178 }
179
180 // default copy ctor, assignment operator and dtor are ok
181
182
183 // setters
184 void SetTextColour(const wxColour& colText) { m_colText = colText; }
185 void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
186 void SetFont(const wxFont& font) { m_font = font; }
187
188 // accessors
189 bool HasTextColour() const { return m_colText.IsOk(); }
190 bool HasBackgroundColour() const { return m_colBack.IsOk(); }
191 bool HasFont() const { return m_font.IsOk(); }
192
193 const wxColour& GetTextColour() const { return m_colText; }
194 const wxColour& GetBackgroundColour() const { return m_colBack; }
195 const wxFont& GetFont() const { return m_font; }
196
197
198 // this is almost like assignment operator except it doesn't overwrite the
199 // fields unset in the source attribute
200 void AssignFrom(const wxListItemAttr& source)
201 {
202 if ( source.HasTextColour() )
203 SetTextColour(source.GetTextColour());
204 if ( source.HasBackgroundColour() )
205 SetBackgroundColour(source.GetBackgroundColour());
206 if ( source.HasFont() )
207 SetFont(source.GetFont());
208 }
209
210 private:
211 wxColour m_colText,
212 m_colBack;
213 wxFont m_font;
214 };
215
216 // ----------------------------------------------------------------------------
217 // wxListItem: the item or column info, used to exchange data with wxListCtrl
218 // ----------------------------------------------------------------------------
219
220 class WXDLLIMPEXP_CORE wxListItem : public wxObject
221 {
222 public:
223 wxListItem() { Init(); m_attr = NULL; }
224 wxListItem(const wxListItem& item)
225 : wxObject(),
226 m_mask(item.m_mask),
227 m_itemId(item.m_itemId),
228 m_col(item.m_col),
229 m_state(item.m_state),
230 m_stateMask(item.m_stateMask),
231 m_text(item.m_text),
232 m_image(item.m_image),
233 m_data(item.m_data),
234 m_format(item.m_format),
235 m_width(item.m_width),
236 m_attr(NULL)
237 {
238 // copy list item attributes
239 if ( item.HasAttributes() )
240 m_attr = new wxListItemAttr(*item.GetAttributes());
241 }
242
243 wxListItem& operator=(const wxListItem& item)
244 {
245 if ( &item != this )
246 {
247 m_mask = item.m_mask;
248 m_itemId = item.m_itemId;
249 m_col = item.m_col;
250 m_state = item.m_state;
251 m_stateMask = item.m_stateMask;
252 m_text = item.m_text;
253 m_image = item.m_image;
254 m_data = item.m_data;
255 m_format = item.m_format;
256 m_width = item.m_width;
257 m_attr = item.m_attr ? new wxListItemAttr(*item.m_attr) : NULL;
258 }
259
260 return *this;
261 }
262
263 virtual ~wxListItem() { delete m_attr; }
264
265 // resetting
266 void Clear() { Init(); m_text.clear(); ClearAttributes(); }
267 void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } }
268
269 // setters
270 void SetMask(long mask)
271 { m_mask = mask; }
272 void SetId(long id)
273 { m_itemId = id; }
274 void SetColumn(int col)
275 { m_col = col; }
276 void SetState(long state)
277 { m_mask |= wxLIST_MASK_STATE; m_state = state; m_stateMask |= state; }
278 void SetStateMask(long stateMask)
279 { m_stateMask = stateMask; }
280 void SetText(const wxString& text)
281 { m_mask |= wxLIST_MASK_TEXT; m_text = text; }
282 void SetImage(int image)
283 { m_mask |= wxLIST_MASK_IMAGE; m_image = image; }
284 void SetData(long data)
285 { m_mask |= wxLIST_MASK_DATA; m_data = data; }
286 void SetData(void *data)
287 { m_mask |= wxLIST_MASK_DATA; m_data = wxPtrToUInt(data); }
288
289 void SetWidth(int width)
290 { m_mask |= wxLIST_MASK_WIDTH; m_width = width; }
291 void SetAlign(wxListColumnFormat align)
292 { m_mask |= wxLIST_MASK_FORMAT; m_format = align; }
293
294 void SetTextColour(const wxColour& colText)
295 { Attributes().SetTextColour(colText); }
296 void SetBackgroundColour(const wxColour& colBack)
297 { Attributes().SetBackgroundColour(colBack); }
298 void SetFont(const wxFont& font)
299 { Attributes().SetFont(font); }
300
301 // accessors
302 long GetMask() const { return m_mask; }
303 long GetId() const { return m_itemId; }
304 int GetColumn() const { return m_col; }
305 long GetState() const { return m_state & m_stateMask; }
306 const wxString& GetText() const { return m_text; }
307 int GetImage() const { return m_image; }
308 wxUIntPtr GetData() const { return m_data; }
309
310 int GetWidth() const { return m_width; }
311 wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; }
312
313 wxListItemAttr *GetAttributes() const { return m_attr; }
314 bool HasAttributes() const { return m_attr != NULL; }
315
316 wxColour GetTextColour() const
317 { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; }
318 wxColour GetBackgroundColour() const
319 { return HasAttributes() ? m_attr->GetBackgroundColour()
320 : wxNullColour; }
321 wxFont GetFont() const
322 { return HasAttributes() ? m_attr->GetFont() : wxNullFont; }
323
324 // this conversion is necessary to make old code using GetItem() to
325 // compile
326 operator long() const { return m_itemId; }
327
328 // these members are public for compatibility
329
330 long m_mask; // Indicates what fields are valid
331 long m_itemId; // The zero-based item position
332 int m_col; // Zero-based column, if in report mode
333 long m_state; // The state of the item
334 long m_stateMask;// Which flags of m_state are valid (uses same flags)
335 wxString m_text; // The label/header text
336 int m_image; // The zero-based index into an image list
337 wxUIntPtr m_data; // App-defined data
338
339 // For columns only
340 int m_format; // left, right, centre
341 int m_width; // width of column
342
343 #ifdef __WXPM__
344 int m_miniImage; // handle to the mini image for OS/2
345 #endif
346
347 protected:
348 // creates m_attr if we don't have it yet
349 wxListItemAttr& Attributes()
350 {
351 if ( !m_attr )
352 m_attr = new wxListItemAttr;
353
354 return *m_attr;
355 }
356
357 void Init()
358 {
359 m_mask = 0;
360 m_itemId = -1;
361 m_col = 0;
362 m_state = 0;
363 m_stateMask = 0;
364 m_image = -1;
365 m_data = 0;
366
367 m_format = wxLIST_FORMAT_CENTRE;
368 m_width = 0;
369 }
370
371 wxListItemAttr *m_attr; // optional pointer to the items style
372
373 private:
374 DECLARE_DYNAMIC_CLASS(wxListItem)
375 };
376
377 // ----------------------------------------------------------------------------
378 // wxListCtrlBase: the base class for the main control itself.
379 // ----------------------------------------------------------------------------
380
381 // Unlike other base classes, this class doesn't currently define the API of
382 // the real control class but is just used for implementation convenience. We
383 // should define the public class functions as pure virtual here in the future
384 // however.
385 class WXDLLIMPEXP_CORE wxListCtrlBase : public wxControl
386 {
387 public:
388 wxListCtrlBase() { }
389
390 // Image list methods.
391 // -------------------
392
393 // Associate the given (possibly NULL to indicate that no images will be
394 // used) image list with the control. The ownership of the image list
395 // passes to the control, i.e. it will be deleted when the control itself
396 // is destroyed.
397 //
398 // The value of "which" must be one of wxIMAGE_LIST_{NORMAL,SMALL,STATE}.
399 virtual void AssignImageList(wxImageList* imageList, int which) = 0;
400
401 // Same as AssignImageList() but the control does not delete the image list
402 // so it can be shared among several controls.
403 virtual void SetImageList(wxImageList* imageList, int which) = 0;
404
405 // Return the currently used image list, may be NULL.
406 virtual wxImageList* GetImageList(int which) const = 0;
407
408
409 // Column-related methods.
410 // -----------------------
411
412 // All these methods can only be used in report view mode.
413
414 // Appends a new column.
415 //
416 // Returns the index of the newly inserted column or -1 on error.
417 long AppendColumn(const wxString& heading,
418 int format = wxLIST_FORMAT_LEFT,
419 int width = -1);
420
421 // Add a new column to the control at the position "col".
422 //
423 // Returns the index of the newly inserted column or -1 on error.
424 long InsertColumn(long col, const wxListItem& info);
425 long InsertColumn(long col,
426 const wxString& heading,
427 int format = wxLIST_FORMAT_LEFT,
428 int width = wxLIST_AUTOSIZE);
429
430 // Delete the given or all columns.
431 virtual bool DeleteColumn(int col) = 0;
432 virtual bool DeleteAllColumns() = 0;
433
434 // Return the current number of columns.
435 virtual int GetColumnCount() const = 0;
436
437 // Get or update information about the given column. Set item mask to
438 // indicate the fields to retrieve or change.
439 //
440 // Returns false on error, e.g. if the column index is invalid.
441 virtual bool GetColumn(int col, wxListItem& item) const = 0;
442 virtual bool SetColumn(int col, const wxListItem& item) = 0;
443
444 // Convenient wrappers for the above methods which get or update just the
445 // column width.
446 virtual int GetColumnWidth(int col) const = 0;
447 virtual bool SetColumnWidth(int col, int width) = 0;
448
449
450 // Other miscellaneous accessors.
451 // ------------------------------
452
453 // Convenient functions for testing the list control mode:
454 bool InReportView() const { return HasFlag(wxLC_REPORT); }
455 bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
456
457 protected:
458 // Real implementations methods to which our public forwards.
459 virtual long DoInsertColumn(long col, const wxListItem& info) = 0;
460
461 // Overridden methods of the base class.
462 virtual wxSize DoGetBestClientSize() const;
463 };
464
465 // ----------------------------------------------------------------------------
466 // wxListEvent - the event class for the wxListCtrl notifications
467 // ----------------------------------------------------------------------------
468
469 class WXDLLIMPEXP_CORE wxListEvent : public wxNotifyEvent
470 {
471 public:
472 wxListEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
473 : wxNotifyEvent(commandType, winid)
474 , m_code(-1)
475 , m_oldItemIndex(-1)
476 , m_itemIndex(-1)
477 , m_col(-1)
478 , m_pointDrag()
479 , m_item()
480 , m_editCancelled(false)
481 { }
482
483 wxListEvent(const wxListEvent& event)
484 : wxNotifyEvent(event)
485 , m_code(event.m_code)
486 , m_oldItemIndex(event.m_oldItemIndex)
487 , m_itemIndex(event.m_itemIndex)
488 , m_col(event.m_col)
489 , m_pointDrag(event.m_pointDrag)
490 , m_item(event.m_item)
491 , m_editCancelled(event.m_editCancelled)
492 { }
493
494 int GetKeyCode() const { return m_code; }
495 long GetIndex() const { return m_itemIndex; }
496 int GetColumn() const { return m_col; }
497 wxPoint GetPoint() const { return m_pointDrag; }
498 const wxString& GetLabel() const { return m_item.m_text; }
499 const wxString& GetText() const { return m_item.m_text; }
500 int GetImage() const { return m_item.m_image; }
501 long GetData() const { return static_cast<long>(m_item.m_data); }
502 long GetMask() const { return m_item.m_mask; }
503 const wxListItem& GetItem() const { return m_item; }
504
505 // for wxEVT_COMMAND_LIST_CACHE_HINT only
506 long GetCacheFrom() const { return m_oldItemIndex; }
507 long GetCacheTo() const { return m_itemIndex; }
508
509 // was label editing canceled? (for wxEVT_COMMAND_LIST_END_LABEL_EDIT only)
510 bool IsEditCancelled() const { return m_editCancelled; }
511 void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; }
512
513 virtual wxEvent *Clone() const { return new wxListEvent(*this); }
514
515 //protected: -- not for backwards compatibility
516 int m_code;
517 long m_oldItemIndex; // only for wxEVT_COMMAND_LIST_CACHE_HINT
518 long m_itemIndex;
519 int m_col;
520 wxPoint m_pointDrag;
521
522 wxListItem m_item;
523
524 protected:
525 bool m_editCancelled;
526
527 private:
528 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent)
529 };
530
531 // ----------------------------------------------------------------------------
532 // wxListCtrl event macros
533 // ----------------------------------------------------------------------------
534
535 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_DRAG, wxListEvent );
536 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_RDRAG, wxListEvent );
537 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, wxListEvent );
538 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEvent );
539 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_DELETE_ITEM, wxListEvent );
540 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, wxListEvent );
541
542 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEvent );
543 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEvent );
544 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_KEY_DOWN, wxListEvent );
545 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_INSERT_ITEM, wxListEvent );
546 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_CLICK, wxListEvent );
547 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEvent );
548 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, wxListEvent );
549 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEvent );
550 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_CACHE_HINT, wxListEvent );
551 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, wxListEvent );
552 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEvent );
553 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_DRAGGING, wxListEvent );
554 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_COL_END_DRAG, wxListEvent );
555 wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_LIST_ITEM_FOCUSED, wxListEvent );
556
557 typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
558
559 #define wxListEventHandler(func) \
560 wxEVENT_HANDLER_CAST(wxListEventFunction, func)
561
562 #define wx__DECLARE_LISTEVT(evt, id, fn) \
563 wx__DECLARE_EVT1(wxEVT_COMMAND_LIST_ ## evt, id, wxListEventHandler(fn))
564
565 #define EVT_LIST_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_DRAG, id, fn)
566 #define EVT_LIST_BEGIN_RDRAG(id, fn) wx__DECLARE_LISTEVT(BEGIN_RDRAG, id, fn)
567 #define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(BEGIN_LABEL_EDIT, id, fn)
568 #define EVT_LIST_END_LABEL_EDIT(id, fn) wx__DECLARE_LISTEVT(END_LABEL_EDIT, id, fn)
569 #define EVT_LIST_DELETE_ITEM(id, fn) wx__DECLARE_LISTEVT(DELETE_ITEM, id, fn)
570 #define EVT_LIST_DELETE_ALL_ITEMS(id, fn) wx__DECLARE_LISTEVT(DELETE_ALL_ITEMS, id, fn)
571 #define EVT_LIST_KEY_DOWN(id, fn) wx__DECLARE_LISTEVT(KEY_DOWN, id, fn)
572 #define EVT_LIST_INSERT_ITEM(id, fn) wx__DECLARE_LISTEVT(INSERT_ITEM, id, fn)
573
574 #define EVT_LIST_COL_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_CLICK, id, fn)
575 #define EVT_LIST_COL_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(COL_RIGHT_CLICK, id, fn)
576 #define EVT_LIST_COL_BEGIN_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_BEGIN_DRAG, id, fn)
577 #define EVT_LIST_COL_DRAGGING(id, fn) wx__DECLARE_LISTEVT(COL_DRAGGING, id, fn)
578 #define EVT_LIST_COL_END_DRAG(id, fn) wx__DECLARE_LISTEVT(COL_END_DRAG, id, fn)
579
580 #define EVT_LIST_ITEM_SELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_SELECTED, id, fn)
581 #define EVT_LIST_ITEM_DESELECTED(id, fn) wx__DECLARE_LISTEVT(ITEM_DESELECTED, id, fn)
582 #define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_RIGHT_CLICK, id, fn)
583 #define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn)
584 #define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn)
585 #define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn)
586
587 #define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn)
588
589
590 #endif
591 // _WX_LISTCTRL_H_BASE_