2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkColorSelection.html
27 * outFile = ColorSelection
28 * strct = GtkColorSelection
31 * clss = ColorSelection
39 * - gtk_color_selection_
48 * - GdkColor* -> Color
52 module gtk
.ColorSelection
;
54 private import gtk
.gtktypes
;
56 private import lib
.gtk
;
58 private import glib
.Str
;
59 private import gdk
.Color
;
63 * The GtkColorSelection is a widget that is used to select
64 * a color. It consists of a color wheel and number of sliders
65 * and entry boxes for color parameters such as hue, saturation,
66 * value, red, green, blue, and opacity. It is found on the standard
67 * color selection dialog box GtkColorSelectionDialog.
69 private import gtk
.VBox
;
70 public class ColorSelection
: VBox
73 /** the main Gtk struct */
74 protected GtkColorSelection
* gtkColorSelection
;
77 public GtkColorSelection
* getColorSelectionStruct()
79 return gtkColorSelection
;
83 /** the main Gtk struct as a void* */
84 protected void* getStruct()
86 return cast(void*)gtkColorSelection
;
90 * Sets our main struct and passes it to the parent class
92 public this (GtkColorSelection
* gtkColorSelection
)
94 super(cast(GtkVBox
*)gtkColorSelection
);
95 this.gtkColorSelection
= gtkColorSelection
;
101 // imports for the signal processing
102 private import gobject
.Signals
;
103 private import gdk
.gdktypes
;
104 int[char[]] connectedSignals
;
106 void delegate(ColorSelection
)[] onColorChangedListeners
;
107 void addOnColorChanged(void delegate(ColorSelection
) dlg
)
109 if ( !("color-changed" in connectedSignals
) )
114 cast(GCallback
)&callBackColorChanged
,
117 cast(ConnectFlags
)0);
118 connectedSignals
["color-changed"] = 1;
120 onColorChangedListeners
~= dlg
;
122 extern(C
) static void callBackColorChanged(GtkColorSelection
* colorselectionStruct
, ColorSelection colorSelection
)
124 bit consumed
= false;
126 foreach ( void delegate(ColorSelection
) dlg
; colorSelection
.onColorChangedListeners
)
137 * Creates a new GtkColorSelection.
139 * a new GtkColorSelection
143 // GtkWidget* gtk_color_selection_new (void);
144 this(cast(GtkColorSelection
*)gtk_color_selection_new() );
149 * gtk_color_selection_set_update_policy is deprecated and should not be used in newly-written code.
150 * Sets the policy controlling when the color_changed signals are emitted.
151 * The available policies are:
152 * GTK_UPDATE_CONTINUOUS - signals are sent continuously as the color
154 * GTK_UPDATE_DISCONTINUOUS - signals are sent only when the mouse
155 * button is released.
156 * GTK_UPDATE_DELAYED - signals are sent when the mouse button is
157 * released or when the mouse has been motionless for a period of
160 * a GtkColorSelection.
162 * a GtkUpdateType value indicating the desired policy.
164 public void setUpdatePolicy(GtkUpdateType policy
)
166 // void gtk_color_selection_set_update_policy (GtkColorSelection *colorsel, GtkUpdateType policy);
167 gtk_color_selection_set_update_policy(gtkColorSelection
, policy
);
171 * Sets the colorsel to use or not use opacity.
173 * a GtkColorSelection.
175 * TRUE if colorsel can set the opacity, FALSE otherwise.
177 public void setHasOpacityControl(int hasOpacity
)
179 // void gtk_color_selection_set_has_opacity_control (GtkColorSelection *colorsel, gboolean has_opacity);
180 gtk_color_selection_set_has_opacity_control(gtkColorSelection
, hasOpacity
);
184 * Determines whether the colorsel has an opacity control.
186 * a GtkColorSelection.
188 * TRUE if the colorsel has an opacity control. FALSE if it does't.
190 public int getHasOpacityControl()
192 // gboolean gtk_color_selection_get_has_opacity_control (GtkColorSelection *colorsel);
193 return gtk_color_selection_get_has_opacity_control(gtkColorSelection
);
197 * Shows and hides the palette based upon the value of has_palette.
199 * a GtkColorSelection.
201 * TRUE if palette is to be visible, FALSE otherwise.
203 public void setHasPalette(int hasPalette
)
205 // void gtk_color_selection_set_has_palette (GtkColorSelection *colorsel, gboolean has_palette);
206 gtk_color_selection_set_has_palette(gtkColorSelection
, hasPalette
);
210 * Determines whether the color selector has a color palette.
212 * a GtkColorSelection.
214 * TRUE if the selector has a palette. FALSE if it hasn't.
216 public int getHasPalette()
218 // gboolean gtk_color_selection_get_has_palette (GtkColorSelection *colorsel);
219 return gtk_color_selection_get_has_palette(gtkColorSelection
);
223 * Returns the current alpha value.
225 * a GtkColorSelection.
227 * an integer between 0 and 65535.
229 public ushort getCurrentAlpha()
231 // guint16 gtk_color_selection_get_current_alpha (GtkColorSelection *colorsel);
232 return gtk_color_selection_get_current_alpha(gtkColorSelection
);
236 * Sets the current opacity to be alpha. The first time this is called, it will
237 * also set the original opacity to be alpha too.
239 * a GtkColorSelection.
241 * an integer between 0 and 65535.
243 public void setCurrentAlpha(ushort alpha
)
245 // void gtk_color_selection_set_current_alpha (GtkColorSelection *colorsel, guint16 alpha);
246 gtk_color_selection_set_current_alpha(gtkColorSelection
, alpha
);
250 * Sets color to be the current color in the GtkColorSelection widget.
252 * a GtkColorSelection.
254 * a GdkColor to fill in with the current color.
256 public void getCurrentColor(Color color
)
258 // void gtk_color_selection_get_current_color (GtkColorSelection *colorsel, GdkColor *color);
259 gtk_color_selection_get_current_color(gtkColorSelection
, (color
is null) ?
null : color
.getColorStruct());
263 * Sets the current color to be color. The first time this is called, it will
264 * also set the original color to be color too.
266 * a GtkColorSelection.
268 * A GdkColor to set the current color with.
270 public void setCurrentColor(Color color
)
272 // void gtk_color_selection_set_current_color (GtkColorSelection *colorsel, const GdkColor *color);
273 gtk_color_selection_set_current_color(gtkColorSelection
, (color
is null) ?
null : color
.getColorStruct());
277 * Returns the previous alpha value.
279 * a GtkColorSelection.
281 * an integer between 0 and 65535.
283 public ushort getPreviousAlpha()
285 // guint16 gtk_color_selection_get_previous_alpha (GtkColorSelection *colorsel);
286 return gtk_color_selection_get_previous_alpha(gtkColorSelection
);
290 * Sets the 'previous' alpha to be alpha. This function should be called with
291 * some hesitations, as it might seem confusing to have that alpha change.
293 * a GtkColorSelection.
295 * an integer between 0 and 65535.
297 public void setPreviousAlpha(ushort alpha
)
299 // void gtk_color_selection_set_previous_alpha (GtkColorSelection *colorsel, guint16 alpha);
300 gtk_color_selection_set_previous_alpha(gtkColorSelection
, alpha
);
304 * Fills color in with the original color value.
306 * a GtkColorSelection.
308 * a GdkColor to fill in with the original color value.
310 public void getPreviousColor(Color color
)
312 // void gtk_color_selection_get_previous_color (GtkColorSelection *colorsel, GdkColor *color);
313 gtk_color_selection_get_previous_color(gtkColorSelection
, (color
is null) ?
null : color
.getColorStruct());
317 * Sets the 'previous' color to be color. This function should be called with
318 * some hesitations, as it might seem confusing to have that color change.
319 * Calling gtk_color_selection_set_current_color() will also set this color the first
322 * a GtkColorSelection.
324 * a GdkColor to set the previous color with.
326 public void setPreviousColor(Color color
)
328 // void gtk_color_selection_set_previous_color (GtkColorSelection *colorsel, const GdkColor *color);
329 gtk_color_selection_set_previous_color(gtkColorSelection
, (color
is null) ?
null : color
.getColorStruct());
333 * Gets the current state of the colorsel.
335 * a GtkColorSelection.
337 * TRUE if the user is currently dragging a color around, and FALSE
338 * if the selection has stopped.
340 public int isAdjusting()
342 // gboolean gtk_color_selection_is_adjusting (GtkColorSelection *colorsel);
343 return gtk_color_selection_is_adjusting(gtkColorSelection
);
347 * Parses a color palette string; the string is a colon-separated
348 * list of color names readable by gdk_color_parse().
350 * a string encoding a color palette.
352 * return location for allocated array of GdkColor.
354 * return location for length of array.
356 * TRUE if a palette was successfully parsed.
358 public static int paletteFromString(char[] str, GdkColor
** colors
, int* nColors
)
360 // gboolean gtk_color_selection_palette_from_string (const gchar *str, GdkColor **colors, gint *n_colors);
361 return gtk_color_selection_palette_from_string(Str
.toStringz(str), colors
, nColors
);
365 * Encodes a palette as a string, useful for persistent storage.
367 * an array of colors.
369 * length of the array.
371 * allocated string encoding the palette.
373 public static char[] paletteToString(Color colors
, int nColors
)
375 // gchar* gtk_color_selection_palette_to_string (const GdkColor *colors, gint n_colors);
376 return Str
.toString(gtk_color_selection_palette_to_string((colors
is null) ?
null : colors
.getColorStruct(), nColors
) );
381 * gtk_color_selection_set_change_palette_hook is deprecated and should not be used in newly-written code. This function is deprecated in favor of
382 * gtk_color_selection_set_change_palette_with_screen_hook(), and does
383 * not work in multihead environments.
384 * Installs a global function to be called whenever the user tries to
385 * modify the palette in a color selection. This function should save
386 * the new palette contents, and update the GtkSettings property
387 * "gtk-color-palette" so all GtkColorSelection widgets will be modified.
389 * a function to call when the custom palette needs saving.
391 * the previous change palette hook (that was replaced).
393 public static GtkColorSelectionChangePaletteFunc
setChangePaletteHook(GtkColorSelectionChangePaletteFunc func
)
395 // GtkColorSelectionChangePaletteFunc gtk_color_selection_set_change_palette_hook (GtkColorSelectionChangePaletteFunc func);
396 return gtk_color_selection_set_change_palette_hook(func
);
401 * Installs a global function to be called whenever the user tries to
402 * modify the palette in a color selection. This function should save
403 * the new palette contents, and update the GtkSettings property
404 * "gtk-color-palette" so all GtkColorSelection widgets will be modified.
406 * a function to call when the custom palette needs saving.
408 * the previous change palette hook (that was replaced).
411 public static GtkColorSelectionChangePaletteWithScreenFunc
setChangePaletteWithScreenHook(GtkColorSelectionChangePaletteWithScreenFunc func
)
413 // GtkColorSelectionChangePaletteWithScreenFunc gtk_color_selection_set_change_palette_with_screen_hook (GtkColorSelectionChangePaletteWithScreenFunc func);
414 return gtk_color_selection_set_change_palette_with_screen_hook(func
);
420 * gtk_color_selection_set_color is deprecated and should not be used in newly-written code. Use gtk_color_selection_set_current_color() instead.
421 * Sets the current color to be color. The first time this is called, it will
422 * also set the original color to be color too.
424 * a GtkColorSelection.
426 * an array of 4 doubles specifying the red, green, blue and opacity
427 * to set the current color to.
429 public void setColor(double* color
)
431 // void gtk_color_selection_set_color (GtkColorSelection *colorsel, gdouble *color);
432 gtk_color_selection_set_color(gtkColorSelection
, color
);
437 * gtk_color_selection_get_color is deprecated and should not be used in newly-written code.
438 * Sets color to be the current color in the GtkColorSelection widget.
439 * This function is deprecated, use gtk_color_selection_get_current_color() instead.
441 * a GtkColorSelection.
443 * an array of 4 gdouble to fill in with the current color.
445 * The "current-alpha" property
446 * "current-alpha" guint : Read / Write
447 * The current opacity value (0 fully transparent, 65535 fully opaque).
448 * Allowed values: <= 65535
449 * Default value: 65535
451 public void getColor(double* color
)
453 // void gtk_color_selection_get_color (GtkColorSelection *colorsel, gdouble *color);
454 gtk_color_selection_get_color(gtkColorSelection
, color
);