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