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