]> git.saurik.com Git - wxWidgets.git/blob - samples/listctrl/listtest.cpp
d7e1acbf4bf980241c1b4b55befc7a2ec0899165
[wxWidgets.git] / samples / listctrl / listtest.cpp
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 #ifndef __WXMSW__
29 #include "mondrian.xpm"
30 #endif
31
32 #include "wx/listctrl.h"
33 #include "listtest.h"
34
35 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
36 EVT_MENU(BUSY_ON, MyFrame::BusyOn)
37 EVT_MENU(BUSY_OFF, MyFrame::BusyOff)
38 EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
39 EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
40 EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
41 EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView)
42 EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView)
43 EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
44 EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
45 EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
46 EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
47 EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
48 EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
49 EVT_MENU(LIST_SORT, MyFrame::OnSort)
50 END_EVENT_TABLE()
51
52 BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
53 EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag)
54 EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag)
55 EVT_LIST_BEGIN_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnBeginLabelEdit)
56 EVT_LIST_END_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnEndLabelEdit)
57 EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
58 EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
59 EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
60 EVT_LIST_ITEM_SELECTED(LIST_CTRL, MyListCtrl::OnSelected)
61 EVT_LIST_ITEM_DESELECTED(LIST_CTRL, MyListCtrl::OnDeselected)
62 EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
63 EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
64 EVT_LIST_COL_CLICK(LIST_CTRL, MyListCtrl::OnColClick)
65 END_EVENT_TABLE()
66
67 IMPLEMENT_APP(MyApp)
68
69 int wxCALLBACK MyCompareFunction(long item1, long item2, long sortData)
70 {
71 // inverse the order
72 return item1 < item2;
73 }
74
75 // `Main program' equivalent, creating windows and returning main app frame
76 bool MyApp::OnInit(void)
77 {
78 // Create the main frame window
79 MyFrame *frame = new MyFrame((wxFrame *) NULL, "wxListCtrl Test", 50, 50, 450, 340);
80
81 // This reduces flicker effects - even better would be to define OnEraseBackground
82 // to do nothing. When the list control's scrollbars are show or hidden, the
83 // frame is sent a background erase event.
84 frame->SetBackgroundColour( *wxWHITE );
85
86 // Give it an icon
87 frame->SetIcon( wxICON(mondrian) );
88
89 // Make an image list containing large icons
90 m_imageListNormal = new wxImageList(32, 32, TRUE);
91 m_imageListSmall = new wxImageList(16, 16, TRUE);
92
93 #ifdef __WXMSW__
94 m_imageListNormal->Add( wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE) );
95 m_imageListNormal->Add( wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE) );
96 m_imageListNormal->Add( wxIcon("icon3", wxBITMAP_TYPE_ICO_RESOURCE) );
97 m_imageListNormal->Add( wxIcon("icon4", wxBITMAP_TYPE_ICO_RESOURCE) );
98 m_imageListNormal->Add( wxIcon("icon5", wxBITMAP_TYPE_ICO_RESOURCE) );
99 m_imageListNormal->Add( wxIcon("icon6", wxBITMAP_TYPE_ICO_RESOURCE) );
100 m_imageListNormal->Add( wxIcon("icon7", wxBITMAP_TYPE_ICO_RESOURCE) );
101 m_imageListNormal->Add( wxIcon("icon8", wxBITMAP_TYPE_ICO_RESOURCE) );
102 m_imageListNormal->Add( wxIcon("icon9", wxBITMAP_TYPE_ICO_RESOURCE) );
103
104 m_imageListSmall->Add( wxIcon("iconsmall", wxBITMAP_TYPE_ICO_RESOURCE) );
105
106 #else
107
108 #include "bitmaps/toolbrai.xpm"
109 m_imageListNormal->Add( wxIcon( toolbrai_xpm ) );
110 #include "bitmaps/toolchar.xpm"
111 m_imageListNormal->Add( wxIcon( toolchar_xpm ) );
112 #include "bitmaps/tooldata.xpm"
113 m_imageListNormal->Add( wxIcon( tooldata_xpm ) );
114 #include "bitmaps/toolnote.xpm"
115 m_imageListNormal->Add( wxIcon( toolnote_xpm ) );
116 #include "bitmaps/tooltodo.xpm"
117 m_imageListNormal->Add( wxIcon( tooltodo_xpm ) );
118 #include "bitmaps/toolchec.xpm"
119 m_imageListNormal->Add( wxIcon( toolchec_xpm ) );
120 #include "bitmaps/toolgame.xpm"
121 m_imageListNormal->Add( wxIcon( toolgame_xpm ) );
122 #include "bitmaps/tooltime.xpm"
123 m_imageListNormal->Add( wxIcon( tooltime_xpm ) );
124 #include "bitmaps/toolword.xpm"
125 m_imageListNormal->Add( wxIcon( toolword_xpm ) );
126
127 #include "bitmaps/small1.xpm"
128 m_imageListSmall->Add( wxIcon( small1_xpm) );
129
130 #endif
131
132 // Make a menubar
133 wxMenu *file_menu = new wxMenu;
134
135 file_menu->Append(LIST_LIST_VIEW, "&List view");
136 file_menu->Append(LIST_REPORT_VIEW, "&Report view");
137 file_menu->Append(LIST_ICON_VIEW, "&Icon view");
138 file_menu->Append(LIST_ICON_TEXT_VIEW, "Icon view with &text");
139 file_menu->Append(LIST_SMALL_ICON_VIEW, "&Small icon view");
140 file_menu->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text");
141 file_menu->Append(LIST_DESELECT_ALL, "&Deselect All");
142 file_menu->Append(LIST_SELECT_ALL, "S&elect All");
143 file_menu->AppendSeparator();
144 file_menu->Append(LIST_SORT, "&Sort\tCtrl-S");
145 file_menu->AppendSeparator();
146 file_menu->Append(LIST_DELETE_ALL, "Delete &all items");
147 file_menu->AppendSeparator();
148 file_menu->Append(BUSY_ON, "&Busy cursor on");
149 file_menu->Append(BUSY_OFF, "&Busy cursor off");
150 file_menu->AppendSeparator();
151 file_menu->Append(LIST_ABOUT, "&About");
152 file_menu->Append(LIST_QUIT, "E&xit");
153 wxMenuBar *menu_bar = new wxMenuBar;
154 menu_bar->Append(file_menu, "&File");
155 frame->SetMenuBar(menu_bar);
156
157 // Make a panel with a message
158 frame->m_listCtrl = new MyListCtrl(frame, LIST_CTRL, wxPoint(0, 0), wxSize(400, 200),
159 wxLC_LIST|wxSUNKEN_BORDER|wxLC_EDIT_LABELS );
160 // wxLC_LIST|wxLC_USER_TEXT|wxSUNKEN_BORDER); // wxLC_USER_TEXT requires app to supply all text on demand
161 frame->m_logWindow = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxSize(400, 200), wxTE_MULTILINE|wxSUNKEN_BORDER);
162
163 wxLayoutConstraints *c = new wxLayoutConstraints;
164 c->top.SameAs (frame, wxTop);
165 c->left.SameAs (frame, wxLeft);
166 c->right.SameAs (frame, wxRight);
167 c->height.PercentOf (frame, wxHeight, 66);
168 frame->m_listCtrl->SetConstraints(c);
169
170 c = new wxLayoutConstraints;
171 c->top.Below (frame->m_listCtrl);
172 c->left.SameAs (frame, wxLeft);
173 c->right.SameAs (frame, wxRight);
174 c->bottom.SameAs (frame, wxBottom);
175 frame->m_logWindow->SetConstraints(c);
176 frame->SetAutoLayout(TRUE);
177
178 for ( int i=0; i < 30; i++)
179 {
180 wxChar buf[20];
181 wxSprintf(buf, _T("Item %d"), i);
182 frame->m_listCtrl->InsertItem(i, buf);
183 }
184
185 frame->CreateStatusBar(3);
186 frame->SetStatusText("", 0);
187
188 // Show the frame
189 frame->Show(TRUE);
190
191 SetTopWindow(frame);
192
193 return TRUE;
194 }
195
196 // My frame constructor
197 MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h):
198 wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
199 {
200 m_listCtrl = (MyListCtrl *) NULL;
201 m_logWindow = (wxTextCtrl *) NULL;
202 }
203
204 MyFrame::~MyFrame(void)
205 {
206 delete wxGetApp().m_imageListNormal;
207 delete wxGetApp().m_imageListSmall;
208 }
209
210 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
211 {
212 Close(TRUE);
213 }
214
215 void MyFrame::BusyOn(wxCommandEvent& WXUNUSED(event))
216 {
217 wxBeginBusyCursor();
218 }
219
220 void MyFrame::BusyOff(wxCommandEvent& WXUNUSED(event))
221 {
222 wxEndBusyCursor();
223 }
224
225 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
226 {
227 wxMessageDialog dialog(this, "List test sample\nJulian Smart (c) 1997",
228 "About list test", wxOK|wxCANCEL);
229
230 dialog.ShowModal();
231 }
232
233 void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event))
234 {
235 int n = m_listCtrl->GetItemCount();
236 for (int i = 0; i < n; i++)
237 m_listCtrl->SetItemState(i,0,wxLIST_STATE_SELECTED);
238 }
239
240 void MyFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event))
241 {
242 int n = m_listCtrl->GetItemCount();
243 for (int i = 0; i < n; i++)
244 m_listCtrl->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
245 }
246
247 void MyFrame::OnListView(wxCommandEvent& WXUNUSED(event))
248 {
249 m_listCtrl->DeleteAllItems();
250 m_logWindow->Clear();
251 m_listCtrl->SetSingleStyle(wxLC_LIST);
252 m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_NORMAL);
253 m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_SMALL);
254
255 for ( int i=0; i < 30; i++)
256 {
257 wxChar buf[20];
258 wxSprintf(buf, _T("Item %d"), i);
259 m_listCtrl->InsertItem(i, buf);
260 }
261 }
262
263 void MyFrame::OnReportView(wxCommandEvent& WXUNUSED(event))
264 {
265 m_listCtrl->DeleteAllItems();
266 m_listCtrl->DeleteAllColumns();
267 m_logWindow->Clear();
268
269 m_listCtrl->SetSingleStyle(wxLC_REPORT);
270 m_listCtrl->SetImageList((wxImageList *) NULL, wxIMAGE_LIST_NORMAL);
271 m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
272
273 m_listCtrl->InsertColumn(0, "Column 1"); // , wxLIST_FORMAT_LEFT, 140);
274 m_listCtrl->InsertColumn(1, "Column 2"); // , wxLIST_FORMAT_LEFT, 140);
275 m_listCtrl->InsertColumn(2, "One More Column (2)"); // , wxLIST_FORMAT_LEFT, 140);
276
277 for ( int i = 0; i < 300; i++ )
278 {
279 wxChar buf[50];
280 wxSprintf(buf, _T("This is item %d"), i);
281 long tmp = m_listCtrl->InsertItem(i, buf, 0);
282 m_listCtrl->SetItemData(tmp, i);
283
284 wxSprintf(buf, _T("Col 1, item %d"), i);
285 tmp = m_listCtrl->SetItem(i, 1, buf);
286
287 wxSprintf(buf, _T("Item %d in column 2"), i);
288 tmp = m_listCtrl->SetItem(i, 2, buf);
289 }
290
291 #ifndef __WXMSW__
292 // we leave all mask fields to 0 and only change the colour
293 wxListItem first;
294 first.m_itemId = 0;
295 first.m_colour = wxBLUE;
296 m_listCtrl->SetItem( first );
297
298 first.m_itemId = 2;
299 first.m_colour = wxLIGHT_GREY;
300 m_listCtrl->SetItem( first );
301 first.m_itemId = 3;
302 first.m_colour = wxLIGHT_GREY;
303 m_listCtrl->SetItem( first );
304 #endif
305
306 m_listCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
307 m_listCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
308 m_listCtrl->SetColumnWidth( 2, wxLIST_AUTOSIZE );
309 }
310
311 void MyFrame::OnIconView(wxCommandEvent& WXUNUSED(event))
312 {
313 m_listCtrl->DeleteAllItems();
314 m_logWindow->Clear();
315 m_listCtrl->SetSingleStyle(wxLC_ICON);
316 m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
317 m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
318
319 for ( int i=0; i < 9; i++)
320 {
321 m_listCtrl->InsertItem(i, i);
322 }
323 }
324
325 void MyFrame::OnIconTextView(wxCommandEvent& WXUNUSED(event))
326 {
327 m_listCtrl->DeleteAllItems();
328 m_logWindow->Clear();
329 m_listCtrl->SetSingleStyle(wxLC_ICON);
330 m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
331 m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
332
333 for ( int i=0; i < 9; i++)
334 {
335 wxChar buf[20];
336 wxSprintf(buf, _T("Label %d"), i);
337 m_listCtrl->InsertItem(i, buf, i);
338 }
339 }
340
341 void MyFrame::OnSmallIconView(wxCommandEvent& WXUNUSED(event))
342 {
343 m_listCtrl->DeleteAllItems();
344 m_logWindow->Clear();
345 m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON);
346 m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
347 m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
348
349 for ( int i=0; i < 9; i++)
350 {
351 m_listCtrl->InsertItem(i, 0);
352 }
353 }
354
355 void MyFrame::OnSmallIconTextView(wxCommandEvent& WXUNUSED(event))
356 {
357 m_listCtrl->DeleteAllItems();
358 m_logWindow->Clear();
359 m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON);
360 m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
361 m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL);
362
363 for ( int i=0; i < 9; i++)
364 {
365 m_listCtrl->InsertItem(i, "Label", 0);
366 }
367 }
368
369 void MyFrame::OnSort(wxCommandEvent& WXUNUSED(event))
370 {
371 m_listCtrl->SortItems(MyCompareFunction, 0);
372 }
373
374 void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event))
375 {
376 (void)wxGetElapsedTime(TRUE);
377
378 int nItems = m_listCtrl->GetItemCount();
379 m_listCtrl->DeleteAllItems();
380
381 wxLogMessage("Deleting %d items took %ld ms",
382 nItems, wxGetElapsedTime());
383 }
384
385 // MyListCtrl
386
387 void MyListCtrl::OnColClick(wxListEvent& event)
388 {
389 if ( !wxGetApp().GetTopWindow() )
390 return;
391
392 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
393 if ( !text )
394 return;
395
396 wxString msg;
397 msg.Printf( "OnColumnClick at %d.\n", event.GetColumn() );
398 text->WriteText(msg);
399 }
400
401 void MyListCtrl::OnBeginDrag(wxListEvent& event)
402 {
403 if ( !wxGetApp().GetTopWindow() )
404 return;
405
406 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
407 if ( !text )
408 return;
409
410 wxString msg;
411 msg.Printf( "OnBeginDrag at %d,%d.\n", event.m_pointDrag.x, event.m_pointDrag.y );
412 text->WriteText(msg);
413 }
414
415 void MyListCtrl::OnBeginRDrag(wxListEvent& event)
416 {
417 if ( !wxGetApp().GetTopWindow() )
418 return;
419
420 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
421 if ( !text )
422 return;
423
424 wxString msg;
425 msg.Printf( "OnBeginRDrag at %d,%d.\n", event.m_pointDrag.x, event.m_pointDrag.y );
426 text->WriteText(msg);
427 }
428
429 void MyListCtrl::OnBeginLabelEdit(wxListEvent& event)
430 {
431 if ( !wxGetApp().GetTopWindow() )
432 return;
433
434 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
435 if ( !text )
436 return;
437
438 text->WriteText("OnBeginLabelEdit: ");
439 text->WriteText(event.m_item.m_text);
440 text->WriteText("\n");
441 }
442
443 void MyListCtrl::OnEndLabelEdit(wxListEvent& event)
444 {
445 if ( !wxGetApp().GetTopWindow() )
446 return;
447
448 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
449 if ( !text )
450 return;
451
452 text->WriteText("OnEndLabelEdit: ");
453 text->WriteText(event.m_item.m_text);
454 text->WriteText("\n");
455 }
456
457 void MyListCtrl::OnDeleteItem(wxListEvent& WXUNUSED(event))
458 {
459 if ( !wxGetApp().GetTopWindow() )
460 return;
461
462 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
463 if ( !text )
464 return;
465
466 text->WriteText("OnDeleteItem\n");
467 }
468
469 void MyListCtrl::OnGetInfo(wxListEvent& event)
470 {
471 if ( !wxGetApp().GetTopWindow() )
472 return;
473
474 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
475 if ( !text )
476 return;
477
478 text->WriteText("OnGetInfo\n");
479
480 (*text) << "OnGetInfo (" << event.m_item.m_itemId << ", " << event.m_item.m_col << ")";
481 if ( event.m_item.m_mask & wxLIST_MASK_STATE )
482 (*text) << " wxLIST_MASK_STATE";
483 if ( event.m_item.m_mask & wxLIST_MASK_TEXT )
484 (*text) << " wxLIST_MASK_TEXT";
485 if ( event.m_item.m_mask & wxLIST_MASK_IMAGE )
486 (*text) << " wxLIST_MASK_IMAGE";
487 if ( event.m_item.m_mask & wxLIST_MASK_DATA )
488 (*text) << " wxLIST_MASK_DATA";
489 if ( event.m_item.m_mask & wxLIST_SET_ITEM )
490 (*text) << " wxLIST_SET_ITEM";
491 if ( event.m_item.m_mask & wxLIST_MASK_WIDTH )
492 (*text) << " wxLIST_MASK_WIDTH";
493 if ( event.m_item.m_mask & wxLIST_MASK_FORMAT )
494 (*text) << " wxLIST_MASK_WIDTH";
495
496 if ( event.m_item.m_mask & wxLIST_MASK_TEXT )
497 {
498 event.m_item.m_text = "My callback text";
499 }
500 (*text) << "\n";
501 }
502
503 void MyListCtrl::OnSetInfo(wxListEvent& WXUNUSED(event))
504 {
505 if ( !wxGetApp().GetTopWindow() )
506 return;
507
508 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
509 if ( !text )
510 return;
511
512 text->WriteText("OnSetInfo\n");
513 }
514
515 void MyListCtrl::OnSelected(wxListEvent& event)
516 {
517 if ( !wxGetApp().GetTopWindow() )
518 return;
519
520 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
521 if ( !text )
522 return;
523
524 if ( GetWindowStyle() & wxLC_REPORT )
525 {
526 wxListItem info;
527 info.m_itemId = event.m_itemIndex;
528 info.m_col = 1;
529 info.m_mask = wxLIST_MASK_TEXT;
530 if ( GetItem(info) )
531 {
532 *text << "Value of the 2nd field of the selected item: "
533 << info.m_text << '\n';
534 }
535 else
536 {
537 wxFAIL_MSG("wxListCtrl::GetItem() failed");
538 }
539 }
540
541 text->WriteText("OnSelected\n");
542 }
543
544 void MyListCtrl::OnDeselected(wxListEvent& WXUNUSED(event))
545 {
546 if ( !wxGetApp().GetTopWindow() )
547 return;
548
549 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
550 if ( !text )
551 return;
552
553 text->WriteText("OnDeselected\n");
554 }
555
556 void MyListCtrl::OnActivated(wxListEvent& WXUNUSED(event))
557 {
558 if ( !wxGetApp().GetTopWindow() )
559 return;
560
561 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
562 if ( !text )
563 return;
564
565 text->WriteText("OnActivated\n");
566 }
567
568 void MyListCtrl::OnListKeyDown(wxListEvent& event)
569 {
570 if ( !wxGetApp().GetTopWindow() )
571 return;
572
573 wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
574 if ( !text )
575 return;
576
577 text->WriteText("OnListKeyDown\n");
578 }
579
580