Implement support for wxSL_<DIR> in wxGTK, show them better in the sample.

Support wxSL_{LEFT,TOP,RIGHT,BOTTOM} in wxGTL version of wxSlider.

Make the display of the orientations in the slider page of the widgets sample
more clear.

Also document wxSL_<DIR> meaning better.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-11-14 23:15:27 +00:00
parent eec4500dca
commit c0a9fe92fa
3 changed files with 49 additions and 20 deletions

View File

@@ -80,6 +80,7 @@ enum
// sides radiobox values
enum
{
SliderTicks_None,
SliderTicks_Top,
SliderTicks_Bottom,
SliderTicks_Left,
@@ -263,12 +264,13 @@ void SliderWidgetsPage::CreateContent()
m_chkValueLabel = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show &value label"));
static const wxString sides[] =
{
wxT("default"),
wxT("top"),
wxT("bottom"),
wxT("left"),
wxT("right"),
};
m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, wxT("&Ticks/Labels"),
m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, wxT("&Label position"),
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(sides), sides,
1, wxRA_SPECIFY_COLS);
@@ -377,7 +379,7 @@ void SliderWidgetsPage::Reset()
m_chkMinMaxLabels->SetValue(true);
m_chkBothSides->SetValue(false);
m_radioSides->SetSelection(SliderTicks_Top);
m_radioSides->SetSelection(SliderTicks_None);
}
void SliderWidgetsPage::CreateSlider()
@@ -404,24 +406,30 @@ void SliderWidgetsPage::CreateSlider()
flags |= wxSL_AUTOTICKS;
}
// notice that the style names refer to the _ticks_ positions while we want
// to allow the user to select the label(s) positions and the labels are on
// the opposite side from the ticks, hence the apparent reversal below
switch ( m_radioSides->GetSelection() )
{
case SliderTicks_None:
break;
case SliderTicks_Top:
flags |= wxSL_TOP;
break;
case SliderTicks_Left:
flags |= wxSL_LEFT | wxSL_VERTICAL;
break;
case SliderTicks_Bottom:
flags |= wxSL_BOTTOM;
break;
case SliderTicks_Right:
case SliderTicks_Left:
flags |= wxSL_RIGHT | wxSL_VERTICAL;
break;
case SliderTicks_Bottom:
flags |= wxSL_TOP;
break;
case SliderTicks_Right:
flags |= wxSL_LEFT | wxSL_VERTICAL;
break;
default:
wxFAIL_MSG(wxT("unexpected radiobox selection"));
// fall through
@@ -657,7 +665,7 @@ void SliderWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
!m_chkValueLabel->GetValue() ||
!m_chkMinMaxLabels->GetValue() ||
m_chkBothSides->GetValue() ||
m_radioSides->GetSelection() != SliderTicks_Top );
m_radioSides->GetSelection() != SliderTicks_None );
}
void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))