Top | ![]() |
![]() |
![]() |
![]() |
gtk_colorComboBoxWidgetgtk_colorComboBoxWidget — Defines a specialised GtkComboBox to choose stored colours. |
void | color-selected | Action |
void | color-value-changed | Action |
void | material-value-changed | Action |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkComboBox ╰── VisuUiColorCombobox
VisuUiColorCombobox implements AtkImplementorIface, GtkBuildable, GtkCellLayout and GtkCellEditable.
This widget looks like a GtkComboBox and it displays a list
of stored colours. These colours may come from the configuration
files or can be selected and stored by the user actions. To do it,
the first entry of the combo box is 'new / modify', that opens a GTK
colour picker. The new values are used to craete a new colour entry
in the combo box. In a complete version, the combo box can have a
GtkVBox associated to modify colours without creating new entries, see
visu_ui_color_combobox_newWithRanges()
method. Otherwise, only already
selected colours are available. The stored colours are shared by
all widgets of this class. It is thus a convenient way to have
coherent colour picker through V_Sim.
When the widget is created with ranges, the additional part
can be retrieve with visu_ui_color_combobox_getRangeWidgets()
and attached
whereever is convenient. When the ranges are modified, the new
colour is not added to the combo box. It can be read using
visu_ui_color_combobox_getRangeColor()
or visu_ui_color_combobox_getRangeMaterial()
. The combo
box is set thus to an unselected state and
visu_ui_color_combobox_getSelection()
will return a NULL
pointer. Besides the colour ranges, there is an add button to
insert the newly defined colour into the combo box.
This widget can emit a “color-selected” signal that is a wrapper around the “changed” signal, but it is emitted only when a new colour is selected (either an existing one or a newly created from the picker). This colour is passed to the callback. The two other signals, “color-value-changed” and “material-value-changed”, are generated when the widget have been created with ranges and that one of these ranges is modified.
GtkWidget *
visu_ui_color_combobox_new (gboolean hasAlphaChannel
);
A VisuUiColorCombobox widget is like a GtkComboBox widget, but it is already filled
with the colors stores in the structures adhoc in visu_tools.h. Using this widget
is a convienient way to share colors between all part of V_Sim and to give a consistent
look of all color selection. If the argument hasAlphaChannel
is FALSE, the widget
display all colors but without their alpha channel, assuming it to be fully opaque.
Since: 3.1
GtkWidget *
visu_ui_color_combobox_newWithRanges (gboolean hasAlphaChannel
);
Create a color combo and several ranges.
Since: 3.3
gboolean visu_ui_color_combobox_setSelection (VisuUiColorCombobox *colorComboBox
,ToolColor *color
);
Use this method to set the ComboBox on the given color. This emits a 'color-channel' signal if the color is changed, which means, a previous color has been modified, or a new color is selected.
Since: 3.1
void visu_ui_color_combobox_setRangeColor (VisuUiColorCombobox *colorComboBox
,const float rgba[4]
,gboolean raiseSignal
);
Change the values for the ranges that control the color. If the color exists
in the list, it is also selected.
This is possible only if the colorComboBox
has been created with
visu_ui_color_combobox_newWithRanges()
.
colorComboBox |
a VisuUiColorCombobox widget ; |
|
rgba |
4 floating point values ; |
|
raiseSignal |
if TRUE a material-value-changed can be raised. |
Since: 3.3
void visu_ui_color_combobox_setRangeMaterial (VisuUiColorCombobox *colorComboBox
,const float material[TOOL_MATERIAL_N_VALUES]
,gboolean raiseSignal
);
Change the values for the ranges that control the light (emission, diffuse...).
This is possible only if the colorComboBox
has been created with
visu_ui_color_combobox_newWithRanges()
.
colorComboBox |
a VisuUiColorCombobox widget ; |
|
material |
TOOL_MATERIAL_N_VALUES (see ToolMaterialIds) floating point values ; |
|
raiseSignal |
if TRUE a material-value-changed can be raised. |
Since: 3.3
const ToolColor *
visu_ui_color_combobox_getSelection (VisuUiColorCombobox *colorComboBox
);
The user can access to the selected ToolColor object using this method.
a pointer to the selected ToolColor object (or NULL). This object is read-only.
[transfer none]
Since: 3.1
GdkPixbuf * visu_ui_color_combobox_getPixbufFromColor (VisuUiColorCombobox *colorComboBox
,ToolColor *color
);
The colorComboBox
has little pixbufs to represent the color. User methods can
use these pixbufs but should considered them read-only.
a pixbuf pointer corresponding to the
little image shown on the colorComboBox
.
[transfer full]
Since: 3.1
float *
visu_ui_color_combobox_getRangeMaterial
(VisuUiColorCombobox *colorComboBox
);
If the colorComboBox
uses ranges (see visu_ui_color_combobox_newWithRanges()
), this method
is used to get the values from the material ranges.
a newly created array of size
TOOL_MATERIAL_N_VALUES (see ToolMaterialIds). Use g_free()
to delete it.
[array fixed-size=5][transfer full]
Since: 3.3
float *
visu_ui_color_combobox_getRangeColor (VisuUiColorCombobox *colorComboBox
);
If the colorComboBox
uses ranges (see visu_ui_color_combobox_newWithRanges()
), this method
is used to get the values from the color ranges.
a newly created
array of size 4. Use g_free()
to delete it.
[array fixed-size=4][transfer full]
Since: 3.2
void visu_ui_color_combobox_setExpanded (VisuUiColorCombobox *colorComboBox
,gboolean value
);
Set the expanded state of the ranges. This is usable only if the colorComboBox has been created with ranges.
Since: 3.3
GtkWidget *
visu_ui_color_combobox_getRangeWidgets
(VisuUiColorCombobox *colorComboBox
);
Retrieve the wiodget using to represent the ranges, or NULL if the object has no ranges.
Since: 3.3
void visu_ui_color_combobox_setPrintValues (VisuUiColorCombobox *colorComboBox
,gboolean value
);
Print or not the RGB values.
Since: 3.4
typedef struct _VisuUiColorCombobox VisuUiColorCombobox;
Private structure to store informations of a VisuUiColorCombobox object.
Since: 3.1
typedef struct _VisuUiColorComboboxClass VisuUiColorComboboxClass;
Private structure to store informations of a VisuUiColorComboboxClass object.
Since: 3.1
“color-selected”
signalvoid user_function (VisuUiColorCombobox *combo, gpointer color, gpointer user_data)
This signal is emitted when a new valid colour is selected, either an existing one or newly created one.
combo |
the VisuUiColorCombobox that emits the signal ; |
|
color |
the newly selected ToolColor. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.1
“color-value-changed”
signalvoid user_function (VisuUiColorCombobox *combo, guint RGBA, gpointer user_data)
This signal is emitted when the range of a colour is modified.
combo |
the VisuUiColorCombobox that emits the signal ; |
|
RGBA |
the modified channel. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.3
“material-value-changed”
signalvoid user_function (VisuUiColorCombobox *combo, guint mat, gpointer user_data)
This signal is emitted when the range of a material is modified.
combo |
the VisuUiColorCombobox that emits the signal ; |
|
mat |
the modified material channel (see ToolMaterialIds). |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 3.3