]> git.saurik.com Git - wxWidgets.git/blame - src/generic/notebook.cpp
Some themes round the edges of the buttons, overwriting any text that
[wxWidgets.git] / src / generic / notebook.cpp
CommitLineData
1e6d9499
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: notebook.cpp
3// Purpose: implementation of wxNotebook
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
14f355c2 19#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
1e6d9499
JS
20#pragma implementation "notebook.h"
21#endif
22
1cc4f822
JJ
23#ifdef __VMS
24#pragma message disable unscomzer
25#endif
26
1e6d9499
JS
27// For compilers that support precompilation, includes "wx.h".
28#include "wx/wxprec.h"
29
30#ifdef __BORLANDC__
31#pragma hdrstop
32#endif
33
ed58dbea
RR
34#include "wx/string.h"
35#include "wx/log.h"
36#include "wx/settings.h"
37#include "wx/generic/imaglist.h"
38#include "wx/notebook.h"
39#include "wx/dcclient.h"
00dd3b18 40#include "wx/generic/tabg.h"
1e6d9499
JS
41
42// ----------------------------------------------------------------------------
43// macros
44// ----------------------------------------------------------------------------
45
46// check that the page index is valid
47#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
48
49// ----------------------------------------------------------------------------
50// event table
51// ----------------------------------------------------------------------------
52
2e4df4bf
VZ
53DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
54DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
55
1e6d9499
JS
56BEGIN_EVENT_TABLE(wxNotebook, wxControl)
57 EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
58 EVT_SIZE(wxNotebook::OnSize)
59 EVT_PAINT(wxNotebook::OnPaint)
60 EVT_MOUSE_EVENTS(wxNotebook::OnMouseEvent)
61 EVT_SET_FOCUS(wxNotebook::OnSetFocus)
62 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
1e6d9499
JS
63END_EVENT_TABLE()
64
65IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
66IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
1e6d9499
JS
67
68// ============================================================================
69// implementation
70// ============================================================================
71
00dd3b18
MB
72// ============================================================================
73// Private class
74// ============================================================================
75
76// This reuses wxTabView to draw the tabs.
77class WXDLLEXPORT wxNotebookTabView: public wxTabView
78{
79DECLARE_DYNAMIC_CLASS(wxNotebookTabView)
80public:
81 wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR);
82 ~wxNotebookTabView(void);
83
84 // Called when a tab is activated
85 virtual void OnTabActivate(int activateId, int deactivateId);
86 // Allows vetoing
87 virtual bool OnTabPreActivate(int activateId, int deactivateId);
88
89protected:
90 wxNotebook* m_notebook;
91};
92
1e6d9499
JS
93// ----------------------------------------------------------------------------
94// wxNotebook construction
95// ----------------------------------------------------------------------------
96
97// common part of all ctors
98void wxNotebook::Init()
99{
100 m_tabView = (wxNotebookTabView*) NULL;
1e6d9499
JS
101 m_nSelection = -1;
102}
103
104// default for dynamic class
105wxNotebook::wxNotebook()
106{
107 Init();
108}
109
110// the same arguments as for wxControl
111wxNotebook::wxNotebook(wxWindow *parent,
112 wxWindowID id,
113 const wxPoint& pos,
114 const wxSize& size,
115 long style,
116 const wxString& name)
117{
118 Init();
119
120 Create(parent, id, pos, size, style, name);
121}
122
123// Create() function
124bool wxNotebook::Create(wxWindow *parent,
125 wxWindowID id,
126 const wxPoint& pos,
127 const wxSize& size,
128 long style,
129 const wxString& name)
130{
131 // base init
132 SetName(name);
133
134 m_windowId = id == -1 ? NewControlId() : id;
135
b4f8693c 136 if (!wxControl::Create(parent, id, pos, size, style|wxNO_BORDER, wxDefaultValidator, name))
1e6d9499
JS
137 return FALSE;
138
a756f210 139 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
f60d0f94 140
1e6d9499
JS
141 SetTabView(new wxNotebookTabView(this));
142
143 return TRUE;
144}
145
146// dtor
147wxNotebook::~wxNotebook()
148{
149 delete m_tabView;
150}
151
152// ----------------------------------------------------------------------------
153// wxNotebook accessors
154// ----------------------------------------------------------------------------
1e6d9499
JS
155int wxNotebook::GetRowCount() const
156{
157 // TODO
158 return 0;
159}
160
15aad3b9 161int wxNotebook::SetSelection(size_t nPage)
1e6d9499 162{
1e6d9499
JS
163 wxASSERT( IS_VALID_PAGE(nPage) );
164
aeab10d0
JS
165#if defined (__WIN16__)
166 m_tabView->SetTabSelection(nPage);
167#else
1e6d9499
JS
168 wxNotebookPage* pPage = GetPage(nPage);
169
170 m_tabView->SetTabSelection((int) (long) pPage);
aeab10d0 171#endif
1e6d9499
JS
172 // TODO
173 return 0;
174}
175
45f22d48 176#if 0
1e6d9499
JS
177void wxNotebook::AdvanceSelection(bool bForward)
178{
179 int nSel = GetSelection();
180 int nMax = GetPageCount() - 1;
181 if ( bForward )
182 SetSelection(nSel == nMax ? 0 : nSel + 1);
183 else
184 SetSelection(nSel == 0 ? nMax : nSel - 1);
185}
45f22d48 186#endif
1e6d9499 187
15aad3b9 188bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
1e6d9499
JS
189{
190 wxASSERT( IS_VALID_PAGE(nPage) );
aeab10d0
JS
191#if defined (__WIN16__)
192 m_tabView->SetTabText(nPage, strText);
193 Refresh();
194 return TRUE;
195#else
1e6d9499
JS
196 wxNotebookPage* page = GetPage(nPage);
197 if (page)
198 {
199 m_tabView->SetTabText((int) (long) page, strText);
200 Refresh();
201 return TRUE;
202 }
aeab10d0 203#endif
1e6d9499
JS
204 return FALSE;
205}
206
15aad3b9 207wxString wxNotebook::GetPageText(size_t nPage) const
1e6d9499
JS
208{
209 wxASSERT( IS_VALID_PAGE(nPage) );
210
aeab10d0
JS
211#if defined (__WIN16__)
212 return m_tabView->GetTabText(nPage);
213#else
1e6d9499
JS
214 wxNotebookPage* page = ((wxNotebook*)this)->GetPage(nPage);
215 if (page)
216 return m_tabView->GetTabText((int) (long) page);
217 else
218 return wxEmptyString;
aeab10d0 219#endif
1e6d9499
JS
220}
221
15aad3b9 222int wxNotebook::GetPageImage(size_t nPage) const
1e6d9499
JS
223{
224 wxASSERT( IS_VALID_PAGE(nPage) );
225
226 // TODO
227 return 0;
228}
229
15aad3b9 230bool wxNotebook::SetPageImage(size_t nPage, int nImage)
1e6d9499
JS
231{
232 wxASSERT( IS_VALID_PAGE(nPage) );
233
234 // TODO
235 return FALSE;
236}
237
9806a47c
JS
238// set the size (the same for all pages)
239void wxNotebook::SetPageSize(const wxSize& size)
240{
241 // TODO
242}
243
244// set the padding between tabs (in pixels)
245void wxNotebook::SetPadding(const wxSize& padding)
246{
247 // TODO
248}
249
250// set the size of the tabs for wxNB_FIXEDWIDTH controls
251void wxNotebook::SetTabSize(const wxSize& sz)
252{
253 // TODO
254}
255
1e6d9499
JS
256// ----------------------------------------------------------------------------
257// wxNotebook operations
258// ----------------------------------------------------------------------------
259
260// remove one page from the notebook and delete it
15aad3b9 261bool wxNotebook::DeletePage(size_t nPage)
1e6d9499
JS
262{
263 wxCHECK( IS_VALID_PAGE(nPage), FALSE );
264
265 if (m_nSelection != -1)
266 {
45f22d48
JS
267 m_pages[m_nSelection]->Show(FALSE);
268 m_pages[m_nSelection]->Lower();
1e6d9499
JS
269 }
270
271 wxNotebookPage* pPage = GetPage(nPage);
aeab10d0
JS
272#if defined (__WIN16__)
273 m_tabView->RemoveTab(nPage);
274#else
1e6d9499 275 m_tabView->RemoveTab((int) (long) pPage);
aeab10d0 276#endif
1e6d9499 277
45f22d48
JS
278 m_pages.Remove(pPage);
279 delete pPage;
1e6d9499 280
45f22d48 281 if (m_pages.GetCount() == 0)
1e6d9499
JS
282 {
283 m_nSelection = -1;
284 m_tabView->SetTabSelection(-1, FALSE);
285 }
286 else if (m_nSelection > -1)
287 {
288 m_nSelection = -1;
aeab10d0
JS
289#if defined (__WIN16__)
290 m_tabView->SetTabSelection(0, FALSE);
291#else
1e6d9499 292 m_tabView->SetTabSelection((int) (long) GetPage(0), FALSE);
aeab10d0 293#endif
1e6d9499
JS
294 if (m_nSelection != 0)
295 ChangePage(-1, 0);
296 }
297
298 RefreshLayout(FALSE);
299
300 return TRUE;
301}
302
303bool wxNotebook::DeletePage(wxNotebookPage* page)
304{
305 int pagePos = FindPagePosition(page);
306 if (pagePos > -1)
307 return DeletePage(pagePos);
308 else
309 return FALSE;
310}
311
15aad3b9 312bool wxNotebook::RemovePage(size_t nPage)
64b090c7
MB
313{
314 return DoRemovePage(nPage) != NULL;
315}
316
317// remove one page from the notebook
318wxWindow* wxNotebook::DoRemovePage(size_t nPage)
1e6d9499
JS
319{
320 wxCHECK( IS_VALID_PAGE(nPage), FALSE );
321
45f22d48
JS
322 m_pages[nPage]->Show(FALSE);
323 // m_pages[nPage]->Lower();
1e6d9499
JS
324
325 wxNotebookPage* pPage = GetPage(nPage);
aeab10d0
JS
326#if defined (__WIN16__)
327 m_tabView->RemoveTab(nPage);
328#else
1e6d9499 329 m_tabView->RemoveTab((int) (long) pPage);
aeab10d0 330#endif
1e6d9499 331
45f22d48 332 m_pages.Remove(pPage);
1e6d9499 333
45f22d48 334 if (m_pages.GetCount() == 0)
1e6d9499
JS
335 {
336 m_nSelection = -1;
337 m_tabView->SetTabSelection(-1, TRUE);
338 }
339 else if (m_nSelection > -1)
340 {
341 // Only change the selection if the page we
342 // deleted was the selection.
30d2b71d 343 if (nPage == (size_t)m_nSelection)
1e6d9499
JS
344 {
345 m_nSelection = -1;
346 // Select the first tab. Generates a ChangePage.
30d2b71d 347 m_tabView->SetTabSelection(0, TRUE);
1e6d9499
JS
348 }
349 else
350 {
351 // We must adjust which tab we think is selected.
352 // If greater than the page we deleted, it must be moved down
353 // a notch.
30d2b71d 354 if (size_t(m_nSelection) > nPage)
1e6d9499
JS
355 m_nSelection -- ;
356 }
357 }
358
359 RefreshLayout(FALSE);
360
64b090c7 361 return pPage;
1e6d9499
JS
362}
363
364bool wxNotebook::RemovePage(wxNotebookPage* page)
365{
366 int pagePos = FindPagePosition(page);
367 if (pagePos > -1)
368 return RemovePage(pagePos);
369 else
370 return FALSE;
371}
372
373// Find the position of the wxNotebookPage, -1 if not found.
374int wxNotebook::FindPagePosition(wxNotebookPage* page) const
375{
15aad3b9
VZ
376 size_t nPageCount = GetPageCount();
377 size_t nPage;
1e6d9499 378 for ( nPage = 0; nPage < nPageCount; nPage++ )
45f22d48 379 if (m_pages[nPage] == page)
1e6d9499
JS
380 return nPage;
381 return -1;
382}
383
384// remove all pages
385bool wxNotebook::DeleteAllPages()
386{
387 m_tabView->ClearTabs(TRUE);
388
15aad3b9
VZ
389 size_t nPageCount = GetPageCount();
390 size_t nPage;
1e6d9499 391 for ( nPage = 0; nPage < nPageCount; nPage++ )
45f22d48 392 delete m_pages[nPage];
1e6d9499 393
45f22d48 394 m_pages.Clear();
1e6d9499
JS
395
396 return TRUE;
397}
398
1e6d9499 399// same as AddPage() but does it at given position
15aad3b9 400bool wxNotebook::InsertPage(size_t nPage,
1e6d9499
JS
401 wxNotebookPage *pPage,
402 const wxString& strText,
403 bool bSelect,
404 int imageId)
405{
406 wxASSERT( pPage != NULL );
407 wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
408
aeab10d0
JS
409// For 16 bit integers (tabs limited to 32768)
410#if defined (__WIN16__)
411 m_tabView->AddTab(nPage, strText);
412#else
1e6d9499 413 m_tabView->AddTab((int) (long) pPage, strText);
aeab10d0 414#endif
1e6d9499
JS
415 if (!bSelect)
416 pPage->Show(FALSE);
417
418 // save the pointer to the page
45f22d48 419 m_pages.Insert(pPage, nPage);
1e6d9499
JS
420
421 if (bSelect)
422 {
423 // This will cause ChangePage to be called, via OnSelPage
aeab10d0
JS
424#if defined (__WIN16__)
425 m_tabView->SetTabSelection(nPage, TRUE);
426#else
1e6d9499 427 m_tabView->SetTabSelection((int) (long) pPage, TRUE);
aeab10d0 428#endif
1e6d9499
JS
429 }
430
431 // some page must be selected: either this one or the first one if there is
432 // still no selection
433 if ( m_nSelection == -1 )
434 ChangePage(-1, 0);
435
436 RefreshLayout(FALSE);
437
438 return TRUE;
439}
440
441// ----------------------------------------------------------------------------
442// wxNotebook callbacks
443// ----------------------------------------------------------------------------
444
445// @@@ OnSize() is used for setting the font when it's called for the first
446// time because doing it in ::Create() doesn't work (for unknown reasons)
447void wxNotebook::OnSize(wxSizeEvent& event)
448{
449 static bool s_bFirstTime = TRUE;
450 if ( s_bFirstTime ) {
451 // TODO: any first-time-size processing.
452 s_bFirstTime = FALSE;
453 }
454
455 RefreshLayout();
456
457 // Processing continues to next OnSize
458 event.Skip();
459}
460
461// This was supposed to cure the non-display of the notebook
462// until the user resizes the window.
463// What's going on?
5180055b 464void wxNotebook::OnInternalIdle()
1e6d9499 465{
5180055b
JS
466 wxWindow::OnInternalIdle();
467
468#if 0
1e6d9499
JS
469 static bool s_bFirstTime = TRUE;
470 if ( s_bFirstTime ) {
471 /*
472 wxSize sz(GetSize());
473 sz.x ++;
474 SetSize(sz);
475 sz.x --;
476 SetSize(sz);
477 */
478
479 /*
480 wxSize sz(GetSize());
481 wxSizeEvent sizeEvent(sz, GetId());
482 sizeEvent.SetEventObject(this);
483 GetEventHandler()->ProcessEvent(sizeEvent);
484 Refresh();
485 */
486 s_bFirstTime = FALSE;
487 }
5180055b 488#endif
1e6d9499
JS
489}
490
491// Implementation: calculate the layout of the view rect
492// and resize the children if required
493bool wxNotebook::RefreshLayout(bool force)
494{
495 if (m_tabView)
496 {
497 wxRect oldRect = m_tabView->GetViewRect();
498
499 int cw, ch;
500 GetClientSize(& cw, & ch);
501
502 int tabHeight = m_tabView->GetTotalTabHeight();
503 wxRect rect;
504 rect.x = 4;
505 rect.y = tabHeight + 4;
506 rect.width = cw - 8;
507 rect.height = ch - 4 - rect.y ;
2e4df4bf 508
1e6d9499
JS
509 m_tabView->SetViewRect(rect);
510
25889d3c 511 m_tabView->LayoutTabs();
1e6d9499
JS
512
513 // Need to do it a 2nd time to get the tab height with
514 // the new view width, since changing the view width changes the
515 // tab layout.
516 tabHeight = m_tabView->GetTotalTabHeight();
517 rect.x = 4;
518 rect.y = tabHeight + 4;
519 rect.width = cw - 8;
520 rect.height = ch - 4 - rect.y ;
2e4df4bf 521
1e6d9499
JS
522 m_tabView->SetViewRect(rect);
523
25889d3c 524 m_tabView->LayoutTabs();
1e6d9499
JS
525
526 if (!force && (rect == oldRect))
527 return FALSE;
528
529 // fit the notebook page to the tab control's display area
530
15aad3b9
VZ
531 size_t nCount = m_pages.Count();
532 for ( size_t nPage = 0; nPage < nCount; nPage++ ) {
45f22d48 533 wxNotebookPage *pPage = m_pages[nPage];
10d1f413 534 wxRect clientRect = GetAvailableClientSize();
1e6d9499
JS
535 if (pPage->IsShown())
536 {
1e6d9499
JS
537 pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
538 if ( pPage->GetAutoLayout() )
539 pPage->Layout();
540 }
541 }
542 Refresh();
543 }
544 return TRUE;
545}
546
547void wxNotebook::OnSelChange(wxNotebookEvent& event)
548{
549 // is it our tab control?
550 if ( event.GetEventObject() == this )
551 {
552 if (event.GetSelection() != m_nSelection)
553 ChangePage(event.GetOldSelection(), event.GetSelection());
554 }
555
556 // we want to give others a chance to process this message as well
557 event.Skip();
558}
559
560void wxNotebook::OnSetFocus(wxFocusEvent& event)
561{
562 // set focus to the currently selected page if any
563 if ( m_nSelection != -1 )
45f22d48 564 m_pages[m_nSelection]->SetFocus();
1e6d9499
JS
565
566 event.Skip();
567}
568
569void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
570{
571 if ( event.IsWindowChange() ) {
572 // change pages
573 AdvanceSelection(event.GetDirection());
574 }
575 else {
576 // pass to the parent
577 if ( GetParent() ) {
578 event.SetCurrentFocus(this);
579 GetParent()->ProcessEvent(event);
580 }
581 }
582}
583
584// ----------------------------------------------------------------------------
585// wxNotebook base class virtuals
586// ----------------------------------------------------------------------------
587
588// override these 2 functions to do nothing: everything is done in OnSize
589
590void wxNotebook::SetConstraintSizes(bool /* recurse */)
591{
592 // don't set the sizes of the pages - their correct size is not yet known
593 wxControl::SetConstraintSizes(FALSE);
594}
595
596bool wxNotebook::DoPhase(int /* nPhase */)
597{
598 return TRUE;
599}
600
af111fc3 601void wxNotebook::Command(wxCommandEvent& WXUNUSED(event))
1e6d9499 602{
b0c0a393 603 wxFAIL_MSG(wxT("wxNotebook::Command not implemented"));
1e6d9499
JS
604}
605
606// ----------------------------------------------------------------------------
607// wxNotebook helper functions
608// ----------------------------------------------------------------------------
609
610// hide the currently active panel and show the new one
611void wxNotebook::ChangePage(int nOldSel, int nSel)
612{
613 // cout << "ChangePage: " << nOldSel << ", " << nSel << "\n";
614 wxASSERT( nOldSel != nSel ); // impossible
615
616 if ( nOldSel != -1 ) {
45f22d48
JS
617 m_pages[nOldSel]->Show(FALSE);
618 m_pages[nOldSel]->Lower();
1e6d9499
JS
619 }
620
45f22d48 621 wxNotebookPage *pPage = m_pages[nSel];
1e6d9499
JS
622
623 wxRect clientRect = GetAvailableClientSize();
624 pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
625
f6bcfd97
BP
626 Refresh();
627
1e6d9499
JS
628 pPage->Show(TRUE);
629 pPage->Raise();
630 pPage->SetFocus();
631
1e6d9499
JS
632 m_nSelection = nSel;
633}
634
635void wxNotebook::OnMouseEvent(wxMouseEvent& event)
636{
637 if (m_tabView)
638 m_tabView->OnEvent(event);
639}
640
641void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event) )
642{
643 wxPaintDC dc(this);
644 if (m_tabView)
645 m_tabView->Draw(dc);
646}
647
648wxRect wxNotebook::GetAvailableClientSize()
649{
650 int cw, ch;
651 GetClientSize(& cw, & ch);
652
653 int tabHeight = m_tabView->GetTotalTabHeight();
654
655 // TODO: these margins should be configurable.
656 wxRect rect;
657 rect.x = 6;
658 rect.y = tabHeight + 6;
659 rect.width = cw - 12;
660 rect.height = ch - 4 - rect.y ;
661
662 return rect;
663}
664
665/*
666 * wxNotebookTabView
667 */
2e4df4bf 668
1e6d9499
JS
669IMPLEMENT_CLASS(wxNotebookTabView, wxTabView)
670
671wxNotebookTabView::wxNotebookTabView(wxNotebook *notebook, long style): wxTabView(style)
672{
673 m_notebook = notebook;
674
675 m_notebook->SetTabView(this);
676
677 SetWindow(m_notebook);
678}
679
680wxNotebookTabView::~wxNotebookTabView(void)
681{
682}
683
684// Called when a tab is activated
685void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
686{
687 if (!m_notebook)
688 return;
689
690 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
691
aeab10d0
JS
692#if defined (__WIN16__)
693 int activatePos = activateId;
694 int deactivatePos = deactivateId;
695#else
1e6d9499
JS
696 // Translate from wxTabView's ids (which aren't position-dependent)
697 // to wxNotebook's (which are).
698 wxNotebookPage* pActive = (wxNotebookPage*) activateId;
699 wxNotebookPage* pDeactive = (wxNotebookPage*) deactivateId;
700
701 int activatePos = m_notebook->FindPagePosition(pActive);
702 int deactivatePos = m_notebook->FindPagePosition(pDeactive);
703
aeab10d0 704#endif
1e6d9499
JS
705 event.SetEventObject(m_notebook);
706 event.SetSelection(activatePos);
707 event.SetOldSelection(deactivatePos);
708 m_notebook->GetEventHandler()->ProcessEvent(event);
709}
710
1c507b17
JS
711// Allows Vetoing
712bool wxNotebookTabView::OnTabPreActivate(int activateId, int deactivateId)
713{
714 bool retval = TRUE;
715
716 if (m_notebook)
717 {
718 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId());
719
720#if defined (__WIN16__)
721 int activatePos = activateId;
722 int deactivatePos = deactivateId;
723#else
724 // Translate from wxTabView's ids (which aren't position-dependent)
725 // to wxNotebook's (which are).
726 wxNotebookPage* pActive = (wxNotebookPage*) activateId;
727 wxNotebookPage* pDeactive = (wxNotebookPage*) deactivateId;
728
729 int activatePos = m_notebook->FindPagePosition(pActive);
730 int deactivatePos = m_notebook->FindPagePosition(pDeactive);
731
732#endif
733 event.SetEventObject(m_notebook);
734 event.SetSelection(activatePos);
735 event.SetOldSelection(deactivatePos);
736 if (m_notebook->GetEventHandler()->ProcessEvent(event))
737 {
738 retval = event.IsAllowed();
739 }
740 }
741 return retval;
742}
1e6d9499 743