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
This commit is contained in:
@@ -255,42 +255,43 @@ void wxGenericColourDialog::CreateWidgets()
|
|||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
int sliderX = singleCustomColourRect.x + singleCustomColourRect.width + sectionSpacing;
|
const int sliderX = singleCustomColourRect.x + singleCustomColourRect.width + sectionSpacing;
|
||||||
#if defined(__WXMOTIF__)
|
const int sliderHeight = 160;
|
||||||
int sliderSpacing = 65;
|
|
||||||
int sliderHeight = 160;
|
|
||||||
#else
|
|
||||||
int sliderSpacing = 45;
|
|
||||||
int sliderHeight = 160;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
redSlider = new wxSlider(this, wxID_RED_SLIDER, singleCustomColour.Red(), 0, 255,
|
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,
|
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,
|
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 *topsizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
// 1) space for explicitly layouted controls
|
// 1) space for sliders
|
||||||
topsizer->Add( sliderX + 3*sliderSpacing, sliderHeight+25 );
|
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 );
|
||||||
|
|
||||||
|
topSizer->Add( sliderSizer, 0, wxCENTRE | wxALL, 10 );
|
||||||
|
|
||||||
#if wxUSE_STATLINE
|
#if wxUSE_STATLINE
|
||||||
// 2) static line
|
// 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
|
#endif
|
||||||
|
|
||||||
// 3) buttons
|
// 3) buttons
|
||||||
wxSizer *buttonsizer = CreateButtonSizer( wxOK|wxCANCEL );
|
wxSizer *buttonsizer = CreateButtonSizer( wxOK|wxCANCEL );
|
||||||
buttonsizer->Add( new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), 0, wxLEFT|wxRIGHT, 10 );
|
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 );
|
SetAutoLayout( true );
|
||||||
SetSizer( topsizer );
|
SetSizer( topSizer );
|
||||||
|
|
||||||
topsizer->SetSizeHints( this );
|
topSizer->SetSizeHints( this );
|
||||||
topsizer->Fit( this );
|
topSizer->Fit( this );
|
||||||
|
|
||||||
Centre( wxBOTH );
|
Centre( wxBOTH );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user