]> git.saurik.com Git - wxWidgets.git/blob - src/mac/notebmac.cpp
don't call SelectObject() twice in SetBrush() nor SetFont() neither
[wxWidgets.git] / src / mac / notebmac.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: notebook.cpp
3 // Purpose: implementation of wxNotebook
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "notebook.h"
14 #endif
15
16 // ============================================================================
17 // declarations
18 // ============================================================================
19
20 // ----------------------------------------------------------------------------
21 // headers
22 // ----------------------------------------------------------------------------
23 #include "wx/app.h"
24 #include "wx/string.h"
25 #include "wx/log.h"
26 #include "wx/imaglist.h"
27 #include "wx/image.h"
28 #include "wx/notebook.h"
29 #include "wx/mac/uma.h"
30 // ----------------------------------------------------------------------------
31 // macros
32 // ----------------------------------------------------------------------------
33
34 // check that the page index is valid
35 #define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
36
37
38 // ----------------------------------------------------------------------------
39 // event table
40 // ----------------------------------------------------------------------------
41
42 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
43 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
44
45 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
46 EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
47 EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
48
49 EVT_SIZE(wxNotebook::OnSize)
50 EVT_SET_FOCUS(wxNotebook::OnSetFocus)
51 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
52 END_EVENT_TABLE()
53
54 IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
55 IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
56
57 // ============================================================================
58 // implementation
59 // ============================================================================
60
61 // The Appearance Manager docs show using tab controls in either edge to edge
62 // mode, or inset. I think edge to edge conforms better to the other ports,
63 // and inset mode is better accomplished with space around the wxNotebook rather
64 // than within it. --Robin
65
66 // CS : had to switch off tight spacing due to 10.3 problems
67 #define wxMAC_EDGE_TO_EDGE 0
68
69 static inline int wxMacTabMargin(long nbStyle, long side)
70 {
71 static int tabMargin = -1;
72 static int otherMargin = -1;
73
74 if ( tabMargin == -1)
75 {
76 if ( UMAHasAquaLayout() )
77 {
78 tabMargin = 26; // From Appearance Manager docs for small tab control dimensions
79 #if wxMAC_EDGE_TO_EDGE
80 otherMargin = 0;
81 #else
82 otherMargin = 20;
83 #endif
84 }
85 else
86 {
87 tabMargin = 30;
88 #if wxMAC_EDGE_TO_EDGE
89 otherMargin = 0;
90 #else
91 otherMargin = 16;
92 #endif
93 }
94 }
95
96 // If the style matches the side asked for then return the tab margin,
97 // but we have to special case wxNB_TOP since it is zero...
98 if ( side == wxNB_TOP)
99 {
100 if ( nbStyle != 0 && nbStyle & (wxNB_LEFT|wxNB_RIGHT|wxNB_BOTTOM))
101 {
102 return otherMargin;
103 }
104 else
105 {
106 return tabMargin;
107 }
108 }
109 else if ( nbStyle & side)
110 return tabMargin;
111 else
112 return otherMargin;
113 }
114
115 static inline int wxMacTabLeftMargin(long style)
116 {
117 return wxMacTabMargin(style, wxNB_LEFT);
118 }
119
120 static inline int wxMacTabTopMargin(long style)
121 {
122 return wxMacTabMargin(style, wxNB_TOP);
123 }
124
125 static inline int wxMacTabRightMargin(long style)
126 {
127 return wxMacTabMargin(style, wxNB_RIGHT);
128 }
129
130 static inline int wxMacTabBottomMargin(long style)
131 {
132 return wxMacTabMargin(style, wxNB_BOTTOM);
133 }
134
135 // ----------------------------------------------------------------------------
136 // wxNotebook construction
137 // ----------------------------------------------------------------------------
138
139 // common part of all ctors
140 void wxNotebook::Init()
141 {
142 if ( UMAHasAquaLayout() )
143 {
144 // Should these depend on wxMAC_EDGE_TO_EDGE too?
145 m_macHorizontalBorder = 7;
146 m_macVerticalBorder = 8;
147 }
148
149 m_nSelection = -1;
150 }
151
152 // default for dynamic class
153 wxNotebook::wxNotebook()
154 {
155 Init();
156 }
157
158 // the same arguments as for wxControl
159 wxNotebook::wxNotebook(wxWindow *parent,
160 wxWindowID id,
161 const wxPoint& pos,
162 const wxSize& size,
163 long style,
164 const wxString& name)
165 {
166 Init();
167
168 Create(parent, id, pos, size, style, name);
169 }
170
171 // Create() function
172 bool wxNotebook::Create(wxWindow *parent,
173 wxWindowID id,
174 const wxPoint& pos,
175 const wxSize& size,
176 long style,
177 const wxString& name)
178 {
179 if ( !wxNotebookBase::Create(parent, id, pos, size, style, name) )
180 return false;
181
182 Rect bounds ;
183 Str255 title ;
184
185 MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
186
187 int tabstyle = kControlTabSmallNorthProc ;
188 if ( HasFlag(wxNB_LEFT) )
189 tabstyle = kControlTabSmallWestProc ;
190 else if ( HasFlag( wxNB_RIGHT ) )
191 tabstyle = kControlTabSmallEastProc ;
192 else if ( HasFlag( wxNB_BOTTOM ) )
193 tabstyle = kControlTabSmallSouthProc ;
194
195
196 m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
197 tabstyle , (long) this ) ;
198
199 MacPostControlCreate() ;
200 return TRUE ;
201 }
202
203 // dtor
204 wxNotebook::~wxNotebook()
205 {
206 }
207
208 wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
209 {
210 wxSize sizeTotal = sizePage;
211
212 int major,minor;
213 wxGetOsVersion( &major, &minor );
214
215 // Mac has large notebook borders. Aqua even more so.
216
217 if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
218 {
219 sizeTotal.x += 90;
220
221 if (major >= 10)
222 sizeTotal.y += 28;
223 else
224 sizeTotal.y += 20;
225 }
226 else
227 {
228 if (major >= 10)
229 {
230 sizeTotal.x += 34;
231 sizeTotal.y += 46;
232 }
233 else
234 {
235 sizeTotal.x += 22;
236 sizeTotal.y += 44;
237 }
238 }
239
240 return sizeTotal;
241 }
242
243 // ----------------------------------------------------------------------------
244 // wxNotebook accessors
245 // ----------------------------------------------------------------------------
246
247 void wxNotebook::SetPadding(const wxSize& padding)
248 {
249 wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
250 }
251
252 void wxNotebook::SetTabSize(const wxSize& sz)
253 {
254 wxFAIL_MSG( wxT("wxNotebook::SetTabSize not implemented") );
255 }
256
257 void wxNotebook::SetPageSize(const wxSize& size)
258 {
259 wxFAIL_MSG( wxT("wxNotebook::SetPageSize not implemented") );
260 }
261
262 int wxNotebook::SetSelection(size_t nPage)
263 {
264 wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") );
265
266 if ( int(nPage) != m_nSelection )
267 {
268 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId);
269 event.SetSelection(nPage);
270 event.SetOldSelection(m_nSelection);
271 event.SetEventObject(this);
272 if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
273 {
274 // program allows the page change
275 event.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
276 (void)GetEventHandler()->ProcessEvent(event);
277
278 ChangePage(m_nSelection, nPage);
279 }
280 }
281
282 return m_nSelection;
283 }
284
285 bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
286 {
287 wxASSERT( IS_VALID_PAGE(nPage) );
288
289 wxNotebookPage *page = m_pages[nPage];
290 page->SetLabel(strText);
291 MacSetupTabs();
292
293 return true;
294 }
295
296 wxString wxNotebook::GetPageText(size_t nPage) const
297 {
298 wxASSERT( IS_VALID_PAGE(nPage) );
299
300 wxNotebookPage *page = m_pages[nPage];
301 return page->GetLabel();
302 }
303
304 int wxNotebook::GetPageImage(size_t nPage) const
305 {
306 wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") );
307
308 return m_images[nPage];
309 }
310
311 bool wxNotebook::SetPageImage(size_t nPage, int nImage)
312 {
313 wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
314
315 wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
316 _T("invalid image index in SetPageImage()") );
317
318 if ( nImage != m_images[nPage] )
319 {
320 // if the item didn't have an icon before or, on the contrary, did have
321 // it but has lost it now, its size will change - but if the icon just
322 // changes, it won't
323 m_images[nPage] = nImage;
324
325 MacSetupTabs() ;
326 }
327
328 return TRUE;
329 }
330
331 // ----------------------------------------------------------------------------
332 // wxNotebook operations
333 // ----------------------------------------------------------------------------
334
335 // remove one page from the notebook, without deleting the window
336 wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage)
337 {
338 wxCHECK( IS_VALID_PAGE(nPage), NULL );
339 wxNotebookPage* page = m_pages[nPage] ;
340 m_pages.RemoveAt(nPage);
341
342 MacSetupTabs();
343
344 if(m_nSelection >= (int)GetPageCount()) {
345 m_nSelection = GetPageCount() - 1;
346 }
347 if(m_nSelection >= 0) {
348 m_pages[m_nSelection]->Show(true);
349 }
350 return page;
351 }
352
353 // remove all pages
354 bool wxNotebook::DeleteAllPages()
355 {
356 WX_CLEAR_ARRAY(m_pages) ;
357 MacSetupTabs();
358 m_nSelection = -1 ;
359 return TRUE;
360 }
361
362
363 // same as AddPage() but does it at given position
364 bool wxNotebook::InsertPage(size_t nPage,
365 wxNotebookPage *pPage,
366 const wxString& strText,
367 bool bSelect,
368 int imageId)
369 {
370 if ( !wxNotebookBase::InsertPage(nPage, pPage, strText, bSelect, imageId) )
371 return false;
372
373 wxASSERT_MSG( pPage->GetParent() == this,
374 _T("notebook pages must have notebook as parent") );
375
376 // don't show pages by default (we'll need to adjust their size first)
377 pPage->Show( false ) ;
378
379 pPage->SetLabel(strText);
380
381 m_images.Insert(imageId, nPage);
382
383 MacSetupTabs();
384
385 int h, w;
386 GetSize(&w, &h);
387 pPage->SetSize(wxMacTabLeftMargin(GetWindowStyle()) + m_macHorizontalBorder,
388 wxMacTabTopMargin(GetWindowStyle()) + m_macVerticalBorder,
389 w - wxMacTabLeftMargin(GetWindowStyle()) - wxMacTabRightMargin(GetWindowStyle()) - 2*m_macHorizontalBorder,
390 h - wxMacTabTopMargin(GetWindowStyle()) - wxMacTabBottomMargin(GetWindowStyle()) - 2*m_macVerticalBorder);
391 if ( pPage->GetAutoLayout() ) {
392 pPage->Layout();
393 }
394
395
396 // now deal with the selection
397 // ---------------------------
398
399 // if the inserted page is before the selected one, we must update the
400 // index of the selected page
401
402 if ( int(nPage) <= m_nSelection )
403 {
404 m_nSelection++;
405 // while this still is the same page showing, we need to update the tabs
406 SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
407 }
408
409 // some page should be selected: either this one or the first one if there
410 // is still no selection
411 int selNew = -1;
412 if ( bSelect )
413 selNew = nPage;
414 else if ( m_nSelection == -1 )
415 selNew = 0;
416
417 if ( selNew != -1 )
418 SetSelection(selNew);
419
420 return true;
421 }
422
423 /* Added by Mark Newsam
424 * When a page is added or deleted to the notebook this function updates
425 * information held in the m_macControl so that it matches the order
426 * the user would expect.
427 */
428 void wxNotebook::MacSetupTabs()
429 {
430 SetControl32BitMaximum( (ControlHandle) m_macControl , GetPageCount() ) ;
431
432 wxNotebookPage *page;
433 ControlTabInfoRec info;
434
435 const size_t countPages = GetPageCount();
436 for(size_t ii = 0; ii < countPages; ii++)
437 {
438 page = m_pages[ii];
439 info.version = 0;
440 info.iconSuiteID = 0;
441 wxMacStringToPascal( page->GetLabel() , info.name ) ;
442
443 SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
444 sizeof( ControlTabInfoRec) , (char*) &info ) ;
445 SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
446 #if TARGET_CARBON
447 if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
448 {
449 // tab controls only support very specific types of images, therefore we are doing an odyssee
450 // accross the icon worlds (even Apple DTS did not find a shorter path)
451 // in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
452 // afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we
453 // unregister it) in case this will ever lead to having the same icon everywhere add some kind
454 // of static counter
455 const wxBitmap* bmap = GetImageList()->GetBitmap( GetPageImage(ii ) ) ;
456 if ( bmap )
457 {
458 wxBitmap scaledBitmap ;
459 if ( bmap->GetWidth() != 16 || bmap->GetHeight() != 16 )
460 {
461 scaledBitmap = wxBitmap( bmap->ConvertToImage().Scale(16,16) ) ;
462 bmap = &scaledBitmap ;
463 }
464 ControlButtonContentInfo info ;
465 wxMacCreateBitmapButton( &info , *bmap , kControlContentPictHandle) ;
466 IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
467 OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
468 wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ;
469 IconRef iconRef ;
470 err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1, iconFamily, &iconRef ) ;
471 wxASSERT_MSG( err == noErr , wxT("Error when adding bitmap") ) ;
472 info.contentType = kControlContentIconRef ;
473 info.u.iconRef = iconRef ;
474 SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
475 sizeof( info ), (Ptr)&info );
476 wxASSERT_MSG( err == noErr , wxT("Error when setting icon on tab") ) ;
477 if ( UMAGetSystemVersion() <= 0x1030 )
478 {
479 UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
480 }
481
482 ReleaseIconRef( iconRef ) ;
483 DisposeHandle( (Handle) iconFamily ) ;
484 }
485 }
486 #endif
487 }
488 Rect bounds;
489 GetControlBounds((ControlHandle)m_macControl, &bounds);
490 InvalWindowRect((WindowRef)MacGetRootWindow(), &bounds);
491 }
492
493 // ----------------------------------------------------------------------------
494 // wxNotebook callbacks
495 // ----------------------------------------------------------------------------
496
497 // @@@ OnSize() is used for setting the font when it's called for the first
498 // time because doing it in ::Create() doesn't work (for unknown reasons)
499 void wxNotebook::OnSize(wxSizeEvent& event)
500 {
501 // emulate page change (it's esp. important to do it first time because
502 // otherwise our page would stay invisible)
503 /*
504 int nSel = m_nSelection;
505 m_nSelection = -1;
506 SetSelection(nSel);
507 */
508
509 // fit the notebook page to the tab control's display area
510 int w, h;
511 GetSize(&w, &h);
512
513 unsigned int nCount = m_pages.Count();
514 for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
515 wxNotebookPage *pPage = m_pages[nPage];
516 pPage->SetSize(wxMacTabLeftMargin(GetWindowStyle()) + m_macHorizontalBorder,
517 wxMacTabTopMargin(GetWindowStyle()) + m_macVerticalBorder,
518 w - wxMacTabLeftMargin(GetWindowStyle()) - wxMacTabRightMargin(GetWindowStyle()) - 2*m_macHorizontalBorder,
519 h - wxMacTabTopMargin(GetWindowStyle()) - wxMacTabBottomMargin(GetWindowStyle()) - 2*m_macVerticalBorder);
520 if ( pPage->GetAutoLayout() ) {
521 pPage->Layout();
522 }
523 }
524
525 // Processing continues to next OnSize
526 event.Skip();
527 }
528
529 void wxNotebook::OnSelChange(wxNotebookEvent& event)
530 {
531 // is it our tab control?
532 if ( event.GetEventObject() == this )
533 ChangePage(event.GetOldSelection(), event.GetSelection());
534
535 // we want to give others a chance to process this message as well
536 event.Skip();
537 }
538
539 void wxNotebook::OnSetFocus(wxFocusEvent& event)
540 {
541 // set focus to the currently selected page if any
542 if ( m_nSelection != -1 )
543 m_pages[m_nSelection]->SetFocus();
544
545 event.Skip();
546 }
547
548 void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
549 {
550 if ( event.IsWindowChange() ) {
551 // change pages
552 AdvanceSelection(event.GetDirection());
553 }
554 else {
555 // we get this event in 2 cases
556 //
557 // a) one of our pages might have generated it because the user TABbed
558 // out from it in which case we should propagate the event upwards and
559 // our parent will take care of setting the focus to prev/next sibling
560 //
561 // or
562 //
563 // b) the parent panel wants to give the focus to us so that we
564 // forward it to our selected page. We can't deal with this in
565 // OnSetFocus() because we don't know which direction the focus came
566 // from in this case and so can't choose between setting the focus to
567 // first or last panel child
568 wxWindow *parent = GetParent();
569 // the cast is here to fic a GCC ICE
570 if ( ((wxWindow*)event.GetEventObject()) == parent )
571 {
572 // no, it doesn't come from child, case (b): forward to a page
573 if ( m_nSelection != -1 )
574 {
575 // so that the page knows that the event comes from it's parent
576 // and is being propagated downwards
577 event.SetEventObject(this);
578
579 wxWindow *page = m_pages[m_nSelection];
580 if ( !page->GetEventHandler()->ProcessEvent(event) )
581 {
582 page->SetFocus();
583 }
584 //else: page manages focus inside it itself
585 }
586 else
587 {
588 // we have no pages - still have to give focus to _something_
589 SetFocus();
590 }
591 }
592 else
593 {
594 // it comes from our child, case (a), pass to the parent
595 if ( parent ) {
596 event.SetCurrentFocus(this);
597 parent->GetEventHandler()->ProcessEvent(event);
598 }
599 }
600 }
601 }
602
603 // ----------------------------------------------------------------------------
604 // wxNotebook base class virtuals
605 // ----------------------------------------------------------------------------
606
607 #if wxUSE_CONSTRAINTS
608
609 // override these 2 functions to do nothing: everything is done in OnSize
610
611 void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse))
612 {
613 // don't set the sizes of the pages - their correct size is not yet known
614 wxControl::SetConstraintSizes(FALSE);
615 }
616
617 bool wxNotebook::DoPhase(int WXUNUSED(nPhase))
618 {
619 return TRUE;
620 }
621
622 #endif // wxUSE_CONSTRAINTS
623
624 void wxNotebook::Command(wxCommandEvent& event)
625 {
626 wxFAIL_MSG(wxT("wxNotebook::Command not implemented"));
627 }
628
629 // ----------------------------------------------------------------------------
630 // wxNotebook helper functions
631 // ----------------------------------------------------------------------------
632
633 // hide the currently active panel and show the new one
634 void wxNotebook::ChangePage(int nOldSel, int nSel)
635 {
636 if ( nOldSel != -1 )
637 {
638 m_pages[nOldSel]->Show(FALSE);
639 }
640
641 if ( nSel != -1 )
642 {
643 wxNotebookPage *pPage = m_pages[nSel];
644 pPage->Show(TRUE);
645 pPage->SetFocus();
646 }
647
648 m_nSelection = nSel;
649 SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
650 }
651
652
653 void wxNotebook::OnMouse( wxMouseEvent &event )
654 {
655 if ( (ControlHandle) m_macControl == NULL )
656 {
657 event.Skip() ;
658 return ;
659 }
660
661 if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
662 {
663 int x = event.m_x ;
664 int y = event.m_y ;
665
666 MacClientToRootWindow( &x , &y ) ;
667
668 ControlHandle control ;
669 Point localwhere ;
670 SInt16 controlpart ;
671
672 localwhere.h = x ;
673 localwhere.v = y ;
674
675 short modifiers = 0;
676
677 if ( !event.m_leftDown && !event.m_rightDown )
678 modifiers |= btnState ;
679
680 if ( event.m_shiftDown )
681 modifiers |= shiftKey ;
682
683 if ( event.m_controlDown )
684 modifiers |= controlKey ;
685
686 if ( event.m_altDown )
687 modifiers |= optionKey ;
688
689 if ( event.m_metaDown )
690 modifiers |= cmdKey ;
691
692 control = (ControlHandle) m_macControl ;
693 if ( control && ::IsControlActive( control ) )
694 {
695 {
696 wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
697 ::GetControl32BitValue(control) - 1, m_nSelection);
698 changing.SetEventObject(this);
699 GetEventHandler()->ProcessEvent(changing);
700
701 if(changing.IsAllowed())
702 {
703 controlpart = ::HandleControlClick(control, localwhere, modifiers,
704 (ControlActionUPP) -1);
705 wxTheApp->s_lastMouseDown = 0 ;
706
707 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
708 ::GetControl32BitValue(control) - 1, m_nSelection);
709 event.SetEventObject(this);
710
711 GetEventHandler()->ProcessEvent(event);
712 }
713 }
714 }
715 }
716 }
717
718
719 void wxNotebook::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
720 {
721 #if 0
722 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
723 event.SetEventObject(this);
724
725 ProcessEvent(event);
726 #endif
727 }
728