]> git.saurik.com Git - wxWidgets.git/blame - samples/notebook/notebook.cpp
Skip EVT_RIGHT_UP event in wxHtmlWindow if it wasn't handled.
[wxWidgets.git] / samples / notebook / notebook.cpp
CommitLineData
0b4d4194 1/////////////////////////////////////////////////////////////////////////////
c1dfe277
JS
2// Name: samples/notebook/notebook.cpp
3// Purpose: a sample demonstrating notebook usage
0b4d4194 4// Author: Julian Smart
c1dfe277 5// Modified by: Dimitri Schoolwerth
0b4d4194
JS
6// Created: 26/10/98
7// RCS-ID: $Id$
be5a51fb 8// Copyright: (c) 1998-2002 wxWidgets team
526954c5 9// Licence: wxWindows licence
0b4d4194
JS
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
d22699b5 16 #pragma hdrstop
0b4d4194
JS
17#endif
18
19#ifndef WX_PRECOMP
d22699b5 20 #include "wx/wx.h"
0b4d4194
JS
21#endif
22
c1dfe277
JS
23#include "wx/imaglist.h"
24#include "wx/artprov.h"
d0a84b63
VZ
25#include "wx/cshelp.h"
26#include "wx/utils.h"
b2f757f9 27#include "notebook.h"
0b4d4194 28
d52f6c4e
VZ
29#if !defined(__WXMSW__) && !defined(__WXPM__)
30 #include "../sample.xpm"
31#endif
32
425ec0a5
FM
33//-----------------------------------------------------------------------------
34// MyApp
35//-----------------------------------------------------------------------------
36
0b4d4194
JS
37IMPLEMENT_APP(MyApp)
38
477350ce 39bool MyApp::OnInit()
0b4d4194 40{
45e6e6f8
VZ
41 if ( !wxApp::OnInit() )
42 return false;
43
df1496e3
VZ
44#if wxUSE_HELP
45 wxHelpProvider::Set( new wxSimpleHelpProvider );
46#endif
47
c1dfe277 48 // Create the main window
eca15c0d 49 MyFrame *frame = new MyFrame();
c1dfe277
JS
50
51 // Problem with generic wxNotebook implementation whereby it doesn't size
52 // properly unless you set the size again
3a5bcc4d 53#if defined(__WXMOTIF__)
c1dfe277
JS
54 int width, height;
55 frame->GetSize(& width, & height);
422d0ff0 56 frame->SetSize(wxDefaultCoord, wxDefaultCoord, width, height);
5dcf05ae
JS
57#endif
58
c1dfe277
JS
59 frame->Show();
60
1cfac5b8 61 return true;
0b4d4194
JS
62}
63
425ec0a5
FM
64
65//-----------------------------------------------------------------------------
66// Creation functions
67//-----------------------------------------------------------------------------
68
61c083e7 69wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent)
0b4d4194 70{
9133965e 71 wxPanel *panel = new wxPanel(parent);
76645ab3 72
df1496e3
VZ
73#if wxUSE_HELP
74 panel->SetHelpText( wxT( "Panel with a Button" ) );
75#endif
76
1cfac5b8 77 (void) new wxButton( panel, wxID_ANY, wxT("Button"),
425ec0a5 78 wxPoint(10, 10), wxDefaultSize );
76645ab3
VZ
79
80 return panel;
81}
82
61c083e7 83wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent)
76645ab3 84{
9133965e 85 wxPanel *panel = new wxPanel(parent);
c1dfe277 86
df1496e3
VZ
87#if wxUSE_HELP
88 panel->SetHelpText( wxT( "Panel with some Radio Buttons" ) );
89#endif
90
ce00f59b 91 wxString animals[] =
425ec0a5 92 { wxT("Fox"), wxT("Hare"), wxT("Rabbit"),
c1dfe277 93 wxT("Sabre-toothed tiger"), wxT("T Rex") };
76645ab3 94
1cfac5b8 95 wxRadioBox *radiobox1 = new wxRadioBox(panel, wxID_ANY, wxT("Choose one"),
c1dfe277
JS
96 wxDefaultPosition, wxDefaultSize, 5, animals, 2, wxRA_SPECIFY_ROWS);
97
ce00f59b 98 wxString computers[] =
425ec0a5 99 { wxT("Amiga"), wxT("Commodore 64"), wxT("PET"),
c1dfe277 100 wxT("Another") };
76645ab3 101
1cfac5b8 102 wxRadioBox *radiobox2 = new wxRadioBox(panel, wxID_ANY,
c1dfe277
JS
103 wxT("Choose your favourite"), wxDefaultPosition, wxDefaultSize,
104 4, computers, 0, wxRA_SPECIFY_COLS);
0b4d4194 105
76645ab3 106 wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
c1dfe277
JS
107 sizerPanel->Add(radiobox1, 2, wxEXPAND);
108 sizerPanel->Add(radiobox2, 1, wxEXPAND);
109 panel->SetSizer(sizerPanel);
110
76645ab3
VZ
111 return panel;
112}
c1dfe277 113
61c083e7 114wxPanel *CreateVetoPage(wxBookCtrlBase *parent)
76645ab3 115{
9133965e 116 wxPanel *panel = new wxPanel(parent);
c1dfe277 117
df1496e3
VZ
118#if wxUSE_HELP
119 panel->SetHelpText( wxT( "An empty panel" ) );
120#endif
121
1cfac5b8 122 (void) new wxStaticText( panel, wxID_ANY,
ce00f59b 123 wxT("This page intentionally left blank"),
425ec0a5 124 wxPoint(10, 10) );
c1dfe277 125
76645ab3
VZ
126 return panel;
127}
128
61c083e7 129wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent)
76645ab3 130{
9133965e 131 wxPanel *panel = new wxPanel(parent);
c1dfe277 132
df1496e3
VZ
133#if wxUSE_HELP
134 panel->SetHelpText( wxT( "Panel with a maximized button" ) );
135#endif
136
ed420f6d 137 wxButton *buttonBig = new wxButton(panel, wxID_ANY, wxT("Maximized button"));
c1dfe277 138
76645ab3 139 wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
c1dfe277
JS
140 sizerPanel->Add(buttonBig, 1, wxEXPAND);
141 panel->SetSizer(sizerPanel);
142
76645ab3
VZ
143 return panel;
144}
145
61c083e7 146wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
76645ab3 147{
9133965e 148 wxPanel *panel = new wxPanel(parent);
c1dfe277 149
df1496e3
VZ
150#if wxUSE_HELP
151 panel->SetHelpText( wxT( "Maroon panel" ) );
152#endif
153
c1dfe277 154 panel->SetBackgroundColour( wxColour( wxT("MAROON") ) );
1cfac5b8 155 (void) new wxStaticText( panel, wxID_ANY,
ce00f59b 156 wxT("This page has been inserted, not added."),
425ec0a5 157 wxPoint(10, 10) );
c1dfe277 158
76645ab3
VZ
159 return panel;
160}
161
61c083e7 162int GetIconIndex(wxBookCtrlBase* bookCtrl)
76645ab3 163{
9133965e
WS
164 if (bookCtrl && bookCtrl->GetImageList())
165 {
166 int nImages = bookCtrl->GetImageList()->GetImageCount();
167 if (nImages > 0)
168 {
169 return bookCtrl->GetPageCount() % nImages;
170 }
171 }
76645ab3 172
9133965e
WS
173 return -1;
174}
76645ab3 175
61c083e7 176void CreateInitialPages(wxBookCtrlBase *parent)
9133965e
WS
177{
178 // Create and add some panels to the notebook
179
180 wxPanel *panel = CreateRadioButtonsPage(parent);
181 parent->AddPage( panel, RADIOBUTTONS_PAGE_NAME, false, GetIconIndex(parent) );
c1dfe277 182
9133965e
WS
183 panel = CreateVetoPage(parent);
184 parent->AddPage( panel, VETO_PAGE_NAME, false, GetIconIndex(parent) );
c1dfe277 185
9133965e
WS
186 panel = CreateBigButtonPage(parent);
187 parent->AddPage( panel, MAXIMIZED_BUTTON_PAGE_NAME, false, GetIconIndex(parent) );
76645ab3 188
9133965e
WS
189 panel = CreateInsertPage(parent);
190 parent->InsertPage( 0, panel, I_WAS_INSERTED_PAGE_NAME, false, GetIconIndex(parent) );
76645ab3 191
9133965e 192 parent->SetSelection(1);
c1dfe277
JS
193}
194
61c083e7 195wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
0b4d4194 196{
eca15c0d
VZ
197 if ( pageName.Contains(INSERTED_PAGE_NAME) ||
198 pageName.Contains(ADDED_PAGE_NAME) ||
199 pageName.Contains(ADDED_SUB_PAGE_NAME) ||
200 pageName.Contains(ADDED_PAGE_NAME_BEFORE) )
9133965e 201 return CreateUserCreatedPage(parent);
c1dfe277 202
eca15c0d 203 if ( pageName == I_WAS_INSERTED_PAGE_NAME )
9133965e 204 return CreateInsertPage(parent);
9133965e 205
eca15c0d 206 if ( pageName == VETO_PAGE_NAME )
9133965e 207 return CreateVetoPage(parent);
9133965e 208
eca15c0d 209 if ( pageName == RADIOBUTTONS_PAGE_NAME )
9133965e 210 return CreateRadioButtonsPage(parent);
9133965e 211
eca15c0d 212 if ( pageName == MAXIMIZED_BUTTON_PAGE_NAME )
9133965e 213 return CreateBigButtonPage(parent);
9133965e 214
9a83f860 215 wxFAIL_MSG( wxT("unknown page name") );
9133965e 216
eca15c0d 217 return NULL;
0b4d4194
JS
218}
219
425ec0a5
FM
220
221//-----------------------------------------------------------------------------
222// MyFrame
223//-----------------------------------------------------------------------------
224
225BEGIN_EVENT_TABLE(MyFrame, wxFrame)
226 // File menu
227 EVT_MENU_RANGE(ID_BOOK_NOTEBOOK, ID_BOOK_MAX, MyFrame::OnType)
228 EVT_MENU_RANGE(ID_ORIENT_DEFAULT, ID_ORIENT_MAX, MyFrame::OnOrient)
229 EVT_MENU(ID_SHOW_IMAGES, MyFrame::OnShowImages)
8864388c 230 EVT_MENU_RANGE(ID_FIXEDWIDTH, ID_HORZ_LAYOUT, MyFrame::OnStyle)
425ec0a5
FM
231 EVT_MENU(wxID_EXIT, MyFrame::OnExit)
232
233 // Operations menu
234 EVT_MENU(ID_ADD_PAGE, MyFrame::OnAddPage)
235 EVT_MENU(ID_ADD_PAGE_NO_SELECT, MyFrame::OnAddPageNoSelect)
236 EVT_MENU(ID_INSERT_PAGE, MyFrame::OnInsertPage)
237 EVT_MENU(ID_DELETE_CUR_PAGE, MyFrame::OnDeleteCurPage)
238 EVT_MENU(ID_DELETE_LAST_PAGE, MyFrame::OnDeleteLastPage)
239 EVT_MENU(ID_NEXT_PAGE, MyFrame::OnNextPage)
f7aaef4d
VZ
240 EVT_MENU(ID_CHANGE_SELECTION, MyFrame::OnChangeSelection)
241 EVT_MENU(ID_SET_SELECTION, MyFrame::OnSetSelection)
864181f4
VZ
242 EVT_MENU(ID_GET_PAGE_SIZE, MyFrame::OnGetPageSize)
243 EVT_MENU(ID_SET_PAGE_SIZE, MyFrame::OnSetPageSize)
425ec0a5
FM
244
245#if wxUSE_HELP
246 EVT_MENU(ID_CONTEXT_HELP, MyFrame::OnContextHelp)
247#endif // wxUSE_HELP
248 EVT_MENU(ID_HITTEST, MyFrame::OnHitTest)
249
250 // Book controls
251#if wxUSE_NOTEBOOK
252 EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnNotebook)
253 EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnNotebook)
254#endif
255#if wxUSE_LISTBOOK
256 EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnListbook)
257 EVT_LISTBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnListbook)
258#endif
259#if wxUSE_CHOICEBOOK
260 EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnChoicebook)
261 EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnChoicebook)
262#endif
263#if wxUSE_TREEBOOK
264 EVT_TREEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnTreebook)
265 EVT_TREEBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnTreebook)
266
267 EVT_MENU(ID_ADD_SUB_PAGE, MyFrame::OnAddSubPage)
268 EVT_MENU(ID_ADD_PAGE_BEFORE, MyFrame::OnAddPageBefore)
269 EVT_UPDATE_UI_RANGE(ID_ADD_PAGE_BEFORE, ID_ADD_SUB_PAGE,
270 MyFrame::OnUpdateTreeMenu)
271#endif
272#if wxUSE_TOOLBOOK
273 EVT_TOOLBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnToolbook)
274 EVT_TOOLBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnToolbook)
275#endif
873ff54b
SL
276#if wxUSE_AUI
277 EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnAuiNotebook)
278 EVT_AUINOTEBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnAuiNotebook)
279#endif
425ec0a5
FM
280
281 // Update title in idle time
282 EVT_IDLE(MyFrame::OnIdle)
283END_EVENT_TABLE()
284
eca15c0d 285MyFrame::MyFrame()
df1496e3 286 : wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample")))
0b4d4194 287{
df1496e3
VZ
288#if wxUSE_HELP
289 SetExtraStyle(wxFRAME_EX_CONTEXTHELP);
290#endif // wxUSE_HELP
291
53d09d55 292#if wxUSE_NOTEBOOK
eca15c0d 293 m_type = Type_Notebook;
53d09d55 294#elif wxUSE_CHOICEBOOK
eca15c0d 295 m_type = Type_Choicebook;
53d09d55 296#elif wxUSE_LISTBOOK
eca15c0d
VZ
297 m_type = Type_Listbook;
298#elif wxUSE_TREEBOOK
299 m_type = Type_Treebook;
fab8784c
VZ
300#elif wxUSE_TOOLBOOK
301 m_type = Type_Toolbook;
873ff54b
SL
302#elif wxUSE_AUI
303 m_type = Type_Aui;
abae3b80 304#else
53d09d55
WS
305 #error "Don't use Notebook sample without any book enabled in wxWidgets build!"
306#endif
307
9133965e
WS
308 m_orient = ID_ORIENT_DEFAULT;
309 m_chkShowImages = true;
8864388c 310 m_fixedWidth = false;
9133965e 311 m_multi = false;
8864388c
VZ
312 m_noPageTheme = false;
313 m_buttonBar = false;
314 m_horzLayout = false;
9133965e 315
d52f6c4e 316 SetIcon(wxICON(sample));
9133965e 317
d52f6c4e 318 // menu of the sample
9133965e
WS
319 wxMenu *menuType = new wxMenu;
320#if wxUSE_NOTEBOOK
321 menuType->AppendRadioItem(ID_BOOK_NOTEBOOK, wxT("&Notebook\tCtrl-1"));
322#endif
323#if wxUSE_LISTBOOK
324 menuType->AppendRadioItem(ID_BOOK_LISTBOOK, wxT("&Listbook\tCtrl-2"));
325#endif
326#if wxUSE_CHOICEBOOK
327 menuType->AppendRadioItem(ID_BOOK_CHOICEBOOK, wxT("&Choicebook\tCtrl-3"));
328#endif
eca15c0d
VZ
329#if wxUSE_TREEBOOK
330 menuType->AppendRadioItem(ID_BOOK_TREEBOOK, wxT("&Treebook\tCtrl-4"));
331#endif
d709457c
JS
332#if wxUSE_TOOLBOOK
333 menuType->AppendRadioItem(ID_BOOK_TOOLBOOK, wxT("T&oolbook\tCtrl-5"));
334#endif
873ff54b
SL
335#if wxUSE_AUI
336 menuType->AppendRadioItem(ID_BOOK_AUINOTEBOOK, wxT("&AuiNotebook\tCtrl-6"));
337#endif
eca15c0d
VZ
338
339 menuType->Check(ID_BOOK_NOTEBOOK + m_type, true);
9133965e
WS
340
341 wxMenu *menuOrient = new wxMenu;
76680db4
VZ
342 menuOrient->AppendRadioItem(ID_ORIENT_DEFAULT, wxT("&Default\tAlt-0"));
343 menuOrient->AppendRadioItem(ID_ORIENT_TOP, wxT("&Top\tAlt-1"));
344 menuOrient->AppendRadioItem(ID_ORIENT_BOTTOM, wxT("&Bottom\tAlt-2"));
345 menuOrient->AppendRadioItem(ID_ORIENT_LEFT, wxT("&Left\tAlt-3"));
346 menuOrient->AppendRadioItem(ID_ORIENT_RIGHT, wxT("&Right\tAlt-4"));
eca15c0d 347
8864388c
VZ
348 wxMenu *menuStyle = new wxMenu;
349#if wxUSE_NOTEBOOK
350 menuStyle->AppendCheckItem(ID_FIXEDWIDTH, wxT("&Fixed Width (wxNotebook)"));
351 menuStyle->AppendCheckItem(ID_MULTI, wxT("&Multiple lines (wxNotebook)"));
352 menuStyle->AppendCheckItem(ID_NOPAGETHEME, wxT("&No Page Theme (wxNotebook)"));
353#endif
354#if wxUSE_TOOLBOOK
355 menuStyle->AppendCheckItem(ID_BUTTONBAR, wxT("&Button Bar (wxToolbook)"));
356 menuStyle->AppendCheckItem(ID_HORZ_LAYOUT, wxT("&Horizontal layout (wxToolbook)"));
357#endif
358
d0a84b63
VZ
359 wxMenu *menuPageOperations = new wxMenu;
360 menuPageOperations->Append(ID_ADD_PAGE, wxT("&Add page\tAlt-A"));
a85dda4a 361 menuPageOperations->Append(ID_ADD_PAGE_NO_SELECT, wxT("&Add page (don't select)\tAlt-B"));
d0a84b63
VZ
362 menuPageOperations->Append(ID_INSERT_PAGE, wxT("&Insert page\tAlt-I"));
363 menuPageOperations->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page\tAlt-D"));
364 menuPageOperations->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page\tAlt-L"));
365 menuPageOperations->Append(ID_NEXT_PAGE, wxT("&Next page\tAlt-N"));
eca15c0d 366#if wxUSE_TREEBOOK
d0a84b63
VZ
367 menuPageOperations->AppendSeparator();
368 menuPageOperations->Append(ID_ADD_PAGE_BEFORE, wxT("Insert page &before\tAlt-B"));
369 menuPageOperations->Append(ID_ADD_SUB_PAGE, wxT("Add s&ub page\tAlt-U"));
eca15c0d 370#endif
1d6fcbcc 371 menuPageOperations->AppendSeparator();
f7aaef4d
VZ
372 menuPageOperations->Append(ID_CHANGE_SELECTION, wxT("&Change selection to 0\tCtrl-0"));
373 menuPageOperations->Append(ID_SET_SELECTION, wxT("&Set selection to 0\tShift-Ctrl-0"));
864181f4
VZ
374 menuPageOperations->AppendSeparator();
375 menuPageOperations->Append(ID_GET_PAGE_SIZE, "Sho&w page size");
376 menuPageOperations->Append(ID_SET_PAGE_SIZE, "Set &page size");
9133965e 377
d0a84b63 378 wxMenu *menuOperations = new wxMenu;
df1496e3
VZ
379#if wxUSE_HELP
380 menuOperations->Append(ID_CONTEXT_HELP, wxT("&Context help\tCtrl-F1"));
381#endif // wxUSE_HELP
d0a84b63
VZ
382 menuOperations->Append(ID_HITTEST, wxT("&Hit test\tCtrl-H"));
383
9133965e
WS
384 wxMenu *menuFile = new wxMenu;
385 menuFile->Append(wxID_ANY, wxT("&Type"), menuType, wxT("Type of control"));
386 menuFile->Append(wxID_ANY, wxT("&Orientation"), menuOrient, wxT("Orientation of control"));
c0c99785 387 menuFile->AppendCheckItem(ID_SHOW_IMAGES, wxT("&Show images\tAlt-S"));
8864388c 388 menuFile->Append(wxID_ANY, wxT("&Style"), menuStyle, wxT("Style of control"));
9133965e
WS
389 menuFile->AppendSeparator();
390 menuFile->Append(wxID_EXIT, wxT("E&xit"), wxT("Quits the application"));
391 menuFile->Check(ID_SHOW_IMAGES, m_chkShowImages);
9133965e
WS
392
393 wxMenuBar *menuBar = new wxMenuBar;
394 menuBar->Append(menuFile, wxT("&File"));
d0a84b63 395 menuBar->Append(menuPageOperations, wxT("&Pages"));
eca15c0d 396 menuBar->Append(menuOperations, wxT("&Operations"));
9133965e
WS
397 SetMenuBar(menuBar);
398
399 // books creation
eca15c0d
VZ
400 m_panel = NULL;
401 m_bookCtrl = NULL;
76645ab3
VZ
402
403 // create a dummy image list with a few icons
eca15c0d 404 const wxSize imageSize(32, 32);
76645ab3 405
eca15c0d
VZ
406 m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight());
407 m_imageList->
408 Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, imageSize));
409 m_imageList->
410 Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, imageSize));
411 m_imageList->
412 Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, imageSize));
413 m_imageList->
414 Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize));
76645ab3 415
eca15c0d 416 m_panel = new wxPanel(this);
c1dfe277 417
9133965e 418#if USE_LOG
1cfac5b8 419 m_text = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
eca15c0d
VZ
420 wxDefaultPosition, wxDefaultSize,
421 wxTE_MULTILINE | wxTE_READONLY);
c1dfe277
JS
422
423 m_logTargetOld = wxLog::SetActiveTarget( new wxLogTextCtrl(m_text) );
9133965e 424#endif // USE_LOG
c1dfe277 425
c1dfe277
JS
426 // Set sizers
427 m_sizerFrame = new wxBoxSizer(wxVERTICAL);
428
9133965e
WS
429#if USE_LOG
430 m_sizerFrame->Add(m_text, 1, wxEXPAND);
431#endif // USE_LOG
c1dfe277 432
eca15c0d 433 RecreateBook();
c1dfe277
JS
434
435 m_panel->SetSizer(m_sizerFrame);
119629aa 436 m_panel->Layout();
c1dfe277 437
119629aa
VZ
438 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
439 sizer->Add(m_panel, wxSizerFlags(1).Expand());
440 SetSizerAndFit(sizer);
0b4d4194
JS
441}
442
c1dfe277 443MyFrame::~MyFrame()
0b4d4194 444{
9133965e 445#if USE_LOG
c1dfe277 446 delete wxLog::SetActiveTarget(m_logTargetOld);
9133965e 447#endif // USE_LOG
76645ab3 448
eca15c0d 449 delete m_imageList;
0b4d4194
JS
450}
451
eca15c0d
VZ
452// DISPATCH_ON_TYPE() macro is an ugly way to write the "same" code for
453// different wxBookCtrlBase-derived classes without duplicating code and
454// without using templates, it expands into "before <xxx> after" where "xxx"
455// part is control class-specific
456#if wxUSE_NOTEBOOK
457 #define CASE_NOTEBOOK(x) case Type_Notebook: x; break;
5a053c22 458#else
eca15c0d 459 #define CASE_NOTEBOOK(x)
02161c7c 460#endif
eca15c0d 461
02161c7c 462#if wxUSE_LISTBOOK
eca15c0d
VZ
463 #define CASE_LISTBOOK(x) case Type_Listbook: x; break;
464#else
465 #define CASE_LISTBOOK(x)
136bafcd
VZ
466#endif
467
468#if wxUSE_CHOICEBOOK
469 #define CASE_CHOICEBOOK(x) case Type_Choicebook: x; break;
136bafcd
VZ
470#else
471 #define CASE_CHOICEBOOK(x)
02161c7c 472#endif
eca15c0d
VZ
473
474#if wxUSE_TREEBOOK
475 #define CASE_TREEBOOK(x) case Type_Treebook: x; break;
476#else
477 #define CASE_TREEBOOK(x)
02161c7c 478#endif
c1dfe277 479
d709457c
JS
480#if wxUSE_TOOLBOOK
481 #define CASE_TOOLBOOK(x) case Type_Toolbook: x; break;
482#else
483 #define CASE_TOOLBOOK(x)
484#endif
485
873ff54b
SL
486#if wxUSE_AUI
487 #define CASE_AUINOTEBOOK(x) case Type_AuiNotebook: x; break;
488#else
489 #define CASE_AUINOTEBOOK(x)
490#endif
491
492#define DISPATCH_ON_TYPE(before, nb, lb, cb, tb, toolb, aui, after) \
eca15c0d
VZ
493 switch ( m_type ) \
494 { \
495 CASE_NOTEBOOK(before nb after) \
eca15c0d 496 CASE_LISTBOOK(before lb after) \
136bafcd 497 CASE_CHOICEBOOK(before cb after) \
eca15c0d 498 CASE_TREEBOOK(before tb after) \
425ec0a5 499 CASE_TOOLBOOK(before toolb after) \
873ff54b 500 CASE_AUINOTEBOOK(before aui after) \
eca15c0d
VZ
501 \
502 default: \
9a83f860 503 wxFAIL_MSG( wxT("unknown book control type") ); \
eca15c0d
VZ
504 }
505
873ff54b 506int MyFrame::TranslateBookFlag(int nb, int lb, int chb, int tbk, int toolbk, int aui) const
eca15c0d
VZ
507{
508 int flag = 0;
509
873ff54b 510 DISPATCH_ON_TYPE(flag =, nb, lb, chb, tbk, toolbk, aui, + 0);
eca15c0d
VZ
511
512 return flag;
9133965e 513}
c1dfe277 514
eca15c0d 515void MyFrame::RecreateBook()
9133965e 516{
eca15c0d
VZ
517 int flags;
518 switch ( m_orient )
76645ab3 519 {
eca15c0d 520 case ID_ORIENT_TOP:
2ddb4d13 521 flags = wxBK_TOP;
eca15c0d
VZ
522 break;
523
524 case ID_ORIENT_BOTTOM:
2ddb4d13 525 flags = wxBK_BOTTOM;
eca15c0d
VZ
526 break;
527
528 case ID_ORIENT_LEFT:
2ddb4d13 529 flags = wxBK_LEFT;
eca15c0d
VZ
530 break;
531
532 case ID_ORIENT_RIGHT:
2ddb4d13 533 flags = wxBK_RIGHT;
eca15c0d
VZ
534 break;
535
536 default:
2ddb4d13 537 flags = wxBK_DEFAULT;
76645ab3 538 }
c1dfe277 539
8864388c
VZ
540#if wxUSE_NOTEBOOK
541 if ( m_fixedWidth && m_type == Type_Notebook )
542 flags |= wxNB_FIXEDWIDTH;
eca15c0d
VZ
543 if ( m_multi && m_type == Type_Notebook )
544 flags |= wxNB_MULTILINE;
8864388c
VZ
545 if ( m_noPageTheme && m_type == Type_Notebook )
546 flags |= wxNB_NOPAGETHEME;
547#endif
548#if wxUSE_TOOLBOOK
549 if ( m_buttonBar && m_type == Type_Toolbook )
550 flags |= wxTBK_BUTTONBAR;
551 if ( m_horzLayout && m_type == Type_Toolbook )
552 flags |= wxTBK_HORZ_LAYOUT;
553#endif
eca15c0d
VZ
554
555 wxBookCtrlBase *oldBook = m_bookCtrl;
556
557 m_bookCtrl = NULL;
558
559 DISPATCH_ON_TYPE(m_bookCtrl = new,
560 wxNotebook,
eca15c0d 561 wxListbook,
136bafcd 562 wxChoicebook,
eca15c0d 563 wxTreebook,
d709457c 564 wxToolbook,
873ff54b 565 wxAuiNotebook,
eca15c0d
VZ
566 (m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, flags));
567
568 if ( !m_bookCtrl )
569 return;
570
571 m_bookCtrl->Hide();
572
bd448041
VZ
573 // wxToolbook doesn't work without icons so always use them for it.
574 if ( m_chkShowImages || m_type == Type_Toolbook )
c1dfe277 575 {
eca15c0d 576 m_bookCtrl->SetImageList(m_imageList);
c1dfe277
JS
577 }
578
eca15c0d
VZ
579 if ( oldBook )
580 {
581#if wxUSE_TREEBOOK
582 // we only need the old treebook if we're recreating another treebook
583 wxTreebook *tbkOld = m_type == Type_Treebook
584 ? wxDynamicCast(oldBook, wxTreebook)
585 : NULL;
586#endif // wxUSE_TREEBOOK
587
588 const int count = oldBook->GetPageCount();
589 for ( int n = 0; n < count; n++ )
590 {
591 const int image = GetIconIndex(m_bookCtrl);
592 const wxString str = oldBook->GetPageText(n);
593
594 wxWindow *page = CreatePage(m_bookCtrl, str);
595
596 // treebook complication: need to account for possible parent page
597#if wxUSE_TREEBOOK
598 if ( tbkOld )
599 {
600 const int parent = tbkOld->GetPageParent(n);
601 if ( parent != wxNOT_FOUND )
602 {
603 wxStaticCast(m_bookCtrl, wxTreebook)->
9d5371c6 604 InsertSubPage(parent, page, str, false, image);
eca15c0d
VZ
605
606 // skip adding it again below
607 continue;
608 }
609 }
610#endif // wxUSE_TREEBOOK
611
612 m_bookCtrl->AddPage(page, str, false, image);
613 }
614
615 const int sel = oldBook->GetSelection();
616 if ( sel != wxNOT_FOUND )
617 m_bookCtrl->SetSelection(sel);
618
619
620 m_sizerFrame->Detach(oldBook);
621 delete oldBook;
622 }
623 else // no old book
624 {
625 CreateInitialPages(m_bookCtrl);
626 }
627
628 m_sizerFrame->Insert(0, m_bookCtrl, wxSizerFlags(5).Expand().Border());
629
630 m_sizerFrame->Show(m_bookCtrl);
9133965e 631 m_sizerFrame->Layout();
c1dfe277
JS
632}
633
ce00f59b 634void MyFrame::AddFlagStrIfFlagPresent(wxString & flagStr, long flags, long flag,
425ec0a5
FM
635 const wxChar * flagName) const
636{
637 if( (flags & flag) == flag )
638 {
639 if( !flagStr.empty() )
9a83f860 640 flagStr += wxT(" | ");
425ec0a5
FM
641 flagStr += flagName;
642 }
643}
9133965e 644
425ec0a5
FM
645wxPanel *MyFrame::CreateNewPage() const
646{
647 wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY );
9133965e 648
df1496e3 649#if wxUSE_HELP
425ec0a5 650 panel->SetHelpText( wxT( "Panel with \"First\" and \"Second\" buttons" ) );
eca15c0d 651#endif
136bafcd 652
425ec0a5
FM
653 (void) new wxButton(panel, wxID_ANY, wxT("First button"), wxPoint(10, 30));
654 (void) new wxButton(panel, wxID_ANY, wxT("Second button"), wxPoint(150, 30));
655
656 return panel;
657}
c1dfe277 658
425ec0a5
FM
659
660//-----------------------------------------------------------------------------
661// MyFrame - event handlers
662//-----------------------------------------------------------------------------
0b4d4194 663
df1496e3
VZ
664#if wxUSE_HELP
665
666void MyFrame::OnContextHelp(wxCommandEvent& WXUNUSED(event))
667{
668 // launches local event loop
669 wxContextHelp ch( this );
670}
671
672#endif // wxUSE_HELP
673
d0a84b63
VZ
674void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event))
675{
676 wxBookCtrlBase * book = GetCurrentBook();
677 const wxPoint pt = ::wxGetMousePosition();
678
679 long flags;
680 int pagePos = book->HitTest( book->ScreenToClient(pt), &flags );
681
682 wxString flagsStr;
683
9a83f860
VZ
684 AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_NOWHERE, wxT("wxBK_HITTEST_NOWHERE") );
685 AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONICON, wxT("wxBK_HITTEST_ONICON") );
686 AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONLABEL, wxT("wxBK_HITTEST_ONLABEL") );
687 AddFlagStrIfFlagPresent( flagsStr, flags, wxBK_HITTEST_ONPAGE, wxT("wxBK_HITTEST_ONPAGE") );
d0a84b63
VZ
688
689 wxLogMessage(wxT("HitTest at (%d,%d): %d: %s"),
690 pt.x,
691 pt.y,
692 pagePos,
693 flagsStr.c_str());
694}
695
9133965e 696void MyFrame::OnType(wxCommandEvent& event)
0b4d4194 697{
81d3348a 698 m_type = static_cast<BookType>(event.GetId() - ID_BOOK_NOTEBOOK);
eca15c0d
VZ
699
700 if ( m_bookCtrl )
701 m_sizerFrame->Hide(m_bookCtrl);
0b4d4194 702
eca15c0d
VZ
703 RecreateBook();
704}
477350ce 705
eca15c0d 706#if wxUSE_TREEBOOK
477350ce 707
eca15c0d
VZ
708void MyFrame::OnUpdateTreeMenu(wxUpdateUIEvent& event)
709{
710 event.Enable(m_type == Type_Treebook);
477350ce
VZ
711}
712
eca15c0d
VZ
713#endif // wxUSE_TREEBOOK
714
9133965e 715void MyFrame::OnOrient(wxCommandEvent& event)
477350ce 716{
9133965e 717 m_orient = event.GetId();
eca15c0d 718 RecreateBook();
9133965e
WS
719 m_sizerFrame->Layout();
720}
477350ce 721
9133965e
WS
722void MyFrame::OnShowImages(wxCommandEvent& event)
723{
724 m_chkShowImages = event.IsChecked();
eca15c0d 725 RecreateBook();
9133965e
WS
726 m_sizerFrame->Layout();
727}
c1dfe277 728
8864388c 729void MyFrame::OnStyle(wxCommandEvent& event)
9133965e 730{
8864388c
VZ
731 bool checked = event.IsChecked();
732 switch (event.GetId())
733 {
734 case ID_FIXEDWIDTH: m_fixedWidth = checked; break;
735 case ID_MULTI: m_multi = checked; break;
736 case ID_NOPAGETHEME: m_noPageTheme = checked; break;
737 case ID_BUTTONBAR: m_buttonBar = checked; break;
738 case ID_HORZ_LAYOUT: m_horzLayout = checked; break;
739 default: break; // avoid compiler warning
740 }
741
eca15c0d 742 RecreateBook();
9133965e 743 m_sizerFrame->Layout();
9133965e 744}
477350ce 745
9133965e
WS
746void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
747{
748 Close();
326f9654
RR
749}
750
eca15c0d
VZ
751void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event))
752{
61c083e7 753 wxBookCtrlBase *currBook = GetCurrentBook();
9133965e
WS
754
755 if ( currBook )
3957448a 756 {
eca15c0d
VZ
757 static unsigned s_pageAdded = 0;
758 currBook->AddPage(CreateNewPage(),
759 wxString::Format
760 (
761 ADDED_PAGE_NAME wxT("%u"),
762 ++s_pageAdded
763 ),
764 true,
765 GetIconIndex(currBook));
766 }
767}
768
a85dda4a
RR
769void MyFrame::OnAddPageNoSelect(wxCommandEvent& WXUNUSED(event))
770{
771 wxBookCtrlBase *currBook = GetCurrentBook();
772
773 if ( currBook )
774 {
775 static unsigned s_pageAdded = 0;
776 currBook->AddPage(CreateNewPage(),
777 wxString::Format
778 (
779 ADDED_PAGE_NAME wxT("%u"),
780 ++s_pageAdded
781 ),
782 false,
783 GetIconIndex(currBook));
784 }
785}
786
eca15c0d
VZ
787#if wxUSE_TREEBOOK
788void MyFrame::OnAddSubPage(wxCommandEvent& WXUNUSED(event))
789{
790 wxTreebook *currBook = wxDynamicCast(GetCurrentBook(), wxTreebook);
791 if ( currBook )
792 {
793 const int selPos = currBook->GetSelection();
794 if ( selPos == wxNOT_FOUND )
795 {
9a83f860 796 wxLogError(wxT("Select the parent page first!"));
eca15c0d
VZ
797 return;
798 }
799
800 static unsigned s_subPageAdded = 0;
9d5371c6
VZ
801 currBook->InsertSubPage
802 (
803 selPos,
804 CreateNewPage(),
805 wxString::Format
806 (
807 ADDED_SUB_PAGE_NAME wxT("%u"),
808 ++s_subPageAdded
809 ),
810 true,
811 GetIconIndex(currBook)
812 );
eca15c0d
VZ
813 }
814}
815
816void MyFrame::OnAddPageBefore(wxCommandEvent& WXUNUSED(event))
817{
818 wxBookCtrlBase *currBook = GetCurrentBook();
819 if ( currBook )
820 {
821 const int selPos = currBook->GetSelection();
822 if ( selPos == wxNOT_FOUND )
823 {
9a83f860 824 wxLogError(wxT("Select the parent page first!"));
eca15c0d
VZ
825 return;
826 }
827
828 static unsigned s_subPageAdded = 0;
829 currBook->InsertPage(selPos,
830 CreateNewPage(),
831 wxString::Format
832 (
833 ADDED_PAGE_NAME_BEFORE wxT("%u"),
834 ++s_subPageAdded
835 ),
836 true,
837 GetIconIndex(currBook));
3957448a
VZ
838 }
839}
eca15c0d 840#endif // wxUSE_TREEBOOK
3957448a 841
9133965e 842void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event))
29f538ce 843{
9133965e
WS
844 static unsigned s_pageIns = 0;
845
61c083e7 846 wxBookCtrlBase *currBook = GetCurrentBook();
f6bcfd97 847
9133965e 848 if ( currBook )
f6bcfd97 849 {
9133965e
WS
850 wxPanel *panel = CreateUserCreatedPage( currBook );
851
852 currBook->InsertPage( 0, panel,
853 wxString::Format(INSERTED_PAGE_NAME wxT("%u"), ++s_pageIns), false,
854 GetIconIndex(currBook) );
855
856 currBook->SetSelection(0);
f6bcfd97 857 }
29f538ce
RR
858}
859
9133965e 860void MyFrame::OnDeleteCurPage(wxCommandEvent& WXUNUSED(event))
33d0e17c 861{
61c083e7 862 wxBookCtrlBase *currBook = GetCurrentBook();
33d0e17c 863
9133965e
WS
864 if ( currBook )
865 {
866 int sel = currBook->GetSelection();
867
868 if (sel != wxNOT_FOUND)
869 {
870 currBook->DeletePage(sel);
871 }
872 }
0b4d4194
JS
873}
874
9133965e 875void MyFrame::OnDeleteLastPage(wxCommandEvent& WXUNUSED(event))
0b4d4194 876{
61c083e7 877 wxBookCtrlBase *currBook = GetCurrentBook();
d22699b5 878
9133965e 879 if ( currBook )
c1dfe277 880 {
9133965e 881 int page = currBook->GetPageCount();
c1dfe277 882
9133965e
WS
883 if ( page != 0 )
884 {
885 currBook->DeletePage(page - 1);
c1dfe277 886 }
c1dfe277 887 }
9133965e 888}
0b4d4194 889
9133965e
WS
890void MyFrame::OnNextPage(wxCommandEvent& WXUNUSED(event))
891{
61c083e7 892 wxBookCtrlBase *currBook = GetCurrentBook();
0b4d4194 893
9133965e
WS
894 if ( currBook )
895 {
896 currBook->AdvanceSelection();
897 }
0b4d4194
JS
898}
899
f7aaef4d 900void MyFrame::OnChangeSelection(wxCommandEvent& WXUNUSED(event))
1d6fcbcc
VZ
901{
902 wxBookCtrlBase *currBook = GetCurrentBook();
903
904 if ( currBook )
1d6fcbcc 905 currBook->ChangeSelection(0);
f7aaef4d
VZ
906}
907
908void MyFrame::OnSetSelection(wxCommandEvent& WXUNUSED(event))
909{
910 wxBookCtrlBase *currBook = GetCurrentBook();
911
912 if ( currBook )
913 currBook->SetSelection(0);
1d6fcbcc
VZ
914}
915
864181f4
VZ
916void MyFrame::OnGetPageSize(wxCommandEvent& WXUNUSED(event))
917{
918 wxBookCtrlBase* const currBook = GetCurrentBook();
919 if ( !currBook )
920 return;
921
922 const wxSize sizePage = currBook->GetPage(0)->GetSize();
923 const wxSize sizeBook = currBook->GetSize();
924
925 wxLogMessage("Page size is (%d, %d), book size (%d, %d)",
926 sizePage.x, sizePage.y,
927 sizeBook.x, sizeBook.y);
928}
929
930void MyFrame::OnSetPageSize(wxCommandEvent& WXUNUSED(event))
931{
932 wxBookCtrlBase* const currBook = GetCurrentBook();
933 if ( !currBook )
934 return;
935
936 const wxSize sizePage(300, 300);
937 currBook->SetPageSize(sizePage);
938
939 wxLogMessage("Page size set to (%d, %d)",
940 sizePage.x, sizePage.y);
941}
942
c1dfe277 943void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
96d37807 944{
9133965e
WS
945 static int s_nPages = wxNOT_FOUND;
946 static int s_nSel = wxNOT_FOUND;
61c083e7 947 static wxBookCtrlBase *s_currBook = NULL;
9133965e 948
61c083e7 949 wxBookCtrlBase *currBook = GetCurrentBook();
96d37807 950
9133965e
WS
951 int nPages = currBook ? currBook->GetPageCount() : 0;
952 int nSel = currBook ? currBook->GetSelection() : wxNOT_FOUND;
953
954 if ( nPages != s_nPages || nSel != s_nSel || s_currBook != currBook )
96d37807
VZ
955 {
956 s_nPages = nPages;
957 s_nSel = nSel;
9133965e
WS
958 s_currBook = currBook;
959
960 wxString selection;
961 if ( nSel == wxNOT_FOUND )
962 selection << wxT("not found");
963 else
964 selection << nSel;
96d37807
VZ
965
966 wxString title;
9133965e 967 title.Printf(wxT("Notebook and friends (%d pages, selection: %s)"), nPages, selection.c_str());
96d37807
VZ
968
969 SetTitle(title);
970 }
971}
3957448a 972
eca15c0d
VZ
973void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
974{
975 static const struct EventInfo
976 {
977 wxEventType typeChanged,
978 typeChanging;
979 const wxChar *name;
980 } events[] =
981 {
02161c7c 982#if wxUSE_NOTEBOOK
eca15c0d
VZ
983 {
984 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
985 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
9a83f860 986 wxT("wxNotebook")
eca15c0d
VZ
987 },
988#endif // wxUSE_NOTEBOOK
02161c7c 989#if wxUSE_LISTBOOK
eca15c0d
VZ
990 {
991 wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,
992 wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING,
9a83f860 993 wxT("wxListbook")
eca15c0d
VZ
994 },
995#endif // wxUSE_LISTBOOK
136bafcd
VZ
996#if wxUSE_CHOICEBOOK
997 {
998 wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED,
999 wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING,
9a83f860 1000 wxT("wxChoicebook")
136bafcd
VZ
1001 },
1002#endif // wxUSE_CHOICEBOOK
eca15c0d
VZ
1003#if wxUSE_TREEBOOK
1004 {
1005 wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED,
1006 wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING,
9a83f860 1007 wxT("wxTreebook")
eca15c0d
VZ
1008 },
1009#endif // wxUSE_TREEBOOK
d709457c
JS
1010#if wxUSE_TOOLBOOK
1011 {
1012 wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED,
1013 wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING,
9a83f860 1014 wxT("wxToolbook")
d709457c
JS
1015 },
1016#endif // wxUSE_TOOLBOOK
873ff54b
SL
1017#if wxUSE_AUI
1018 {
1019 wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,
1020 wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING,
1021 wxT("wxAuiNotebook")
1022 },
1023#endif // wxUSE_AUI
eca15c0d
VZ
1024 };
1025
1026
1027 wxString nameEvent,
1028 nameControl,
1029 veto;
1030 const wxEventType eventType = event.GetEventType();
c7e94140
VZ
1031
1032 // NB: can't use wxStaticCast here as wxBookCtrlBase is not in
1033 // wxRTTI
1034 const wxBookCtrlBase * const
1035 book = static_cast<wxBookCtrlBase *>(event.GetEventObject());
1036
eca15c0d
VZ
1037 for ( size_t n = 0; n < WXSIZEOF(events); n++ )
1038 {
1039 const EventInfo& ei = events[n];
1040 if ( eventType == ei.typeChanged )
1041 {
1042 nameEvent = wxT("Changed");
1043 }
1044 else if ( eventType == ei.typeChanging )
1045 {
1046 const int idx = event.GetOldSelection();
582ca353 1047
eca15c0d
VZ
1048 if ( idx != wxNOT_FOUND &&
1049 book && book->GetPageText(idx) == VETO_PAGE_NAME )
1050 {
1051 if ( wxMessageBox
1052 (
1053 wxT("Are you sure you want to leave this page?\n")
1054 wxT("(This demonstrates veto-ing)"),
1055 wxT("Notebook sample"),
1056 wxICON_QUESTION | wxYES_NO,
1057 this
1058 ) != wxYES )
1059 {
1060 event.Veto();
9a83f860 1061 veto = wxT(" (vetoed)");
eca15c0d
VZ
1062 }
1063 }
1064
1065 nameEvent = wxT("Changing");
1066 }
1067 else // skip end of the loop
1068 {
1069 continue;
1070 }
1071
1072 nameControl = ei.name;
1073 break;
1074 }
1075
1076 static int s_num = 0;
1077
c7e94140 1078 wxLogMessage(wxT("Event #%d: %s: %s (%d) new sel %d, old %d, current %d%s"),
eca15c0d
VZ
1079 ++s_num,
1080 nameControl.c_str(),
1081 nameEvent.c_str(),
1082 eventType,
1083 event.GetSelection(),
1084 event.GetOldSelection(),
c7e94140 1085 book->GetSelection(),
eca15c0d
VZ
1086 veto.c_str());
1087
1088#if USE_LOG
1089 m_text->SetInsertionPointEnd();
02161c7c 1090#endif
eca15c0d 1091}