alternative to assert
[gtkD.git] / src / gtk / ToggleToolButton.d
blob69ce06375c8c859c22583ad1c4468b09959c3a0c
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 = 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 * local aliases:
52 module gtk.ToggleToolButton;
54 private import gtk.gtktypes;
56 private import lib.gtk;
58 private import glib.Str;
59 private import gtk.ToolItem;
61 /**
62 * Description
63 * A GtkToggleToolButton is a GtkToolItem that contains a toggle
64 * button.
65 * Use gtk_toggle_tool_button_new() to create a new
66 * GtkToggleToolButton. Use gtk_toggle_tool_button_new_from_stock() to
67 * create a new GtkToggleToolButton containing a stock item.
69 private import gtk.ToolButton;
70 public class ToggleToolButton : ToolButton
73 /** the main Gtk struct */
74 protected GtkToggleToolButton* gtkToggleToolButton;
77 public GtkToggleToolButton* getToggleToolButtonStruct()
79 return gtkToggleToolButton;
83 /** the main Gtk struct as a void* */
84 protected void* getStruct()
86 return cast(void*)gtkToggleToolButton;
89 /**
90 * Sets our main struct and passes it to the parent class
92 public this (GtkToggleToolButton* gtkToggleToolButton)
94 super(cast(GtkToolButton*)gtkToggleToolButton);
95 this.gtkToggleToolButton = gtkToggleToolButton;
98 /**
101 // imports for the signal processing
102 private import gobject.Signals;
103 private import gdk.gdktypes;
104 int[char[]] connectedSignals;
106 void delegate(ToggleToolButton)[] onToggledListeners;
107 void addOnToggled(void delegate(ToggleToolButton) dlg)
109 if ( !("toggled" in connectedSignals) )
111 Signals.connectData(
112 getStruct(),
113 "toggled",
114 cast(GCallback)&callBackToggled,
115 this,
116 null,
117 cast(ConnectFlags)0);
118 connectedSignals["toggled"] = 1;
120 onToggledListeners ~= dlg;
122 extern(C) static void callBackToggled(GtkToggleToolButton* toggleToolButtonStruct, ToggleToolButton toggleToolButton)
124 bit consumed = false;
126 foreach ( void delegate(ToggleToolButton) dlg ; toggleToolButton.onToggledListeners )
128 dlg(toggleToolButton);
131 return consumed;
137 * Returns a new GtkToggleToolButton
138 * Returns:
139 * a newly created GtkToggleToolButton
140 * Since 2.4
142 public this ()
144 // GtkToolItem* gtk_toggle_tool_button_new (void);
145 this(cast(GtkToggleToolButton*)gtk_toggle_tool_button_new() );
149 * Creates a new GtkToggleToolButton containing the image and text from a
150 * stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK
151 * and GTK_STOCK_APPLY.
152 * It is an error if stock_id is not a name of a stock item.
153 * stock_id:
154 * the name of the stock item
155 * Returns:
156 * A new GtkToggleToolButton
157 * Since 2.4
159 public this (char[] stockId)
161 // GtkToolItem* gtk_toggle_tool_button_new_from_stock (const gchar *stock_id);
162 this(cast(GtkToggleToolButton*)gtk_toggle_tool_button_new_from_stock(Str.toStringz(stockId)) );
166 * Sets the status of the toggle tool button. Set to TRUE if you
167 * want the GtkToggleButton to be 'pressed in', and FALSE to raise it.
168 * This action causes the toggled signal to be emitted.
169 * button:
170 * a GtkToggleToolButton
171 * is_active:
172 * whether button should be active
173 * Since 2.4
175 public void setActive(int isActive)
177 // void gtk_toggle_tool_button_set_active (GtkToggleToolButton *button, gboolean is_active);
178 gtk_toggle_tool_button_set_active(gtkToggleToolButton, isActive);
182 * Queries a GtkToggleToolButton and returns its current state.
183 * Returns TRUE if the toggle button is pressed in and FALSE if it is raised.
184 * button:
185 * a GtkToggleToolButton
186 * Returns:
187 * TRUE if the toggle tool button is pressed in, FALSE if not
188 * Since 2.4
189 * Property Details
190 * The "active" property
191 * "active" gboolean : Read / Write
192 * If the toggle tool button should be pressed in or not.
193 * Default value: FALSE
194 * Since 2.8
195 * Signal Details
196 * The "toggled" signal
197 * void user_function (GtkToggleToolButton *toggle_tool_button,
198 * gpointer user_data) : Run first
199 * Emitted whenever the toggle tool button changes state.
200 * toggle_tool_button:
201 * the object that emitted the signal
202 * user_data:
203 * user data set when the signal handler was connected.
204 * See Also
205 * GtkToolbar, GtkToolButton, GtkSeparatorToolItem
206 * The toolbar widget
207 * The parent class of GtkToggleToolButton. The properties
208 * "label_widget", "label", "icon_widget", and "stock_id" on
209 * GtkToolButton determine the label and icon used on
210 * GtkToggleToolButtons.
211 * A subclass of GtkToolItem that separates groups of
212 * items on a toolbar.
214 public int getActive()
216 // gboolean gtk_toggle_tool_button_get_active (GtkToggleToolButton *button);
217 return gtk_toggle_tool_button_get_active(gtkToggleToolButton);