Modify widgets sample to demonstrate colour picker with alpha support.

This commit is contained in:
Artur Wieczorekl
2015-11-11 17:33:38 +01:00
committed by Artur Wieczorek
parent 59f5fe993b
commit b81e842689

View File

@@ -98,7 +98,8 @@ protected:
// --------------
wxCheckBox *m_chkColourTextCtrl,
*m_chkColourShowLabel;
*m_chkColourShowLabel,
*m_chkColourShowAlpha;
wxBoxSizer *m_sizer;
private:
@@ -145,6 +146,7 @@ void ColourPickerWidgetsPage::CreateContent()
wxStaticBoxSizer *clrbox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&ColourPicker style"));
m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(clrbox, wxT("With textctrl"));
m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(clrbox, wxT("With label"));
m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(clrbox, wxT("With opacity"));
boxleft->Add(clrbox, 0, wxALL|wxGROW, 5);
boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")),
@@ -189,6 +191,9 @@ long ColourPickerWidgetsPage::GetPickerStyle()
if ( m_chkColourShowLabel->GetValue() )
style |= wxCLRP_SHOW_LABEL;
if ( m_chkColourShowAlpha->GetValue() )
style |= wxCLRP_SHOW_ALPHA;
return style;
}
@@ -227,7 +232,8 @@ void ColourPickerWidgetsPage::OnColourChange(wxColourPickerEvent& event)
void ColourPickerWidgetsPage::OnCheckBox(wxCommandEvent &event)
{
if (event.GetEventObject() == m_chkColourTextCtrl ||
event.GetEventObject() == m_chkColourShowLabel)
event.GetEventObject() == m_chkColourShowLabel ||
event.GetEventObject() == m_chkColourShowAlpha)
RecreatePicker();
}