1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/notebook.cpp
3 // Purpose: implementation of wxNotebook
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "notebook.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/string.h"
31 #include "wx/imaglist.h"
33 #include "wx/control.h"
34 #include "wx/notebook.h"
37 #include "wx/msw/private.h"
39 // Windows standard headers
41 #error "wxNotebook is only supported Windows 95 and above"
44 #include <windowsx.h> // for SetWindowFont
46 #ifdef __GNUWIN32_OLD__
47 #include "wx/msw/gnuwin32/extra.h"
50 #if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__))
54 #include "wx/msw/winundef.h"
57 #include "wx/msw/uxtheme.h"
59 #include "wx/radiobut.h"
60 #include "wx/radiobox.h"
61 #include "wx/checkbox.h"
62 #include "wx/bmpbuttn.h"
63 #include "wx/statline.h"
64 #include "wx/statbox.h"
65 #include "wx/stattext.h"
66 #include "wx/slider.h"
67 #include "wx/scrolwin.h"
81 // ----------------------------------------------------------------------------
83 // ----------------------------------------------------------------------------
85 // check that the page index is valid
86 #define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
89 #define m_hwnd (HWND)GetHWND()
91 // ----------------------------------------------------------------------------
93 // ----------------------------------------------------------------------------
95 // This is a work-around for missing defines in gcc-2.95 headers
97 #define TCS_RIGHT 0x0002
101 #define TCS_VERTICAL 0x0080
105 #define TCS_BOTTOM TCS_RIGHT
108 // ----------------------------------------------------------------------------
110 // ----------------------------------------------------------------------------
112 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
)
113 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
)
115 BEGIN_EVENT_TABLE(wxNotebook
, wxControl
)
116 EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange
)
118 EVT_SIZE(wxNotebook::OnSize
)
120 EVT_SET_FOCUS(wxNotebook::OnSetFocus
)
122 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey
)
125 #if wxUSE_EXTENDED_RTTI
126 IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook
, wxControl
,"wx/notebook.h")
128 WX_BEGIN_PROPERTIES_TABLE(wxNotebook
)
129 WX_END_PROPERTIES_TABLE()
131 WX_BEGIN_HANDLERS_TABLE(wxNotebook
)
132 WX_END_HANDLERS_TABLE()
134 WX_CONSTRUCTOR_4( wxNotebook
, wxWindow
* , Parent
, wxWindowID
, Id
, wxPoint
, Position
, wxSize
, Size
)
137 IMPLEMENT_DYNAMIC_CLASS(wxNotebook
, wxControl
)
139 IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent
, wxNotifyEvent
)
141 // ============================================================================
143 // ============================================================================
145 // ----------------------------------------------------------------------------
146 // wxNotebook construction
147 // ----------------------------------------------------------------------------
149 // common part of all ctors
150 void wxNotebook::Init()
156 // default for dynamic class
157 wxNotebook::wxNotebook()
162 // the same arguments as for wxControl
163 wxNotebook::wxNotebook(wxWindow
*parent
,
168 const wxString
& name
)
172 Create(parent
, id
, pos
, size
, style
, name
);
176 bool wxNotebook::Create(wxWindow
*parent
,
181 const wxString
& name
)
183 // Does ComCtl32 support non-top tabs?
184 int verComCtl32
= wxApp::GetComCtl32Version();
185 if ( verComCtl32
< 470 || verComCtl32
>= 600 )
187 if (style
& wxNB_BOTTOM
)
188 style
&= ~wxNB_BOTTOM
;
190 if (style
& wxNB_LEFT
)
193 if (style
& wxNB_RIGHT
)
194 style
&= ~wxNB_RIGHT
;
197 if ( !CreateControl(parent
, id
, pos
, size
, style
| wxTAB_TRAVERSAL
,
198 wxDefaultValidator
, name
) )
201 if ( !MSWCreateControl(WC_TABCONTROL
, wxEmptyString
, pos
, size
) )
204 SetBackgroundColour(wxColour(::GetSysColor(COLOR_BTNFACE
)));
209 WXDWORD
wxNotebook::MSWGetStyle(long style
, WXDWORD
*exstyle
) const
211 WXDWORD tabStyle
= wxControl::MSWGetStyle(style
, exstyle
);
213 tabStyle
|= WS_TABSTOP
| TCS_TABS
;
215 if ( style
& wxNB_MULTILINE
)
216 tabStyle
|= TCS_MULTILINE
;
217 if ( style
& wxNB_FIXEDWIDTH
)
218 tabStyle
|= TCS_FIXEDWIDTH
;
220 if ( style
& wxNB_BOTTOM
)
221 tabStyle
|= TCS_RIGHT
;
222 else if ( style
& wxNB_LEFT
)
223 tabStyle
|= TCS_VERTICAL
;
224 else if ( style
& wxNB_RIGHT
)
225 tabStyle
|= TCS_VERTICAL
| TCS_RIGHT
;
230 // note that we never want to have the default WS_EX_CLIENTEDGE style
231 // as it looks too ugly for the notebooks
238 // ----------------------------------------------------------------------------
239 // wxNotebook accessors
240 // ----------------------------------------------------------------------------
242 int wxNotebook::GetPageCount() const
245 wxASSERT( (int)m_pages
.Count() == TabCtrl_GetItemCount(m_hwnd
) );
247 return m_pages
.Count();
250 int wxNotebook::GetRowCount() const
252 return TabCtrl_GetRowCount(m_hwnd
);
255 int wxNotebook::SetSelection(int nPage
)
257 wxCHECK_MSG( IS_VALID_PAGE(nPage
), -1, wxT("notebook page out of range") );
259 if ( nPage
!= m_nSelection
)
261 wxNotebookEvent
event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, m_windowId
);
262 event
.SetSelection(nPage
);
263 event
.SetOldSelection(m_nSelection
);
264 event
.SetEventObject(this);
265 if ( !GetEventHandler()->ProcessEvent(event
) || event
.IsAllowed() )
267 // program allows the page change
268 event
.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
);
269 (void)GetEventHandler()->ProcessEvent(event
);
271 TabCtrl_SetCurSel(m_hwnd
, nPage
);
278 bool wxNotebook::SetPageText(int nPage
, const wxString
& strText
)
280 wxCHECK_MSG( IS_VALID_PAGE(nPage
), FALSE
, wxT("notebook page out of range") );
283 tcItem
.mask
= TCIF_TEXT
;
284 tcItem
.pszText
= (wxChar
*)strText
.c_str();
286 return TabCtrl_SetItem(m_hwnd
, nPage
, &tcItem
) != 0;
289 wxString
wxNotebook::GetPageText(int nPage
) const
291 wxCHECK_MSG( IS_VALID_PAGE(nPage
), wxEmptyString
, wxT("notebook page out of range") );
295 tcItem
.mask
= TCIF_TEXT
;
296 tcItem
.pszText
= buf
;
297 tcItem
.cchTextMax
= WXSIZEOF(buf
);
300 if ( TabCtrl_GetItem(m_hwnd
, nPage
, &tcItem
) )
301 str
= tcItem
.pszText
;
306 int wxNotebook::GetPageImage(int nPage
) const
308 wxCHECK_MSG( IS_VALID_PAGE(nPage
), -1, wxT("notebook page out of range") );
311 tcItem
.mask
= TCIF_IMAGE
;
313 return TabCtrl_GetItem(m_hwnd
, nPage
, &tcItem
) ? tcItem
.iImage
: -1;
316 bool wxNotebook::SetPageImage(int nPage
, int nImage
)
318 wxCHECK_MSG( IS_VALID_PAGE(nPage
), FALSE
, wxT("notebook page out of range") );
321 tcItem
.mask
= TCIF_IMAGE
;
322 tcItem
.iImage
= nImage
;
324 return TabCtrl_SetItem(m_hwnd
, nPage
, &tcItem
) != 0;
327 void wxNotebook::SetImageList(wxImageList
* imageList
)
329 wxNotebookBase::SetImageList(imageList
);
333 TabCtrl_SetImageList(m_hwnd
, (HIMAGELIST
)imageList
->GetHIMAGELIST());
337 // ----------------------------------------------------------------------------
338 // wxNotebook size settings
339 // ----------------------------------------------------------------------------
341 void wxNotebook::SetPageSize(const wxSize
& size
)
343 // transform the page size into the notebook size
350 TabCtrl_AdjustRect(GetHwnd(), TRUE
, &rc
);
353 SetSize(rc
.right
- rc
.left
, rc
.bottom
- rc
.top
);
356 void wxNotebook::SetPadding(const wxSize
& padding
)
358 TabCtrl_SetPadding(GetHwnd(), padding
.x
, padding
.y
);
361 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
363 void wxNotebook::SetTabSize(const wxSize
& sz
)
365 ::SendMessage(GetHwnd(), TCM_SETITEMSIZE
, 0, MAKELPARAM(sz
.x
, sz
.y
));
368 wxSize
wxNotebook::CalcSizeFromPage(const wxSize
& sizePage
) const
370 wxSize sizeTotal
= sizePage
;
372 // We need to make getting tab size part of the wxWindows API.
373 wxSize
tabSize(0, 0);
374 if (GetPageCount() > 0)
377 TabCtrl_GetItemRect((HWND
) GetHWND(), 0, & rect
);
378 tabSize
.x
= rect
.right
- rect
.left
;
379 tabSize
.y
= rect
.bottom
- rect
.top
;
381 if ( HasFlag(wxNB_LEFT
) || HasFlag(wxNB_RIGHT
) )
383 sizeTotal
.x
+= tabSize
.x
+ 7;
389 sizeTotal
.y
+= tabSize
.y
+ 7;
395 void wxNotebook::AdjustPageSize(wxNotebookPage
*page
)
397 wxCHECK_RET( page
, _T("NULL page in wxNotebook::AdjustPageSize") );
403 // get the page size from the notebook size
404 GetSize((int *)&rc
.right
, (int *)&rc
.bottom
);
405 TabCtrl_AdjustRect(m_hwnd
, FALSE
, &rc
);
407 page
->SetSize(rc
.left
, rc
.top
, rc
.right
- rc
.left
, rc
.bottom
- rc
.top
);
410 // ----------------------------------------------------------------------------
411 // wxNotebook operations
412 // ----------------------------------------------------------------------------
414 // remove one page from the notebook, without deleting
415 wxNotebookPage
*wxNotebook::DoRemovePage(int nPage
)
417 wxNotebookPage
*pageRemoved
= wxNotebookBase::DoRemovePage(nPage
);
421 TabCtrl_DeleteItem(m_hwnd
, nPage
);
423 if ( m_pages
.IsEmpty() )
425 // no selection any more, the notebook becamse empty
428 else // notebook still not empty
430 // change the selected page if it was deleted or became invalid
432 if ( m_nSelection
== GetPageCount() )
434 // last page deleted, make the new last page the new selection
435 selNew
= m_nSelection
- 1;
437 else if ( nPage
<= m_nSelection
)
439 // we must show another page, even if it has the same index
440 selNew
= m_nSelection
;
442 else // nothing changes for the currently selected page
446 // we still must refresh the current page: this needs to be done
447 // for some unknown reason if the tab control shows the up-down
448 // control (i.e. when there are too many pages) -- otherwise after
449 // deleting a page nothing at all is shown
450 if (m_nSelection
>= 0)
451 m_pages
[m_nSelection
]->Refresh();
456 // m_nSelection must be always valid so reset it before calling
459 SetSelection(selNew
);
467 bool wxNotebook::DeleteAllPages()
469 int nPageCount
= GetPageCount();
471 for ( nPage
= 0; nPage
< nPageCount
; nPage
++ )
472 delete m_pages
[nPage
];
476 TabCtrl_DeleteAllItems(m_hwnd
);
483 // same as AddPage() but does it at given position
484 bool wxNotebook::InsertPage(int nPage
,
485 wxNotebookPage
*pPage
,
486 const wxString
& strText
,
490 wxCHECK_MSG( pPage
!= NULL
, FALSE
, _T("NULL page in wxNotebook::InsertPage") );
491 wxCHECK_MSG( IS_VALID_PAGE(nPage
) || nPage
== GetPageCount(), FALSE
,
492 _T("invalid index in wxNotebook::InsertPage") );
494 wxASSERT_MSG( pPage
->GetParent() == this,
495 _T("notebook pages must have notebook as parent") );
497 #if wxUSE_UXTHEME && wxUSE_UXTHEME_AUTO
498 static bool g_TestedForTheme
= FALSE
;
499 static bool g_UseTheme
= FALSE
;
500 if (!g_TestedForTheme
)
502 int commCtrlVersion
= wxTheApp
->GetComCtl32Version() ;
504 g_UseTheme
= (commCtrlVersion
>= 600);
505 g_TestedForTheme
= TRUE
;
508 // Automatically apply the theme background,
509 // changing the colour of the panel to match the
510 // tab page colour. This won't work well with all
511 // themes but it's a start.
512 if (g_UseTheme
&& wxUxThemeEngine::Get() && pPage
->IsKindOf(CLASSINFO(wxPanel
)))
514 ApplyThemeBackground(pPage
, GetThemeBackgroundColour());
518 // add a new tab to the control
519 // ----------------------------
521 // init all fields to 0
523 wxZeroMemory(tcItem
);
525 // set the image, if any
528 tcItem
.mask
|= TCIF_IMAGE
;
529 tcItem
.iImage
= imageId
;
533 if ( !strText
.IsEmpty() )
535 tcItem
.mask
|= TCIF_TEXT
;
536 tcItem
.pszText
= (wxChar
*)strText
.c_str(); // const_cast
539 // fit the notebook page to the tab control's display area: this should be
540 // done before adding it to the notebook or TabCtrl_InsertItem() will
541 // change the notebooks size itself!
542 AdjustPageSize(pPage
);
544 // finally do insert it
545 if ( TabCtrl_InsertItem(m_hwnd
, nPage
, &tcItem
) == -1 )
547 wxLogError(wxT("Can't create the notebook page '%s'."), strText
.c_str());
552 // succeeded: save the pointer to the page
553 m_pages
.Insert(pPage
, nPage
);
555 // for the first page (only) we need to adjust the size again because the
556 // notebook size changed: the tabs which hadn't been there before are now
558 if ( m_pages
.GetCount() == 1 )
560 AdjustPageSize(pPage
);
563 // hide the page: unless it is selected, it shouldn't be shown (and if it
564 // is selected it will be shown later)
565 HWND hwnd
= GetWinHwnd(pPage
);
566 SetWindowLong(hwnd
, GWL_STYLE
, GetWindowLong(hwnd
, GWL_STYLE
) & ~WS_VISIBLE
);
568 // this updates internal flag too -- otherwise it would get out of sync
569 // with the real state
573 // now deal with the selection
574 // ---------------------------
576 // if the inserted page is before the selected one, we must update the
577 // index of the selected page
578 if ( nPage
<= m_nSelection
)
580 // one extra page added
584 // some page should be selected: either this one or the first one if there
585 // is still no selection
589 else if ( m_nSelection
== -1 )
593 SetSelection(selNew
);
598 int wxNotebook::HitTest(const wxPoint
& pt
, long *flags
) const
600 TC_HITTESTINFO hitTestInfo
;
601 hitTestInfo
.pt
.x
= pt
.x
;
602 hitTestInfo
.pt
.y
= pt
.y
;
603 int item
= TabCtrl_HitTest(GetHwnd(), &hitTestInfo
);
609 if ((hitTestInfo
.flags
& TCHT_NOWHERE
) == TCHT_NOWHERE
)
610 *flags
|= wxNB_HITTEST_NOWHERE
;
611 if ((hitTestInfo
.flags
& TCHT_ONITEM
) == TCHT_ONITEM
)
612 *flags
|= wxNB_HITTEST_ONITEM
;
613 if ((hitTestInfo
.flags
& TCHT_ONITEMICON
) == TCHT_ONITEMICON
)
614 *flags
|= wxNB_HITTEST_ONICON
;
615 if ((hitTestInfo
.flags
& TCHT_ONITEMLABEL
) == TCHT_ONITEMLABEL
)
616 *flags
|= wxNB_HITTEST_ONLABEL
;
623 // ----------------------------------------------------------------------------
624 // wxNotebook callbacks
625 // ----------------------------------------------------------------------------
627 void wxNotebook::OnSize(wxSizeEvent
& event
)
629 // fit the notebook page to the tab control's display area
631 rc
.left
= rc
.top
= 0;
632 GetSize((int *)&rc
.right
, (int *)&rc
.bottom
);
634 TabCtrl_AdjustRect(m_hwnd
, FALSE
, &rc
);
636 int width
= rc
.right
- rc
.left
,
637 height
= rc
.bottom
- rc
.top
;
638 size_t nCount
= m_pages
.Count();
639 for ( size_t nPage
= 0; nPage
< nCount
; nPage
++ ) {
640 wxNotebookPage
*pPage
= m_pages
[nPage
];
641 pPage
->SetSize(rc
.left
, rc
.top
, width
, height
);
647 void wxNotebook::OnSelChange(wxNotebookEvent
& event
)
649 // is it our tab control?
650 if ( event
.GetEventObject() == this )
652 int sel
= event
.GetOldSelection();
654 m_pages
[sel
]->Show(FALSE
);
656 sel
= event
.GetSelection();
659 wxNotebookPage
*pPage
= m_pages
[sel
];
667 // we want to give others a chance to process this message as well
671 void wxNotebook::OnSetFocus(wxFocusEvent
& event
)
673 // this function is only called when the focus is explicitly set (i.e. from
674 // the program) to the notebook - in this case we don't need the
675 // complicated OnNavigationKey() logic because the programmer knows better
678 // set focus to the currently selected page if any
679 if ( m_nSelection
!= -1 )
680 m_pages
[m_nSelection
]->SetFocus();
685 void wxNotebook::OnNavigationKey(wxNavigationKeyEvent
& event
)
687 if ( event
.IsWindowChange() ) {
689 AdvanceSelection(event
.GetDirection());
692 // we get this event in 2 cases
694 // a) one of our pages might have generated it because the user TABbed
695 // out from it in which case we should propagate the event upwards and
696 // our parent will take care of setting the focus to prev/next sibling
700 // b) the parent panel wants to give the focus to us so that we
701 // forward it to our selected page. We can't deal with this in
702 // OnSetFocus() because we don't know which direction the focus came
703 // from in this case and so can't choose between setting the focus to
704 // first or last panel child
705 wxWindow
*parent
= GetParent();
706 // the cast is here to fic a GCC ICE
707 if ( ((wxWindow
*)event
.GetEventObject()) == parent
)
709 // no, it doesn't come from child, case (b): forward to a page
710 if ( m_nSelection
!= -1 )
712 // so that the page knows that the event comes from it's parent
713 // and is being propagated downwards
714 event
.SetEventObject(this);
716 wxWindow
*page
= m_pages
[m_nSelection
];
717 if ( !page
->GetEventHandler()->ProcessEvent(event
) )
721 //else: page manages focus inside it itself
725 // we have no pages - still have to give focus to _something_
731 // it comes from our child, case (a), pass to the parent
733 event
.SetCurrentFocus(this);
734 parent
->GetEventHandler()->ProcessEvent(event
);
740 // ----------------------------------------------------------------------------
741 // wxNotebook base class virtuals
742 // ----------------------------------------------------------------------------
744 #if wxUSE_CONSTRAINTS
746 // override these 2 functions to do nothing: everything is done in OnSize
748 void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse
))
750 // don't set the sizes of the pages - their correct size is not yet known
751 wxControl::SetConstraintSizes(FALSE
);
754 bool wxNotebook::DoPhase(int WXUNUSED(nPhase
))
759 #endif // wxUSE_CONSTRAINTS
761 // ----------------------------------------------------------------------------
762 // wxNotebook Windows message handlers
763 // ----------------------------------------------------------------------------
765 bool wxNotebook::MSWOnScroll(int orientation
, WXWORD nSBCode
,
766 WXWORD pos
, WXHWND control
)
768 // don't generate EVT_SCROLLWIN events for the WM_SCROLLs coming from the
773 return wxNotebookBase::MSWOnScroll(orientation
, nSBCode
, pos
, control
);
776 bool wxNotebook::MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
* result
)
778 wxNotebookEvent
event(wxEVT_NULL
, m_windowId
);
780 NMHDR
* hdr
= (NMHDR
*)lParam
;
781 switch ( hdr
->code
) {
783 event
.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
);
786 case TCN_SELCHANGING
:
787 event
.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
);
791 return wxControl::MSWOnNotify(idCtrl
, lParam
, result
);
794 event
.SetSelection(TabCtrl_GetCurSel(m_hwnd
));
795 event
.SetOldSelection(m_nSelection
);
796 event
.SetEventObject(this);
797 event
.SetInt(idCtrl
);
799 bool processed
= GetEventHandler()->ProcessEvent(event
);
800 *result
= !event
.IsAllowed();
804 // Windows only: attempts to get colour for UX theme page background
805 wxColour
wxNotebook::GetThemeBackgroundColour()
808 if (wxUxThemeEngine::Get())
810 wxUxThemeHandle
hTheme(this, L
"TAB");
813 // This is total guesswork.
814 // See PlatformSDK\Include\Tmschema.h for values
816 wxUxThemeEngine::Get()->GetThemeColor
821 3821, /* FILLCOLORHINT */
825 wxColour
colour(GetRValue(themeColor
), GetGValue(themeColor
), GetBValue(themeColor
));
829 #endif // wxUSE_UXTHEME
831 return GetBackgroundColour();
834 // Windows only: attempts to apply the UX theme page background to this page
836 void wxNotebook::ApplyThemeBackground(wxWindow
* window
, const wxColour
& colour
)
838 void wxNotebook::ApplyThemeBackground(wxWindow
*, const wxColour
&)
842 // Don't set the background for buttons since this will
843 // switch it into ownerdraw mode
844 if (window
->IsKindOf(CLASSINFO(wxButton
)) && !window
->IsKindOf(CLASSINFO(wxBitmapButton
)))
845 // This is essential, otherwise you'll see dark grey
846 // corners in the buttons.
847 ((wxButton
*)window
)->wxControl::SetBackgroundColour(colour
);
848 else if (window
->IsKindOf(CLASSINFO(wxStaticText
)) ||
849 window
->IsKindOf(CLASSINFO(wxStaticBox
)) ||
850 window
->IsKindOf(CLASSINFO(wxStaticLine
)) ||
851 window
->IsKindOf(CLASSINFO(wxRadioButton
)) ||
852 window
->IsKindOf(CLASSINFO(wxRadioBox
)) ||
853 window
->IsKindOf(CLASSINFO(wxCheckBox
)) ||
854 window
->IsKindOf(CLASSINFO(wxBitmapButton
)) ||
855 window
->IsKindOf(CLASSINFO(wxSlider
)) ||
856 window
->IsKindOf(CLASSINFO(wxPanel
)) ||
857 (window
->IsKindOf(CLASSINFO(wxNotebook
)) && (window
!= this)) ||
858 window
->IsKindOf(CLASSINFO(wxScrolledWindow
))
861 window
->SetBackgroundColour(colour
);
864 for ( wxWindowList::compatibility_iterator node
= window
->GetChildren().GetFirst(); node
; node
= node
->GetNext() )
866 wxWindow
*child
= node
->GetData();
867 ApplyThemeBackground(child
, colour
);
872 long wxNotebook::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
874 static bool g_TestedForTheme
= FALSE
;
875 static bool g_UseTheme
= FALSE
;
880 if (!g_TestedForTheme
)
882 int commCtrlVersion
= wxTheApp
->GetComCtl32Version() ;
884 g_UseTheme
= (commCtrlVersion
>= 600);
885 g_TestedForTheme
= TRUE
;
888 // If using XP themes, it seems we can get away
889 // with not drawing a background, which reduces flicker.
895 return wxControl::MSWWindowProc(nMsg
, wParam
, lParam
);
899 #endif // wxUSE_NOTEBOOK