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