]>
Commit | Line | Data |
---|---|---|
457814b5 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: listctrl.cpp | |
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 and Markus Holzem | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma implementation | |
14 | #pragma interface | |
15 | #endif | |
16 | ||
17 | // For compilers that support precompilation, includes "wx/wx.h". | |
18 | #include "wx/wxprec.h" | |
19 | ||
20 | #ifdef __BORLANDC__ | |
21 | #pragma hdrstop | |
22 | #endif | |
23 | ||
24 | #ifndef WX_PRECOMP | |
25 | #include "wx/wx.h" | |
26 | #endif | |
27 | ||
28 | #include "wx/listctrl.h" | |
29 | #include "listtest.h" | |
30 | ||
31 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |
32 | EVT_MENU(LIST_QUIT, MyFrame::OnQuit) | |
33 | EVT_MENU(LIST_ABOUT, MyFrame::OnAbout) | |
34 | EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView) | |
35 | EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView) | |
36 | EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView) | |
37 | EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView) | |
38 | EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView) | |
39 | EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView) | |
c4771147 | 40 | EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll) |
18244936 | 41 | EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll) |
457814b5 JS |
42 | END_EVENT_TABLE() |
43 | ||
44 | BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl) | |
45 | EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag) | |
46 | EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag) | |
47 | EVT_LIST_BEGIN_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnBeginLabelEdit) | |
48 | EVT_LIST_END_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnEndLabelEdit) | |
49 | EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem) | |
50 | EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo) | |
51 | EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo) | |
52 | EVT_LIST_ITEM_SELECTED(LIST_CTRL, MyListCtrl::OnSelected) | |
53 | EVT_LIST_ITEM_DESELECTED(LIST_CTRL, MyListCtrl::OnDeselected) | |
54 | EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnKeyDown) | |
55 | END_EVENT_TABLE() | |
56 | ||
57 | IMPLEMENT_APP(MyApp) | |
58 | ||
59 | // `Main program' equivalent, creating windows and returning main app frame | |
60 | bool MyApp::OnInit(void) | |
61 | { | |
62 | // Create the main frame window | |
c67daf87 | 63 | MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxListCtrl Test", 50, 50, 450, 340); |
457814b5 JS |
64 | |
65 | // This reduces flicker effects - even better would be to define OnEraseBackground | |
66 | // to do nothing. When the list control's scrollbars are show or hidden, the | |
67 | // frame is sent a background erase event. | |
68 | frame->SetBackgroundColour(wxColour(255, 255, 255)); | |
69 | ||
70 | // Give it an icon | |
2049ba38 | 71 | #ifdef __WXMSW__ |
457814b5 | 72 | frame->SetIcon(wxIcon("mondrian")); |
b0d77f43 RR |
73 | #else |
74 | #include "mondrian.xpm" | |
75 | frame->SetIcon(wxIcon(mondrian_xpm)); | |
457814b5 JS |
76 | #endif |
77 | ||
78 | // Make an image list containing large icons | |
79 | m_imageListNormal = new wxImageList(32, 32, TRUE); | |
80 | m_imageListSmall = new wxImageList(16, 16, TRUE); | |
81 | ||
b0d77f43 RR |
82 | #ifdef __WXMSW__ |
83 | m_imageListNormal->Add( wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
84 | m_imageListNormal->Add( wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
85 | m_imageListNormal->Add( wxIcon("icon3", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
86 | m_imageListNormal->Add( wxIcon("icon4", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
87 | m_imageListNormal->Add( wxIcon("icon5", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
88 | m_imageListNormal->Add( wxIcon("icon6", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
89 | m_imageListNormal->Add( wxIcon("icon7", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
90 | m_imageListNormal->Add( wxIcon("icon8", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
91 | m_imageListNormal->Add( wxIcon("icon9", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
92 | ||
93 | m_imageListSmall->Add( wxIcon("iconsmall", wxBITMAP_TYPE_ICO_RESOURCE) ); | |
94 | ||
95 | #else | |
96 | ||
97 | #include "bitmaps/toolbrai.xpm" | |
98 | m_imageListNormal->Add( wxIcon( toolbrai_xpm ) ); | |
99 | #include "bitmaps/toolchar.xpm" | |
100 | m_imageListNormal->Add( wxIcon( toolchar_xpm ) ); | |
101 | #include "bitmaps/tooldata.xpm" | |
102 | m_imageListNormal->Add( wxIcon( tooldata_xpm ) ); | |
103 | #include "bitmaps/toolnote.xpm" | |
104 | m_imageListNormal->Add( wxIcon( toolnote_xpm ) ); | |
105 | #include "bitmaps/tooltodo.xpm" | |
106 | m_imageListNormal->Add( wxIcon( tooltodo_xpm ) ); | |
107 | #include "bitmaps/toolchec.xpm" | |
108 | m_imageListNormal->Add( wxIcon( toolchec_xpm ) ); | |
109 | #include "bitmaps/toolgame.xpm" | |
110 | m_imageListNormal->Add( wxIcon( toolgame_xpm ) ); | |
111 | #include "bitmaps/tooltime.xpm" | |
112 | m_imageListNormal->Add( wxIcon( tooltime_xpm ) ); | |
113 | #include "bitmaps/toolword.xpm" | |
114 | m_imageListNormal->Add( wxIcon( toolword_xpm ) ); | |
115 | ||
116 | #include "bitmaps/small1.xpm" | |
117 | m_imageListSmall->Add( wxIcon( small1_xpm) ); | |
118 | ||
119 | #endif | |
457814b5 JS |
120 | |
121 | // Make a menubar | |
122 | wxMenu *file_menu = new wxMenu; | |
123 | ||
124 | file_menu->Append(LIST_LIST_VIEW, "&List view"); | |
125 | file_menu->Append(LIST_REPORT_VIEW, "&Report view"); | |
126 | file_menu->Append(LIST_ICON_VIEW, "&Icon view"); | |
127 | file_menu->Append(LIST_ICON_TEXT_VIEW, "Icon view with &text"); | |
128 | file_menu->Append(LIST_SMALL_ICON_VIEW, "&Small icon view"); | |
129 | file_menu->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text"); | |
c4771147 KB |
130 | file_menu->Append(LIST_DESELECT_ALL, "&Deselect All"); |
131 | file_menu->Append(LIST_SELECT_ALL, "S&elect All"); | |
457814b5 JS |
132 | file_menu->AppendSeparator(); |
133 | file_menu->Append(LIST_ABOUT, "&About"); | |
134 | file_menu->Append(LIST_QUIT, "E&xit"); | |
135 | wxMenuBar *menu_bar = new wxMenuBar; | |
136 | menu_bar->Append(file_menu, "&File"); | |
137 | frame->SetMenuBar(menu_bar); | |
138 | ||
139 | // Make a panel with a message | |
140 | frame->m_listCtrl = new MyListCtrl(frame, LIST_CTRL, wxPoint(0, 0), wxSize(400, 200), | |
141 | wxLC_LIST|wxSUNKEN_BORDER); | |
142 | // wxLC_LIST|wxLC_USER_TEXT|wxSUNKEN_BORDER); // wxLC_USER_TEXT requires app to supply all text on demand | |
143 | frame->m_logWindow = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxSize(400, 200), wxTE_MULTILINE|wxSUNKEN_BORDER); | |
144 | ||
145 | wxLayoutConstraints *c = new wxLayoutConstraints; | |
146 | c->top.SameAs (frame, wxTop); | |
147 | c->left.SameAs (frame, wxLeft); | |
148 | c->right.SameAs (frame, wxRight); | |
149 | c->height.PercentOf (frame, wxHeight, 66); | |
150 | frame->m_listCtrl->SetConstraints(c); | |
151 | ||
152 | c = new wxLayoutConstraints; | |
153 | c->top.Below (frame->m_listCtrl); | |
154 | c->left.SameAs (frame, wxLeft); | |
155 | c->right.SameAs (frame, wxRight); | |
156 | c->bottom.SameAs (frame, wxBottom); | |
157 | frame->m_logWindow->SetConstraints(c); | |
158 | frame->SetAutoLayout(TRUE); | |
159 | ||
160 | for ( int i=0; i < 30; i++) | |
161 | { | |
162 | char buf[20]; | |
163 | sprintf(buf, "Item %d", i); | |
cb43b372 | 164 | frame->m_listCtrl->InsertItem(i, buf); |
457814b5 JS |
165 | } |
166 | ||
167 | frame->CreateStatusBar(3); | |
168 | frame->SetStatusText("", 0); | |
169 | ||
170 | // Show the frame | |
171 | frame->Show(TRUE); | |
172 | ||
173 | SetTopWindow(frame); | |
174 | ||
175 | return TRUE; | |
176 | } | |
177 | ||
178 | // My frame constructor | |
179 | MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h): | |
180 | wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) | |
181 | { | |
c67daf87 UR |
182 | m_listCtrl = (MyListCtrl *) NULL; |
183 | m_logWindow = (wxTextCtrl *) NULL; | |
457814b5 JS |
184 | } |
185 | ||
186 | MyFrame::~MyFrame(void) | |
187 | { | |
188 | delete wxGetApp().m_imageListNormal; | |
189 | delete wxGetApp().m_imageListSmall; | |
190 | } | |
191 | ||
b0d77f43 | 192 | void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
193 | { |
194 | Close(TRUE); | |
195 | } | |
196 | ||
b0d77f43 | 197 | void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
198 | { |
199 | wxMessageDialog dialog(this, "List test sample\nJulian Smart (c) 1997", | |
200 | "About list test", wxOK|wxCANCEL); | |
201 | ||
202 | dialog.ShowModal(); | |
203 | } | |
204 | ||
c4771147 KB |
205 | void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event)) |
206 | { | |
207 | int n = m_listCtrl->GetItemCount(); | |
208 | int i; | |
209 | for(i = 0; i < n; i++) | |
210 | m_listCtrl->SetItemState(i,0,wxLIST_STATE_SELECTED); | |
211 | } | |
212 | ||
213 | void MyFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event)) | |
214 | { | |
215 | int n = m_listCtrl->GetItemCount(); | |
216 | int i; | |
217 | for(i = 0; i < n; i++) | |
218 | m_listCtrl->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); | |
219 | } | |
220 | ||
b0d77f43 | 221 | void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
222 | { |
223 | m_logWindow->Clear(); | |
224 | m_listCtrl->DeleteAllItems(); | |
225 | m_listCtrl->SetSingleStyle(wxLC_LIST); | |
c67daf87 UR |
226 | m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_NORMAL); |
227 | m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_SMALL); | |
457814b5 JS |
228 | |
229 | for ( int i=0; i < 30; i++) | |
230 | { | |
231 | char buf[20]; | |
232 | sprintf(buf, "Item %d", i); | |
cb43b372 | 233 | m_listCtrl->InsertItem(i, buf); |
457814b5 JS |
234 | } |
235 | } | |
236 | ||
b0d77f43 | 237 | void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
238 | { |
239 | m_logWindow->Clear(); | |
240 | m_listCtrl->DeleteAllItems(); | |
241 | m_listCtrl->SetSingleStyle(wxLC_REPORT); | |
c67daf87 | 242 | m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_NORMAL); |
457814b5 JS |
243 | m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); |
244 | ||
245 | m_listCtrl->InsertColumn(0, "Column 1", wxLIST_FORMAT_LEFT, 140); | |
246 | m_listCtrl->InsertColumn(1, "Column 2", wxLIST_FORMAT_LEFT, 140); | |
247 | ||
248 | for ( int i=0; i < 30; i++) | |
249 | { | |
250 | char buf[20]; | |
251 | sprintf(buf, "Item %d, col 1", i); | |
252 | long tmp = m_listCtrl->InsertItem(i, buf, 0); | |
253 | ||
254 | sprintf(buf, "Item %d, col 2", i); | |
255 | tmp = m_listCtrl->SetItem(i, 1, buf); | |
256 | } | |
257 | } | |
258 | ||
b0d77f43 | 259 | void MyFrame::OnIconView(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
260 | { |
261 | m_logWindow->Clear(); | |
262 | m_listCtrl->DeleteAllItems(); | |
263 | m_listCtrl->SetSingleStyle(wxLC_ICON); | |
264 | m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); | |
265 | m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); | |
266 | ||
267 | for ( int i=0; i < 9; i++) | |
268 | { | |
cb43b372 | 269 | m_listCtrl->InsertItem(i, i); |
457814b5 JS |
270 | } |
271 | } | |
272 | ||
b0d77f43 | 273 | void MyFrame::OnIconTextView(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
274 | { |
275 | m_logWindow->Clear(); | |
276 | m_listCtrl->DeleteAllItems(); | |
277 | m_listCtrl->SetSingleStyle(wxLC_ICON); | |
278 | m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); | |
279 | m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); | |
280 | ||
281 | for ( int i=0; i < 9; i++) | |
282 | { | |
283 | char buf[20]; | |
284 | sprintf(buf, "Label %d", i); | |
cb43b372 | 285 | m_listCtrl->InsertItem(i, buf, i); |
457814b5 JS |
286 | } |
287 | } | |
288 | ||
b0d77f43 | 289 | void MyFrame::OnSmallIconView(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
290 | { |
291 | m_logWindow->Clear(); | |
292 | m_listCtrl->DeleteAllItems(); | |
293 | m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON); | |
294 | m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); | |
295 | m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); | |
296 | ||
297 | for ( int i=0; i < 9; i++) | |
298 | { | |
cb43b372 | 299 | m_listCtrl->InsertItem(i, 0); |
457814b5 JS |
300 | } |
301 | } | |
302 | ||
b0d77f43 | 303 | void MyFrame::OnSmallIconTextView(wxCommandEvent& WXUNUSED(event)) |
457814b5 JS |
304 | { |
305 | m_logWindow->Clear(); | |
306 | m_listCtrl->DeleteAllItems(); | |
307 | m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON); | |
308 | m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); | |
309 | m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); | |
310 | ||
311 | for ( int i=0; i < 9; i++) | |
312 | { | |
cb43b372 | 313 | m_listCtrl->InsertItem(i, "Label", 0); |
457814b5 JS |
314 | } |
315 | } | |
316 | ||
317 | // MyListCtrl | |
318 | ||
cb43b372 | 319 | void MyListCtrl::OnBeginDrag(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
320 | { |
321 | if ( !wxGetApp().GetTopWindow() ) | |
322 | return; | |
323 | ||
324 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
325 | if ( !text ) | |
326 | return; | |
327 | ||
328 | #ifndef __GNUWIN32__ | |
329 | ostream str(text); | |
330 | ||
331 | str << "OnBeginDrag\n"; | |
332 | str.flush(); | |
333 | #endif | |
334 | } | |
335 | ||
cb43b372 | 336 | void MyListCtrl::OnBeginRDrag(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
337 | { |
338 | if ( !wxGetApp().GetTopWindow() ) | |
339 | return; | |
340 | ||
341 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
342 | if ( !text ) | |
343 | return; | |
344 | #ifndef __GNUWIN32__ | |
345 | ostream str(text); | |
346 | ||
347 | str << "OnBeginRDrag\n"; | |
348 | str.flush(); | |
349 | #endif | |
350 | } | |
351 | ||
cb43b372 | 352 | void MyListCtrl::OnBeginLabelEdit(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
353 | { |
354 | if ( !wxGetApp().GetTopWindow() ) | |
355 | return; | |
356 | ||
357 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
358 | if ( !text ) | |
359 | return; | |
360 | ||
361 | #ifndef __GNUWIN32__ | |
362 | ostream str(text); | |
363 | ||
364 | str << "OnBeginLabelEdit\n"; | |
365 | str.flush(); | |
366 | #endif | |
367 | } | |
368 | ||
cb43b372 | 369 | void MyListCtrl::OnEndLabelEdit(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
370 | { |
371 | if ( !wxGetApp().GetTopWindow() ) | |
372 | return; | |
373 | ||
374 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
375 | if ( !text ) | |
376 | return; | |
377 | ||
378 | #ifndef __GNUWIN32__ | |
379 | ostream str(text); | |
380 | ||
381 | str << "OnEndLabelEdit\n"; | |
382 | str.flush(); | |
383 | #endif | |
384 | } | |
385 | ||
cb43b372 | 386 | void MyListCtrl::OnDeleteItem(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
387 | { |
388 | if ( !wxGetApp().GetTopWindow() ) | |
389 | return; | |
390 | ||
391 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
392 | if ( !text ) | |
393 | return; | |
394 | ||
395 | #ifndef __GNUWIN32__ | |
396 | ostream str(text); | |
397 | ||
398 | str << "OnDeleteItem\n"; | |
399 | str.flush(); | |
400 | #endif | |
401 | } | |
402 | ||
403 | void MyListCtrl::OnGetInfo(wxListEvent& event) | |
404 | { | |
405 | if ( !wxGetApp().GetTopWindow() ) | |
406 | return; | |
407 | ||
408 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
409 | if ( !text ) | |
410 | return; | |
411 | ||
412 | #ifndef __GNUWIN32__ | |
413 | ostream str(text); | |
414 | ||
415 | str << "OnGetInfo (" << event.m_item.m_itemId << ", " << event.m_item.m_col << ")"; | |
416 | if ( event.m_item.m_mask & wxLIST_MASK_STATE ) | |
417 | str << " wxLIST_MASK_STATE"; | |
418 | if ( event.m_item.m_mask & wxLIST_MASK_TEXT ) | |
419 | str << " wxLIST_MASK_TEXT"; | |
420 | if ( event.m_item.m_mask & wxLIST_MASK_IMAGE ) | |
421 | str << " wxLIST_MASK_IMAGE"; | |
422 | if ( event.m_item.m_mask & wxLIST_MASK_DATA ) | |
423 | str << " wxLIST_MASK_DATA"; | |
424 | if ( event.m_item.m_mask & wxLIST_SET_ITEM ) | |
425 | str << " wxLIST_SET_ITEM"; | |
426 | if ( event.m_item.m_mask & wxLIST_MASK_WIDTH ) | |
427 | str << " wxLIST_MASK_WIDTH"; | |
428 | if ( event.m_item.m_mask & wxLIST_MASK_FORMAT ) | |
429 | str << " wxLIST_MASK_WIDTH"; | |
430 | ||
431 | if ( event.m_item.m_mask & wxLIST_MASK_TEXT ) | |
432 | { | |
433 | event.m_item.m_text = "My callback text"; | |
434 | } | |
435 | str << "\n"; | |
436 | str.flush(); | |
437 | #endif | |
438 | } | |
439 | ||
cb43b372 | 440 | void MyListCtrl::OnSetInfo(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
441 | { |
442 | if ( !wxGetApp().GetTopWindow() ) | |
443 | return; | |
444 | ||
445 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
446 | if ( !text ) | |
447 | return; | |
448 | ||
449 | #ifndef __GNUWIN32__ | |
450 | ostream str(text); | |
451 | ||
452 | str << "OnSetInfo\n"; | |
453 | str.flush(); | |
454 | #endif | |
455 | } | |
456 | ||
cb43b372 | 457 | void MyListCtrl::OnSelected(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
458 | { |
459 | if ( !wxGetApp().GetTopWindow() ) | |
460 | return; | |
461 | ||
462 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
463 | if ( !text ) | |
464 | return; | |
465 | ||
466 | #ifndef __GNUWIN32__ | |
467 | ostream str(text); | |
468 | ||
469 | str << "OnSelected\n"; | |
470 | str.flush(); | |
471 | #endif | |
472 | } | |
473 | ||
cb43b372 | 474 | void MyListCtrl::OnDeselected(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
475 | { |
476 | if ( !wxGetApp().GetTopWindow() ) | |
477 | return; | |
478 | ||
479 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
480 | if ( !text ) | |
481 | return; | |
482 | ||
483 | #ifndef __GNUWIN32__ | |
484 | ostream str(text); | |
485 | ||
486 | str << "OnDeselected\n"; | |
487 | str.flush(); | |
488 | #endif | |
489 | } | |
490 | ||
cb43b372 | 491 | void MyListCtrl::OnKeyDown(wxListEvent& WXUNUSED(event)) |
457814b5 JS |
492 | { |
493 | if ( !wxGetApp().GetTopWindow() ) | |
494 | return; | |
495 | ||
496 | wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; | |
497 | if ( !text ) | |
498 | return; | |
499 | ||
500 | #ifndef __GNUWIN32__ | |
501 | ostream str(text); | |
502 | ||
503 | str << "OnKeyDown\n"; | |
504 | str.flush(); | |
505 | #endif | |
506 | } | |
507 |