Add wxEVT_COLOURPICKER_CURRENT_CHANGED and DIALOG_CANCELLED events
Send events from generic wxColourPickerCtrl when the currently selected colour in the dialog shown by it changes and when this dialog is cancelled. Notice that currently this only works on wxMSW as it relies on wxEVT_COLOUR_CHANGED support in wxColourDialog which is only available there. Based on work of Trylz, see https://github.com/wxWidgets/wxWidgets/pull/1219
This commit is contained in:
@@ -83,6 +83,9 @@ protected:
|
||||
|
||||
|
||||
void OnColourChange(wxColourPickerEvent &ev);
|
||||
void OnColourCurrentChanged(wxColourPickerEvent &ev);
|
||||
void OnColourDialogCancelled(wxColourPickerEvent &ev);
|
||||
|
||||
void OnCheckBox(wxCommandEvent &ev);
|
||||
void OnButtonReset(wxCommandEvent &ev);
|
||||
|
||||
@@ -111,6 +114,8 @@ wxBEGIN_EVENT_TABLE(ColourPickerWidgetsPage, WidgetsPage)
|
||||
EVT_BUTTON(PickerPage_Reset, ColourPickerWidgetsPage::OnButtonReset)
|
||||
|
||||
EVT_COLOURPICKER_CHANGED(PickerPage_Colour, ColourPickerWidgetsPage::OnColourChange)
|
||||
EVT_COLOURPICKER_CURRENT_CHANGED(PickerPage_Colour, ColourPickerWidgetsPage::OnColourCurrentChanged)
|
||||
EVT_COLOURPICKER_DIALOG_CANCELLED(PickerPage_Colour, ColourPickerWidgetsPage::OnColourDialogCancelled)
|
||||
|
||||
EVT_CHECKBOX(wxID_ANY, ColourPickerWidgetsPage::OnCheckBox)
|
||||
wxEND_EVENT_TABLE()
|
||||
@@ -221,6 +226,18 @@ void ColourPickerWidgetsPage::OnColourChange(wxColourPickerEvent& event)
|
||||
event.GetColour().GetAsString(wxC2S_CSS_SYNTAX));
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::OnColourCurrentChanged(wxColourPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("The currently selected colour changed to '%s'",
|
||||
event.GetColour().GetAsString(wxC2S_CSS_SYNTAX));
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::OnColourDialogCancelled(wxColourPickerEvent& event)
|
||||
{
|
||||
wxLogMessage("Colour selection dialog cancelled, current colour is '%s'",
|
||||
event.GetColour().GetAsString(wxC2S_CSS_SYNTAX));
|
||||
}
|
||||
|
||||
void ColourPickerWidgetsPage::OnCheckBox(wxCommandEvent &event)
|
||||
{
|
||||
if (event.GetEventObject() == m_chkColourTextCtrl ||
|
||||
|
Reference in New Issue
Block a user