growablecols
minsize
*/
+
//---------------------------------------------------------------------------
// wxSizerItem
//---------------------------------------------------------------------------
+void wxSizerItem::Init()
+{
+ m_window = NULL;
+ m_sizer = NULL;
+ m_show = true;
+ m_userData = NULL;
+ m_zoneRect = wxRect( 0, 0, 0, 0 );
+}
+
+void wxSizerItem::Init(const wxSizerFlags& flags)
+{
+ Init();
+
+ m_proportion = flags.GetProportion();
+ m_flag = flags.GetFlags();
+ m_border = flags.GetBorderInPixels();
+}
+
wxSizerItem::wxSizerItem( int width, int height, int proportion, int flag, int border, wxObject* userData )
: m_window( NULL )
, m_sizer( NULL )
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
+ , m_zoneRect( 0, 0, 0, 0 )
, m_show( true )
, m_userData( userData )
{
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
+ , m_zoneRect( 0, 0, 0, 0 )
, m_show( true )
, m_userData( userData )
{
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
+ , m_zoneRect( 0, 0, 0, 0 )
, m_show( true )
, m_ratio( 0.0 )
, m_userData( userData )
}
wxSizerItem::wxSizerItem()
- : m_window( NULL )
- , m_sizer( NULL )
- , m_proportion( 0 )
- , m_border( 0 )
- , m_flag( 0 )
- , m_show( true )
- , m_ratio( 0.0 )
- , m_userData( NULL )
{
+ Init();
+
+ m_proportion = 0;
+ m_border = 0;
+ m_flag = 0;
}
wxSizerItem::~wxSizerItem()
if (IsSizer())
m_sizer->SetDimension( pos.x, pos.y, size.x, size.y );
+ m_zoneRect = wxRect(pos, size);
if (IsWindow())
m_window->SetSize( pos.x, pos.y, size.x, size.y, wxSIZE_ALLOW_MINUS_ONE );
WX_CLEAR_LIST(wxSizerItemList, m_children);
}
-void wxSizer::Insert( size_t index, wxSizerItem *item )
+wxSizerItem* wxSizer::Insert( size_t index, wxSizerItem *item )
{
m_children.Insert( index, item );
if( item->GetWindow() )
item->GetWindow()->SetContainingSizer( this );
+
+ return item;
}
bool wxSizer::Remove( wxWindow *window )
// Limit the size if sizeMax != wxDefaultSize
- if ( size.x > sizeMax.x && sizeMax.x != -1 )
+ if ( size.x > sizeMax.x && sizeMax.x != wxDefaultCoord )
size.x = sizeMax.x;
- if ( size.y > sizeMax.y && sizeMax.y != -1 )
+ if ( size.y > sizeMax.y && sizeMax.y != wxDefaultCoord )
size.y = sizeMax.y;
return size;
// Limit the size if sizeMax != wxDefaultSize
- if ( size.x > sizeMax.x && sizeMax.x != -1 )
+ if ( size.x > sizeMax.x && sizeMax.x != wxDefaultCoord )
size.x = sizeMax.x;
- if ( size.y > sizeMax.y && sizeMax.y != -1 )
+ if ( size.y > sizeMax.y && sizeMax.y != wxDefaultCoord )
size.y = sizeMax.y;
return size;
return true;
}
-bool wxSizer::Show( wxWindow *window, bool show, bool recursive )
+wxSizerItem* wxSizer::GetItem( wxWindow *window, bool recursive )
{
- wxASSERT_MSG( window, _T("Show for NULL window") );
+ wxASSERT_MSG( window, _T("GetItem for NULL window") );
wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
if (item->GetWindow() == window)
{
- item->Show( show );
-
- return true;
+ return item;
}
else if (recursive && item->IsSizer())
{
- if (item->GetSizer()->Show(window, show, recursive))
- return true;
+ wxSizerItem *subitem = item->GetSizer()->GetItem( window, true );
+ if (subitem)
+ return subitem;
}
node = node->GetNext();
}
- return false;
+ return NULL;
}
-bool wxSizer::Show( wxSizer *sizer, bool show, bool recursive )
+wxSizerItem* wxSizer::GetItem( wxSizer *sizer, bool recursive )
{
- wxASSERT_MSG( sizer, _T("Show for NULL sizer") );
+ wxASSERT_MSG( sizer, _T("GetItem for NULL sizer") );
wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
- wxSizerItem *item = node->GetData();
+ wxSizerItem *item = node->GetData();
if (item->GetSizer() == sizer)
{
- item->Show( show );
-
- return true;
+ return item;
}
else if (recursive && item->IsSizer())
{
- if (item->GetSizer()->Show(sizer, show, recursive))
- return true;
+ wxSizerItem *subitem = item->GetSizer()->GetItem( sizer, true );
+ if (subitem)
+ return subitem;
}
node = node->GetNext();
}
+ return NULL;
+}
+
+wxSizerItem* wxSizer::GetItem( size_t index )
+{
+ wxCHECK_MSG( index < m_children.GetCount(),
+ NULL,
+ _T("GetItem index is out of range") );
+
+ return m_children.Item( index )->GetData();
+}
+
+bool wxSizer::Show( wxWindow *window, bool show, bool recursive )
+{
+ wxSizerItem *item = GetItem( window, recursive );
+
+ if ( item )
+ {
+ item->Show( show );
+ return true;
+ }
+
+ return false;
+}
+
+bool wxSizer::Show( wxSizer *sizer, bool show, bool recursive )
+{
+ wxSizerItem *item = GetItem( sizer, recursive );
+
+ if ( item )
+ {
+ item->Show( show );
+ return true;
+ }
+
return false;
}
bool wxSizer::Show( size_t index, bool show)
{
- wxCHECK_MSG( index < m_children.GetCount(),
- false,
- _T("Show index is out of range") );
+ wxSizerItem *item = GetItem( index );
- m_children.Item( index )->GetData()->Show( show );
+ if ( item )
+ {
+ item->Show( show );
+ return true;
+ }
- return true;
+ return false;
}
void wxSizer::ShowItems( bool show )
}
wxPoint child_pos( pt );
- wxSize child_size( wxSize( size.x, height) );
+ wxSize child_size( size.x, height );
if (item->GetFlag() & (wxEXPAND | wxSHAPED))
child_size.x = m_size.x;
}
wxPoint child_pos( pt );
- wxSize child_size( wxSize(width, size.y) );
+ wxSize child_size( width, size.y );
if (item->GetFlag() & (wxEXPAND | wxSHAPED))
child_size.y = m_size.y;
#else
#ifdef __WXGTK__
- if ( box->GetLabel().IsEmpty() )
+ if ( box->GetLabel().empty() )
*borderTop = 5;
else
#endif // __WXGTK__
#if wxUSE_BOOKCTRL
-wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrl *bookctrl)
+wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase *bookctrl)
: m_bookctrl(bookctrl)
{
wxASSERT_MSG( bookctrl, wxT("wxBookCtrlSizer needs a control") );