X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f38924e863cd44e2abd49d20d201d72aa773c51e..236566738198d598fab7ac15c78007c1734ce449:/src/msw/notebook.cpp diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index ff438e3dc6..cd19ed2b0d 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -18,28 +18,26 @@ #if wxUSE_NOTEBOOK -#include "wx/notebook.h" +#include "wx/notebook.h" #ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/dc.h" - #include "wx/log.h" - #include "wx/event.h" - #include "wx/app.h" - #include "wx/dcclient.h" - #include "wx/dcmemory.h" + #include "wx/msw/wrapcctl.h" // include "properly" + #include "wx/string.h" + #include "wx/dc.h" + #include "wx/log.h" + #include "wx/event.h" + #include "wx/app.h" + #include "wx/dcclient.h" + #include "wx/dcmemory.h" + #include "wx/control.h" #endif // WX_PRECOMP -#include "wx/imaglist.h" -#include "wx/control.h" -#include "wx/sysopt.h" +#include "wx/imaglist.h" +#include "wx/sysopt.h" -#include "wx/msw/private.h" - -#include - -#include +#include "wx/msw/private.h" +#include #include "wx/msw/winundef.h" #if wxUSE_UXTHEME @@ -268,6 +266,15 @@ bool wxNotebook::Create(wxWindow *parent, long style, const wxString& name) { + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + { +#if defined(__POCKETPC__) + style |= wxBK_BOTTOM | wxNB_FLAT; +#else + style |= wxBK_TOP; +#endif + } + #ifdef __WXWINCE__ // Not sure why, but without this style, there is no border // around the notebook tabs. @@ -585,26 +592,29 @@ void wxNotebook::SetTabSize(const wxSize& sz) wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const { + // we can't use TabCtrl_AdjustRect here because it only works for wxNB_TOP wxSize sizeTotal = sizePage; - // We need to make getting tab size part of the wxWidgets API. wxSize tabSize; - if (GetPageCount() > 0) + if ( GetPageCount() > 0 ) { RECT rect; - TabCtrl_GetItemRect((HWND) GetHWND(), 0, & rect); + TabCtrl_GetItemRect(GetHwnd(), 0, &rect); tabSize.x = rect.right - rect.left; tabSize.y = rect.bottom - rect.top; } - if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) ) + + // add an extra margin in both directions + const int MARGIN = 8; + if ( IsVertical() ) { - sizeTotal.x += tabSize.x + 7; - sizeTotal.y += 7; + sizeTotal.x += MARGIN; + sizeTotal.y += tabSize.y + MARGIN; } - else + else // horizontal layout { - sizeTotal.x += 7; - sizeTotal.y += tabSize.y + 7; + sizeTotal.x += tabSize.x + MARGIN; + sizeTotal.y += MARGIN; } return sizeTotal; @@ -751,6 +761,13 @@ bool wxNotebook::InsertPage(size_t nPage, return false; } + // need to update the bg brush when the first page is added + // so the first panel gets the correct themed background + if ( m_pages.empty() ) + { + UpdateBgBrush(); + } + // succeeded: save the pointer to the page m_pages.Insert(pPage, nPage); @@ -802,13 +819,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const *flags = 0; if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE) - *flags |= wxNB_HITTEST_NOWHERE; + *flags |= wxBK_HITTEST_NOWHERE; if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM) - *flags |= wxNB_HITTEST_ONITEM; + *flags |= wxBK_HITTEST_ONITEM; if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) - *flags |= wxNB_HITTEST_ONICON; + *flags |= wxBK_HITTEST_ONICON; if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) - *flags |= wxNB_HITTEST_ONLABEL; + *flags |= wxBK_HITTEST_ONLABEL; + if ( item == wxNOT_FOUND && GetPageSize().Contains(pt) ) + *flags |= wxBK_HITTEST_ONPAGE; } return item; @@ -1042,25 +1061,6 @@ void wxNotebook::OnSelChange(wxNotebookEvent& event) event.Skip(); } -bool wxNotebook::MSWTranslateMessage(WXMSG *wxmsg) -{ - const MSG * const msg = (MSG *)wxmsg; - - // intercept TAB, CTRL+TAB and CTRL+SHIFT+TAB for processing by wxNotebook. - // TAB will be passed to the currently selected page, CTRL+TAB and - // CTRL+SHIFT+TAB will be processed by the notebook itself. do not - // intercept SHIFT+TAB. This goes to the parent of the notebook which will - // process it. - if ( msg->message == WM_KEYDOWN && msg->wParam == VK_TAB && - msg->hwnd == GetHwnd() && - (wxIsCtrlDown() || !wxIsShiftDown()) ) - { - return MSWProcessMessage(wxmsg); - } - - return false; -} - void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) { if ( event.IsWindowChange() ) {