]> git.saurik.com Git - wxWidgets.git/commitdiff
call wxSizerFlags::Top/Bottom() or Left/Right() shouldn't change horizontal or vertic...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Jun 2008 01:22:34 +0000 (01:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Jun 2008 01:22:34 +0000 (01:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/sizer.h
interface/sizer.h

index 59b834d2f3876177ecc109e0a8852303d7a6ebe2..85c5292c4ff3f763f45e7c51a0e5801a65d3e737 100644 (file)
@@ -58,27 +58,51 @@ public:
         return *this;
     }
 
-    wxSizerFlags& Align(int alignment) // combination of wxAlignment values
+    wxSizerFlags& Expand()
     {
-        m_flags &= ~wxALIGN_MASK;
-        m_flags |= alignment;
-
+        m_flags |= wxEXPAND;
         return *this;
     }
 
-    wxSizerFlags& Expand()
+    // notice that Align() replaces the current alignment flags, use specific
+    // methods below such as Top(), Left() &c if you want to set just the
+    // vertical or horizontal alignment
+    wxSizerFlags& Align(int alignment) // combination of wxAlignment values
     {
-        m_flags |= wxEXPAND;
+        m_flags &= ~wxALIGN_MASK;
+        m_flags |= alignment;
+
         return *this;
     }
 
     // some shortcuts for Align()
     wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); }
     wxSizerFlags& Center() { return Centre(); }
-    wxSizerFlags& Top() { return Align(wxALIGN_TOP); }
-    wxSizerFlags& Left() { return Align(wxALIGN_LEFT); }
-    wxSizerFlags& Right() { return Align(wxALIGN_RIGHT); }
-    wxSizerFlags& Bottom() { return Align(wxALIGN_BOTTOM); }
+
+    wxSizerFlags& Top() 
+    { 
+        m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL); 
+        return *this; 
+    }
+
+    wxSizerFlags& Left() 
+    { 
+        m_flags &= ~(wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL); 
+        return *this; 
+    }
+
+    wxSizerFlags& Right() 
+    { 
+        m_flags = (m_flags & ~wxALIGN_CENTRE_HORIZONTAL) | wxALIGN_RIGHT; 
+        return *this; 
+    }
+
+    wxSizerFlags& Bottom() 
+    { 
+        m_flags = (m_flags & ~wxALIGN_CENTRE_VERTICAL) | wxALIGN_BOTTOM; 
+        return *this; 
+    }
+
 
     // default border size used by Border() below
     static int GetDefaultBorder()
index fa8f19d059436c340cf9fea91a7c80b913e3a8dc..619bd2dcba35d767cc1c47d8be218249effadd58 100644 (file)
@@ -322,11 +322,12 @@ public:
     @class wxSizerFlags
     @wxheader{sizer.h}
 
-    Normally, when you add an item to a sizer via
-    wxSizer::Add, you have to specify a lot of flags and
-    parameters which can be unwieldy. This is where wxSizerFlags comes in: it
-    allows you to specify all parameters using the named methods instead. For
-    example, instead of
+    Container for sizer items flags providing readable names for them.
+
+    Normally, when you add an item to a sizer via wxSizer::Add, you have to
+    specify a lot of flags and parameters which can be unwieldy. This is where
+    wxSizerFlags comes in: it allows you to specify all parameters using the
+    named methods instead. For example, instead of
 
     @code
     sizer->Add(ctrl, 0, wxEXPAND | wxALL, 10);
@@ -367,10 +368,14 @@ public:
     wxSizerFlags(int proportion = 0);
 
     /**
-        Sets the alignment of this wxSizerFlags to @e align.  Note that if this
-        method is not called, the wxSizerFlags has no specified alignment.
+        Sets the alignment of this wxSizerFlags to @e align.
+
+        This method replaces the previously set alignment with the specified
+        one.
 
         @see Top(), Left(), Right(), Bottom(), Centre()
+
+        @param align Combination of @c wxALIGN_XXX bit masks.
     */
     wxSizerFlags& Align(int align = 0);
 
@@ -389,9 +394,10 @@ public:
     wxSizerFlags& Border(int direction = wxALL);
 
     /**
-        Aligns the object to the bottom, shortcut for @c Align(wxALIGN_BOTTOM).
+        Aligns the object to the bottom, similar for @c Align(wxALIGN_BOTTOM).
 
-        @see Align()
+        Unlike Align(), this method doesn't change the horizontal alignment of
+        the item.
     */
     wxSizerFlags& Bottom();
 
@@ -447,9 +453,10 @@ public:
     static int GetDefaultBorder();
 
     /**
-        Aligns the object to the left, shortcut for @c Align(wxALIGN_LEFT)
+        Aligns the object to the left, similar for @c Align(wxALIGN_LEFT).
 
-        @see Align()
+        Unlike Align(), this method doesn't change the vertical alignment of
+        the item.
     */
     wxSizerFlags& Left();
 
@@ -459,9 +466,10 @@ public:
     wxSizerFlags& Proportion(int proportion = 0);
 
     /**
-        Aligns the object to the right, shortcut for @c Align(wxALIGN_RIGHT)
+        Aligns the object to the right, similar for @c Align(wxALIGN_RIGHT).
 
-        @see Align()
+        Unlike Align(), this method doesn't change the vertical alignment of
+        the item.
     */
     wxSizerFlags& Right();
 
@@ -472,9 +480,10 @@ public:
     wxSizerFlags& Shaped();
 
     /**
-        Aligns the object to the top, shortcut for @c Align(wxALIGN_TOP)
+        Aligns the object to the top, similar for @c Align(wxALIGN_TOP).
 
-        @see Align()
+        Unlike Align(), this method doesn't change the horizontal alignment of
+        the item.
     */
     wxSizerFlags& Top();