X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ca65c0440a7163e4e37e48b1c4329709d722db47..c0b0635cf69537ca32377bad5650b39402cb21b6:/src/generic/colrdlgg.cpp?ds=inline diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 849f205e68..8bc0f1e75c 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -20,7 +20,7 @@ #pragma hdrstop #endif -#if wxUSE_COLOURDLG && !defined(__WXGTK20__) +#if wxUSE_COLOURDLG && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__)) #ifndef WX_PRECOMP #include "wx/utils.h" @@ -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 ); @@ -544,7 +545,7 @@ void wxGenericColourDialog::OnRedSlider(wxCommandEvent& WXUNUSED(event)) return; wxClientDC dc(this); - singleCustomColour.Set(redSlider->GetValue(), singleCustomColour.Green(), singleCustomColour.Blue()); + singleCustomColour.Set((unsigned char)redSlider->GetValue(), singleCustomColour.Green(), singleCustomColour.Blue()); PaintCustomColour(dc); } @@ -554,7 +555,7 @@ void wxGenericColourDialog::OnGreenSlider(wxCommandEvent& WXUNUSED(event)) return; wxClientDC dc(this); - singleCustomColour.Set(singleCustomColour.Red(), greenSlider->GetValue(), singleCustomColour.Blue()); + singleCustomColour.Set(singleCustomColour.Red(), (unsigned char)greenSlider->GetValue(), singleCustomColour.Blue()); PaintCustomColour(dc); } @@ -564,7 +565,7 @@ void wxGenericColourDialog::OnBlueSlider(wxCommandEvent& WXUNUSED(event)) return; wxClientDC dc(this); - singleCustomColour.Set(singleCustomColour.Red(), singleCustomColour.Green(), blueSlider->GetValue()); + singleCustomColour.Set(singleCustomColour.Red(), singleCustomColour.Green(), (unsigned char)blueSlider->GetValue()); PaintCustomColour(dc); }