Wrote the README_GIT file to be a proper tutorial on git, repo.or.cz and gtkD.
[gtkD.git] / gtkD / src / gtk / ColorButton.d
blobd22aa42e2b26e115bc998c5b2a9585046b98e2fa
1 /*
2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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 * module aliases:
50 * local aliases:
53 module gtk.ColorButton;
55 version(noAssert)
57 version(Tango)
59 import tango.io.Stdout; // use the tango loging?
63 private import gtkc.gtktypes;
65 private import gtkc.gtk;
68 private import glib.Str;
69 private import gdk.Color;
74 /**
75 * Description
76 * The GtkColorButton is a button which displays the currently selected color
77 * an allows to open a color selection dialog to change the color. It is suitable
78 * widget for selecting a color in a preference dialog.
80 private import gtk.Button;
81 public class ColorButton : Button
84 /** the main Gtk struct */
85 protected GtkColorButton* gtkColorButton;
88 public GtkColorButton* getColorButtonStruct()
90 return gtkColorButton;
94 /** the main Gtk struct as a void* */
95 protected void* getStruct()
97 return cast(void*)gtkColorButton;
101 * Sets our main struct and passes it to the parent class
103 public this (GtkColorButton* gtkColorButton)
105 version(noAssert)
107 if ( gtkColorButton is null )
109 int zero = 0;
110 version(Tango)
112 Stdout("struct gtkColorButton is null on constructor").newline;
114 else
116 printf("struct gtkColorButton is null on constructor");
118 zero = zero / zero;
121 else
123 assert(gtkColorButton !is null, "struct gtkColorButton is null on constructor");
125 super(cast(GtkButton*)gtkColorButton);
126 this.gtkColorButton = gtkColorButton;
132 // imports for the signal processing
133 private import gobject.Signals;
134 private import gtkc.gdktypes;
135 int[char[]] connectedSignals;
137 void delegate(ColorButton)[] onColorSetListeners;
138 void addOnColorSet(void delegate(ColorButton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
140 if ( !("color-set" in connectedSignals) )
142 Signals.connectData(
143 getStruct(),
144 "color-set",
145 cast(GCallback)&callBackColorSet,
146 cast(void*)this,
147 null,
148 connectFlags);
149 connectedSignals["color-set"] = 1;
151 onColorSetListeners ~= dlg;
153 extern(C) static void callBackColorSet(GtkColorButton* widgetStruct, ColorButton colorButton)
155 bool consumed = false;
157 foreach ( void delegate(ColorButton) dlg ; colorButton.onColorSetListeners )
159 dlg(colorButton);
162 return consumed;
168 * Creates a new color button. This returns a widget in the form of
169 * a small button containing a swatch representing the current selected
170 * color. When the button is clicked, a color-selection dialog will open,
171 * allowing the user to select a color. The swatch will be updated to reflect
172 * the new color when the user finishes.
173 * Returns:
174 * a new color button.
175 * Since 2.4
177 public this ()
179 // GtkWidget* gtk_color_button_new (void);
180 this(cast(GtkColorButton*)gtk_color_button_new() );
184 * Creates a new color button.
185 * color:
186 * A GdkColor to set the current color with.
187 * Returns:
188 * a new color button.
189 * Since 2.4
191 public this (Color color)
193 // GtkWidget* gtk_color_button_new_with_color (const GdkColor *color);
194 this(cast(GtkColorButton*)gtk_color_button_new_with_color((color is null) ? null : color.getColorStruct()) );
198 * Sets the current color to be color.
199 * color_button:
200 * a GtkColorButton.
201 * color:
202 * A GdkColor to set the current color with.
203 * Since 2.4
205 public void setColor(Color color)
207 // void gtk_color_button_set_color (GtkColorButton *color_button, const GdkColor *color);
208 gtk_color_button_set_color(gtkColorButton, (color is null) ? null : color.getColorStruct());
212 * Sets color to be the current color in the GtkColorButton widget.
213 * color_button:
214 * a GtkColorButton.
215 * color:
216 * a GdkColor to fill in with the current color.
217 * Since 2.4
219 public void getColor(Color color)
221 // void gtk_color_button_get_color (GtkColorButton *color_button, GdkColor *color);
222 gtk_color_button_get_color(gtkColorButton, (color is null) ? null : color.getColorStruct());
226 * Sets the current opacity to be alpha.
227 * color_button:
228 * a GtkColorButton.
229 * alpha:
230 * an integer between 0 and 65535.
231 * Since 2.4
233 public void setAlpha(ushort alpha)
235 // void gtk_color_button_set_alpha (GtkColorButton *color_button, guint16 alpha);
236 gtk_color_button_set_alpha(gtkColorButton, alpha);
240 * Returns the current alpha value.
241 * color_button:
242 * a GtkColorButton.
243 * Returns:
244 * an integer between 0 and 65535.
245 * Since 2.4
247 public ushort getAlpha()
249 // guint16 gtk_color_button_get_alpha (GtkColorButton *color_button);
250 return gtk_color_button_get_alpha(gtkColorButton);
254 * Sets whether or not the color button should use the alpha channel.
255 * color_button:
256 * a GtkColorButton.
257 * use_alpha:
258 * TRUE if color button should use alpha channel, FALSE if not.
259 * Since 2.4
261 public void setUseAlpha(int useAlpha)
263 // void gtk_color_button_set_use_alpha (GtkColorButton *color_button, gboolean use_alpha);
264 gtk_color_button_set_use_alpha(gtkColorButton, useAlpha);
268 * Does the color selection dialog use the alpha channel?
269 * color_button:
270 * a GtkColorButton.
271 * Returns:
272 * TRUE if the color sample uses alpha channel, FALSE if not.
273 * Since 2.4
275 public int getUseAlpha()
277 // gboolean gtk_color_button_get_use_alpha (GtkColorButton *color_button);
278 return gtk_color_button_get_use_alpha(gtkColorButton);
282 * Sets the title for the color selection dialog.
283 * color_button:
284 * a GtkColorButton
285 * title:
286 * String containing new window title.
287 * Since 2.4
289 public void setTitle(char[] title)
291 // void gtk_color_button_set_title (GtkColorButton *color_button, const gchar *title);
292 gtk_color_button_set_title(gtkColorButton, Str.toStringz(title));
296 * Gets the title of the color selection dialog.
297 * color_button:
298 * a GtkColorButton
299 * Returns:
300 * An internal string, do not free the return value
301 * Since 2.4
302 * Property Details
303 * The "alpha" property
304 * "alpha" guint : Read / Write
305 * The selected opacity value (0 fully transparent, 65535 fully opaque).
306 * Allowed values: <= 65535
307 * Default value: 65535
308 * Since 2.4
310 public char[] getTitle()
312 // const gchar* gtk_color_button_get_title (GtkColorButton *color_button);
313 return Str.toString(gtk_color_button_get_title(gtkColorButton) );