alternative to assert
[gtkD.git] / src / gtk / Statusbar.d
blobd76fefb60ad2a7b0451be134e18ffeb259807401
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 = GtkStatusbar.html
26 * outPack = gtk
27 * outFile = Statusbar
28 * strct = GtkStatusbar
29 * realStrct=
30 * ctorStrct=
31 * clss = Statusbar
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_statusbar_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * structWrap:
47 * local aliases:
50 module gtk.Statusbar;
52 private import gtk.gtktypes;
54 private import lib.gtk;
56 private import glib.Str;
58 /**
59 * Description
60 * A GtkStatusbar is usually placed along the bottom of an application's main
61 * GtkWindow. It may provide a regular commentary of the application's status
62 * (as is usually the case in a web browser, for example), or may be used to
63 * simply output a message when the status changes, (when an upload is complete
64 * in an FTP client, for example).
65 * It may also have a resize grip (a triangular area in the lower right corner)
66 * which can be clicked on to resize the window containing the statusbar.
67 * Status bars in Gtk+ maintain a stack of messages. The message at
68 * the top of the each bar's stack is the one that will currently be displayed.
69 * Any messages added to a statusbar's stack must specify a context_id
70 * that is used to uniquely identify the source of a message. This context_id can be
71 * generated by gtk_statusbar_get_context_id(), given a message and the
72 * statusbar that it will be added to. Note that messages are stored in a
73 * stack, and when choosing which message to display, the stack structure is
74 * adhered to, regardless of the context identifier of a message.
75 * Status bars are created using gtk_statusbar_new().
76 * Messages are added to the bar's stack with gtk_statusbar_push().
77 * The message at the top of the stack can be removed using gtk_statusbar_pop(). A message can be removed from anywhere in the stack if its message_id was recorded at the time it was added. This is done using gtk_statusbar_remove().
79 private import gtk.HBox;
80 public class Statusbar : HBox
83 /** the main Gtk struct */
84 protected GtkStatusbar* gtkStatusbar;
87 public GtkStatusbar* getStatusbarStruct()
89 return gtkStatusbar;
93 /** the main Gtk struct as a void* */
94 protected void* getStruct()
96 return cast(void*)gtkStatusbar;
99 /**
100 * Sets our main struct and passes it to the parent class
102 public this (GtkStatusbar* gtkStatusbar)
104 super(cast(GtkHBox*)gtkStatusbar);
105 this.gtkStatusbar = gtkStatusbar;
111 // imports for the signal processing
112 private import gobject.Signals;
113 private import gdk.gdktypes;
114 int[char[]] connectedSignals;
116 void delegate(guint, char[], Statusbar)[] onTextPoppedListeners;
117 void addOnTextPopped(void delegate(guint, char[], Statusbar) dlg)
119 if ( !("text-popped" in connectedSignals) )
121 Signals.connectData(
122 getStruct(),
123 "text-popped",
124 cast(GCallback)&callBackTextPopped,
125 this,
126 null,
127 cast(ConnectFlags)0);
128 connectedSignals["text-popped"] = 1;
130 onTextPoppedListeners ~= dlg;
132 extern(C) static void callBackTextPopped(GtkStatusbar* statusbarStruct, guint contextId, gchar* text, Statusbar statusbar)
134 bit consumed = false;
136 foreach ( void delegate(guint, char[], Statusbar) dlg ; statusbar.onTextPoppedListeners )
138 dlg(contextId, Str.toString(text), statusbar);
141 return consumed;
144 void delegate(guint, char[], Statusbar)[] onTextPushedListeners;
145 void addOnTextPushed(void delegate(guint, char[], Statusbar) dlg)
147 if ( !("text-pushed" in connectedSignals) )
149 Signals.connectData(
150 getStruct(),
151 "text-pushed",
152 cast(GCallback)&callBackTextPushed,
153 this,
154 null,
155 cast(ConnectFlags)0);
156 connectedSignals["text-pushed"] = 1;
158 onTextPushedListeners ~= dlg;
160 extern(C) static void callBackTextPushed(GtkStatusbar* statusbarStruct, guint contextId, gchar* text, Statusbar statusbar)
162 bit consumed = false;
164 foreach ( void delegate(guint, char[], Statusbar) dlg ; statusbar.onTextPushedListeners )
166 dlg(contextId, Str.toString(text), statusbar);
169 return consumed;
175 * Creates a new GtkStatusbar ready for messages.
176 * Returns:
177 * the new GtkStatusbar.
179 public this ()
181 // GtkWidget* gtk_statusbar_new (void);
182 this(cast(GtkStatusbar*)gtk_statusbar_new() );
186 * Returns a new context identifier, given a description of the actual context.
187 * statusbar:
188 * a GtkStatusbar.
189 * context_description:
190 * textual description of what context the new message is
191 * being used in.
192 * Returns:
193 * an integer id.
195 public uint getContextId(char[] contextDescription)
197 // guint gtk_statusbar_get_context_id (GtkStatusbar *statusbar, const gchar *context_description);
198 return gtk_statusbar_get_context_id(gtkStatusbar, Str.toStringz(contextDescription));
202 * Pushes a new message onto a statusbar's stack.
203 * statusbar:
204 * a GtkStatusbar.
205 * context_id:
206 * the message's context id, as returned by
207 * gtk_statusbar_get_context_id().
208 * text:
209 * the message to add to the statusbar.
210 * Returns:
211 * the message's new message id for use with gtk_statusbar_remove().
213 public uint push(uint contextId, char[] text)
215 // guint gtk_statusbar_push (GtkStatusbar *statusbar, guint context_id, const gchar *text);
216 return gtk_statusbar_push(gtkStatusbar, contextId, Str.toStringz(text));
220 * Removes the message at the top of a GtkStatusBar's stack.
221 * statusbar:
222 * a GtkStatusBar.
223 * context_id:
224 * a context identifier.
226 public void pop(uint contextId)
228 // void gtk_statusbar_pop (GtkStatusbar *statusbar, guint context_id);
229 gtk_statusbar_pop(gtkStatusbar, contextId);
233 * Forces the removal of a message from a statusbar's stack. The exact context_id and message_id must be specified.
234 * statusbar:
235 * a GtkStatusBar.
236 * context_id:
237 * a context identifier.
238 * message_id:
239 * a message identifier, as returned by gtk_statusbar_push().
241 public void remove(uint contextId, uint messageId)
243 // void gtk_statusbar_remove (GtkStatusbar *statusbar, guint context_id, guint message_id);
244 gtk_statusbar_remove(gtkStatusbar, contextId, messageId);
248 * Sets whether the statusbar has a resize grip. TRUE by default.
249 * statusbar:
250 * a GtkStatusBar.
251 * setting:
252 * TRUE to have a resize grip.
254 public void setHasResizeGrip(int setting)
256 // void gtk_statusbar_set_has_resize_grip (GtkStatusbar *statusbar, gboolean setting);
257 gtk_statusbar_set_has_resize_grip(gtkStatusbar, setting);
261 * Returns whether the statusbar has a resize grip.
262 * statusbar:
263 * a GtkStatusBar.
264 * Returns:
265 * TRUE if the statusbar has a resize grip.
266 * Property Details
267 * The "has-resize-grip" property
268 * "has-resize-grip" gboolean : Read / Write
269 * Whether the statusbar has a grip for resizing the toplevel window.
270 * Default value: TRUE
271 * Since 2.4
272 * Style Property Details
273 * The "shadow-type" style property
274 * "shadow-type" GtkShadowType : Read
275 * Style of bevel around the statusbar text.
276 * Default value: GTK_SHADOW_IN
277 * Signal Details
278 * The "text-popped" signal
279 * void user_function (GtkStatusbar *statusbar,
280 * guint context_id,
281 * gchar *text,
282 * gpointer user_data) : Run last
283 * Is emitted whenever a new message is popped off a statusbar's stack.
284 * statusbar:
285 * the object which received the signal.
286 * context_id:
287 * the context id of the relevant message/statusbar.
288 * text:
289 * the message that was just popped.
290 * user_data:
291 * user data set when the signal handler was connected.
293 public int getHasResizeGrip()
295 // gboolean gtk_statusbar_get_has_resize_grip (GtkStatusbar *statusbar);
296 return gtk_statusbar_get_has_resize_grip(gtkStatusbar);