Fix passing alpha channel to/from colour dialog for GTK+ 2.
Pass to/from GtkColorSelection widget also alpha component of the selected colour.
This commit is contained in:
parent
363492e50b
commit
fc5033afde
@ -97,6 +97,8 @@ void wxColourDialog::ColourDataToDialog()
|
|||||||
gtk_color_selection_set_current_rgba(sel, color);
|
gtk_color_selection_set_current_rgba(sel, color);
|
||||||
#else
|
#else
|
||||||
gtk_color_selection_set_current_color(sel, color.GetColor());
|
gtk_color_selection_set_current_color(sel, color.GetColor());
|
||||||
|
// Convert alpha range: [0,255] -> [0,65535]
|
||||||
|
gtk_color_selection_set_current_alpha(sel, 257*color.Alpha());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,11 +131,17 @@ void wxColourDialog::DialogToColourData()
|
|||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
GdkRGBA clr;
|
GdkRGBA clr;
|
||||||
gtk_color_selection_get_current_rgba(sel, &clr);
|
gtk_color_selection_get_current_rgba(sel, &clr);
|
||||||
|
m_data.SetColour(clr);
|
||||||
#else
|
#else
|
||||||
GdkColor clr;
|
GdkColor clr;
|
||||||
gtk_color_selection_get_current_color(sel, &clr);
|
gtk_color_selection_get_current_color(sel, &clr);
|
||||||
|
// Set RGB colour
|
||||||
|
wxColour cRGB(clr);
|
||||||
|
guint16 alpha = gtk_color_selection_get_current_alpha(sel);
|
||||||
|
// Set RGBA colour (convert alpha range: [0,65535] -> [0,255]).
|
||||||
|
wxColour cRGBA(cRGB.Red(), cRGB.Green(), cRGB.Blue(), alpha/257);
|
||||||
|
m_data.SetColour(cRGBA);
|
||||||
#endif
|
#endif
|
||||||
m_data.SetColour(clr);
|
|
||||||
|
|
||||||
// Extract custom palette:
|
// Extract custom palette:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user