I've no idea here...
[gtkD.git] / src / gtk / ColorSelection.d
blob32d9823e29b0f39a4908362d39bbcc7b29d351fc
1 /*
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
26 * outPack = gtk
27 * outFile = ColorSelection
28 * strct = GtkColorSelection
29 * realStrct=
30 * ctorStrct=
31 * clss = ColorSelection
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_color_selection_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gdk.Color
47 * structWrap:
48 * - GdkColor* -> Color
49 * local aliases:
52 module gtk.ColorSelection;
54 private import gtk.gtktypes;
56 private import lib.gtk;
58 private import glib.Str;
59 private import gdk.Color;
61 /**
62 * Description
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;
89 /**
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;
98 /**
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) )
111 Signals.connectData(
112 getStruct(),
113 "color-changed",
114 cast(GCallback)&callBackColorChanged,
115 this,
116 null,
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 )
128 dlg(colorSelection);
131 return consumed;
137 * Creates a new GtkColorSelection.
138 * Returns:
139 * a new GtkColorSelection
141 public this ()
143 // GtkWidget* gtk_color_selection_new (void);
144 this(cast(GtkColorSelection*)gtk_color_selection_new() );
148 * Warning
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
153 * selection changes.
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
158 * time.
159 * colorsel:
160 * a GtkColorSelection.
161 * policy:
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.
172 * colorsel:
173 * a GtkColorSelection.
174 * has_opacity:
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.
185 * colorsel:
186 * a GtkColorSelection.
187 * Returns:
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.
198 * colorsel:
199 * a GtkColorSelection.
200 * has_palette:
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.
211 * colorsel:
212 * a GtkColorSelection.
213 * Returns:
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.
224 * colorsel:
225 * a GtkColorSelection.
226 * Returns:
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.
238 * colorsel:
239 * a GtkColorSelection.
240 * alpha:
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.
251 * colorsel:
252 * a GtkColorSelection.
253 * color:
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.
265 * colorsel:
266 * a GtkColorSelection.
267 * color:
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.
278 * colorsel:
279 * a GtkColorSelection.
280 * Returns:
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.
292 * colorsel:
293 * a GtkColorSelection.
294 * alpha:
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.
305 * colorsel:
306 * a GtkColorSelection.
307 * color:
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
320 * time it is called.
321 * colorsel:
322 * a GtkColorSelection.
323 * color:
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.
334 * colorsel:
335 * a GtkColorSelection.
336 * Returns:
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().
349 * str:
350 * a string encoding a color palette.
351 * colors:
352 * return location for allocated array of GdkColor.
353 * n_colors:
354 * return location for length of array.
355 * Returns:
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.
366 * colors:
367 * an array of colors.
368 * n_colors:
369 * length of the array.
370 * Returns:
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) );
380 * Warning
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.
388 * func:
389 * a function to call when the custom palette needs saving.
390 * Returns:
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.
405 * func:
406 * a function to call when the custom palette needs saving.
407 * Returns:
408 * the previous change palette hook (that was replaced).
409 * Since 2.2
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);
419 * Warning
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.
423 * colorsel:
424 * a GtkColorSelection.
425 * color:
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);
436 * Warning
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.
440 * colorsel:
441 * a GtkColorSelection.
442 * color:
443 * an array of 4 gdouble to fill in with the current color.
444 * Property Details
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);