]> git.saurik.com Git - wxWidgets.git/blob - samples/listctrl/listtest.h
Fix missing or broken interface items for Phoenix
[wxWidgets.git] / samples / listctrl / listtest.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: listctrl.h
3 // Purpose: wxListCtrl sample
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // not all ports have support for EVT_CONTEXT_MENU yet, don't define
13 // USE_CONTEXT_MENU for those which don't
14 #if defined(__WXMOTIF__) || defined(__WXPM__) || defined(__WXX11__)
15 #define USE_CONTEXT_MENU 0
16 #else
17 #define USE_CONTEXT_MENU 1
18 #endif
19
20 // Define a new application type
21 class MyApp: public wxApp
22 {
23 public:
24 MyApp() { }
25
26 virtual bool OnInit();
27
28 private:
29 wxDECLARE_NO_COPY_CLASS(MyApp);
30 };
31
32 class MyListCtrl: public wxListCtrl
33 {
34 public:
35 MyListCtrl(wxWindow *parent,
36 const wxWindowID id,
37 const wxPoint& pos,
38 const wxSize& size,
39 long style)
40 : wxListCtrl(parent, id, pos, size, style)
41 {
42 m_updated = -1;
43
44 #ifdef __POCKETPC__
45 EnableContextMenu();
46 #endif
47 }
48
49 // add one item to the listctrl in report mode
50 void InsertItemInReportView(int i);
51
52 void OnColClick(wxListEvent& event);
53 void OnColRightClick(wxListEvent& event);
54 void OnColBeginDrag(wxListEvent& event);
55 void OnColDragging(wxListEvent& event);
56 void OnColEndDrag(wxListEvent& event);
57 void OnBeginDrag(wxListEvent& event);
58 void OnBeginRDrag(wxListEvent& event);
59 void OnBeginLabelEdit(wxListEvent& event);
60 void OnEndLabelEdit(wxListEvent& event);
61 void OnDeleteItem(wxListEvent& event);
62 void OnDeleteAllItems(wxListEvent& event);
63 void OnSelected(wxListEvent& event);
64 void OnDeselected(wxListEvent& event);
65 void OnListKeyDown(wxListEvent& event);
66 void OnActivated(wxListEvent& event);
67 void OnFocused(wxListEvent& event);
68 void OnCacheHint(wxListEvent& event);
69
70 void OnChar(wxKeyEvent& event);
71
72 #if USE_CONTEXT_MENU
73 void OnContextMenu(wxContextMenuEvent& event);
74 #endif
75
76 void OnRightClick(wxMouseEvent& event);
77
78 private:
79 void ShowContextMenu(const wxPoint& pos);
80 wxLog *m_logOld;
81 void SetColumnImage(int col, int image);
82
83 void LogEvent(const wxListEvent& event, const wxChar *eventName);
84 void LogColEvent(const wxListEvent& event, const wxChar *eventName);
85
86 virtual wxString OnGetItemText(long item, long column) const;
87 virtual int OnGetItemColumnImage(long item, long column) const;
88 virtual wxListItemAttr *OnGetItemAttr(long item) const;
89
90 long m_updated;
91
92
93 wxDECLARE_NO_COPY_CLASS(MyListCtrl);
94 DECLARE_EVENT_TABLE()
95 };
96
97 // Define a new frame type
98 class MyFrame: public wxFrame
99 {
100 public:
101 MyFrame(const wxChar *title);
102 virtual ~MyFrame();
103
104 void DoSize();
105
106 protected:
107 void OnSize(wxSizeEvent& event);
108
109 void OnQuit(wxCommandEvent& event);
110 void OnAbout(wxCommandEvent& event);
111 void OnListView(wxCommandEvent& event);
112 void OnReportView(wxCommandEvent& event);
113 void OnIconView(wxCommandEvent& event);
114 void OnIconTextView(wxCommandEvent& event);
115 void OnSmallIconView(wxCommandEvent& event);
116 void OnSmallIconTextView(wxCommandEvent& event);
117 void OnVirtualView(wxCommandEvent& event);
118 void OnSmallVirtualView(wxCommandEvent& event);
119
120 void OnSetItemsCount(wxCommandEvent& event);
121
122
123 void OnGoTo(wxCommandEvent& event);
124 void OnFocusLast(wxCommandEvent& event);
125 void OnToggleFirstSel(wxCommandEvent& event);
126 void OnDeselectAll(wxCommandEvent& event);
127 void OnSelectAll(wxCommandEvent& event);
128 void OnAdd(wxCommandEvent& event);
129 void OnEdit(wxCommandEvent& event);
130 void OnDelete(wxCommandEvent& event);
131 void OnDeleteAll(wxCommandEvent& event);
132 void OnSort(wxCommandEvent& event);
133 void OnSetFgColour(wxCommandEvent& event);
134 void OnSetBgColour(wxCommandEvent& event);
135 void OnSetRowLines(wxCommandEvent& event);
136 void OnToggleMultiSel(wxCommandEvent& event);
137 void OnShowColInfo(wxCommandEvent& event);
138 void OnShowSelInfo(wxCommandEvent& event);
139 void OnShowViewRect(wxCommandEvent& event);
140 #ifdef wxHAS_LISTCTRL_COLUMN_ORDER
141 void OnSetColOrder(wxCommandEvent& event);
142 void OnGetColOrder(wxCommandEvent& event);
143 #endif // wxHAS_LISTCTRL_COLUMN_ORDER
144 void OnFreeze(wxCommandEvent& event);
145 void OnThaw(wxCommandEvent& event);
146 void OnToggleLines(wxCommandEvent& event);
147 void OnToggleHeader(wxCommandEvent& event);
148 void OnToggleBell(wxCommandEvent& event);
149 #ifdef __WXOSX__
150 void OnToggleMacUseGeneric(wxCommandEvent& event);
151 #endif // __WXOSX__
152 void OnFind(wxCommandEvent& event);
153
154 void OnUpdateUIEnableInReport(wxUpdateUIEvent& event);
155 void OnUpdateToggleMultiSel(wxUpdateUIEvent& event);
156 void OnUpdateToggleHeader(wxUpdateUIEvent& event);
157 void OnUpdateRowLines(wxUpdateUIEvent& event);
158
159 wxImageList *m_imageListNormal;
160 wxImageList *m_imageListSmall;
161
162 wxPanel *m_panel;
163 MyListCtrl *m_listCtrl;
164 wxTextCtrl *m_logWindow;
165
166 private:
167 // recreate the list control with the new flags
168 void RecreateList(long flags, bool withText = true);
169
170 // fill the control with items depending on the view
171 void InitWithListItems();
172 void InitWithReportItems();
173 void InitWithIconItems(bool withText, bool sameIcon = false);
174 void InitWithVirtualItems();
175
176 // return true if the control is not in virtual view, give an error message
177 // and return false if it is
178 bool CheckNonVirtual() const;
179
180
181 wxLog *m_logOld;
182
183 bool m_smallVirtual;
184
185 // number of items to initialize list/report view with
186 int m_numListItems;
187
188
189 wxDECLARE_NO_COPY_CLASS(MyFrame);
190 DECLARE_EVENT_TABLE()
191 };
192
193
194 // IDs for the menu commands
195 enum
196 {
197 LIST_ABOUT = wxID_ABOUT,
198 LIST_QUIT = wxID_EXIT,
199
200 LIST_LIST_VIEW = wxID_HIGHEST,
201 LIST_ICON_VIEW,
202 LIST_ICON_TEXT_VIEW,
203 LIST_SMALL_ICON_VIEW,
204 LIST_SMALL_ICON_TEXT_VIEW,
205 LIST_REPORT_VIEW,
206 LIST_VIRTUAL_VIEW,
207 LIST_SMALL_VIRTUAL_VIEW,
208 LIST_SET_ITEMS_COUNT,
209
210 LIST_DESELECT_ALL,
211 LIST_SELECT_ALL,
212 LIST_DELETE_ALL,
213 LIST_DELETE,
214 LIST_ADD,
215 LIST_EDIT,
216 LIST_SORT,
217 LIST_FIND,
218 LIST_SET_FG_COL,
219 LIST_SET_BG_COL,
220 LIST_ROW_LINES,
221 LIST_TOGGLE_MULTI_SEL,
222 LIST_TOGGLE_HEADER,
223 LIST_TOGGLE_BELL,
224 LIST_TOGGLE_FIRST,
225 LIST_SHOW_COL_INFO,
226 LIST_SHOW_SEL_INFO,
227 LIST_SHOW_VIEW_RECT,
228 #ifdef wxHAS_LISTCTRL_COLUMN_ORDER
229 LIST_SET_COL_ORDER,
230 LIST_GET_COL_ORDER,
231 #endif // wxHAS_LISTCTRL_COLUMN_ORDER
232 LIST_GOTO,
233 LIST_FOCUS_LAST,
234 LIST_FREEZE,
235 LIST_THAW,
236 LIST_TOGGLE_LINES,
237 #ifdef __WXOSX__
238 LIST_MAC_USE_GENERIC,
239 #endif
240
241 LIST_CTRL = 1000
242 };