Added list control item click event wrappers
[wxWidgets.git] / include / wx / listctrl.h
1 #ifndef _WX_LISTCTRL_H_BASE_
2 #define _WX_LISTCTRL_H_BASE_
3
4 #if defined(__WXMSW__)
5 #ifdef __WIN16__
6 #include "wx/generic/listctrl.h"
7 #else
8 #include "wx/msw/listctrl.h"
9 #endif
10 #elif defined(__WXMOTIF__)
11 #include "wx/generic/listctrl.h"
12 #elif defined(__WXGTK__)
13 #include "wx/generic/listctrl.h"
14 #elif defined(__WXQT__)
15 #include "wx/generic/listctrl.h"
16 #elif defined(__WXMAC__)
17 #include "wx/generic/listctrl.h"
18 #elif defined(__WXPM__)
19 #include "wx/os2/listctrl.h"
20 #elif defined(__WXSTUBS__)
21 #include "wx/generic/listctrl.h"
22 #endif
23
24 // ----------------------------------------------------------------------------
25 // wxListEvent - the event class for the wxListCtrl notifications
26 // ----------------------------------------------------------------------------
27
28 class WXDLLEXPORT wxListEvent : public wxNotifyEvent
29 {
30 public:
31 wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
32
33 int m_code;
34 long m_itemIndex;
35 long m_oldItemIndex;
36 int m_col;
37 bool m_cancelled;
38 wxPoint m_pointDrag;
39
40 wxListItem m_item;
41
42 inline int GetCode() { return m_code; }
43 inline long GetIndex() { return m_itemIndex; }
44 inline long GetOldIndex() { return m_oldItemIndex; }
45 inline long GetItem() { return m_itemIndex; }
46 inline long GetOldItem() { return m_oldItemIndex; }
47 inline int GetColumn() { return m_col; }
48 inline bool Cancelled() { return m_cancelled; }
49 inline wxPoint GetPoint() { return m_pointDrag; }
50 inline const wxString &GetLabel() const { return m_item.m_text; }
51 inline const wxString &GetText() const { return m_item.m_text; }
52 inline int GetImage() { return m_item.m_image; }
53 inline long GetData() { return m_item.m_data; }
54 inline long GetMask() { return m_item.m_mask; }
55 inline const wxListItem &GetItem() const { return m_item; }
56
57 private:
58 DECLARE_DYNAMIC_CLASS(wxListEvent)
59 };
60
61 typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
62
63 #define EVT_LIST_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
64 #define EVT_LIST_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
65 #define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
66 #define EVT_LIST_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
67 #define EVT_LIST_DELETE_ITEM(id, fn) { wxEVT_COMMAND_LIST_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
68 #define EVT_LIST_DELETE_ALL_ITEMS(id, fn) { wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
69 #define EVT_LIST_GET_INFO(id, fn) { wxEVT_COMMAND_LIST_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
70 #define EVT_LIST_SET_INFO(id, fn) { wxEVT_COMMAND_LIST_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
71 #define EVT_LIST_ITEM_SELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
72 #define EVT_LIST_ITEM_DESELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_DESELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
73 #define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
74 #define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
75 #define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
76 #define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
77 #define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
78 #define EVT_LIST_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_LIST_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
79
80 #endif
81 // _WX_LISTCTRL_H_BASE_