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