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