X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/efba61bac0c9eab455ffa18daf982fc68faba077..4e1ba52e0a6749942692db66e852994113eac1af:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 93d8ed9709..f787a74ffc 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -99,7 +99,7 @@ void wxSizerItem::Init() m_sizer = NULL; m_show = true; m_userData = NULL; - m_zoneRect = wxRect( 0, 0, 0, 0 ); + m_zoneRect = wxRect(0,0,0,0); } void wxSizerItem::Init(const wxSizerFlags& flags) @@ -119,7 +119,7 @@ wxSizerItem::wxSizerItem( int width, int height, int proportion, int flag, int b , m_proportion( proportion ) , m_border( border ) , m_flag( flag ) - , m_zoneRect( 0, 0, 0, 0 ) + , m_zoneRect() , m_show( true ) , m_userData( userData ) { @@ -132,7 +132,7 @@ wxSizerItem::wxSizerItem( wxWindow *window, int proportion, int flag, int border , m_proportion( proportion ) , m_border( border ) , m_flag( flag ) - , m_zoneRect( 0, 0, 0, 0 ) + , m_zoneRect() , m_show( true ) , m_userData( userData ) { @@ -152,7 +152,7 @@ wxSizerItem::wxSizerItem( wxSizer *sizer, int proportion, int flag, int border, , m_proportion( proportion ) , m_border( border ) , m_flag( flag ) - , m_zoneRect( 0, 0, 0, 0 ) + , m_zoneRect() , m_show( true ) , m_ratio( 0.0 ) , m_userData( userData ) @@ -363,7 +363,7 @@ int wxSizerItem::GetOption() const //--------------------------------------------------------------------------- wxSizer::wxSizer() - : m_minSize( wxSize( 0, 0 ) ) + :m_minSize() { } @@ -1131,9 +1131,11 @@ void wxFlexGridSizer::RecalcSizes() SetItemBounds( node->GetData(), x, y, w, h); } - y = y + m_rowHeights[r] + m_vgap; + if (m_rowHeights[r] != -1) + y = y + m_rowHeights[r] + m_vgap; } - x = x + m_colWidths[c] + m_hgap; + if (m_colWidths[c] != -1) + x = x + m_colWidths[c] + m_hgap; } } @@ -1187,12 +1189,16 @@ wxSize wxFlexGridSizer::CalcMin() int width = 0; for (int col = 0; col < ncols; col++) if ( m_colWidths[ col ] != -1 ) - width += m_colWidths[ col ] + ( col == ncols-1 ? 0 : m_hgap ); + width += m_colWidths[ col ] + m_hgap; + if (width > 0) + width -= m_hgap; int height = 0; for (int row = 0; row < nrows; row++) if ( m_rowHeights[ row ] != -1 ) - height += m_rowHeights[ row ] + ( row == nrows-1 ? 0 : m_vgap ); + height += m_rowHeights[ row ] + m_vgap; + if (height > 0) + height -= m_vgap; m_calculatedMinSize = wxSize( width, height ); return m_calculatedMinSize; @@ -1564,6 +1570,12 @@ wxStaticBoxSizer::wxStaticBoxSizer( wxStaticBox *box, int orient ) wxASSERT_MSG( box, wxT("wxStaticBoxSizer needs a static box") ); } +wxStaticBoxSizer::wxStaticBoxSizer(int orient, wxWindow *win, const wxString& s) + : wxBoxSizer(orient), + m_staticBox(new wxStaticBox(win, wxID_ANY, s)) +{ +} + static void GetStaticBoxBorders( wxStaticBox *box, int *borderTop, int *borderOther) @@ -1654,12 +1666,18 @@ void wxStaticBoxSizer::ShowItems( bool show ) wxStdDialogButtonSizer::wxStdDialogButtonSizer() : wxBoxSizer(wxHORIZONTAL) { + // Vertical buttons with lots of space on either side + // looks rubbish on WinCE, so let's not do this for now. + // If we are going to use vertical buttons, we should + // put the sizer to the right of other controls in the dialog, + // and that's beyond the scope of this sizer. +#ifndef __WXWINCE__ bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - // If we have a PDA screen, put yes/no button over // all other buttons, otherwise on the left side. if (is_pda) m_orient = wxVERTICAL; +#endif m_buttonAffirmative = NULL; m_buttonApply = NULL; @@ -1687,6 +1705,7 @@ void wxStdDialogButtonSizer::AddButton(wxButton *mybutton) m_buttonCancel = mybutton; break; case wxID_HELP: + case wxID_CONTEXT_HELP: m_buttonHelp = mybutton; break; default: @@ -1709,7 +1728,7 @@ void wxStdDialogButtonSizer::SetCancelButton( wxButton *button ) m_buttonCancel = button; } -void wxStdDialogButtonSizer::Finalise() +void wxStdDialogButtonSizer::Realize() { #ifdef __WXMAC__ Add(0, 0, 0, wxLEFT, 6); @@ -1832,7 +1851,7 @@ void wxBookCtrlSizer::RecalcSizes() wxSize wxBookCtrlSizer::CalcMin() { - wxSize sizeBorder = m_bookctrl->CalcSizeFromPage(wxSize(0, 0)); + wxSize sizeBorder = m_bookctrl->CalcSizeFromPage(wxSize(0,0)); sizeBorder.x += 5; sizeBorder.y += 5;