]> git.saurik.com Git - wxWidgets.git/blob - src/os2/notebook.cpp
Include wx/module.h according to precompiled headers of wx/wx.h (with other minor...
[wxWidgets.git] / src / os2 / notebook.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/os2/notebook.cpp
3 // Purpose: implementation of wxNotebook
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/12/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #if wxUSE_NOTEBOOK
16
17 #include "wx/notebook.h"
18
19 // wxWidgets
20 #ifndef WX_PRECOMP
21 #include "wx/app.h"
22 #include "wx/dcclient.h"
23 #include "wx/string.h"
24 #include "wx/settings.h"
25 #include "wx/log.h"
26 #include "wx/event.h"
27 #include "wx/control.h"
28 #endif // WX_PRECOMP
29
30 #include "wx/imaglist.h"
31
32 #include "wx/os2/private.h"
33
34 // ----------------------------------------------------------------------------
35 // macros
36 // ----------------------------------------------------------------------------
37
38 // check that the page index is valid
39 #define IS_VALID_PAGE(nPage) ( \
40 /* size_t is _always_ >= 0 */ \
41 /* ((nPage) >= 0) && */ \
42 ((nPage) < GetPageCount()) \
43 )
44
45 // hide the ugly cast
46 #define m_hWnd (HWND)GetHWND()
47
48 // ----------------------------------------------------------------------------
49 // constants
50 // ----------------------------------------------------------------------------
51
52 // ----------------------------------------------------------------------------
53 // event table
54 // ----------------------------------------------------------------------------
55
56 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
57 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
58
59 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
60 EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
61 EVT_SIZE(wxNotebook::OnSize)
62 EVT_SET_FOCUS(wxNotebook::OnSetFocus)
63 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
64 END_EVENT_TABLE()
65
66 IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
67 IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
68
69 // ============================================================================
70 // implementation
71 // ============================================================================
72
73 // ----------------------------------------------------------------------------
74 // wxNotebook construction
75 // ----------------------------------------------------------------------------
76
77 //
78 // Common part of all ctors
79 //
80 void wxNotebook::Init()
81 {
82 m_imageList = NULL;
83 m_nSelection = -1;
84 m_nTabSize = 0;
85 } // end of wxNotebook::Init
86
87 //
88 // Default for dynamic class
89 //
90 wxNotebook::wxNotebook()
91 {
92 Init();
93 } // end of wxNotebook::wxNotebook
94
95 //
96 // The same arguments as for wxControl
97 //
98 wxNotebook::wxNotebook(
99 wxWindow* pParent
100 , wxWindowID vId
101 , const wxPoint& rPos
102 , const wxSize& rSize
103 , long lStyle
104 , const wxString& rsName
105 )
106 {
107 Init();
108 Create( pParent
109 ,vId
110 ,rPos
111 ,rSize
112 ,lStyle
113 ,rsName
114 );
115 } // end of wxNotebook::wxNotebook
116
117 //
118 // Create() function
119 //
120 bool wxNotebook::Create( wxWindow* pParent,
121 wxWindowID vId,
122 const wxPoint& rPos,
123 const wxSize& rSize,
124 long lStyle,
125 const wxString& rsName )
126 {
127 if ( (lStyle & wxBK_ALIGN_MASK) == wxBK_DEFAULT )
128 lStyle |= wxBK_TOP;
129 //
130 // Base init
131 //
132 if (!CreateControl( pParent
133 ,vId
134 ,rPos
135 ,rSize
136 ,lStyle
137 ,wxDefaultValidator
138 ,rsName
139 ))
140 return false;
141
142 //
143 // Notebook, so explicitly specify 0 as last parameter
144 //
145 if (!OS2CreateControl( wxT("NOTEBOOK")
146 ,wxEmptyString
147 ,rPos
148 ,rSize
149 ,lStyle | wxTAB_TRAVERSAL
150 ))
151 return false;
152
153 SetBackgroundColour(wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)));
154 return true;
155 } // end of wxNotebook::Create
156
157 WXDWORD wxNotebook::OS2GetStyle (
158 long lStyle
159 , WXDWORD* pdwExstyle
160 ) const
161 {
162 WXDWORD dwTabStyle = wxControl::OS2GetStyle( lStyle
163 ,pdwExstyle
164 );
165
166 dwTabStyle |= WS_TABSTOP | BKS_SOLIDBIND | BKS_ROUNDEDTABS | BKS_TABTEXTCENTER | BKS_TABBEDDIALOG;
167
168 if (lStyle & wxBK_BOTTOM)
169 dwTabStyle |= BKS_MAJORTABBOTTOM | BKS_BACKPAGESBL;
170 else if (lStyle & wxBK_RIGHT)
171 dwTabStyle |= BKS_MAJORTABRIGHT | BKS_BACKPAGESBR;
172 else if (lStyle & wxBK_LEFT)
173 dwTabStyle |= BKS_MAJORTABLEFT | BKS_BACKPAGESTL;
174 else // default to top
175 dwTabStyle |= BKS_MAJORTABTOP | BKS_BACKPAGESTR;
176
177 //
178 // Ex style
179 //
180 if (pdwExstyle )
181 {
182 //
183 // Note that we never want to have the default WS_EX_CLIENTEDGE style
184 // as it looks too ugly for the notebooks
185 //
186 *pdwExstyle = 0;
187 }
188 return dwTabStyle;
189 } // end of wxNotebook::OS2GetStyle
190
191 // ----------------------------------------------------------------------------
192 // wxNotebook accessors
193 // ----------------------------------------------------------------------------
194
195 size_t wxNotebook::GetPageCount() const
196 {
197 //
198 // Consistency check
199 //
200 wxASSERT((int)m_pages.Count() == (int)::WinSendMsg(GetHWND(), BKM_QUERYPAGECOUNT, (MPARAM)0, (MPARAM)BKA_END));
201 return m_pages.Count();
202 } // end of wxNotebook::GetPageCount
203
204 int wxNotebook::GetRowCount() const
205 {
206 return (int)::WinSendMsg( GetHWND()
207 ,BKM_QUERYPAGECOUNT
208 ,(MPARAM)0
209 ,(MPARAM)BKA_MAJOR
210 );
211 } // end of wxNotebook::GetRowCount
212
213 int wxNotebook::SetSelection( size_t nPage )
214 {
215 wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("notebook page out of range") );
216
217 if (nPage != (size_t)m_nSelection)
218 {
219 wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
220 ,m_windowId
221 );
222
223 vEvent.SetSelection(nPage);
224 vEvent.SetOldSelection(m_nSelection);
225 vEvent.SetEventObject(this);
226 if (!GetEventHandler()->ProcessEvent(vEvent) || vEvent.IsAllowed())
227 {
228
229 //
230 // Program allows the page change
231 //
232 vEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED);
233 GetEventHandler()->ProcessEvent(vEvent);
234
235 ::WinSendMsg( GetHWND()
236 ,BKM_TURNTOPAGE
237 ,MPFROMLONG((ULONG)m_alPageId[nPage])
238 ,(MPARAM)0
239 );
240 }
241 }
242 m_nSelection = nPage;
243 return nPage;
244 } // end of wxNotebook::SetSelection
245
246 bool wxNotebook::SetPageText( size_t nPage,
247 const wxString& rsStrText )
248 {
249 wxCHECK_MSG( IS_VALID_PAGE(nPage), false, wxT("notebook page out of range") );
250 return (bool)::WinSendMsg( m_hWnd
251 ,BKM_SETTABTEXT
252 ,MPFROMLONG((ULONG)m_alPageId[nPage])
253 ,MPFROMP((PSZ)rsStrText.c_str())
254 );
255 } // end of wxNotebook::SetPageText
256
257 wxString wxNotebook::GetPageText ( size_t nPage ) const
258 {
259 BOOKTEXT vBookText;
260 wxChar zBuf[256];
261 wxString sStr;
262 ULONG ulRc;
263
264 wxCHECK_MSG( IS_VALID_PAGE(nPage), wxEmptyString, wxT("notebook page out of range") );
265
266 memset(&vBookText, '\0', sizeof(BOOKTEXT));
267 vBookText.textLen = 0; // This will get the length
268 ulRc = LONGFROMMR(::WinSendMsg( m_hWnd
269 ,BKM_QUERYTABTEXT
270 ,MPFROMLONG((ULONG)m_alPageId[nPage])
271 ,MPFROMP(&vBookText)
272 ));
273 if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS || ulRc == 0L)
274 {
275 if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS)
276 {
277 wxLogError(wxT("Invalid Page Id for page text querry."));
278 }
279 return wxEmptyString;
280 }
281 vBookText.textLen = ulRc + 1; // To get the null terminator
282 vBookText.pString = (char*)zBuf;
283
284 //
285 // Now get the actual text
286 //
287 ulRc = LONGFROMMR(::WinSendMsg( m_hWnd
288 ,BKM_QUERYTABTEXT
289 ,MPFROMLONG((ULONG)m_alPageId[nPage])
290 ,MPFROMP(&vBookText)
291 ));
292 if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS || ulRc == 0L)
293 {
294 return wxEmptyString;
295 }
296 if (ulRc > 255L)
297 ulRc = 255L;
298
299 vBookText.pString[ulRc] = '\0';
300 sStr = (wxChar*)vBookText.pString;
301 return sStr;
302 } // end of wxNotebook::GetPageText
303
304 int wxNotebook::GetPageImage ( size_t nPage ) const
305 {
306 wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, wxT("notebook page out of range") );
307
308 //
309 // For OS/2 just return the page
310 //
311 return nPage;
312 } // end of wxNotebook::GetPageImage
313
314 bool wxNotebook::SetPageImage (
315 size_t nPage
316 , int nImage
317 )
318 {
319 wxBitmap vBitmap = (wxBitmap)m_imageList->GetBitmap(nImage);
320
321 return (bool)::WinSendMsg( GetHWND()
322 ,BKM_SETTABBITMAP
323 ,MPFROMLONG((ULONG)m_alPageId[nPage])
324 ,(MPARAM)wxFlipBmp(vBitmap.GetHBITMAP())
325 );
326 } // end of wxNotebook::SetPageImage
327
328 void wxNotebook::SetImageList (
329 wxImageList* pImageList
330 )
331 {
332 //
333 // Does not really do anything yet, but at least we need to
334 // update the base class.
335 //
336 wxNotebookBase::SetImageList(pImageList);
337 } // end of wxNotebook::SetImageList
338
339 // ----------------------------------------------------------------------------
340 // wxNotebook size settings
341 // ----------------------------------------------------------------------------
342 void wxNotebook::SetPageSize (
343 const wxSize& rSize
344 )
345 {
346 SetSize(rSize);
347 } // end of wxNotebook::SetPageSize
348
349 void wxNotebook::SetPadding (
350 const wxSize& WXUNUSED(rPadding)
351 )
352 {
353 //
354 // No padding in OS/2
355 //
356 } // end of wxNotebook::SetPadding
357
358 void wxNotebook::SetTabSize (
359 const wxSize& rSize
360 )
361 {
362 ::WinSendMsg( GetHWND()
363 ,BKM_SETDIMENSIONS
364 ,MPFROM2SHORT( (USHORT)rSize.x
365 ,(USHORT)rSize.y
366 )
367 ,(MPARAM)BKA_MAJORTAB
368 );
369 } // end of wxNotebook::SetTabSize
370
371 // ----------------------------------------------------------------------------
372 // wxNotebook operations
373 // ----------------------------------------------------------------------------
374
375 //
376 // Remove one page from the notebook, without deleting
377 //
378 wxNotebookPage* wxNotebook::DoRemovePage ( size_t nPage )
379 {
380 wxNotebookPage* pPageRemoved = wxNotebookBase::DoRemovePage(nPage);
381
382 if (!pPageRemoved)
383 return NULL;
384
385 ::WinSendMsg( GetHWND()
386 ,BKM_DELETEPAGE
387 ,MPFROMLONG((ULONG)m_alPageId[nPage])
388 ,(MPARAM)BKA_TAB
389 );
390 if (m_pages.IsEmpty())
391 {
392 //
393 // No selection any more, the notebook becamse empty
394 //
395 m_nSelection = -1;
396 }
397 else // notebook still not empty
398 {
399 //
400 // Change the selected page if it was deleted or became invalid
401 //
402 int nSelNew;
403
404 if (m_nSelection == (int)GetPageCount())
405 {
406 //
407 // Last page deleted, make the new last page the new selection
408 //
409 nSelNew = m_nSelection - 1;
410 }
411 else if (nPage <= (size_t)m_nSelection)
412 {
413 //
414 // We must show another page, even if it has the same index
415 //
416 nSelNew = m_nSelection;
417 }
418 else // nothing changes for the currently selected page
419 {
420 nSelNew = -1;
421
422 //
423 // We still must refresh the current page: this needs to be done
424 // for some unknown reason if the tab control shows the up-down
425 // control (i.e. when there are too many pages) -- otherwise after
426 // deleting a page nothing at all is shown
427 //
428 m_pages[m_nSelection]->Refresh();
429 }
430
431 if (nSelNew != -1)
432 {
433 //
434 // m_nSelection must be always valid so reset it before calling
435 // SetSelection()
436 //
437 m_nSelection = -1;
438 SetSelection(nSelNew);
439 }
440 }
441 return pPageRemoved;
442 } // end of wxNotebook::DoRemovePage
443
444 //
445 // Remove all pages
446 //
447 bool wxNotebook::DeleteAllPages()
448 {
449 int nPageCount = GetPageCount();
450 int nPage;
451
452 for (nPage = 0; nPage < nPageCount; nPage++)
453 delete m_pages[nPage];
454 m_pages.Clear();
455 ::WinSendMsg( GetHWND()
456 ,BKM_DELETEPAGE
457 ,(MPARAM)0
458 ,(MPARAM)BKA_ALL
459 );
460 m_nSelection = -1;
461
462 return true;
463 } // end of wxNotebook::DeleteAllPages
464
465 //
466 // Add a page to the notebook
467 //
468 bool wxNotebook::AddPage (
469 wxNotebookPage* pPage
470 , const wxString& rStrText
471 , bool bSelect
472 , int nImageId
473 )
474 {
475 return InsertPage( GetPageCount()
476 ,pPage
477 ,rStrText
478 ,bSelect
479 ,nImageId
480 );
481 } // end of wxNotebook::AddPage
482
483 //
484 // Same as AddPage() but does it at given position
485 //
486 bool wxNotebook::InsertPage ( size_t nPage,
487 wxNotebookPage* pPage,
488 const wxString& rsStrText,
489 bool bSelect,
490 int nImageId )
491 {
492 ULONG ulApiPage;
493
494 wxASSERT( pPage != NULL );
495 wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false );
496
497 //
498 // Under OS/2 we can only insert FIRST, LAST, NEXT or PREV. Requires
499 // two different calls to the API. Page 1 uses the BKA_FIRST. Subsequent
500 // pages use the previous page ID coupled with a BKA_NEXT call. Unlike
501 // Windows, OS/2 uses an internal Page ID to ID the pages.
502 //
503 // OS/2 also has a nice auto-size feature that automatically sizes the
504 // the attached window so we don't have to worry about the size of the
505 // window on the page.
506 //
507 if (nPage == 0)
508 {
509 ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND()
510 ,BKM_INSERTPAGE
511 ,(MPARAM)0
512 ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_FIRST)
513 ));
514 if (ulApiPage == 0L)
515 {
516 ERRORID vError;
517 wxString sError;
518
519 vError = ::WinGetLastError(vHabmain);
520 sError = wxPMErrorToStr(vError);
521 return false;
522 }
523 m_alPageId.Insert((long)ulApiPage, nPage);
524 }
525 else
526 {
527 ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND()
528 ,BKM_INSERTPAGE
529 ,MPFROMLONG((ULONG)m_alPageId[nPage - 1])
530 ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_NEXT)
531 ));
532 if (ulApiPage == 0L)
533 {
534 ERRORID vError;
535 wxString sError;
536
537 vError = ::WinGetLastError(vHabmain);
538 sError = wxPMErrorToStr(vError);
539 return false;
540 }
541 m_alPageId.Insert((long)ulApiPage, nPage);
542 }
543
544 //
545 // Associate a window handle with the page
546 //
547 if (pPage)
548 {
549 if (!::WinSendMsg( GetHWND()
550 ,BKM_SETPAGEWINDOWHWND
551 ,MPFROMLONG((ULONG)m_alPageId[nPage])
552 ,MPFROMHWND(pPage->GetHWND())
553 ))
554 return false;
555 }
556 //
557 // If the inserted page is before the selected one, we must update the
558 // index of the selected page
559 //
560 if (nPage <= (size_t)m_nSelection)
561 {
562 //
563 // One extra page added
564 //
565 m_nSelection++;
566 }
567
568 if (pPage)
569 {
570 //
571 // Save the pointer to the page
572 //
573 m_pages.Insert( pPage
574 ,nPage
575 );
576 }
577
578 //
579 // Now set TAB dimenstions
580 //
581
582 wxWindowDC vDC(this);
583 wxCoord nTextX;
584 wxCoord nTextY;
585
586 vDC.GetTextExtent(rsStrText, &nTextX, &nTextY);
587 nTextY *= 2;
588 nTextX = (wxCoord)(nTextX * 1.3);
589 if (nTextX > m_nTabSize)
590 {
591 m_nTabSize = nTextX;
592 ::WinSendMsg( GetHWND()
593 ,BKM_SETDIMENSIONS
594 ,MPFROM2SHORT((USHORT)m_nTabSize, (USHORT)nTextY)
595 ,(MPARAM)BKA_MAJORTAB
596 );
597 }
598 //
599 // Now set any TAB text
600 //
601 if (!rsStrText.empty())
602 {
603 if (!SetPageText( nPage
604 ,rsStrText
605 ))
606 return false;
607 }
608
609 //
610 // Now set any TAB bitmap image
611 //
612 if (nImageId != -1)
613 {
614 if (!SetPageImage( nPage
615 ,nImageId
616 ))
617 return false;
618 }
619
620 if (pPage)
621 {
622 //
623 // Don't show pages by default (we'll need to adjust their size first)
624 //
625 HWND hWnd = GetWinHwnd(pPage);
626
627 WinSetWindowULong( hWnd
628 ,QWL_STYLE
629 ,WinQueryWindowULong( hWnd
630 ,QWL_STYLE
631 ) & ~WS_VISIBLE
632 );
633
634 //
635 // This updates internal flag too - otherwise it will get out of sync
636 //
637 pPage->Show(false);
638 }
639
640 //
641 // Some page should be selected: either this one or the first one if there is
642 // still no selection
643 //
644 int nSelNew = -1;
645
646 if (bSelect)
647 nSelNew = nPage;
648 else if ( m_nSelection == -1 )
649 nSelNew = 0;
650
651 if (nSelNew != -1)
652 SetSelection(nSelNew);
653
654 InvalidateBestSize();
655
656 return true;
657 } // end of wxNotebook::InsertPage
658
659 // ----------------------------------------------------------------------------
660 // wxNotebook callbacks
661 // ----------------------------------------------------------------------------
662 void wxNotebook::OnSize(
663 wxSizeEvent& rEvent
664 )
665 {
666 rEvent.Skip();
667 } // end of wxNotebook::OnSize
668
669 void wxNotebook::OnSelChange (
670 wxNotebookEvent& rEvent
671 )
672 {
673 //
674 // Is it our tab control?
675 //
676 if (rEvent.GetEventObject() == this)
677 {
678 int nPageCount = GetPageCount();
679 int nSel;
680 ULONG ulOS2Sel = (ULONG)rEvent.GetOldSelection();
681 bool bFound = false;
682
683 for (nSel = 0; nSel < nPageCount; nSel++)
684 {
685 if (ulOS2Sel == (ULONG)m_alPageId[nSel])
686 {
687 bFound = true;
688 break;
689 }
690 }
691
692 if (!bFound)
693 return;
694
695 m_pages[nSel]->Show(false);
696
697 ulOS2Sel = (ULONG)rEvent.GetSelection();
698
699 bFound = false;
700
701 for (nSel = 0; nSel < nPageCount; nSel++)
702 {
703 if (ulOS2Sel == (ULONG)m_alPageId[nSel])
704 {
705 bFound = true;
706 break;
707 }
708 }
709
710 if (!bFound)
711 return;
712
713 wxNotebookPage* pPage = m_pages[nSel];
714
715 pPage->Show(true);
716 m_nSelection = nSel;
717 }
718
719 //
720 // We want to give others a chance to process this message as well
721 //
722 rEvent.Skip();
723 } // end of wxNotebook::OnSelChange
724
725 void wxNotebook::OnSetFocus (
726 wxFocusEvent& rEvent
727 )
728 {
729 //
730 // This function is only called when the focus is explicitly set (i.e. from
731 // the program) to the notebook - in this case we don't need the
732 // complicated OnNavigationKey() logic because the programmer knows better
733 // what [s]he wants
734 //
735 // set focus to the currently selected page if any
736 //
737 if (m_nSelection != -1)
738 m_pages[m_nSelection]->SetFocus();
739 rEvent.Skip();
740 } // end of wxNotebook::OnSetFocus
741
742 void wxNotebook::OnNavigationKey (
743 wxNavigationKeyEvent& rEvent
744 )
745 {
746 if (rEvent.IsWindowChange())
747 {
748 //
749 // Change pages
750 //
751 AdvanceSelection(rEvent.GetDirection());
752 }
753 else
754 {
755 //
756 // We get this event in 2 cases
757 //
758 // a) one of our pages might have generated it because the user TABbed
759 // out from it in which case we should propagate the event upwards and
760 // our parent will take care of setting the focus to prev/next sibling
761 //
762 // or
763 //
764 // b) the parent panel wants to give the focus to us so that we
765 // forward it to our selected page. We can't deal with this in
766 // OnSetFocus() because we don't know which direction the focus came
767 // from in this case and so can't choose between setting the focus to
768 // first or last panel child
769 //
770 wxWindow* pParent = GetParent();
771
772 if (rEvent.GetEventObject() == pParent)
773 {
774 //
775 // No, it doesn't come from child, case (b): forward to a page
776 //
777 if (m_nSelection != -1)
778 {
779 //
780 // So that the page knows that the event comes from it's parent
781 // and is being propagated downwards
782 //
783 rEvent.SetEventObject(this);
784
785 wxWindow* pPage = m_pages[m_nSelection];
786
787 if (!pPage->GetEventHandler()->ProcessEvent(rEvent))
788 {
789 pPage->SetFocus();
790 }
791 //else: page manages focus inside it itself
792 }
793 else
794 {
795 //
796 // We have no pages - still have to give focus to _something_
797 //
798 SetFocus();
799 }
800 }
801 else
802 {
803 //
804 // It comes from our child, case (a), pass to the parent
805 //
806 if (pParent)
807 {
808 rEvent.SetCurrentFocus(this);
809 pParent->GetEventHandler()->ProcessEvent(rEvent);
810 }
811 }
812 }
813 } // end of wxNotebook::OnNavigationKey
814
815 // ----------------------------------------------------------------------------
816 // wxNotebook base class virtuals
817 // ----------------------------------------------------------------------------
818
819 //
820 // Override these 2 functions to do nothing: everything is done in OnSize
821 //
822 void wxNotebook::SetConstraintSizes( bool WXUNUSED(bRecurse) )
823 {
824 //
825 // Don't set the sizes of the pages - their correct size is not yet known
826 //
827 wxControl::SetConstraintSizes(false);
828 } // end of wxNotebook::SetConstraintSizes
829
830 bool wxNotebook::DoPhase ( int WXUNUSED(nPhase) )
831 {
832 return true;
833 } // end of wxNotebook::DoPhase
834
835 // ----------------------------------------------------------------------------
836 // wxNotebook Windows message handlers
837 // ----------------------------------------------------------------------------
838 bool wxNotebook::OS2OnScroll ( int nOrientation,
839 WXWORD wSBCode,
840 WXWORD wPos,
841 WXHWND wControl )
842 {
843 //
844 // Don't generate EVT_SCROLLWIN events for the WM_SCROLLs coming from the
845 // up-down control
846 //
847 if (wControl)
848 return false;
849 return wxNotebookBase::OS2OnScroll( nOrientation
850 ,wSBCode
851 ,wPos
852 ,wControl
853 );
854 } // end of wxNotebook::OS2OnScroll
855
856 #endif // wxUSE_NOTEBOOK