]> git.saurik.com Git - wxWidgets.git/blame - src/msw/notebook.cpp
1. wxMSW::wxNotebook::SetPageSize() and SetPadding() added
[wxWidgets.git] / src / msw / notebook.cpp
CommitLineData
88310e2e
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: msw/notebook.cpp
3// Purpose: implementation of wxNotebook
4// Author: Vadim Zeitlin
907f37b3 5// Modified by:
88310e2e
VZ
6// Created: 11.06.98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9// Licence: wxWindows license
10///////////////////////////////////////////////////////////////////////////////
11
88310e2e 12#ifdef __GNUG__
a3b46648 13#pragma implementation "notebook.h"
88310e2e
VZ
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
a3b46648 20#pragma hdrstop
88310e2e
VZ
21#endif
22
23// wxWindows
24#ifndef WX_PRECOMP
3096bd2f 25 #include "wx/string.h"
88310e2e
VZ
26#endif // WX_PRECOMP
27
3096bd2f
VZ
28#include "wx/log.h"
29#include "wx/imaglist.h"
30#include "wx/event.h"
31#include "wx/control.h"
32#include "wx/notebook.h"
88310e2e 33
3096bd2f 34#include "wx/msw/private.h"
88310e2e
VZ
35
36// Windows standard headers
37#ifndef __WIN95__
2432b92d 38 #error "wxNotebook is only supported Windows 95 and above"
88310e2e
VZ
39#endif //Win95
40
aaab7c01
VZ
41#include <windowsx.h> // for SetWindowFont
42
57c208c5 43#ifndef __TWIN32__
88310e2e 44#ifdef __GNUWIN32__
65fd5cb0 45#ifndef wxUSE_NORLANDER_HEADERS
88310e2e 46 #include "wx/msw/gnuwin32/extra.h"
57c208c5
JS
47#endif
48#endif
65fd5cb0 49#endif
57c208c5 50
65fd5cb0 51#if !defined(__GNUWIN32__) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
88310e2e
VZ
52 #include <commctrl.h>
53#endif
54
55// ----------------------------------------------------------------------------
56// macros
57// ----------------------------------------------------------------------------
58
59// check that the page index is valid
60#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
61
62// hide the ugly cast
63#define m_hwnd (HWND)GetHWND()
64
74b31181
VZ
65// ----------------------------------------------------------------------------
66// constants
67// ----------------------------------------------------------------------------
68
69// This is a work-around for missing defines in gcc-2.95 headers
70#ifndef TCS_RIGHT
71 #define TCS_RIGHT 0x0002
72#endif
73
74#ifndef TCS_VERTICAL
75 #define TCS_VERTICAL 0x0080
76#endif
77
78#ifndef TCS_BOTTOM
79 #define TCS_BOTTOM TCS_RIGHT
80#endif
81
88310e2e
VZ
82// ----------------------------------------------------------------------------
83// event table
84// ----------------------------------------------------------------------------
85
d9317fd4 86BEGIN_EVENT_TABLE(wxNotebook, wxControl)
88310e2e
VZ
87 EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
88
9026ad85 89 EVT_SIZE(wxNotebook::OnSize)
42e69d6b 90
88310e2e 91 EVT_SET_FOCUS(wxNotebook::OnSetFocus)
42e69d6b 92
88310e2e 93 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
d9317fd4 94END_EVENT_TABLE()
88310e2e 95
d9317fd4
VZ
96IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
97IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
88310e2e
VZ
98
99// ============================================================================
100// implementation
101// ============================================================================
102
103// ----------------------------------------------------------------------------
104// wxNotebook construction
105// ----------------------------------------------------------------------------
106
107// common part of all ctors
108void wxNotebook::Init()
109{
110 m_pImageList = NULL;
111 m_nSelection = -1;
112}
113
114// default for dynamic class
115wxNotebook::wxNotebook()
116{
117 Init();
118}
119
120// the same arguments as for wxControl
121wxNotebook::wxNotebook(wxWindow *parent,
8b9518ee 122 wxWindowID id,
88310e2e
VZ
123 const wxPoint& pos,
124 const wxSize& size,
8b9518ee 125 long style,
88310e2e
VZ
126 const wxString& name)
127{
128 Init();
129
130 Create(parent, id, pos, size, style, name);
131}
132
133// Create() function
134bool wxNotebook::Create(wxWindow *parent,
8b9518ee 135 wxWindowID id,
88310e2e
VZ
136 const wxPoint& pos,
137 const wxSize& size,
8b9518ee 138 long style,
88310e2e
VZ
139 const wxString& name)
140{
141 // base init
8d99be5f
VZ
142 if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
143 return FALSE;
88310e2e
VZ
144
145 // colors and font
146 m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
4b7f2165 147 m_foregroundColour = *wxBLACK;
88310e2e 148
88310e2e 149 // style
fd2daa68 150 m_windowStyle = style | wxTAB_TRAVERSAL;
88310e2e 151
d13c32e9
JS
152 long tabStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | TCS_TABS;
153
154 if (m_windowStyle & wxCLIP_CHILDREN)
155 tabStyle |= WS_CLIPCHILDREN;
88310e2e
VZ
156 if ( m_windowStyle & wxTC_MULTILINE )
157 tabStyle |= TCS_MULTILINE;
158 if ( m_windowStyle & wxBORDER )
159 tabStyle &= WS_BORDER;
58a8ab88
JS
160 if (m_windowStyle & wxNB_FIXEDWIDTH)
161 tabStyle |= TCS_FIXEDWIDTH ;
7a3ac804
RS
162 if (m_windowStyle & wxNB_BOTTOM)
163 tabStyle |= TCS_RIGHT;
164 if (m_windowStyle & wxNB_LEFT)
165 tabStyle |= TCS_VERTICAL;
166 if (m_windowStyle & wxNB_RIGHT)
167 tabStyle |= TCS_VERTICAL|TCS_RIGHT;
0398b1d6 168
88310e2e 169
789295bf
VZ
170 if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL,
171 this, NULL, pos.x, pos.y, size.x, size.y,
172 tabStyle, NULL, 0) )
173 {
88310e2e
VZ
174 return FALSE;
175 }
176
27529614 177 // Not all compilers recognise SetWindowFont
789295bf
VZ
178 ::SendMessage(GetHwnd(), WM_SETFONT,
179 (WPARAM)::GetStockObject(DEFAULT_GUI_FONT), TRUE);
27529614 180
aaab7c01 181
907f37b3 182 if ( parent != NULL )
88310e2e 183 parent->AddChild(this);
907f37b3 184
88310e2e
VZ
185 SubclassWin(m_hWnd);
186
187 return TRUE;
188}
189
190// dtor
191wxNotebook::~wxNotebook()
192{
193}
194
195// ----------------------------------------------------------------------------
196// wxNotebook accessors
197// ----------------------------------------------------------------------------
198int wxNotebook::GetPageCount() const
199{
200 // consistency check
201 wxASSERT( (int)m_aPages.Count() == TabCtrl_GetItemCount(m_hwnd) );
202
203 return m_aPages.Count();
204}
205
206int wxNotebook::GetRowCount() const
207{
208 return TabCtrl_GetRowCount(m_hwnd);
209}
210
211int wxNotebook::SetSelection(int nPage)
212{
223d09f6 213 wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") );
88310e2e
VZ
214
215 ChangePage(m_nSelection, nPage);
216
217 return TabCtrl_SetCurSel(m_hwnd, nPage);
218}
219
220void wxNotebook::AdvanceSelection(bool bForward)
221{
222 int nSel = GetSelection();
223 int nMax = GetPageCount() - 1;
224 if ( bForward )
225 SetSelection(nSel == nMax ? 0 : nSel + 1);
226 else
227 SetSelection(nSel == 0 ? nMax : nSel - 1);
228}
229
230bool wxNotebook::SetPageText(int nPage, const wxString& strText)
231{
223d09f6 232 wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") );
88310e2e
VZ
233
234 TC_ITEM tcItem;
235 tcItem.mask = TCIF_TEXT;
837e5743 236 tcItem.pszText = (wxChar *)strText.c_str();
88310e2e
VZ
237
238 return TabCtrl_SetItem(m_hwnd, nPage, &tcItem) != 0;
239}
240
241wxString wxNotebook::GetPageText(int nPage) const
242{
223d09f6 243 wxCHECK_MSG( IS_VALID_PAGE(nPage), wxT(""), wxT("notebook page out of range") );
88310e2e 244
837e5743 245 wxChar buf[256];
88310e2e
VZ
246 TC_ITEM tcItem;
247 tcItem.mask = TCIF_TEXT;
248 tcItem.pszText = buf;
249 tcItem.cchTextMax = WXSIZEOF(buf);
250
251 wxString str;
252 if ( TabCtrl_GetItem(m_hwnd, nPage, &tcItem) )
253 str = tcItem.pszText;
254
255 return str;
256}
257
258int wxNotebook::GetPageImage(int nPage) const
259{
223d09f6 260 wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") );
88310e2e
VZ
261
262 TC_ITEM tcItem;
263 tcItem.mask = TCIF_IMAGE;
264
265 return TabCtrl_GetItem(m_hwnd, nPage, &tcItem) ? tcItem.iImage : -1;
266}
267
268bool wxNotebook::SetPageImage(int nPage, int nImage)
269{
223d09f6 270 wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") );
88310e2e
VZ
271
272 TC_ITEM tcItem;
273 tcItem.mask = TCIF_IMAGE;
274 tcItem.iImage = nImage;
275
276 return TabCtrl_SetItem(m_hwnd, nPage, &tcItem) != 0;
277}
278
279void wxNotebook::SetImageList(wxImageList* imageList)
907f37b3 280{
88310e2e
VZ
281 m_pImageList = imageList;
282 TabCtrl_SetImageList(m_hwnd, (HIMAGELIST)imageList->GetHIMAGELIST());
283}
284
d9506e77
VZ
285// ----------------------------------------------------------------------------
286// wxNotebook size settings
287// ----------------------------------------------------------------------------
288
289void wxNotebook::SetPageSize(const wxSize& size)
290{
291 // transform the page size into the notebook size
292 RECT rc;
293 rc.left =
294 rc.top = 0;
295 rc.right = size.x;
296 rc.bottom = size.y;
297
298 TabCtrl_AdjustRect(GetHwnd(), TRUE, &rc);
299
300 // and now set it
301 SetSize(rc.right - rc.left, rc.bottom - rc.top);
302}
303
304void wxNotebook::SetPadding(const wxSize& padding)
305{
306 TabCtrl_SetPadding(GetHwnd(), padding.x, padding.y);
307}
42e69d6b
VZ
308
309// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
310// style.
311void wxNotebook::SetTabSize(const wxSize& sz)
312{
313 ::SendMessage(GetHwnd(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y));
314}
315
88310e2e
VZ
316// ----------------------------------------------------------------------------
317// wxNotebook operations
318// ----------------------------------------------------------------------------
319
320// remove one page from the notebook
321bool wxNotebook::DeletePage(int nPage)
322{
223d09f6 323 wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") );
88310e2e 324
96d37807
VZ
325 if ( m_nSelection == nPage ) {
326 // advance selection backwards - the page being deleted shouldn't be left
327 // selected
328 AdvanceSelection(FALSE);
329 }
330
88310e2e
VZ
331 TabCtrl_DeleteItem(m_hwnd, nPage);
332
333 delete m_aPages[nPage];
334 m_aPages.Remove(nPage);
335
96d37807
VZ
336 if ( m_aPages.IsEmpty() ) {
337 // no selection if the notebook became empty
338 m_nSelection = -1;
339 }
9b6b5750
JS
340 else
341 m_nSelection = TabCtrl_GetCurSel(m_hwnd);
342
96d37807 343
88310e2e
VZ
344 return TRUE;
345}
346
621793f4
JS
347// remove one page from the notebook, without deleting
348bool wxNotebook::RemovePage(int nPage)
349{
223d09f6 350 wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") );
621793f4
JS
351
352 TabCtrl_DeleteItem(m_hwnd, nPage);
353
354 m_aPages.Remove(nPage);
355
47f12f58
JS
356 if ( m_aPages.IsEmpty() )
357 m_nSelection = -1;
9b6b5750
JS
358 else
359 m_nSelection = TabCtrl_GetCurSel(m_hwnd);
47f12f58 360
621793f4
JS
361 return TRUE;
362}
363
88310e2e
VZ
364// remove all pages
365bool wxNotebook::DeleteAllPages()
366{
88310e2e
VZ
367 int nPageCount = GetPageCount();
368 int nPage;
369 for ( nPage = 0; nPage < nPageCount; nPage++ )
370 delete m_aPages[nPage];
371
372 m_aPages.Clear();
373
907f37b3
VZ
374 TabCtrl_DeleteAllItems(m_hwnd);
375
47f12f58
JS
376 m_nSelection = -1;
377
88310e2e
VZ
378 return TRUE;
379}
380
381// add a page to the notebook
382bool wxNotebook::AddPage(wxNotebookPage *pPage,
383 const wxString& strText,
384 bool bSelect,
385 int imageId)
386{
387 return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
388}
389
390// same as AddPage() but does it at given position
391bool wxNotebook::InsertPage(int nPage,
392 wxNotebookPage *pPage,
393 const wxString& strText,
394 bool bSelect,
395 int imageId)
396{
397 wxASSERT( pPage != NULL );
398 wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
399
43427087
VZ
400 // do add the tab to the control
401
402 // init all fields to 0
88310e2e 403 TC_ITEM tcItem;
43427087 404 memset(&tcItem, 0, sizeof(tcItem));
58a8ab88 405
43427087 406 if ( imageId != -1 )
58a8ab88
JS
407 {
408 tcItem.mask |= TCIF_IMAGE;
409 tcItem.iImage = imageId;
410 }
58a8ab88 411
43427087 412 if ( !strText.IsEmpty() )
58a8ab88 413 {
43427087
VZ
414 tcItem.mask |= TCIF_TEXT;
415 tcItem.pszText = (wxChar *)strText.c_str(); // const_cast
58a8ab88 416 }
88310e2e
VZ
417
418 if ( TabCtrl_InsertItem(m_hwnd, nPage, &tcItem) == -1 ) {
223d09f6 419 wxLogError(wxT("Can't create the notebook page '%s'."), strText.c_str());
43427087 420
88310e2e
VZ
421 return FALSE;
422 }
423
43427087
VZ
424 // if the inserted page is before the selected one, we must update the
425 // index of the selected page
426 if ( nPage <= m_nSelection )
427 {
428 // one extra page added
429 m_nSelection++;
430 }
431
88310e2e
VZ
432 // save the pointer to the page
433 m_aPages.Insert(pPage, nPage);
434
88310e2e 435 // don't show pages by default (we'll need to adjust their size first)
42e69d6b 436 HWND hwnd = GetWinHwnd(pPage);
88310e2e
VZ
437 SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE);
438
42e69d6b
VZ
439 // this updates internal flag too - otherwise it will get out of sync
440 pPage->Show(FALSE);
441
0398b1d6
RD
442 // fit the notebook page to the tab control's display area
443 RECT rc;
444 rc.left = rc.top = 0;
445 GetSize((int *)&rc.right, (int *)&rc.bottom);
446 TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
447 pPage->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
0398b1d6 448
43427087
VZ
449 // some page should be selected: either this one or the first one if there is
450 // still no selection
451 int selNew = -1;
452 if ( bSelect )
453 selNew = nPage;
454 else if ( m_nSelection == -1 )
455 selNew = 0;
456
457 if ( selNew != -1 )
458 SetSelection(selNew);
96d37807 459
88310e2e
VZ
460 return TRUE;
461}
462
463// ----------------------------------------------------------------------------
464// wxNotebook callbacks
465// ----------------------------------------------------------------------------
466
9026ad85 467void wxNotebook::OnSize(wxSizeEvent& event)
88310e2e 468{
b5c3b538
VZ
469 // fit the notebook page to the tab control's display area
470 RECT rc;
471 rc.left = rc.top = 0;
472 GetSize((int *)&rc.right, (int *)&rc.bottom);
473
474 TabCtrl_AdjustRect(m_hwnd, FALSE, &rc);
4b7f2165
VZ
475
476 int width = rc.right - rc.left,
477 height = rc.bottom - rc.top;
c86f1403
VZ
478 size_t nCount = m_aPages.Count();
479 for ( size_t nPage = 0; nPage < nCount; nPage++ ) {
b5c3b538 480 wxNotebookPage *pPage = m_aPages[nPage];
4b7f2165 481 pPage->SetSize(rc.left, rc.top, width, height);
b5c3b538
VZ
482 }
483
88310e2e
VZ
484 event.Skip();
485}
486
487void wxNotebook::OnSelChange(wxNotebookEvent& event)
488{
489 // is it our tab control?
490 if ( event.GetEventObject() == this )
5d1d2d46 491 {
5d1d2d46
VZ
492 int sel = event.GetOldSelection();
493 if ( sel != -1 )
494 m_aPages[sel]->Show(FALSE);
0398b1d6 495
5d1d2d46
VZ
496 sel = event.GetSelection();
497 if ( sel != -1 )
498 {
499 wxNotebookPage *pPage = m_aPages[sel];
500 pPage->Show(TRUE);
501 pPage->SetFocus();
502 }
0398b1d6 503
5d1d2d46
VZ
504 m_nSelection = sel;
505 }
88310e2e
VZ
506
507 // we want to give others a chance to process this message as well
508 event.Skip();
509}
510
511void wxNotebook::OnSetFocus(wxFocusEvent& event)
512{
d9506e77
VZ
513 // this function is only called when the focus is explicitly set (i.e. from
514 // the program) to the notebook - in this case we don't need the
515 // complicated OnNavigationKey() logic because the programmer knows better
516 // what [s]he wants
88310e2e 517
d9506e77
VZ
518 // set focus to the currently selected page if any
519 if ( m_nSelection != -1 )
520 m_aPages[m_nSelection]->SetFocus();
521
522 event.Skip();
88310e2e
VZ
523}
524
525void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
526{
d9506e77
VZ
527 if ( event.IsWindowChange() ) {
528 // change pages
529 AdvanceSelection(event.GetDirection());
530 }
531 else {
532 // we get this event in 2 cases
533 //
534 // a) one of our pages might have generated it because the user TABbed
535 // out from it in which case we should propagate the event upwards and
536 // our parent will take care of setting the focus to prev/next sibling
537 //
538 // or
539 //
540 // b) the parent panel wants to give the focus to us so that we
541 // forward it to our selected page. We can't deal with this in
542 // OnSetFocus() because we don't know which direction the focus came
543 // from in this case and so can't choose between setting the focus to
544 // first or last panel child
545
546 wxWindow *parent = GetParent();
547 if ( event.GetEventObject() == parent )
548 {
549 // no, it doesn't come from child, case (b): forward to a page
550 if ( m_nSelection != -1 )
551 {
552 // so that the page knows that the event comes from it's parent
553 // and is being propagated downwards
554 event.SetEventObject(this);
555
556 wxWindow *page = m_aPages[m_nSelection];
557 if ( !page->GetEventHandler()->ProcessEvent(event) )
558 {
559 page->SetFocus();
560 }
561 //else: page manages focus inside it itself
562 }
563 else
564 {
565 // we have no pages - still have to give focus to _something_
566 SetFocus();
567 }
568 }
569 else
570 {
571 // it comes from our child, case (a), pass to the parent
572 if ( parent ) {
573 event.SetCurrentFocus(this);
574 parent->GetEventHandler()->ProcessEvent(event);
575 }
576 }
88310e2e 577 }
88310e2e
VZ
578}
579
580// ----------------------------------------------------------------------------
581// wxNotebook base class virtuals
582// ----------------------------------------------------------------------------
b5c3b538
VZ
583
584// override these 2 functions to do nothing: everything is done in OnSize
585
4b7f2165 586void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse))
b5c3b538
VZ
587{
588 // don't set the sizes of the pages - their correct size is not yet known
589 wxControl::SetConstraintSizes(FALSE);
590}
591
4b7f2165 592bool wxNotebook::DoPhase(int WXUNUSED(nPhase))
b5c3b538
VZ
593{
594 return TRUE;
595}
596
a23fd0e1 597bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
88310e2e 598{
93a19f17 599 wxNotebookEvent event(wxEVT_NULL, m_windowId);
88310e2e
VZ
600
601 NMHDR* hdr = (NMHDR *)lParam;
602 switch ( hdr->code ) {
603 case TCN_SELCHANGE:
604 event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
605 break;
606
607 case TCN_SELCHANGING:
608 event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING);
609 break;
610
fd3f686c 611 default:
a23fd0e1 612 return wxControl::MSWOnNotify(idCtrl, lParam, result);
88310e2e
VZ
613 }
614
93a19f17
VZ
615 event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
616 event.SetOldSelection(m_nSelection);
88310e2e 617 event.SetEventObject(this);
a23fd0e1 618 event.SetInt(idCtrl);
88310e2e 619
fd3f686c
VZ
620 bool processed = GetEventHandler()->ProcessEvent(event);
621 *result = !event.IsAllowed();
622 return processed;
88310e2e
VZ
623}
624
625// ----------------------------------------------------------------------------
626// wxNotebook helper functions
627// ----------------------------------------------------------------------------
628
43427087
VZ
629// generate the page changing and changed events, hide the currently active
630// panel and show the new one
88310e2e
VZ
631void wxNotebook::ChangePage(int nOldSel, int nSel)
632{
fd3f686c
VZ
633 // MT-FIXME should use a real semaphore
634 static bool s_bInsideChangePage = FALSE;
635
636 // when we call ProcessEvent(), our own OnSelChange() is called which calls
637 // this function - break the infinite loop
638 if ( s_bInsideChangePage )
639 return;
640
aaab7c01
VZ
641 // it's not an error (the message may be generated by the tab control itself)
642 // and it may happen - just do nothing
643 if ( nSel == nOldSel )
644 return;
88310e2e 645
fd3f686c
VZ
646 s_bInsideChangePage = TRUE;
647
648 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId);
649 event.SetSelection(nSel);
650 event.SetOldSelection(nOldSel);
651 event.SetEventObject(this);
652 if ( ProcessEvent(event) && !event.IsAllowed() )
653 {
654 // program doesn't allow the page change
655 s_bInsideChangePage = FALSE;
656 return;
657 }
658
fd3f686c
VZ
659 event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
660 ProcessEvent(event);
661
fd3f686c 662 s_bInsideChangePage = FALSE;
88310e2e 663}