alternative to assert
[gtkD.git] / src / gtk / Assistant.d
blobf431ba65f4ae4d55ef978a55c4dda9439fb34296
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 = GtkAssistant.html
26 * outPack = gtk
27 * outFile = Assistant
28 * strct = GtkAssistant
29 * realStrct=
30 * ctorStrct=
31 * clss = Assistant
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_assistant_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gdk.Pixbuf
47 * - gtk.Widget
48 * structWrap:
49 * - GdkPixbuf* -> Pixbuf
50 * - GtkWidget* -> Widget
51 * local aliases:
54 module gtk.Assistant;
56 private import gtk.gtktypes;
58 private import lib.gtk;
60 private import glib.Str;
61 private import gdk.Pixbuf;
62 private import gtk.Widget;
64 /**
65 * Description
66 * A GtkAssistant is a widget used to represent a generally complex
67 * operation splitted in several steps, guiding the user through its pages
68 * and controlling the page flow to collect the necessary data.
70 private import gtk.Window;
71 public class Assistant : Window
74 /** the main Gtk struct */
75 protected GtkAssistant* gtkAssistant;
78 public GtkAssistant* getAssistantStruct()
80 return gtkAssistant;
84 /** the main Gtk struct as a void* */
85 protected void* getStruct()
87 return cast(void*)gtkAssistant;
90 /**
91 * Sets our main struct and passes it to the parent class
93 public this (GtkAssistant* gtkAssistant)
95 super(cast(GtkWindow*)gtkAssistant);
96 this.gtkAssistant = gtkAssistant;
99 /**
102 // imports for the signal processing
103 private import gobject.Signals;
104 private import gdk.gdktypes;
105 int[char[]] connectedSignals;
107 void delegate(Assistant)[] onApplyListeners;
108 void addOnApply(void delegate(Assistant) dlg)
110 if ( !("apply" in connectedSignals) )
112 Signals.connectData(
113 getStruct(),
114 "apply",
115 cast(GCallback)&callBackApply,
116 this,
117 null,
118 cast(ConnectFlags)0);
119 connectedSignals["apply"] = 1;
121 onApplyListeners ~= dlg;
123 extern(C) static void callBackApply(GtkAssistant* assistantStruct, Assistant assistant)
125 bit consumed = false;
127 foreach ( void delegate(Assistant) dlg ; assistant.onApplyListeners )
129 dlg(assistant);
132 return consumed;
135 void delegate(Assistant)[] onCancelListeners;
136 void addOnCancel(void delegate(Assistant) dlg)
138 if ( !("cancel" in connectedSignals) )
140 Signals.connectData(
141 getStruct(),
142 "cancel",
143 cast(GCallback)&callBackCancel,
144 this,
145 null,
146 cast(ConnectFlags)0);
147 connectedSignals["cancel"] = 1;
149 onCancelListeners ~= dlg;
151 extern(C) static void callBackCancel(GtkAssistant* assistantStruct, Assistant assistant)
153 bit consumed = false;
155 foreach ( void delegate(Assistant) dlg ; assistant.onCancelListeners )
157 dlg(assistant);
160 return consumed;
163 void delegate(Assistant)[] onCloseListeners;
164 void addOnClose(void delegate(Assistant) dlg)
166 if ( !("close" in connectedSignals) )
168 Signals.connectData(
169 getStruct(),
170 "close",
171 cast(GCallback)&callBackClose,
172 this,
173 null,
174 cast(ConnectFlags)0);
175 connectedSignals["close"] = 1;
177 onCloseListeners ~= dlg;
179 extern(C) static void callBackClose(GtkAssistant* assistantStruct, Assistant assistant)
181 bit consumed = false;
183 foreach ( void delegate(Assistant) dlg ; assistant.onCloseListeners )
185 dlg(assistant);
188 return consumed;
191 void delegate(Widget, Assistant)[] onPrepareListeners;
192 void addOnPrepare(void delegate(Widget, Assistant) dlg)
194 if ( !("prepare" in connectedSignals) )
196 Signals.connectData(
197 getStruct(),
198 "prepare",
199 cast(GCallback)&callBackPrepare,
200 this,
201 null,
202 cast(ConnectFlags)0);
203 connectedSignals["prepare"] = 1;
205 onPrepareListeners ~= dlg;
207 extern(C) static void callBackPrepare(GtkAssistant* assistantStruct, GtkWidget* page, Assistant assistant)
209 bit consumed = false;
211 foreach ( void delegate(Widget, Assistant) dlg ; assistant.onPrepareListeners )
213 dlg(new Widget(page), assistant);
216 return consumed;
222 * Creates a new GtkAssistant.
223 * Returns:
224 * a newly created GtkAssistant
225 * Since 2.10
227 public this ()
229 // GtkWidget* gtk_assistant_new (void);
230 this(cast(GtkAssistant*)gtk_assistant_new() );
234 * Returns the page number of the current page
235 * assistant:
236 * a GtkAssistant
237 * Returns:
238 * The index (starting from 0) of the current page in
239 * the assistant, if the assistant has no pages, -1 will be returned
240 * Since 2.10
242 public int getCurrentPage()
244 // gint gtk_assistant_get_current_page (GtkAssistant *assistant);
245 return gtk_assistant_get_current_page(gtkAssistant);
249 * Switches the page to page_num. Note that this will only be necessary
250 * in custom buttons, as the assistant flow can be set with
251 * gtk_assistant_set_forward_page_func().
252 * assistant:
253 * a GtkAssistant
254 * page_num:
255 * index of the page to switch to, starting from 0.
256 * If negative, the last page will be used. If greater
257 * than the number of pages in the assistant, nothing
258 * will be done.
259 * Since 2.10
261 public void setCurrentPage(int pageNum)
263 // void gtk_assistant_set_current_page (GtkAssistant *assistant, gint page_num);
264 gtk_assistant_set_current_page(gtkAssistant, pageNum);
268 * Returns the number of pages in the assistant
269 * assistant:
270 * a GtkAssistant
271 * Returns:
272 * The number of pages in the assistant.
273 * Since 2.10
275 public int getNPages()
277 // gint gtk_assistant_get_n_pages (GtkAssistant *assistant);
278 return gtk_assistant_get_n_pages(gtkAssistant);
282 * Returns the child widget contained in page number page_num.
283 * assistant:
284 * a GtkAssistant
285 * page_num:
286 * The index of a page in the assistant, or -1 to get the last page;
287 * Returns:
288 * The child widget, or NULL if page_num is out of bounds.
289 * Since 2.10
291 public Widget getNthPage(int pageNum)
293 // GtkWidget* gtk_assistant_get_nth_page (GtkAssistant *assistant, gint page_num);
294 return new Widget( gtk_assistant_get_nth_page(gtkAssistant, pageNum) );
298 * Prepends a page to the assistant.
299 * assistant:
300 * a GtkAssistant
301 * page:
302 * a GtkWidget
303 * Returns:
304 * the index (starting at 0) of the inserted page
305 * Since 2.10
307 public int prependPage(Widget page)
309 // gint gtk_assistant_prepend_page (GtkAssistant *assistant, GtkWidget *page);
310 return gtk_assistant_prepend_page(gtkAssistant, (page is null) ? null : page.getWidgetStruct());
314 * Appends a page to the assistant.
315 * assistant:
316 * a GtkAssistant
317 * page:
318 * a GtkWidget
319 * Returns:
320 * the index (starting at 0) of the inserted page
321 * Since 2.10
323 public int appendPage(Widget page)
325 // gint gtk_assistant_append_page (GtkAssistant *assistant, GtkWidget *page);
326 return gtk_assistant_append_page(gtkAssistant, (page is null) ? null : page.getWidgetStruct());
330 * Inserts a page in the assistant at a given position.
331 * assistant:
332 * a GtkAssistant
333 * page:
334 * a GtkWidget
335 * position:
336 * the index (starting at 0) at which to insert the page,
337 * or -1 to append the page to the assistant
338 * Returns:
339 * the index (starting from 0) of the inserted page
340 * Since 2.10
342 public int insertPage(Widget page, int position)
344 // gint gtk_assistant_insert_page (GtkAssistant *assistant, GtkWidget *page, gint position);
345 return gtk_assistant_insert_page(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), position);
350 * Sets the page forwarding function to be page_func, this function will
351 * be used to determine what will be the next page when the user presses
352 * the forward button. Setting page_func to NULL will make the assistant
353 * to use the default forward function, which just goes to the next visible
354 * page.
355 * assistant:
356 * a GtkAssistant
357 * page_func:
358 * the GtkAssistantPageFunc, or NULL to use the default one
359 * data:
360 * user data for page_func
361 * destroy:
362 * destroy notifier for data
363 * Since 2.10
365 public void setForwardPageFunc(GtkAssistantPageFunc pageFunc, void* data, GDestroyNotify destroy)
367 // void gtk_assistant_set_forward_page_func (GtkAssistant *assistant, GtkAssistantPageFunc page_func, gpointer data, GDestroyNotify destroy);
368 gtk_assistant_set_forward_page_func(gtkAssistant, pageFunc, data, destroy);
373 * Sets the page type for page. The page type determines the page
374 * behavior in the assistant.
375 * assistant:
376 * a GtkAssistant
377 * page:
378 * a page of assistant
379 * type:
380 * the new type for page
381 * Since 2.10
383 public void setPageType(Widget page, GtkAssistantPageType type)
385 // void gtk_assistant_set_page_type (GtkAssistant *assistant, GtkWidget *page, GtkAssistantPageType type);
386 gtk_assistant_set_page_type(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), type);
390 * Gets the page type of page.
391 * assistant:
392 * a GtkAssistant
393 * page:
394 * a page of assistant
395 * Returns:
396 * the page type of page.
397 * Since 2.10
399 public GtkAssistantPageType getPageType(Widget page)
401 // GtkAssistantPageType gtk_assistant_get_page_type (GtkAssistant *assistant, GtkWidget *page);
402 return gtk_assistant_get_page_type(gtkAssistant, (page is null) ? null : page.getWidgetStruct());
406 * Sets a title for page. The title is displayed in the header
407 * area of the assistant when page is the current page.
408 * assistant:
409 * a GtkAssistant
410 * page:
411 * a page of assistant
412 * title:
413 * the new title for page
414 * Since 2.10
416 public void setPageTitle(Widget page, char[] title)
418 // void gtk_assistant_set_page_title (GtkAssistant *assistant, GtkWidget *page, const gchar *title);
419 gtk_assistant_set_page_title(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), Str.toStringz(title));
423 * Gets the title for page.
424 * assistant:
425 * a GtkAssistant
426 * page:
427 * a page of assistant
428 * Returns:
429 * the title for page.
430 * Since 2.10
432 public char[] getPageTitle(Widget page)
434 // const gchar* gtk_assistant_get_page_title (GtkAssistant *assistant, GtkWidget *page);
435 return Str.toString(gtk_assistant_get_page_title(gtkAssistant, (page is null) ? null : page.getWidgetStruct()) );
439 * Sets a header image for page. This image is displayed in the header
440 * area of the assistant when page is the current page.
441 * assistant:
442 * a GtkAssistant
443 * page:
444 * a page of assistant
445 * pixbuf:
446 * the new header image page
447 * Since 2.10
449 public void setPageHeaderImage(Widget page, Pixbuf pixbuf)
451 // void gtk_assistant_set_page_header_image (GtkAssistant *assistant, GtkWidget *page, GdkPixbuf *pixbuf);
452 gtk_assistant_set_page_header_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct());
456 * Gets the header image for page.
457 * assistant:
458 * a GtkAssistant
459 * page:
460 * a page of assistant
461 * Returns:
462 * the header image for page, or NULL
463 * if there's no header image for the page.
464 * Since 2.10
466 public Pixbuf getPageHeaderImage(Widget page)
468 // GdkPixbuf* gtk_assistant_get_page_header_image (GtkAssistant *assistant, GtkWidget *page);
469 return new Pixbuf( gtk_assistant_get_page_header_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct()) );
473 * Sets a header image for page. This image is displayed in the side
474 * area of the assistant when page is the current page.
475 * assistant:
476 * a GtkAssistant
477 * page:
478 * a page of assistant
479 * pixbuf:
480 * the new header image page
481 * Since 2.10
483 public void setPageSideImage(Widget page, Pixbuf pixbuf)
485 // void gtk_assistant_set_page_side_image (GtkAssistant *assistant, GtkWidget *page, GdkPixbuf *pixbuf);
486 gtk_assistant_set_page_side_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct());
490 * Gets the header image for page.
491 * assistant:
492 * a GtkAssistant
493 * page:
494 * a page of assistant
495 * Returns:
496 * the side image for page, or NULL
497 * if there's no side image for the page.
498 * Since 2.10
500 public Pixbuf getPageSideImage(Widget page)
502 // GdkPixbuf* gtk_assistant_get_page_side_image (GtkAssistant *assistant, GtkWidget *page);
503 return new Pixbuf( gtk_assistant_get_page_side_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct()) );
507 * Sets whether page contents are complete. This will make
508 * assistant update the buttons state to be able to continue the task.
509 * assistant:
510 * a GtkAssistant
511 * page:
512 * a page of assistant
513 * complete:
514 * the completeness status of the page
515 * Since 2.10
517 public void setPageComplete(Widget page, int complete)
519 // void gtk_assistant_set_page_complete (GtkAssistant *assistant, GtkWidget *page, gboolean complete);
520 gtk_assistant_set_page_complete(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), complete);
524 * Gets whether page is complete..
525 * assistant:
526 * a GtkAssistant
527 * page:
528 * a page of assistant
529 * Returns:
530 * TRUE if page is complete.
531 * Since 2.10
533 public int getPageComplete(Widget page)
535 // gboolean gtk_assistant_get_page_complete (GtkAssistant *assistant, GtkWidget *page);
536 return gtk_assistant_get_page_complete(gtkAssistant, (page is null) ? null : page.getWidgetStruct());
540 * Adds a widget to the action area of a GtkAssistant.
541 * assistant:
542 * a GtkAssistant
543 * child:
544 * a GtkWidget
545 * Since 2.10
547 public void addActionWidget(Widget child)
549 // void gtk_assistant_add_action_widget (GtkAssistant *assistant, GtkWidget *child);
550 gtk_assistant_add_action_widget(gtkAssistant, (child is null) ? null : child.getWidgetStruct());
554 * Removes a widget from the action area of a GtkAssistant.
555 * assistant:
556 * a GtkAssistant
557 * child:
558 * a GtkWidget
559 * Since 2.10
561 public void removeActionWidget(Widget child)
563 // void gtk_assistant_remove_action_widget (GtkAssistant *assistant, GtkWidget *child);
564 gtk_assistant_remove_action_widget(gtkAssistant, (child is null) ? null : child.getWidgetStruct());
568 * Forces assistant to recompute the buttons state.
569 * GTK+ automatically takes care of this in most situations,
570 * e.g. when the user goes to a different page, or when the
571 * visibility or completeness of a page changes.
572 * One situation where it can be necessary to call this
573 * function is when changing a value on the current page
574 * affects the future page flow of the assistant.
575 * assistant:
576 * a GtkAssistant
577 * Since 2.10
578 * Child Property Details
579 * The "complete" child property
580 * "complete" gboolean : Read / Write
581 * Setting the "complete" child property to TRUE marks a page as complete
582 * (i.e.: all the required fields are filled out). GTK+ uses this information
583 * to control the sensitivity of the navigation buttons.
584 * Default value: FALSE
585 * Since 2.10
587 public void updateButtonsState()
589 // void gtk_assistant_update_buttons_state (GtkAssistant *assistant);
590 gtk_assistant_update_buttons_state(gtkAssistant);