From 90f9b8ef0c83c09f80c2f60ad65407ba16f11a3c Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 6 Jun 2006 12:53:31 +0000 Subject: [PATCH] Reverted last wxBookCtrl change and added alignment check to notebook git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/bookctrl.h | 5 +---- src/common/bookctrl.cpp | 5 +---- src/generic/notebook.cpp | 3 +++ src/gtk/notebook.cpp | 3 +++ src/gtk1/notebook.cpp | 3 +++ src/mac/classic/notebmac.cpp | 3 +++ src/msw/notebook.cpp | 2 ++ src/os2/notebook.cpp | 2 ++ src/univ/notebook.cpp | 3 +++ 9 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index d1dfe04f50..4cea68ba31 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -118,9 +118,6 @@ public: // calculate the size of the control from the size of its page virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0; - // get the default alignment - virtual int GetDefaultAlignment() const { return wxBK_TOP; } - // get/set size of area between book control area and page area unsigned int GetInternalBorder() const { return m_internalBorder; } void SetInternalBorder(unsigned int border) { m_internalBorder = border; } @@ -130,7 +127,7 @@ public: int GetControlMargin() const { return m_controlMargin; } // returns true if we have wxBK_TOP or wxBK_BOTTOM style - bool IsVertical() const { return HasFlag(wxBK_ALIGN_MASK) ? HasFlag(wxBK_BOTTOM | wxBK_TOP) : (0 != (GetDefaultAlignment() & (wxBK_BOTTOM | wxBK_TOP))); } + bool IsVertical() const { return HasFlag(wxBK_BOTTOM | wxBK_TOP); } // set/get option to shrink to fit current page void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; } diff --git a/src/common/bookctrl.cpp b/src/common/bookctrl.cpp index e8539c12f4..2ee818f20c 100644 --- a/src/common/bookctrl.cpp +++ b/src/common/bookctrl.cpp @@ -268,11 +268,8 @@ wxRect wxBookCtrlBase::GetPageRect() const wxPoint pt; wxRect rectPage(pt, GetClientSize()); - long style = GetWindowStyle(); - if ( !HasFlag(wxBK_ALIGN_MASK) ) - style = GetDefaultAlignment(); - switch ( style ) + switch ( GetWindowStyle() & wxBK_ALIGN_MASK ) { default: wxFAIL_MSG( _T("unexpected alignment") ); diff --git a/src/generic/notebook.cpp b/src/generic/notebook.cpp index c3e7cb4821..df0e524065 100644 --- a/src/generic/notebook.cpp +++ b/src/generic/notebook.cpp @@ -150,6 +150,9 @@ bool wxNotebook::Create(wxWindow *parent, // base init SetName(name); + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + style |= wxBK_TOP; + m_windowId = id == wxID_ANY ? NewControlId() : id; if (!wxControl::Create(parent, id, pos, size, style|wxNO_BORDER, wxDefaultValidator, name)) diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index c074dcb480..8c22e6af9e 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -324,6 +324,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, m_acceptsFocus = true; m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook; + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + style |= wxBK_TOP; + if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 6d647cc323..8acf3f1fd9 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -324,6 +324,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, m_acceptsFocus = true; m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook; + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + style |= wxBK_TOP; + if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { diff --git a/src/mac/classic/notebmac.cpp b/src/mac/classic/notebmac.cpp index 9bd1c41477..4ef04c7b47 100644 --- a/src/mac/classic/notebmac.cpp +++ b/src/mac/classic/notebmac.cpp @@ -187,6 +187,9 @@ bool wxNotebook::Create(wxWindow *parent, Rect bounds ; Str255 title ; + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + style |= wxBK_TOP; + MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ; int tabstyle = kControlTabSmallNorthProc ; diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 193bd61d6c..e92244917a 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -274,6 +274,8 @@ bool wxNotebook::Create(wxWindow *parent, if (style & wxNB_FLAT) style |= wxBORDER_SUNKEN; #endif + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + style |= wxBK_TOP; #if !wxUSE_UXTHEME // ComCtl32 notebook tabs simply don't work unless they're on top if we have uxtheme, we can diff --git a/src/os2/notebook.cpp b/src/os2/notebook.cpp index 7605b4d78f..26f5212468 100644 --- a/src/os2/notebook.cpp +++ b/src/os2/notebook.cpp @@ -124,6 +124,8 @@ bool wxNotebook::Create( wxWindow* pParent, long lStyle, const wxString& rsName ) { + if ( (lStyle & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + lStyle |= wxBK_TOP; // // Base init // diff --git a/src/univ/notebook.cpp b/src/univ/notebook.cpp index 1255a2fe5c..407dc958ae 100644 --- a/src/univ/notebook.cpp +++ b/src/univ/notebook.cpp @@ -121,6 +121,9 @@ bool wxNotebook::Create(wxWindow *parent, long style, const wxString& name) { + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + style |= wxBK_TOP; + if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; -- 2.45.2