]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag that prevents the sizer from changing...
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 4 Mar 2008 12:01:36 +0000 (12:01 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 4 Mar 2008 12:01:36 +0000 (12:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52309 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/defs.h
include/wx/sizer.h
src/common/sizer.cpp

index 0c278d4f326eed32c6cc98dbd4d741f5ffe803fb..c48dbaa91fde862aaef5522410abdc72f4af64f6 100644 (file)
@@ -1409,7 +1409,10 @@ enum wxOrientation
     wxHORIZONTAL              = 0x0004,
     wxVERTICAL                = 0x0008,
 
-    wxBOTH                    = wxVERTICAL | wxHORIZONTAL
+    wxBOTH                    = wxVERTICAL | wxHORIZONTAL,
+
+    /*  a mask to extract orientation from the combination of flags */
+    wxORIENTATION_MASK        = wxBOTH
 };
 
 enum wxDirection
@@ -1427,7 +1430,10 @@ enum wxDirection
     wxWEST                    = wxLEFT,
     wxEAST                    = wxRIGHT,
 
-    wxALL                     = (wxUP | wxDOWN | wxRIGHT | wxLEFT)
+    wxALL                     = (wxUP | wxDOWN | wxRIGHT | wxLEFT),
+
+    /*  a mask to extract direction from the combination of flags */
+    wxDIRECTION_MASK           = wxALL
 };
 
 enum wxAlignment
@@ -1449,20 +1455,31 @@ enum wxAlignment
     wxALIGN_MASK              = 0x0f00
 };
 
-enum wxStretch
+/* misc. flags for wxSizer items */
+enum wxSizerFlagBits
 {
     /* for compatibility only, default now, don't use explicitly any more */
 #if WXWIN_COMPATIBILITY_2_6
-    wxADJUST_MINSIZE          = 0,
+    wxADJUST_MINSIZE               = 0,
 #endif
+    wxFIXED_MINSIZE                = 0x8000,
+    wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002,
+
+    /*  a mask to extract wxSizerFlagBits from combination of flags */
+    wxSIZER_FLAG_BITS_MASK         = 0x8002
+};
 
+enum wxStretch
+{
     wxSTRETCH_NOT             = 0x0000,
     wxSHRINK                  = 0x1000,
     wxGROW                    = 0x2000,
     wxEXPAND                  = wxGROW,
     wxSHAPED                  = 0x4000,
-    wxFIXED_MINSIZE           = 0x8000,
-    wxTILE                    = 0xc000
+    wxTILE                    = wxSHAPED | wxFIXED_MINSIZE,
+
+    /*  a mask to extract stretch from the combination of flags */
+    wxSTRETCH_MASK            = 0x7000 /* sans wxTILE */
 };
 
 /*  border flags: the values are chosen for backwards compatibility */
index b97b7c085489a0549570019cfd84854ba045ba0c..640f7a56812a94df6c108c02126cde79f96ee552 100644 (file)
@@ -170,6 +170,13 @@ public:
         return *this;
     }
 
+    // makes the item ignore window's visibility status
+    wxSizerFlags& ReserveSpaceEvenIfHidden()
+    {
+        m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN;
+        return *this;
+    }
+
     // accessors for wxSizer only
     int GetProportion() const { return m_proportion; }
     int GetFlags() const { return m_flags; }
@@ -332,10 +339,12 @@ public:
         { return m_kind == Item_Sizer ? m_sizer : NULL; }
     wxSize GetSpacer() const;
 
-    // this function behaves obviously for the windows and spacers but for the
+    // This function behaves obviously for the windows and spacers but for the
     // sizers it returns true if any sizer element is shown and only returns
-    // false if all of them are hidden
+    // false if all of them are hidden. Also, it always returns true if
+    // wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was used.
     bool IsShown() const;
+
     void Show(bool show);
 
     void SetUserData(wxObject* userData)
index cc81970cb5cd30cd72b5fad11b4ea495f24d368a..6d70ae0bc34a560a582e2581274b1d10f0a2fa5d 100644 (file)
@@ -522,6 +522,9 @@ void wxSizerItem::Show( bool show )
 
 bool wxSizerItem::IsShown() const
 {
+    if ( m_flag & wxRESERVE_SPACE_EVEN_IF_HIDDEN )
+        return true;
+
     switch ( m_kind )
     {
         case Item_None: