]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/os2/notebook.cpp
Need to use the same instance handles
[wxWidgets.git] / src / os2 / notebook.cpp
... / ...
CommitLineData
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// wxWindows
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
51DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
52DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
53
54BEGIN_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)
59END_EVENT_TABLE()
60
61IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
62IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
63
64// ============================================================================
65// implementation
66// ============================================================================
67
68// ----------------------------------------------------------------------------
69// wxNotebook construction
70// ----------------------------------------------------------------------------
71
72//
73// Common part of all ctors
74//
75void 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//
85wxNotebook::wxNotebook()
86{
87 Init();
88} // end of wxNotebook::wxNotebook
89
90//
91// The same arguments as for wxControl
92//
93wxNotebook::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//
115bool 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
152WXDWORD 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;
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
190size_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
199int 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
208int 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
243bool 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
256wxString 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
305int 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
317bool 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
331void wxNotebook::SetImageList (
332 wxImageList* WXUNUSED(pImageList)
333)
334{
335 //
336 // Does nothing under OS/2
337 //
338} // end of wxNotebook::SetImageList
339
340// ----------------------------------------------------------------------------
341// wxNotebook size settings
342// ----------------------------------------------------------------------------
343void wxNotebook::SetPageSize (
344 const wxSize& rSize
345)
346{
347 RECTL vRect;
348
349 //
350 // Transform the page size into the notebook size
351 //
352 vRect.xLeft = vRect.yTop = 0;
353 vRect.xRight = rSize.x;
354 vRect.yBottom = rSize.y;
355
356
357 //
358 // And now set it
359 //
360 SetSize( vRect.xRight - vRect.xLeft
361 ,vRect.yBottom - vRect.yTop
362 );
363} // end of wxNotebook::SetPageSize
364
365void wxNotebook::SetPadding (
366 const wxSize& WXUNUSED(rPadding)
367)
368{
369 //
370 // No padding in OS/2
371 //
372} // end of wxNotebook::SetPadding
373
374void wxNotebook::SetTabSize (
375 const wxSize& rSize
376)
377{
378 ::WinSendMsg( GetHWND()
379 ,BKM_SETDIMENSIONS
380 ,MPFROM2SHORT( (USHORT)rSize.x
381 ,(USHORT)rSize.y
382 )
383 ,(MPARAM)BKA_MAJORTAB
384 );
385} // end of wxNotebook::SetTabSize
386
387// ----------------------------------------------------------------------------
388// wxNotebook operations
389// ----------------------------------------------------------------------------
390
391//
392// Remove one page from the notebook, without deleting
393//
394wxNotebookPage* wxNotebook::DoRemovePage (
395 size_t nPage
396)
397{
398 wxNotebookPage* pPageRemoved = wxNotebookBase::DoRemovePage(nPage);
399
400 if (!pPageRemoved)
401 return NULL;
402
403 ::WinSendMsg( GetHWND()
404 ,BKM_DELETEPAGE
405 ,MPFROMLONG((ULONG)m_alPageId[nPage])
406 ,(MPARAM)BKA_TAB
407 );
408 if (m_pages.IsEmpty())
409 {
410 //
411 // No selection any more, the notebook becamse empty
412 //
413 m_nSelection = -1;
414 }
415 else // notebook still not empty
416 {
417 //
418 // Change the selected page if it was deleted or became invalid
419 //
420 int nSelNew;
421
422 if (m_nSelection == (int)GetPageCount())
423 {
424 //
425 // Last page deleted, make the new last page the new selection
426 //
427 nSelNew = m_nSelection - 1;
428 }
429 else if (nPage <= (size_t)m_nSelection)
430 {
431 //
432 // We must show another page, even if it has the same index
433 //
434 nSelNew = m_nSelection;
435 }
436 else // nothing changes for the currently selected page
437 {
438 nSelNew = -1;
439
440 //
441 // We still must refresh the current page: this needs to be done
442 // for some unknown reason if the tab control shows the up-down
443 // control (i.e. when there are too many pages) -- otherwise after
444 // deleting a page nothing at all is shown
445 //
446 m_pages[m_nSelection]->Refresh();
447 }
448
449 if (nSelNew != -1)
450 {
451 //
452 // m_nSelection must be always valid so reset it before calling
453 // SetSelection()
454 //
455 m_nSelection = -1;
456 SetSelection(nSelNew);
457 }
458 }
459 return pPageRemoved;
460} // end of wxNotebook::DoRemovePage
461
462//
463// Remove all pages
464//
465bool wxNotebook::DeleteAllPages()
466{
467 int nPageCount = GetPageCount();
468 int nPage;
469
470 for (nPage = 0; nPage < nPageCount; nPage++)
471 delete m_pages[nPage];
472 m_pages.Clear();
473 ::WinSendMsg( GetHWND()
474 ,BKM_DELETEPAGE
475 ,(MPARAM)0
476 ,(MPARAM)BKA_ALL
477 );
478 m_nSelection = -1;
479 return TRUE;
480} // end of wxNotebook::DeleteAllPages
481
482//
483// Add a page to the notebook
484//
485bool wxNotebook::AddPage (
486 wxNotebookPage* pPage
487, const wxString& rStrText
488, bool bSelect
489, int nImageId
490)
491{
492 return InsertPage( GetPageCount()
493 ,pPage
494 ,rStrText
495 ,bSelect
496 ,nImageId
497 );
498} // end of wxNotebook::AddPage
499
500//
501// Same as AddPage() but does it at given position
502//
503bool wxNotebook::InsertPage (
504 size_t nPage
505, wxNotebookPage* pPage
506, const wxString& rsStrText
507, bool bSelect
508, int nImageId
509)
510{
511 ULONG ulApiPage;
512
513 wxASSERT( pPage != NULL );
514 wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
515
516 //
517 // Under OS/2 we can only insert FIRST, LAST, NEXT or PREV. Requires
518 // two different calls to the API. Page 1 uses the BKA_FIRST. Subsequent
519 // pages use the previous page ID coupled with a BKA_NEXT call. Unlike
520 // Windows, OS/2 uses an internal Page ID to ID the pages.
521 //
522 // OS/2 also has a nice auto-size feature that automatically sizes the
523 // the attached window so we don't have to worry about the size of the
524 // window on the page.
525 //
526 if (nPage == 0)
527 {
528 ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND()
529 ,BKM_INSERTPAGE
530 ,(MPARAM)0
531 ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_FIRST)
532 ));
533 if (ulApiPage == 0L)
534 {
535 ERRORID vError;
536 wxString sError;
537
538 vError = ::WinGetLastError(vHabmain);
539 sError = wxPMErrorToStr(vError);
540 return FALSE;
541 }
542 m_alPageId.Insert((long)ulApiPage, nPage);
543 }
544 else
545 {
546 ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND()
547 ,BKM_INSERTPAGE
548 ,MPFROMLONG((ULONG)m_alPageId[nPage - 1])
549 ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_NEXT)
550 ));
551 if (ulApiPage == 0L)
552 {
553 ERRORID vError;
554 wxString sError;
555
556 vError = ::WinGetLastError(vHabmain);
557 sError = wxPMErrorToStr(vError);
558 return FALSE;
559 }
560 m_alPageId.Insert((long)ulApiPage, nPage);
561 }
562
563 //
564 // Associate a window handle with the page
565 //
566 if (pPage)
567 {
568 if (!::WinSendMsg( GetHWND()
569 ,BKM_SETPAGEWINDOWHWND
570 ,MPFROMLONG((ULONG)m_alPageId[nPage])
571 ,MPFROMHWND(pPage->GetHWND())
572 ))
573 return FALSE;
574 }
575 //
576 // If the inserted page is before the selected one, we must update the
577 // index of the selected page
578 //
579 if (nPage <= (size_t)m_nSelection)
580 {
581 //
582 // One extra page added
583 //
584 m_nSelection++;
585 }
586
587 if (pPage)
588 {
589 //
590 // Save the pointer to the page
591 //
592 m_pages.Insert( pPage
593 ,nPage
594 );
595 }
596
597 //
598 // Now set TAB dimenstions
599 //
600
601 wxWindowDC vDC(this);
602 wxCoord nTextX;
603 wxCoord nTextY;
604
605 vDC.GetTextExtent(rsStrText, &nTextX, &nTextY);
606 nTextY *= 2;
607 nTextX = (wxCoord)(nTextX * 1.3);
608 if (nTextX > m_nTabSize)
609 {
610 m_nTabSize = nTextX;
611 ::WinSendMsg( GetHWND()
612 ,BKM_SETDIMENSIONS
613 ,MPFROM2SHORT((USHORT)m_nTabSize, (USHORT)nTextY)
614 ,(MPARAM)BKA_MAJORTAB
615 );
616 }
617 //
618 // Now set any TAB text
619 //
620 if (!rsStrText.IsEmpty())
621 {
622 if (!SetPageText( nPage
623 ,rsStrText
624 ))
625 return FALSE;
626 }
627
628 //
629 // Now set any TAB bitmap image
630 //
631 if (nImageId != -1)
632 {
633 if (!SetPageImage( nPage
634 ,nImageId
635 ))
636 return FALSE;
637 }
638
639 if (pPage)
640 {
641 //
642 // Don't show pages by default (we'll need to adjust their size first)
643 //
644 HWND hWnd = GetWinHwnd(pPage);
645
646 WinSetWindowULong( hWnd
647 ,QWL_STYLE
648 ,WinQueryWindowULong( hWnd
649 ,QWL_STYLE
650 ) & ~WS_VISIBLE
651 );
652
653 //
654 // This updates internal flag too - otherwise it will get out of sync
655 //
656 pPage->Show(FALSE);
657 }
658
659 //
660 // Some page should be selected: either this one or the first one if there is
661 // still no selection
662 //
663 int nSelNew = -1;
664
665 if (bSelect)
666 nSelNew = nPage;
667 else if ( m_nSelection == -1 )
668 nSelNew = 0;
669
670 if (nSelNew != -1)
671 SetSelection(nSelNew);
672 return TRUE;
673} // end of wxNotebook::InsertPage
674
675// ----------------------------------------------------------------------------
676// wxNotebook callbacks
677// ----------------------------------------------------------------------------
678void wxNotebook::OnSize(
679 wxSizeEvent& rEvent
680)
681{
682 int nPage;
683 int nCount = (int)m_pages.Count();
684
685 for (nPage = 0; nPage < nCount; nPage++)
686 {
687 if (m_nSelection == nPage)
688 m_pages[nPage]->Refresh();
689 else
690 ::WinSetWindowPos(m_pages[nPage]->GetHWND()
691 ,NULLHANDLE
692 ,0,0,0,0
693 ,SWP_HIDE
694 );
695 }
696 rEvent.Skip();
697} // end of wxNotebook::OnSize
698
699void wxNotebook::OnSelChange (
700 wxNotebookEvent& rEvent
701)
702{
703 //
704 // Is it our tab control?
705 //
706 if (rEvent.GetEventObject() == this)
707 {
708 int nPageCount = GetPageCount();
709 int nSel;
710 ULONG ulOS2Sel = (ULONG)rEvent.GetOldSelection();
711 bool bFound = FALSE;
712
713 for (nSel = 0; nSel < nPageCount; nSel++)
714 {
715 if (ulOS2Sel == (ULONG)m_alPageId[nSel])
716 {
717 bFound = TRUE;
718 break;
719 }
720 }
721
722 if (!bFound)
723 return;
724
725 m_pages[nSel]->Show(FALSE);
726
727 ulOS2Sel = (ULONG)rEvent.GetSelection();
728
729 bFound = FALSE;
730
731 for (nSel = 0; nSel < nPageCount; nSel++)
732 {
733 if (ulOS2Sel == (ULONG)m_alPageId[nSel])
734 {
735 bFound = TRUE;
736 break;
737 }
738 }
739
740 if (!bFound)
741 return;
742
743 wxNotebookPage* pPage = m_pages[nSel];
744
745 pPage->Show(TRUE);
746 m_nSelection = nSel;
747 }
748
749 //
750 // We want to give others a chance to process this message as well
751 //
752 rEvent.Skip();
753} // end of wxNotebook::OnSelChange
754
755void wxNotebook::OnSetFocus (
756 wxFocusEvent& rEvent
757)
758{
759 //
760 // This function is only called when the focus is explicitly set (i.e. from
761 // the program) to the notebook - in this case we don't need the
762 // complicated OnNavigationKey() logic because the programmer knows better
763 // what [s]he wants
764 //
765 // set focus to the currently selected page if any
766 //
767 if (m_nSelection != -1)
768 m_pages[m_nSelection]->SetFocus();
769 rEvent.Skip();
770} // end of wxNotebook::OnSetFocus
771
772void wxNotebook::OnNavigationKey (
773 wxNavigationKeyEvent& rEvent
774)
775{
776 if (rEvent.IsWindowChange())
777 {
778 //
779 // Change pages
780 //
781 AdvanceSelection(rEvent.GetDirection());
782 }
783 else
784 {
785 //
786 // We get this event in 2 cases
787 //
788 // a) one of our pages might have generated it because the user TABbed
789 // out from it in which case we should propagate the event upwards and
790 // our parent will take care of setting the focus to prev/next sibling
791 //
792 // or
793 //
794 // b) the parent panel wants to give the focus to us so that we
795 // forward it to our selected page. We can't deal with this in
796 // OnSetFocus() because we don't know which direction the focus came
797 // from in this case and so can't choose between setting the focus to
798 // first or last panel child
799 //
800 wxWindow* pParent = GetParent();
801
802 if (rEvent.GetEventObject() == pParent)
803 {
804 //
805 // No, it doesn't come from child, case (b): forward to a page
806 //
807 if (m_nSelection != -1)
808 {
809 //
810 // So that the page knows that the event comes from it's parent
811 // and is being propagated downwards
812 //
813 rEvent.SetEventObject(this);
814
815 wxWindow* pPage = m_pages[m_nSelection];
816
817 if (!pPage->GetEventHandler()->ProcessEvent(rEvent))
818 {
819 pPage->SetFocus();
820 }
821 //else: page manages focus inside it itself
822 }
823 else
824 {
825 //
826 // We have no pages - still have to give focus to _something_
827 //
828 SetFocus();
829 }
830 }
831 else
832 {
833 //
834 // It comes from our child, case (a), pass to the parent
835 //
836 if (pParent)
837 {
838 rEvent.SetCurrentFocus(this);
839 pParent->GetEventHandler()->ProcessEvent(rEvent);
840 }
841 }
842 }
843} // end of wxNotebook::OnNavigationKey
844
845// ----------------------------------------------------------------------------
846// wxNotebook base class virtuals
847// ----------------------------------------------------------------------------
848
849//
850// Override these 2 functions to do nothing: everything is done in OnSize
851//
852void wxNotebook::SetConstraintSizes(
853 bool WXUNUSED(bRecurse)
854)
855{
856 //
857 // Don't set the sizes of the pages - their correct size is not yet known
858 //
859 wxControl::SetConstraintSizes(FALSE);
860} // end of wxNotebook::SetConstraintSizes
861
862bool wxNotebook::DoPhase (
863 int WXUNUSED(nPhase)
864)
865{
866 return TRUE;
867} // end of wxNotebook::DoPhase
868
869// ----------------------------------------------------------------------------
870// wxNotebook Windows message handlers
871// ----------------------------------------------------------------------------
872bool wxNotebook::OS2OnScroll (
873 int nOrientation
874, WXWORD wSBCode
875, WXWORD wPos
876, WXHWND wControl
877)
878{
879 //
880 // Don't generate EVT_SCROLLWIN events for the WM_SCROLLs coming from the
881 // up-down control
882 //
883 if (wControl)
884 return FALSE;
885 return wxNotebookBase::OS2OnScroll( nOrientation
886 ,wSBCode
887 ,wPos
888 ,wControl
889 );
890} // end of wxNotebook::OS2OnScroll
891
892#endif // wxUSE_NOTEBOOK
893