backported wxRESERVE_SPACE_EVEN_IF_HIDDEN to 2.8
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -118,6 +118,8 @@ All (GUI):
|
||||
- Added alpha support to wxImage::Paste() (Steven Van Ingelgem)
|
||||
- Use current date when opening popup in generic wxDatePickerCtrl.
|
||||
- Remove associated help text from wxHelpProvider when a window is destroyed.
|
||||
- Added wxSizerFlags::ReserveSpaceEvenIfHidden() and
|
||||
wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag.
|
||||
|
||||
All (Unix):
|
||||
|
||||
|
@@ -139,6 +139,11 @@ use that size to calculate the layout. This allows layouts to
|
||||
adjust when an item changes and its \arg{best size} becomes
|
||||
different. If you would rather have a window item stay the size it
|
||||
started with then use wxFIXED\_MINSIZE.}
|
||||
\twocolitem{\windowstyle{wxRESERVE\_SPACE\_EVEN\_IF\_HIDDEN}}{Normally wxSizers
|
||||
don't allocate space for hidden windows or other items. This flag overrides
|
||||
this behavior so that sufficient space is allocated for the window even if it
|
||||
isn't visible. This makes it possible to dynamically show and hide controls
|
||||
without resizing parent dialog, for example. \newsince{2.8.8}}
|
||||
\twocolitem{\windowstyle{wxALIGN\_CENTER wxALIGN\_CENTRE}\\
|
||||
\windowstyle{wxALIGN\_LEFT}\\
|
||||
\windowstyle{wxALIGN\_RIGHT}\\
|
||||
@@ -685,6 +690,17 @@ the window should be also set as its minimal size.
|
||||
Sets the proportion of this wxSizerFlags to \arg{proportion}
|
||||
|
||||
|
||||
\membersection{wxSizerFlags::ReserveSpaceEvenIfHidden}\label{wxsizerflagsreservespaceevenifhidden}
|
||||
|
||||
\func{wxSizerFlags\& }{ReserveSpaceEvenIfHidden}{\void}
|
||||
|
||||
Set the \texttt{wxRESERVE\_SPACE\_EVEN\_IF\_HIDDEN} flag. Normally wxSizers
|
||||
don't allocate space for hidden windows or other items. This flag overrides
|
||||
this behavior so that sufficient space is allocated for the window even if it
|
||||
isn't visible. This makes it possible to dynamically show and hide controls
|
||||
without resizing parent dialog, for example. \newsince{2.8.8}
|
||||
|
||||
|
||||
\membersection{wxSizerFlags::Right}\label{wxsizerflagsright}
|
||||
|
||||
\func{wxSizerFlags\& }{Right}{\void}
|
||||
|
@@ -1273,6 +1273,9 @@ enum wxStretch
|
||||
wxEXPAND = wxGROW,
|
||||
wxSHAPED = 0x4000,
|
||||
wxFIXED_MINSIZE = 0x8000,
|
||||
#if wxABI_VERSION >= 20808
|
||||
wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002,
|
||||
#endif
|
||||
wxTILE = 0xc000,
|
||||
|
||||
/* for compatibility only, default now, don't use explicitly any more */
|
||||
|
@@ -24,6 +24,8 @@ class WXDLLIMPEXP_FWD_CORE wxButton;
|
||||
class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
|
||||
class WXDLLIMPEXP_FWD_CORE wxSizerItem;
|
||||
class WXDLLIMPEXP_FWD_CORE wxSizer;
|
||||
class WXDLLIMPEXP_FWD_CORE wxFlexGridSizer;
|
||||
class WXDLLIMPEXP_FWD_CORE wxGridBagSizer;
|
||||
|
||||
#ifndef wxUSE_BORDER_BY_DEFAULT
|
||||
#ifdef __SMARTPHONE__
|
||||
@@ -175,6 +177,11 @@ public:
|
||||
}
|
||||
#endif // wx 2.8.2+
|
||||
|
||||
#if wxABI_VERSION >= 20808
|
||||
// makes the item ignore window's visibility status
|
||||
wxSizerFlags& ReserveSpaceEvenIfHidden();
|
||||
#endif
|
||||
|
||||
// accessors for wxSizer only
|
||||
int GetProportion() const { return m_proportion; }
|
||||
int GetFlags() const { return m_flags; }
|
||||
@@ -393,8 +400,15 @@ protected:
|
||||
wxObject *m_userData;
|
||||
|
||||
private:
|
||||
// 2.8-only implementation detail for wxRESERVE_SPACE_EVEN_IF_HIDDEN
|
||||
bool ShouldAccountFor() const;
|
||||
|
||||
DECLARE_CLASS(wxSizerItem)
|
||||
DECLARE_NO_COPY_CLASS(wxSizerItem)
|
||||
|
||||
friend class wxBoxSizer;
|
||||
friend class wxFlexGridSizer;
|
||||
friend class wxGridBagSizer;
|
||||
};
|
||||
|
||||
WX_DECLARE_EXPORTED_LIST( wxSizerItem, wxSizerItemList );
|
||||
|
@@ -453,7 +453,7 @@ wxSize wxGridBagSizer::CalcMin()
|
||||
while (node)
|
||||
{
|
||||
wxGBSizerItem* item = (wxGBSizerItem*)node->GetData();
|
||||
if ( item->IsShown() )
|
||||
if ( item->ShouldAccountFor() )
|
||||
{
|
||||
int row, col, endrow, endcol;
|
||||
|
||||
@@ -538,7 +538,7 @@ void wxGridBagSizer::RecalcSizes()
|
||||
int row, col, endrow, endcol;
|
||||
wxGBSizerItem* item = (wxGBSizerItem*)node->GetData();
|
||||
|
||||
if ( item->IsShown() )
|
||||
if ( item->ShouldAccountFor() )
|
||||
{
|
||||
item->GetPos(row, col);
|
||||
item->GetEndPos(endrow, endcol);
|
||||
|
@@ -86,6 +86,17 @@ WX_DEFINE_EXPORTED_LIST( wxSizerItemList )
|
||||
minsize
|
||||
*/
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSizerFlags
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxSizerFlags& wxSizerFlags::ReserveSpaceEvenIfHidden()
|
||||
{
|
||||
m_flags |= wxRESERVE_SPACE_EVEN_IF_HIDDEN;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSizerItem
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -487,6 +498,37 @@ bool wxSizerItem::IsShown() const
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is a helper to support wxRESERVE_SPACE_EVEN_IF_HIDDEN. In wx 2.9+,
|
||||
// this flag is respected by IsShown(), but not in wx 2.8.
|
||||
bool wxSizerItem::ShouldAccountFor() const
|
||||
{
|
||||
if ( m_flag & wxRESERVE_SPACE_EVEN_IF_HIDDEN )
|
||||
return true;
|
||||
|
||||
if ( IsSizer() )
|
||||
{
|
||||
// this mirrors wxSizerItem::IsShown() code above
|
||||
const wxSizerItemList& children = m_sizer->GetChildren();
|
||||
if ( children.GetCount() == 0 )
|
||||
return true;
|
||||
|
||||
for ( wxSizerItemList::compatibility_iterator
|
||||
node = children.GetFirst();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
{
|
||||
if ( node->GetData()->ShouldAccountFor() )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return IsShown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
void wxSizerItem::SetOption( int option )
|
||||
{
|
||||
@@ -1415,7 +1457,7 @@ wxSize wxFlexGridSizer::CalcMin()
|
||||
while (node)
|
||||
{
|
||||
wxSizerItem *item = node->GetData();
|
||||
if ( item->IsShown() )
|
||||
if ( item->ShouldAccountFor() )
|
||||
{
|
||||
wxSize sz( item->CalcMin() );
|
||||
int row = i / ncols;
|
||||
@@ -1660,7 +1702,7 @@ void wxBoxSizer::RecalcSizes()
|
||||
{
|
||||
wxSizerItem *item = node->GetData();
|
||||
|
||||
if (item->IsShown())
|
||||
if (item->ShouldAccountFor())
|
||||
{
|
||||
wxSize size( item->GetMinSizeWithBorder() );
|
||||
|
||||
@@ -1753,7 +1795,7 @@ wxSize wxBoxSizer::CalcMin()
|
||||
{
|
||||
wxSizerItem *item = node->GetData();
|
||||
|
||||
if ( item->IsShown() )
|
||||
if ( item->ShouldAccountFor() )
|
||||
{
|
||||
item->CalcMin(); // result is stored in the item
|
||||
|
||||
@@ -1771,7 +1813,7 @@ wxSize wxBoxSizer::CalcMin()
|
||||
{
|
||||
wxSizerItem *item = node->GetData();
|
||||
|
||||
if (item->IsShown() && item->GetProportion() != 0)
|
||||
if (item->ShouldAccountFor() && item->GetProportion() != 0)
|
||||
{
|
||||
int stretch = item->GetProportion();
|
||||
wxSize size( item->GetMinSizeWithBorder() );
|
||||
@@ -1797,7 +1839,7 @@ wxSize wxBoxSizer::CalcMin()
|
||||
{
|
||||
wxSizerItem *item = node->GetData();
|
||||
|
||||
if (item->IsShown())
|
||||
if (item->ShouldAccountFor())
|
||||
{
|
||||
wxSize size( item->GetMinSizeWithBorder() );
|
||||
if (item->GetProportion() != 0)
|
||||
|
@@ -37,6 +37,8 @@
|
||||
*wxRichTextCtrl*SetTextCursor*;
|
||||
*wxRichTextCtrl*SetURLCursor*;
|
||||
*wxScrollHelper*HandleOnChildFocus*;
|
||||
*wxSizerFlags*ReserveSpaceEvenIfHidden*;
|
||||
*wxSizerItem*ShouldAccountFor*;
|
||||
*wxWindowBase*Get*Sibling*;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user