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
27 * outFile = ColorButton
28 * strct = GtkColorButton
48 * - GdkColor* -> Color
53 module gtk
.ColorButton
;
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
;
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
)
107 if ( gtkColorButton
is null )
112 Stdout("struct gtkColorButton is null on constructor").newline
;
116 printf("struct gtkColorButton is null on constructor");
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
) )
145 cast(GCallback
)&callBackColorSet
,
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
)
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.
174 * a new color button.
179 // GtkWidget* gtk_color_button_new (void);
180 this(cast(GtkColorButton
*)gtk_color_button_new() );
184 * Creates a new color button.
186 * A GdkColor to set the current color with.
188 * a new color button.
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.
202 * A GdkColor to set the current color with.
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.
216 * a GdkColor to fill in with the current color.
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.
230 * an integer between 0 and 65535.
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.
244 * an integer between 0 and 65535.
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.
258 * TRUE if color button should use alpha channel, FALSE if not.
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?
272 * TRUE if the color sample uses alpha channel, FALSE if not.
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.
286 * String containing new window title.
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.
300 * An internal string, do not free the return value
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
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
) );