Add support for alpha channel in wxColourPicker (wxGTK).
Showing opacity slider is controlled by new flag wxCLRP_SHOW_ALPHA.
This commit is contained in:
committed by
Artur Wieczorek
parent
63d6db3131
commit
59f5fe993b
@@ -68,6 +68,7 @@ protected:
|
|||||||
// NOTE: this style is supported just by wxColourButtonGeneric and
|
// NOTE: this style is supported just by wxColourButtonGeneric and
|
||||||
// thus is not exposed in wxColourPickerCtrl
|
// thus is not exposed in wxColourPickerCtrl
|
||||||
#define wxCLRP_SHOW_LABEL 0x0008
|
#define wxCLRP_SHOW_LABEL 0x0008
|
||||||
|
#define wxCLRP_SHOW_ALPHA 0x0010
|
||||||
|
|
||||||
// map platform-dependent controls which implement the wxColourPickerWidgetBase
|
// map platform-dependent controls which implement the wxColourPickerWidgetBase
|
||||||
// under the name "wxColourPickerWidget".
|
// under the name "wxColourPickerWidget".
|
||||||
@@ -146,7 +147,7 @@ public: // internal functions
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual long GetPickerStyle(long style) const wxOVERRIDE
|
virtual long GetPickerStyle(long style) const wxOVERRIDE
|
||||||
{ return (style & wxCLRP_SHOW_LABEL); }
|
{ return (style & (wxCLRP_SHOW_LABEL | wxCLRP_SHOW_ALPHA)); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxColourPickerCtrl);
|
wxDECLARE_DYNAMIC_CLASS(wxColourPickerCtrl);
|
||||||
|
@@ -78,6 +78,9 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
|
|||||||
#endif
|
#endif
|
||||||
g_object_ref(m_widget);
|
g_object_ref(m_widget);
|
||||||
|
|
||||||
|
// Display opacity slider
|
||||||
|
g_object_set(G_OBJECT(m_widget), "use-alpha",
|
||||||
|
static_cast<bool>(style & wxCLRP_SHOW_ALPHA), NULL);
|
||||||
// GtkColourButton signals
|
// GtkColourButton signals
|
||||||
g_signal_connect(m_widget, "color-set",
|
g_signal_connect(m_widget, "color-set",
|
||||||
G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
|
G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
|
||||||
|
Reference in New Issue
Block a user