]> git.saurik.com Git - wxWidgets.git/commitdiff
Each book control should say what its default orientation. Use this info
authorJulian Smart <julian@anthemion.co.uk>
Tue, 6 Jun 2006 11:05:22 +0000 (11:05 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 6 Jun 2006 11:05:22 +0000 (11:05 +0000)
if no alignment style, otherwise assertion will happen in GetPageRect.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/bookctrl.h
src/common/bookctrl.cpp

index 4cea68ba31230c34f62e8833596c8277466017e6..d1dfe04f5022779e39e30b428ba65b919b7eb9c8 100644 (file)
@@ -118,6 +118,9 @@ 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; }
@@ -127,7 +130,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_BOTTOM | wxBK_TOP); }
+    bool IsVertical() const { return HasFlag(wxBK_ALIGN_MASK) ? HasFlag(wxBK_BOTTOM | wxBK_TOP) : (0 != (GetDefaultAlignment() & (wxBK_BOTTOM | wxBK_TOP))); }
 
     // set/get option to shrink to fit current page
     void SetFitToCurrentPage(bool fit) { m_fitToCurrentPage = fit; }
index 0d86e640080dfee71efd9e8690f47d5e6b936504..e8539c12f482089aee95e4951f411161f915422b 100644 (file)
@@ -268,7 +268,11 @@ wxRect wxBookCtrlBase::GetPageRect() const
 
     wxPoint pt;
     wxRect rectPage(pt, GetClientSize());
-    switch ( GetWindowStyle() & wxBK_ALIGN_MASK )
+    long style = GetWindowStyle();
+    if ( !HasFlag(wxBK_ALIGN_MASK) )
+        style = GetDefaultAlignment();
+
+    switch ( style )
     {
         default:
             wxFAIL_MSG( _T("unexpected alignment") );