I've no idea here...
[gtkD.git] / src / gtk / ColorButton.d
blob1de76d7ee5e32c80e242f846199b45dd1cf94d33
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 = GtkColorButton.html
26 * outPack = gtk
27 * outFile = ColorButton
28 * strct = GtkColorButton
29 * realStrct=
30 * ctorStrct=
31 * clss = ColorButton
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_color_button_
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.ColorButton;
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 GtkColorButton is a button which displays the currently selected color
64 * an allows to open a color selection dialog to change the color. It is suitable
65 * widget for selecting a color in a preference dialog.
67 private import gtk.Button;
68 public class ColorButton : Button
71 /** the main Gtk struct */
72 protected GtkColorButton* gtkColorButton;
75 public GtkColorButton* getColorButtonStruct()
77 return gtkColorButton;
81 /** the main Gtk struct as a void* */
82 protected void* getStruct()
84 return cast(void*)gtkColorButton;
87 /**
88 * Sets our main struct and passes it to the parent class
90 public this (GtkColorButton* gtkColorButton)
92 super(cast(GtkButton*)gtkColorButton);
93 this.gtkColorButton = gtkColorButton;
96 /**
99 // imports for the signal processing
100 private import gobject.Signals;
101 private import gdk.gdktypes;
102 int[char[]] connectedSignals;
104 void delegate(ColorButton)[] onColorSetListeners;
105 void addOnColorSet(void delegate(ColorButton) dlg)
107 if ( !("color-set" in connectedSignals) )
109 Signals.connectData(
110 getStruct(),
111 "color-set",
112 cast(GCallback)&callBackColorSet,
113 this,
114 null,
115 cast(ConnectFlags)0);
116 connectedSignals["color-set"] = 1;
118 onColorSetListeners ~= dlg;
120 extern(C) static void callBackColorSet(GtkColorButton* widgetStruct, ColorButton colorButton)
122 bit consumed = false;
124 foreach ( void delegate(ColorButton) dlg ; colorButton.onColorSetListeners )
126 dlg(colorButton);
129 return consumed;
135 * Creates a new color button. This returns a widget in the form of
136 * a small button containing a swatch representing the current selected
137 * color. When the button is clicked, a color-selection dialog will open,
138 * allowing the user to select a color. The swatch will be updated to reflect
139 * the new color when the user finishes.
140 * Returns:
141 * a new color button.
142 * Since 2.4
144 public this ()
146 // GtkWidget* gtk_color_button_new (void);
147 this(cast(GtkColorButton*)gtk_color_button_new() );
151 * Creates a new color button.
152 * color:
153 * A GdkColor to set the current color with.
154 * Returns:
155 * a new color button.
156 * Since 2.4
158 public this (Color color)
160 // GtkWidget* gtk_color_button_new_with_color (const GdkColor *color);
161 this(cast(GtkColorButton*)gtk_color_button_new_with_color((color is null) ? null : color.getColorStruct()) );
165 * Sets the current color to be color.
166 * color_button:
167 * a GtkColorButton.
168 * color:
169 * A GdkColor to set the current color with.
170 * Since 2.4
172 public void setColor(Color color)
174 // void gtk_color_button_set_color (GtkColorButton *color_button, const GdkColor *color);
175 gtk_color_button_set_color(gtkColorButton, (color is null) ? null : color.getColorStruct());
179 * Sets color to be the current color in the GtkColorButton widget.
180 * color_button:
181 * a GtkColorButton.
182 * color:
183 * a GdkColor to fill in with the current color.
184 * Since 2.4
186 public void getColor(Color color)
188 // void gtk_color_button_get_color (GtkColorButton *color_button, GdkColor *color);
189 gtk_color_button_get_color(gtkColorButton, (color is null) ? null : color.getColorStruct());
193 * Sets the current opacity to be alpha.
194 * color_button:
195 * a GtkColorButton.
196 * alpha:
197 * an integer between 0 and 65535.
198 * Since 2.4
200 public void setAlpha(ushort alpha)
202 // void gtk_color_button_set_alpha (GtkColorButton *color_button, guint16 alpha);
203 gtk_color_button_set_alpha(gtkColorButton, alpha);
207 * Returns the current alpha value.
208 * color_button:
209 * a GtkColorButton.
210 * Returns:
211 * an integer between 0 and 65535.
212 * Since 2.4
214 public ushort getAlpha()
216 // guint16 gtk_color_button_get_alpha (GtkColorButton *color_button);
217 return gtk_color_button_get_alpha(gtkColorButton);
221 * Sets whether or not the color button should use the alpha channel.
222 * color_button:
223 * a GtkColorButton.
224 * use_alpha:
225 * TRUE if color button should use alpha channel, FALSE if not.
226 * Since 2.4
228 public void setUseAlpha(int useAlpha)
230 // void gtk_color_button_set_use_alpha (GtkColorButton *color_button, gboolean use_alpha);
231 gtk_color_button_set_use_alpha(gtkColorButton, useAlpha);
235 * Does the color selection dialog use the alpha channel?
236 * color_button:
237 * a GtkColorButton.
238 * Returns:
239 * TRUE if the color sample uses alpha channel, FALSE if not.
240 * Since 2.4
242 public int getUseAlpha()
244 // gboolean gtk_color_button_get_use_alpha (GtkColorButton *color_button);
245 return gtk_color_button_get_use_alpha(gtkColorButton);
249 * Sets the title for the color selection dialog.
250 * color_button:
251 * a GtkColorButton
252 * title:
253 * String containing new window title.
254 * Since 2.4
256 public void setTitle(char[] title)
258 // void gtk_color_button_set_title (GtkColorButton *color_button, const gchar *title);
259 gtk_color_button_set_title(gtkColorButton, Str.toStringz(title));
263 * Gets the title of the color selection dialog.
264 * color_button:
265 * a GtkColorButton
266 * Returns:
267 * An internal string, do not free the return value
268 * Since 2.4
269 * Property Details
270 * The "alpha" property
271 * "alpha" guint : Read / Write
272 * The selected opacity value (0 fully transparent, 65535 fully opaque).
273 * Allowed values: <= 65535
274 * Default value: 65535
275 * Since 2.4
277 public char[] getTitle()
279 // const gchar* gtk_color_button_get_title (GtkColorButton *color_button);
280 return Str.toString(gtk_color_button_get_title(gtkColorButton) );