added wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag that prevents the sizer from changing size if a window is hidden

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52309 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-03-04 12:01:36 +00:00
parent ad1c5f459b
commit 0ba6faaeee
3 changed files with 37 additions and 8 deletions

View File

@@ -1409,7 +1409,10 @@ enum wxOrientation
wxHORIZONTAL = 0x0004, wxHORIZONTAL = 0x0004,
wxVERTICAL = 0x0008, wxVERTICAL = 0x0008,
wxBOTH = wxVERTICAL | wxHORIZONTAL wxBOTH = wxVERTICAL | wxHORIZONTAL,
/* a mask to extract orientation from the combination of flags */
wxORIENTATION_MASK = wxBOTH
}; };
enum wxDirection enum wxDirection
@@ -1427,7 +1430,10 @@ enum wxDirection
wxWEST = wxLEFT, wxWEST = wxLEFT,
wxEAST = wxRIGHT, 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 enum wxAlignment
@@ -1449,20 +1455,31 @@ enum wxAlignment
wxALIGN_MASK = 0x0f00 wxALIGN_MASK = 0x0f00
}; };
enum wxStretch /* misc. flags for wxSizer items */
enum wxSizerFlagBits
{ {
/* for compatibility only, default now, don't use explicitly any more */ /* for compatibility only, default now, don't use explicitly any more */
#if WXWIN_COMPATIBILITY_2_6 #if WXWIN_COMPATIBILITY_2_6
wxADJUST_MINSIZE = 0, wxADJUST_MINSIZE = 0,
#endif #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, wxSTRETCH_NOT = 0x0000,
wxSHRINK = 0x1000, wxSHRINK = 0x1000,
wxGROW = 0x2000, wxGROW = 0x2000,
wxEXPAND = wxGROW, wxEXPAND = wxGROW,
wxSHAPED = 0x4000, wxSHAPED = 0x4000,
wxFIXED_MINSIZE = 0x8000, wxTILE = wxSHAPED | wxFIXED_MINSIZE,
wxTILE = 0xc000
/* a mask to extract stretch from the combination of flags */
wxSTRETCH_MASK = 0x7000 /* sans wxTILE */
}; };
/* border flags: the values are chosen for backwards compatibility */ /* border flags: the values are chosen for backwards compatibility */

View File

@@ -170,6 +170,13 @@ public:
return *this; 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 // accessors for wxSizer only
int GetProportion() const { return m_proportion; } int GetProportion() const { return m_proportion; }
int GetFlags() const { return m_flags; } int GetFlags() const { return m_flags; }
@@ -332,10 +339,12 @@ public:
{ return m_kind == Item_Sizer ? m_sizer : NULL; } { return m_kind == Item_Sizer ? m_sizer : NULL; }
wxSize GetSpacer() const; 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 // 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; bool IsShown() const;
void Show(bool show); void Show(bool show);
void SetUserData(wxObject* userData) void SetUserData(wxObject* userData)

View File

@@ -522,6 +522,9 @@ void wxSizerItem::Show( bool show )
bool wxSizerItem::IsShown() const bool wxSizerItem::IsShown() const
{ {
if ( m_flag & wxRESERVE_SPACE_EVEN_IF_HIDDEN )
return true;
switch ( m_kind ) switch ( m_kind )
{ {
case Item_None: case Item_None: