- // The size that come here will be including borders. Child items should get it
- // without borders.
- if( size>0 )
- {
- if( direction==wxHORIZONTAL )
- {
- if (m_flag & wxWEST)
- size -= m_border;
- if (m_flag & wxEAST)
- size -= m_border;
- }
- else if( direction==wxVERTICAL )
- {
- if (m_flag & wxNORTH)
- size -= m_border;
- if (m_flag & wxSOUTH)
- size -= m_border;
- }
- }
-
+ // The size that come here will be including borders. Child items should get it
+ // without borders.
+ if( size>0 )
+ {
+ if( direction==wxHORIZONTAL )
+ {
+ if (m_flag & wxWEST)
+ size -= m_border;
+ if (m_flag & wxEAST)
+ size -= m_border;
+ }
+ else if( direction==wxVERTICAL )
+ {
+ if (m_flag & wxNORTH)
+ size -= m_border;
+ if (m_flag & wxSOUTH)
+ size -= m_border;
+ }
+ }
+
bool didUse = false;
// Pass the information along to the held object
if (IsSizer())
{
didUse = GetSizer()->InformFirstDirection(direction,size,availableOtherDir);
if (didUse)
bool didUse = false;
// Pass the information along to the held object
if (IsSizer())
{
didUse = GetSizer()->InformFirstDirection(direction,size,availableOtherDir);
if (didUse)
}
else if (IsWindow())
{
didUse = GetWindow()->InformFirstDirection(direction,size,availableOtherDir);
if (didUse)
m_minSize = m_window->GetEffectiveMinSize();
}
else if (IsWindow())
{
didUse = GetWindow()->InformFirstDirection(direction,size,availableOtherDir);
if (didUse)
m_minSize = m_window->GetEffectiveMinSize();
-
- // This information is useful for items with wxSHAPED flag, since
- // we can request an optimal min size for such an item. Even if
- // we overwrite the m_minSize member here, we can read it back from
- // the owned window (happens automatically).
- if( (m_flag & wxSHAPED) && (m_flag & wxEXPAND) && direction )
- {
- if( !wxIsNullDouble(m_ratio) )
- {
- wxCHECK_MSG( (m_proportion==0), false, _T("Shaped item, non-zero proportion in wxSizerItem::InformFirstDirection()") );
- if( direction==wxHORIZONTAL && !wxIsNullDouble(m_ratio) )
- {
- // Clip size so that we don't take too much
- if( availableOtherDir>=0 && int(size/m_ratio)-m_minSize.y>availableOtherDir )
- size = int((availableOtherDir+m_minSize.y)*m_ratio);
- m_minSize = wxSize(size,int(size/m_ratio));
- }
- else if( direction==wxVERTICAL )
- {
- // Clip size so that we don't take too much
- if( availableOtherDir>=0 && int(size*m_ratio)-m_minSize.x>availableOtherDir )
- size = int((availableOtherDir+m_minSize.x)/m_ratio);
- m_minSize = wxSize(int(size*m_ratio),size);
- }
- didUse = true;
- }
- }
- }
-
+
+ // This information is useful for items with wxSHAPED flag, since
+ // we can request an optimal min size for such an item. Even if
+ // we overwrite the m_minSize member here, we can read it back from
+ // the owned window (happens automatically).
+ if( (m_flag & wxSHAPED) && (m_flag & wxEXPAND) && direction )
+ {
+ if( !wxIsNullDouble(m_ratio) )
+ {
+ wxCHECK_MSG( (m_proportion==0), false, _T("Shaped item, non-zero proportion in wxSizerItem::InformFirstDirection()") );
+ if( direction==wxHORIZONTAL && !wxIsNullDouble(m_ratio) )
+ {
+ // Clip size so that we don't take too much
+ if( availableOtherDir>=0 && int(size/m_ratio)-m_minSize.y>availableOtherDir )
+ size = int((availableOtherDir+m_minSize.y)*m_ratio);
+ m_minSize = wxSize(size,int(size/m_ratio));
+ }
+ else if( direction==wxVERTICAL )
+ {
+ // Clip size so that we don't take too much
+ if( availableOtherDir>=0 && int(size*m_ratio)-m_minSize.x>availableOtherDir )
+ size = int((availableOtherDir+m_minSize.x)/m_ratio);
+ m_minSize = wxSize(int(size*m_ratio),size);
+ }
+ didUse = true;
+ }
+ }
+ }
+
// a chance to adjust to that (we give it width component)
node = m_children.GetFirst();
bool didChangeMinSize = false;
// a chance to adjust to that (we give it width component)
node = m_children.GetFirst();
bool didChangeMinSize = false;
{
wxSizerItem *item = node->GetData();
didChangeMinSize |= item->InformFirstDirection( wxHORIZONTAL, w, -1 );
{
wxSizerItem *item = node->GetData();
didChangeMinSize |= item->InformFirstDirection( wxHORIZONTAL, w, -1 );
// made a separate function, since it's reused in AdjustForGrowables.
FindWidthsAndHeights(nrows,ncols);
// made a separate function, since it's reused in AdjustForGrowables.
FindWidthsAndHeights(nrows,ncols);
// Inform child items about the size in minor direction, that can
// change how much free space we have in major dir and how to distribute it.
int majorMinSum = 0;
// Inform child items about the size in minor direction, that can
// change how much free space we have in major dir and how to distribute it.
int majorMinSum = 0;
wxSize szMinPrev = item->GetMinSizeWithBorder();
item->InformFirstDirection(m_orient^wxBOTH,totalMinorSize,delta);
wxSize szMin = item->GetMinSizeWithBorder();
wxSize szMinPrev = item->GetMinSizeWithBorder();
item->InformFirstDirection(m_orient^wxBOTH,totalMinorSize,delta);
wxSize szMin = item->GetMinSizeWithBorder();
- // Since we passed available space along to the item, it should not
- // take too much ,so delat should not become negative.
- delta -= deltaChange;
+ // Since we passed available space along to the item, it should not
+ // take too much, so delta should not become negative.
+ delta -= deltaChange;
}
// And update our min size
SizeInMajorDir(m_minSize) = majorMinSum;
// might have a new delta now
}
// And update our min size
SizeInMajorDir(m_minSize) = majorMinSum;
// might have a new delta now
- SizeInMajorDir(m_minSize) += SizeInMajorDir(sizeMinThis);
- if ( SizeInMinorDir(sizeMinThis) > SizeInMinorDir(m_minSize) )
- SizeInMinorDir(m_minSize) = SizeInMinorDir(sizeMinThis);
+ const wxSize sizeMinThis = item->CalcMin();
+ SizeInMajorDir(m_minSize) += GetSizeInMajorDir(sizeMinThis);
+ if ( GetSizeInMinorDir(sizeMinThis) > GetSizeInMinorDir(m_minSize) )
+ SizeInMinorDir(m_minSize) = GetSizeInMinorDir(sizeMinThis);
// (which might be extended)
struct wxPropHolder : public wxObject
{
wxPropHolder( ) : m_item(0), m_propOld(0) { }
void Init( wxSizerItem *item, int propOld ) { m_item=item; m_propOld=propOld; }
// (which might be extended)
struct wxPropHolder : public wxObject
{
wxPropHolder( ) : m_item(0), m_propOld(0) { }
void Init( wxSizerItem *item, int propOld ) { m_item=item; m_propOld=propOld; }
IMPLEMENT_DYNAMIC_CLASS(wxWrapSizer, wxBoxSizer);
wxWrapSizer::wxWrapSizer( int orient, int flags )
IMPLEMENT_DYNAMIC_CLASS(wxWrapSizer, wxBoxSizer);
wxWrapSizer::wxWrapSizer( int orient, int flags )
- wxSizerItem *psi = m_rows.GetItem( (size_t)ix );
-
- // Restore proportion for last item on line (if item has not been deleted)
- wxPropHolder *pph = (wxPropHolder*)psi->GetUserData();
- if( pph && GetChildren().Find(pph->m_item) )
- pph->m_item->SetProportion(pph->m_propOld);
-
+ wxSizerItem *psi = m_rows.GetItem( (size_t)ix );
+
+ // Restore proportion for last item on line (if item has not been deleted)
+ wxPropHolder *pph = (wxPropHolder*)psi->GetUserData();
+ if( pph && GetChildren().Find(pph->m_item) )
+ pph->m_item->SetProportion(pph->m_propOld);
+
wxSizer *psz = psi->GetSizer();
wxASSERT( psz );
wxSizerItemList &sl = psz->GetChildren();
while( sl.GetLast() )
sl.Erase( sl.GetLast() );
}
wxSizer *psz = psi->GetSizer();
wxASSERT( psz );
wxSizerItemList &sl = psz->GetChildren();
while( sl.GetLast() )
sl.Erase( sl.GetLast() );
}
// Now put our child items into child sizers instead
wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
wxSizerItem *item = NULL, *itemLast=NULL;
// Now put our child items into child sizers instead
wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
wxSizerItem *item = NULL, *itemLast=NULL;
// Get a new empty sizer to insert into
if( (int)m_rows.GetChildren().GetCount()<=m_n_line )
m_rows.Add( new wxBoxSizer(GetOrientation()), 1, wxEXPAND );
// Get a new empty sizer to insert into
if( (int)m_rows.GetChildren().GetCount()<=m_n_line )
m_rows.Add( new wxBoxSizer(GetOrientation()), 1, wxEXPAND );
- // If item is a window, it now has a pointer to the child sizer,
- // which is wrong. Set it to point to us.
+ // If item is a window, it now has a pointer to the child sizer,
+ // which is wrong. Set it to point to us.
while( (int)m_rows.GetChildren().GetCount()>m_n_line )
m_rows.Remove( m_n_line );
// Now do layout on row sizer
m_rows.SetDimension( m_position.x, m_position.y, m_size.x, m_size.y );
while( (int)m_rows.GetChildren().GetCount()>m_n_line )
m_rows.Remove( m_n_line );
// Now do layout on row sizer
m_rows.SetDimension( m_position.x, m_position.y, m_size.x, m_size.y );