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:
Vadim Zeitlin
2019-04-20 21:50:21 +02:00
parent 35c16935f1
commit 807d95e07d
6 changed files with 80 additions and 10 deletions

View File

@@ -44,7 +44,20 @@ wxEventType wxEVT_COLOURPICKER_CHANGED;
The user changed the colour selected in the control either using the
button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
in this case the event is fired only if the users input is valid,
i.e. recognizable).
i.e. recognizable). When using a popup dialog for changing the
colour, this event is sent only when the changes in the dialog are
accepted by the user, unlike @c EVT_COLOURPICKER_CURRENT_CHANGED.
@event{EVT_COLOURPICKER_CURRENT_CHANGED(id, func)}
The user changed the currently selected colour in the dialog
associated with the control. This event is sent immediately when the
selection changes and you must also handle @c EVT_COLOUR_CANCELLED
to revert to the previously selected colour if the selection ends up
not being accepted. This event is new since wxWidgets 3.1.3 and
currently is only implemented in wxMSW.
@event{EVT_COLOURPICKER_DIALOG_CANCELLED(id, func)}
The user cancelled the colour dialog associated with the control,
i.e. closed it without accepting the selection. This event is new
since wxWidgets 3.1.3 and currently is only implemented in wxMSW.
@endEventTable
@library{wxcore}
@@ -124,6 +137,15 @@ public:
@beginEventTable{wxColourPickerEvent}
@event{EVT_COLOURPICKER_CHANGED(id, func)}
Generated whenever the selected colour changes.
@event{EVT_COLOURPICKER_CURRENT_CHANGED(id, func)}
Generated whenever the currently selected colour in the dialog shown
by the picker changes. This event is new since wxWidgets 3.1.3 and
currently is only implemented in wxMSW.
@event{EVT_COLOURPICKER_DIALOG_CANCELLED(id, func)}
Generated when the user cancels the colour dialog associated with
the control, i.e. closes it without accepting the selection. This
event is new since wxWidgets 3.1.3 and currently is only implemented
in wxMSW.
@endEventTable
@library{wxcore}