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