From f79a46f83a4cf63fac29b2a6716be7112003918d Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 16 Jul 2004 13:08:44 +0000 Subject: [PATCH] Sizer based placement of controls in generic colour dialog (patch #991595) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/colrdlgg.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 849f205e68..c77bb50570 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -255,42 +255,43 @@ void wxGenericColourDialog::CreateWidgets() { wxBeginBusyCursor(); - int sliderX = singleCustomColourRect.x + singleCustomColourRect.width + sectionSpacing; -#if defined(__WXMOTIF__) - int sliderSpacing = 65; - int sliderHeight = 160; -#else - int sliderSpacing = 45; - int sliderHeight = 160; -#endif + const int sliderX = singleCustomColourRect.x + singleCustomColourRect.width + sectionSpacing; + const int sliderHeight = 160; redSlider = new wxSlider(this, wxID_RED_SLIDER, singleCustomColour.Red(), 0, 255, - wxPoint(sliderX, 10), wxSize(wxDefaultSize.x, sliderHeight), wxVERTICAL|wxSL_LABELS); + wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxVERTICAL|wxSL_LABELS); greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, singleCustomColour.Green(), 0, 255, - wxPoint(sliderX + sliderSpacing, 10), wxSize(wxDefaultSize.x, sliderHeight), wxVERTICAL|wxSL_LABELS); + wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxVERTICAL|wxSL_LABELS); blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, singleCustomColour.Blue(), 0, 255, - wxPoint(sliderX + 2*sliderSpacing, 10), wxSize(wxDefaultSize.x, sliderHeight), wxVERTICAL|wxSL_LABELS); + wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxVERTICAL|wxSL_LABELS); + + wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL ); + + // 1) space for sliders + sliderSizer->Add( sliderX, sliderHeight ); + sliderSizer->Add( redSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 ); + sliderSizer->Add( greenSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 ); + sliderSizer->Add( blueSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 ); - wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); - // 1) space for explicitly layouted controls - topsizer->Add( sliderX + 3*sliderSpacing, sliderHeight+25 ); + topSizer->Add( sliderSizer, 0, wxCENTRE | wxALL, 10 ); #if wxUSE_STATLINE // 2) static line - topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 ); + topSizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 ); #endif // 3) buttons wxSizer *buttonsizer = CreateButtonSizer( wxOK|wxCANCEL ); buttonsizer->Add( new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), 0, wxLEFT|wxRIGHT, 10 ); - topsizer->Add( buttonsizer, 0, wxCENTRE | wxALL, 10 ); + topSizer->Add( buttonsizer, 0, wxCENTRE | wxALL, 10 ); SetAutoLayout( true ); - SetSizer( topsizer ); + SetSizer( topSizer ); - topsizer->SetSizeHints( this ); - topsizer->Fit( this ); + topSizer->SetSizeHints( this ); + topSizer->Fit( this ); Centre( wxBOTH ); -- 2.45.2