- added wxMicroSleep() and wxMilliSleep() replacing deprecated wxUsleep()
- basic UDP sockets support (Lenny Maiorani)
- fixed wxDateTime::GetWeekDayName() for some dates (Daniel Kaps)
-- support for comma in contrib gizmo wxLEDNumberCtrl (Grant Likely)
- deprecated wxDateTime::SetToTheWeek() in favour of SetToWeekOfYear()
All (GUI):
- added samples/splash
- added support for stock buttons
- added wxTopLevelWindow::RequestUserAttention()
+- support for comma in contrib gizmo wxLEDNumberCtrl (Grant Likely)
+- recursive wxSizer::Show for subsizer and return value if element was found
Unix:
\membersection{wxSizer::Show}\label{wxsizershow}
-\func{void}{Show}{\param{wxWindow* }{window}, \param{bool }{show = true}}
+\func{bool}{Show}{\param{wxWindow* }{window}, \param{bool }{show = true}, \param{bool }{recursive = false}}
-\func{void}{Show}{\param{wxSizer* }{sizer}, \param{bool }{show = true}}
+\func{bool}{Show}{\param{wxSizer* }{sizer}, \param{bool }{show = true}, \param{bool }{recursive = false}}
-\func{void}{Show}{\param{size\_t }{index}, \param{bool }{show = true}}
+\func{bool}{Show}{\param{size\_t }{index}, \param{bool }{show = true}}
Shows or hides the {\it window}, {\it sizer}, or item at {\it index}.
To make a sizer item disappear or reappear, use Show() followed by Layout().
+Use parameter {\it recursive} to show or hide elements found in subsizers.
+
+Returns true if the child item was found, false otherwise.
Note that this only works with wxBoxSizer and wxFlexGridSizer, since they
are the only two sizer classes that can size rows/columns independently.
void SetMinSize(const wxSize& size)
{
if (IsWindow()) m_window->SetMinSize(size);
- m_minSize = size;
+ m_minSize = size;
}
void SetMinSize( int x, int y )
- { SetMinSize(wxSize(x, y)); }
+ { SetMinSize(wxSize(x, y)); }
void SetInitSize( int x, int y )
{ SetMinSize(wxSize(x, y)); }
// Manage whether individual scene items are considered
// in the layout calculations or not.
- void Show( wxWindow *window, bool show = true );
- void Show( wxSizer *sizer, bool show = true );
- void Show( size_t index, bool show = true );
+ bool Show( wxWindow *window, bool show = true, bool recursive = false );
+ bool Show( wxSizer *sizer, bool show = true, bool recursive = false );
+ bool Show( size_t index, bool show = true );
- void Hide( wxSizer *sizer )
- { Show( sizer, false ); }
- void Hide( wxWindow *window )
- { Show( window, false ); }
- void Hide( size_t index )
- { Show( index, false ); }
+ bool Hide( wxSizer *sizer, bool recursive = false )
+ { return Show( sizer, false, recursive ); }
+ bool Hide( wxWindow *window, bool recursive = false )
+ { return Show( window, false, recursive ); }
+ bool Hide( size_t index )
+ { return Show( index, false ); }
bool IsShown( wxWindow *window ) const;
bool IsShown( wxSizer *sizer ) const;
// Read-only access to the row heights and col widths arrays
const wxArrayInt& GetRowHeights() const { return m_rowHeights; }
const wxArrayInt& GetColWidths() const { return m_colWidths; }
-
+
// implementation
virtual void RecalcSizes();
virtual wxSize CalcMin();
void AdjustForFlexDirection();
void AdjustForGrowables(const wxSize& sz, const wxSize& minsz,
int nrows, int ncols);
-
+
// the heights/widths of all rows/columns
wxArrayInt m_rowHeights,
m_colWidths;
wxDEPRECATED( wxBookCtrlSizer(wxBookCtrl *bookctrl) );
wxBookCtrl *GetControl() const { return m_bookctrl; }
-
+
virtual void RecalcSizes();
virtual wxSize CalcMin();
// this protected ctor lets us mark the real one above as deprecated
// and still have warning-free build of the library itself:
wxBookCtrlSizer() {}
-
+
wxBookCtrl *m_bookctrl;
private:
WX_DEFINE_EXPORTED_LIST( wxSizerItemList );
/*
- TODO PROPERTIES
- sizeritem
- object
- object_ref
- minsize
- option
- flag
- border
+ TODO PROPERTIES
+ sizeritem
+ object
+ object_ref
+ minsize
+ option
+ flag
+ border
spacer
- option
- flag
- borfder
- boxsizer
- orient
+ option
+ flag
+ borfder
+ boxsizer
+ orient
staticboxsizer
- orient
- label
- gridsizer
- rows
- cols
- vgap
- hgap
- flexgridsizer
- rows
- cols
- vgap
- hgap
- growablerows
- growablecols
+ orient
+ label
+ gridsizer
+ rows
+ cols
+ vgap
+ hgap
+ flexgridsizer
+ rows
+ cols
+ vgap
+ hgap
+ growablerows
+ growablecols
minsize
*/
//---------------------------------------------------------------------------
if (flag & wxFIXED_MINSIZE)
window->SetMinSize(window->GetSize());
m_minSize = window->GetSize();
-
+
// aspect ratio calculated from initial size
SetRatio( m_minSize );
ret.y += m_border;
if (m_flag & wxSOUTH)
ret.y += m_border;
-
+
return ret;
}
return true;
}
-void wxSizer::Show( wxWindow *window, bool show )
+bool wxSizer::Show( wxWindow *window, bool show, bool recursive )
{
wxASSERT_MSG( window, _T("Show for NULL window") );
if (item->GetWindow() == window)
{
item->Show( show );
- break;
+
+ return true;
}
+ else if (recursive && item->IsSizer())
+ {
+ if (item->GetSizer()->Show(window, show, recursive))
+ return true;
+ }
+
node = node->GetNext();
}
+
+ return false;
}
-void wxSizer::Show( wxSizer *sizer, bool show )
+bool wxSizer::Show( wxSizer *sizer, bool show, bool recursive )
{
wxASSERT_MSG( sizer, _T("Show for NULL sizer") );
if (item->GetSizer() == sizer)
{
item->Show( show );
- break;
+
+ return true;
}
+ else if (recursive && item->IsSizer())
+ {
+ if (item->GetSizer()->Show(sizer, show, recursive))
+ return true;
+ }
+
node = node->GetNext();
}
+
+ return false;
}
-void wxSizer::Show( size_t index, bool show )
+bool wxSizer::Show( size_t index, bool show)
{
- wxCHECK_RET( index < m_children.GetCount(),
+ wxCHECK_MSG( index < m_children.GetCount(),
+ false,
_T("Show index is out of range") );
m_children.Item( index )->GetData()->Show( show );
+
+ return true;
}
void wxSizer::ShowItems( bool show )
void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h )
{
wxPoint pt( x,y );
- wxSize sz( item->GetMinSizeWithBorder() );
+ wxSize sz( item->GetMinSizeWithBorder() );
int flag = item->GetFlag();
if ((flag & wxEXPAND) || (flag & wxSHAPED))
}
AdjustForFlexDirection();
-
+
// Sum total minimum size, including gaps between rows/columns.
// -1 is used as a magic number meaning empty column.
int width = 0;
array[n] = largest;
}
}
-}
+}
void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz, const wxSize& minsz,
// requested growable rows/columns are still valid.
if (m_growableRows[idx] >= nrows)
continue;
-
+
// If all items in a row/column are hidden, that row/column will
// have a dimension of -1. This causes the row/column to be
// hidden completely.
// requested growable rows/columns are still valid.
if (m_growableCols[idx] >= ncols)
continue;
-
+
// If all items in a row/column are hidden, that row/column will
// have a dimension of -1. This causes the column to be hidden
// completely.
if (item->IsShown())
item->CalcMin(); // result is stored in the item
-
+
if (item->IsShown() && item->GetProportion() != 0)
m_stretchable += item->GetProportion();
int stretch = item->GetProportion();
wxSize size( item->GetMinSizeWithBorder() );
int minSize;
-
+
// Integer division rounded up is (a + b - 1) / b
// Round up needed in order to guarantee that all
// all items will have size not less then their min size
minSize = ( size.x*m_stretchable + stretch - 1)/stretch;
else
minSize = ( size.y*m_stretchable + stretch - 1)/stretch;
-
+
if (minSize > maxMinSize)
maxMinSize = minSize;
}
// pixels (otherwise overlapping occurs at the top). The "other"
// border has to be 11.
extraTop = 11;
- other = 11;
+ other = 11;
}
}