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