alternative to assert
[gtkD.git] / gtkD / src / gtk / ToggleToolButton.d
blob666f3ec33d57072bdafaa4fc8e386fef2e0bbdd5
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 = GtkToggleToolButton.html
26 * outPack = gtk
27 * outFile = ToggleToolButton
28 * strct = GtkToggleToolButton
29 * realStrct=
30 * ctorStrct=GtkToolItem
31 * clss = ToggleToolButton
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_toggle_tool_button_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gtk.ToolItem
47 * structWrap:
48 * - GtkToolItem* -> ToolItem
49 * module aliases:
50 * local aliases:
53 module gtk.ToggleToolButton;
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 gtk.ToolItem;
74 /**
75 * Description
76 * A GtkToggleToolButton is a GtkToolItem that contains a toggle
77 * button.
78 * Use gtk_toggle_tool_button_new() to create a new
79 * GtkToggleToolButton. Use gtk_toggle_tool_button_new_from_stock() to
80 * create a new GtkToggleToolButton containing a stock item.
82 private import gtk.ToolButton;
83 public class ToggleToolButton : ToolButton
86 /** the main Gtk struct */
87 protected GtkToggleToolButton* gtkToggleToolButton;
90 public GtkToggleToolButton* getToggleToolButtonStruct()
92 return gtkToggleToolButton;
96 /** the main Gtk struct as a void* */
97 protected void* getStruct()
99 return cast(void*)gtkToggleToolButton;
103 * Sets our main struct and passes it to the parent class
105 public this (GtkToggleToolButton* gtkToggleToolButton)
107 version(noAssert)
109 if ( gtkToggleToolButton is null )
111 int zero = 0;
112 version(Tango)
114 Stdout("struct gtkToggleToolButton is null on constructor").newline;
116 else
118 printf("struct gtkToggleToolButton is null on constructor");
120 zero = zero / zero;
123 else
125 assert(gtkToggleToolButton !is null, "struct gtkToggleToolButton is null on constructor");
127 super(cast(GtkToolButton*)gtkToggleToolButton);
128 this.gtkToggleToolButton = gtkToggleToolButton;
134 // imports for the signal processing
135 private import gobject.Signals;
136 private import gtkc.gdktypes;
137 int[char[]] connectedSignals;
139 void delegate(ToggleToolButton)[] onToggledListeners;
140 void addOnToggled(void delegate(ToggleToolButton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
142 if ( !("toggled" in connectedSignals) )
144 Signals.connectData(
145 getStruct(),
146 "toggled",
147 cast(GCallback)&callBackToggled,
148 cast(void*)this,
149 null,
150 connectFlags);
151 connectedSignals["toggled"] = 1;
153 onToggledListeners ~= dlg;
155 extern(C) static void callBackToggled(GtkToggleToolButton* toggleToolButtonStruct, ToggleToolButton toggleToolButton)
157 bool consumed = false;
159 foreach ( void delegate(ToggleToolButton) dlg ; toggleToolButton.onToggledListeners )
161 dlg(toggleToolButton);
164 return consumed;
170 * Returns a new GtkToggleToolButton
171 * Returns:
172 * a newly created GtkToggleToolButton
173 * Since 2.4
175 public this ()
177 // GtkToolItem* gtk_toggle_tool_button_new (void);
178 this(cast(GtkToggleToolButton*)gtk_toggle_tool_button_new() );
182 * Creates a new GtkToggleToolButton containing the image and text from a
183 * stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK
184 * and GTK_STOCK_APPLY.
185 * It is an error if stock_id is not a name of a stock item.
186 * stock_id:
187 * the name of the stock item
188 * Returns:
189 * A new GtkToggleToolButton
190 * Since 2.4
192 public this (char[] stockId)
194 // GtkToolItem* gtk_toggle_tool_button_new_from_stock (const gchar *stock_id);
195 this(cast(GtkToggleToolButton*)gtk_toggle_tool_button_new_from_stock(Str.toStringz(stockId)) );
199 * Sets the status of the toggle tool button. Set to TRUE if you
200 * want the GtkToggleButton to be 'pressed in', and FALSE to raise it.
201 * This action causes the toggled signal to be emitted.
202 * button:
203 * a GtkToggleToolButton
204 * is_active:
205 * whether button should be active
206 * Since 2.4
208 public void setActive(int isActive)
210 // void gtk_toggle_tool_button_set_active (GtkToggleToolButton *button, gboolean is_active);
211 gtk_toggle_tool_button_set_active(gtkToggleToolButton, isActive);
215 * Queries a GtkToggleToolButton and returns its current state.
216 * Returns TRUE if the toggle button is pressed in and FALSE if it is raised.
217 * button:
218 * a GtkToggleToolButton
219 * Returns:
220 * TRUE if the toggle tool button is pressed in, FALSE if not
221 * Since 2.4
222 * Property Details
223 * The "active" property
224 * "active" gboolean : Read / Write
225 * If the toggle tool button should be pressed in or not.
226 * Default value: FALSE
227 * Since 2.8
228 * Signal Details
229 * The "toggled" signal
230 * void user_function (GtkToggleToolButton *toggle_tool_button,
231 * gpointer user_data) : Run First
232 * Emitted whenever the toggle tool button changes state.
233 * toggle_tool_button:
234 * the object that emitted the signal
235 * user_data:
236 * user data set when the signal handler was connected.
237 * See Also
238 * GtkToolbar, GtkToolButton, GtkSeparatorToolItem
239 * The toolbar widget
240 * The parent class of GtkToggleToolButton. The properties
241 * "label_widget", "label", "icon_widget", and "stock_id" on
242 * GtkToolButton determine the label and icon used on
243 * GtkToggleToolButtons.
244 * A subclass of GtkToolItem that separates groups of
245 * items on a toolbar.
247 public int getActive()
249 // gboolean gtk_toggle_tool_button_get_active (GtkToggleToolButton *button);
250 return gtk_toggle_tool_button_get_active(gtkToggleToolButton);