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
27 * outFile = ColorButton
28 * strct = GtkColorButton
48 * - GdkColor* -> Color
52 module gtk
.ColorButton
;
54 private import gtk
.gtktypes
;
56 private import lib
.gtk
;
58 private import glib
.Str
;
59 private import gdk
.Color
;
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
;
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
;
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
) )
112 cast(GCallback
)&callBackColorSet
,
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
)
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.
141 * a new color button.
146 // GtkWidget* gtk_color_button_new (void);
147 this(cast(GtkColorButton
*)gtk_color_button_new() );
151 * Creates a new color button.
153 * A GdkColor to set the current color with.
155 * a new color button.
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.
169 * A GdkColor to set the current color with.
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.
183 * a GdkColor to fill in with the current color.
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.
197 * an integer between 0 and 65535.
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.
211 * an integer between 0 and 65535.
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.
225 * TRUE if color button should use alpha channel, FALSE if not.
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?
239 * TRUE if the color sample uses alpha channel, FALSE if not.
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.
253 * String containing new window title.
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.
267 * An internal string, do not free the return value
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
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
) );