1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.Assistant; 26 27 private import gdkpixbuf.Pixbuf; 28 private import glib.ConstructionException; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import gobject.Signals; 32 private import gtk.Widget; 33 private import gtk.Window; 34 private import gtkc.gtk; 35 public import gtkc.gtktypes; 36 private import std.algorithm; 37 38 39 /** 40 * A #GtkAssistant is a widget used to represent a generally complex 41 * operation splitted in several steps, guiding the user through its 42 * pages and controlling the page flow to collect the necessary data. 43 * 44 * The design of GtkAssistant is that it controls what buttons to show 45 * and to make sensitive, based on what it knows about the page sequence 46 * and the [type][GtkAssistantPageType] of each page, 47 * in addition to state information like the page 48 * [completion][gtk-assistant-set-page-complete] 49 * and [committed][gtk-assistant-commit] status. 50 * 51 * If you have a case that doesn’t quite fit in #GtkAssistants way of 52 * handling buttons, you can use the #GTK_ASSISTANT_PAGE_CUSTOM page 53 * type and handle buttons yourself. 54 * 55 * # GtkAssistant as GtkBuildable 56 * 57 * The GtkAssistant implementation of the #GtkBuildable interface 58 * exposes the @action_area as internal children with the name 59 * “action_area”. 60 * 61 * To add pages to an assistant in #GtkBuilder, simply add it as a 62 * child to the GtkAssistant object, and set its child properties 63 * as necessary. 64 * 65 * # CSS nodes 66 * 67 * GtkAssistant has a single CSS node with the name assistant. 68 */ 69 public class Assistant : Window 70 { 71 /** the main Gtk struct */ 72 protected GtkAssistant* gtkAssistant; 73 74 /** Get the main Gtk struct */ 75 public GtkAssistant* getAssistantStruct() 76 { 77 return gtkAssistant; 78 } 79 80 /** the main Gtk struct as a void* */ 81 protected override void* getStruct() 82 { 83 return cast(void*)gtkAssistant; 84 } 85 86 protected override void setStruct(GObject* obj) 87 { 88 gtkAssistant = cast(GtkAssistant*)obj; 89 super.setStruct(obj); 90 } 91 92 /** 93 * Sets our main struct and passes it to the parent class. 94 */ 95 public this (GtkAssistant* gtkAssistant, bool ownedRef = false) 96 { 97 this.gtkAssistant = gtkAssistant; 98 super(cast(GtkWindow*)gtkAssistant, ownedRef); 99 } 100 101 102 /** */ 103 public static GType getType() 104 { 105 return gtk_assistant_get_type(); 106 } 107 108 /** 109 * Creates a new #GtkAssistant. 110 * 111 * Returns: a newly created #GtkAssistant 112 * 113 * Since: 2.10 114 * 115 * Throws: ConstructionException GTK+ fails to create the object. 116 */ 117 public this() 118 { 119 auto p = gtk_assistant_new(); 120 121 if(p is null) 122 { 123 throw new ConstructionException("null returned by new"); 124 } 125 126 this(cast(GtkAssistant*) p); 127 } 128 129 /** 130 * Adds a widget to the action area of a #GtkAssistant. 131 * 132 * Params: 133 * child = a #GtkWidget 134 * 135 * Since: 2.10 136 */ 137 public void addActionWidget(Widget child) 138 { 139 gtk_assistant_add_action_widget(gtkAssistant, (child is null) ? null : child.getWidgetStruct()); 140 } 141 142 /** 143 * Appends a page to the @assistant. 144 * 145 * Params: 146 * page = a #GtkWidget 147 * 148 * Returns: the index (starting at 0) of the inserted page 149 * 150 * Since: 2.10 151 */ 152 public int appendPage(Widget page) 153 { 154 return gtk_assistant_append_page(gtkAssistant, (page is null) ? null : page.getWidgetStruct()); 155 } 156 157 /** 158 * Erases the visited page history so the back button is not 159 * shown on the current page, and removes the cancel button 160 * from subsequent pages. 161 * 162 * Use this when the information provided up to the current 163 * page is hereafter deemed permanent and cannot be modified 164 * or undone. For example, showing a progress page to track 165 * a long-running, unreversible operation after the user has 166 * clicked apply on a confirmation page. 167 * 168 * Since: 2.22 169 */ 170 public void commit() 171 { 172 gtk_assistant_commit(gtkAssistant); 173 } 174 175 /** 176 * Returns the page number of the current page. 177 * 178 * Returns: The index (starting from 0) of the current 179 * page in the @assistant, or -1 if the @assistant has no pages, 180 * or no current page. 181 * 182 * Since: 2.10 183 */ 184 public int getCurrentPage() 185 { 186 return gtk_assistant_get_current_page(gtkAssistant); 187 } 188 189 /** 190 * Returns the number of pages in the @assistant 191 * 192 * Returns: the number of pages in the @assistant 193 * 194 * Since: 2.10 195 */ 196 public int getNPages() 197 { 198 return gtk_assistant_get_n_pages(gtkAssistant); 199 } 200 201 /** 202 * Returns the child widget contained in page number @page_num. 203 * 204 * Params: 205 * pageNum = the index of a page in the @assistant, 206 * or -1 to get the last page 207 * 208 * Returns: the child widget, or %NULL 209 * if @page_num is out of bounds 210 * 211 * Since: 2.10 212 */ 213 public Widget getNthPage(int pageNum) 214 { 215 auto p = gtk_assistant_get_nth_page(gtkAssistant, pageNum); 216 217 if(p is null) 218 { 219 return null; 220 } 221 222 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 223 } 224 225 /** 226 * Gets whether @page is complete. 227 * 228 * Params: 229 * page = a page of @assistant 230 * 231 * Returns: %TRUE if @page is complete. 232 * 233 * Since: 2.10 234 */ 235 public bool getPageComplete(Widget page) 236 { 237 return gtk_assistant_get_page_complete(gtkAssistant, (page is null) ? null : page.getWidgetStruct()) != 0; 238 } 239 240 /** 241 * Gets whether page has padding. 242 * 243 * Params: 244 * page = a page of @assistant 245 * 246 * Returns: %TRUE if @page has padding 247 * 248 * Since: 3.18 249 */ 250 public bool getPageHasPadding(Widget page) 251 { 252 return gtk_assistant_get_page_has_padding(gtkAssistant, (page is null) ? null : page.getWidgetStruct()) != 0; 253 } 254 255 /** 256 * Gets the header image for @page. 257 * 258 * Deprecated: Since GTK+ 3.2, a header is no longer shown; 259 * add your header decoration to the page content instead. 260 * 261 * Params: 262 * page = a page of @assistant 263 * 264 * Returns: the header image for @page, 265 * or %NULL if there’s no header image for the page 266 * 267 * Since: 2.10 268 */ 269 public Pixbuf getPageHeaderImage(Widget page) 270 { 271 auto p = gtk_assistant_get_page_header_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct()); 272 273 if(p is null) 274 { 275 return null; 276 } 277 278 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 279 } 280 281 /** 282 * Gets the side image for @page. 283 * 284 * Deprecated: Since GTK+ 3.2, sidebar images are not 285 * shown anymore. 286 * 287 * Params: 288 * page = a page of @assistant 289 * 290 * Returns: the side image for @page, 291 * or %NULL if there’s no side image for the page 292 * 293 * Since: 2.10 294 */ 295 public Pixbuf getPageSideImage(Widget page) 296 { 297 auto p = gtk_assistant_get_page_side_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct()); 298 299 if(p is null) 300 { 301 return null; 302 } 303 304 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 305 } 306 307 /** 308 * Gets the title for @page. 309 * 310 * Params: 311 * page = a page of @assistant 312 * 313 * Returns: the title for @page 314 * 315 * Since: 2.10 316 */ 317 public string getPageTitle(Widget page) 318 { 319 return Str.toString(gtk_assistant_get_page_title(gtkAssistant, (page is null) ? null : page.getWidgetStruct())); 320 } 321 322 /** 323 * Gets the page type of @page. 324 * 325 * Params: 326 * page = a page of @assistant 327 * 328 * Returns: the page type of @page 329 * 330 * Since: 2.10 331 */ 332 public GtkAssistantPageType getPageType(Widget page) 333 { 334 return gtk_assistant_get_page_type(gtkAssistant, (page is null) ? null : page.getWidgetStruct()); 335 } 336 337 /** 338 * Inserts a page in the @assistant at a given position. 339 * 340 * Params: 341 * page = a #GtkWidget 342 * position = the index (starting at 0) at which to insert the page, 343 * or -1 to append the page to the @assistant 344 * 345 * Returns: the index (starting from 0) of the inserted page 346 * 347 * Since: 2.10 348 */ 349 public int insertPage(Widget page, int position) 350 { 351 return gtk_assistant_insert_page(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), position); 352 } 353 354 /** 355 * Navigate to the next page. 356 * 357 * It is a programming error to call this function when 358 * there is no next page. 359 * 360 * This function is for use when creating pages of the 361 * #GTK_ASSISTANT_PAGE_CUSTOM type. 362 * 363 * Since: 3.0 364 */ 365 public void nextPage() 366 { 367 gtk_assistant_next_page(gtkAssistant); 368 } 369 370 /** 371 * Prepends a page to the @assistant. 372 * 373 * Params: 374 * page = a #GtkWidget 375 * 376 * Returns: the index (starting at 0) of the inserted page 377 * 378 * Since: 2.10 379 */ 380 public int prependPage(Widget page) 381 { 382 return gtk_assistant_prepend_page(gtkAssistant, (page is null) ? null : page.getWidgetStruct()); 383 } 384 385 /** 386 * Navigate to the previous visited page. 387 * 388 * It is a programming error to call this function when 389 * no previous page is available. 390 * 391 * This function is for use when creating pages of the 392 * #GTK_ASSISTANT_PAGE_CUSTOM type. 393 * 394 * Since: 3.0 395 */ 396 public void previousPage() 397 { 398 gtk_assistant_previous_page(gtkAssistant); 399 } 400 401 /** 402 * Removes a widget from the action area of a #GtkAssistant. 403 * 404 * Params: 405 * child = a #GtkWidget 406 * 407 * Since: 2.10 408 */ 409 public void removeActionWidget(Widget child) 410 { 411 gtk_assistant_remove_action_widget(gtkAssistant, (child is null) ? null : child.getWidgetStruct()); 412 } 413 414 /** 415 * Removes the @page_num’s page from @assistant. 416 * 417 * Params: 418 * pageNum = the index of a page in the @assistant, 419 * or -1 to remove the last page 420 * 421 * Since: 3.2 422 */ 423 public void removePage(int pageNum) 424 { 425 gtk_assistant_remove_page(gtkAssistant, pageNum); 426 } 427 428 /** 429 * Switches the page to @page_num. 430 * 431 * Note that this will only be necessary in custom buttons, 432 * as the @assistant flow can be set with 433 * gtk_assistant_set_forward_page_func(). 434 * 435 * Params: 436 * pageNum = index of the page to switch to, starting from 0. 437 * If negative, the last page will be used. If greater 438 * than the number of pages in the @assistant, nothing 439 * will be done. 440 * 441 * Since: 2.10 442 */ 443 public void setCurrentPage(int pageNum) 444 { 445 gtk_assistant_set_current_page(gtkAssistant, pageNum); 446 } 447 448 /** 449 * Sets the page forwarding function to be @page_func. 450 * 451 * This function will be used to determine what will be 452 * the next page when the user presses the forward button. 453 * Setting @page_func to %NULL will make the assistant to 454 * use the default forward function, which just goes to the 455 * next visible page. 456 * 457 * Params: 458 * pageFunc = the #GtkAssistantPageFunc, or %NULL 459 * to use the default one 460 * data = user data for @page_func 461 * destroy = destroy notifier for @data 462 * 463 * Since: 2.10 464 */ 465 public void setForwardPageFunc(GtkAssistantPageFunc pageFunc, void* data, GDestroyNotify destroy) 466 { 467 gtk_assistant_set_forward_page_func(gtkAssistant, pageFunc, data, destroy); 468 } 469 470 /** 471 * Sets whether @page contents are complete. 472 * 473 * This will make @assistant update the buttons state 474 * to be able to continue the task. 475 * 476 * Params: 477 * page = a page of @assistant 478 * complete = the completeness status of the page 479 * 480 * Since: 2.10 481 */ 482 public void setPageComplete(Widget page, bool complete) 483 { 484 gtk_assistant_set_page_complete(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), complete); 485 } 486 487 /** 488 * Sets whether the assistant is adding padding around 489 * the page. 490 * 491 * Params: 492 * page = a page of @assistant 493 * hasPadding = whether this page has padding 494 * 495 * Since: 3.18 496 */ 497 public void setPageHasPadding(Widget page, bool hasPadding) 498 { 499 gtk_assistant_set_page_has_padding(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), hasPadding); 500 } 501 502 /** 503 * Sets a header image for @page. 504 * 505 * Deprecated: Since GTK+ 3.2, a header is no longer shown; 506 * add your header decoration to the page content instead. 507 * 508 * Params: 509 * page = a page of @assistant 510 * pixbuf = the new header image @page 511 * 512 * Since: 2.10 513 */ 514 public void setPageHeaderImage(Widget page, Pixbuf pixbuf) 515 { 516 gtk_assistant_set_page_header_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 517 } 518 519 /** 520 * Sets a side image for @page. 521 * 522 * This image used to be displayed in the side area of the assistant 523 * when @page is the current page. 524 * 525 * Deprecated: Since GTK+ 3.2, sidebar images are not 526 * shown anymore. 527 * 528 * Params: 529 * page = a page of @assistant 530 * pixbuf = the new side image @page 531 * 532 * Since: 2.10 533 */ 534 public void setPageSideImage(Widget page, Pixbuf pixbuf) 535 { 536 gtk_assistant_set_page_side_image(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 537 } 538 539 /** 540 * Sets a title for @page. 541 * 542 * The title is displayed in the header area of the assistant 543 * when @page is the current page. 544 * 545 * Params: 546 * page = a page of @assistant 547 * title = the new title for @page 548 * 549 * Since: 2.10 550 */ 551 public void setPageTitle(Widget page, string title) 552 { 553 gtk_assistant_set_page_title(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), Str.toStringz(title)); 554 } 555 556 /** 557 * Sets the page type for @page. 558 * 559 * The page type determines the page behavior in the @assistant. 560 * 561 * Params: 562 * page = a page of @assistant 563 * type = the new type for @page 564 * 565 * Since: 2.10 566 */ 567 public void setPageType(Widget page, GtkAssistantPageType type) 568 { 569 gtk_assistant_set_page_type(gtkAssistant, (page is null) ? null : page.getWidgetStruct(), type); 570 } 571 572 /** 573 * Forces @assistant to recompute the buttons state. 574 * 575 * GTK+ automatically takes care of this in most situations, 576 * e.g. when the user goes to a different page, or when the 577 * visibility or completeness of a page changes. 578 * 579 * One situation where it can be necessary to call this 580 * function is when changing a value on the current page 581 * affects the future page flow of the assistant. 582 * 583 * Since: 2.10 584 */ 585 public void updateButtonsState() 586 { 587 gtk_assistant_update_buttons_state(gtkAssistant); 588 } 589 590 protected class OnApplyDelegateWrapper 591 { 592 static OnApplyDelegateWrapper[] listeners; 593 void delegate(Assistant) dlg; 594 gulong handlerId; 595 596 this(void delegate(Assistant) dlg) 597 { 598 this.dlg = dlg; 599 this.listeners ~= this; 600 } 601 602 void remove(OnApplyDelegateWrapper source) 603 { 604 foreach(index, wrapper; listeners) 605 { 606 if (wrapper.handlerId == source.handlerId) 607 { 608 listeners[index] = null; 609 listeners = std.algorithm.remove(listeners, index); 610 break; 611 } 612 } 613 } 614 } 615 616 /** 617 * The ::apply signal is emitted when the apply button is clicked. 618 * 619 * The default behavior of the #GtkAssistant is to switch to the page 620 * after the current page, unless the current page is the last one. 621 * 622 * A handler for the ::apply signal should carry out the actions for 623 * which the wizard has collected data. If the action takes a long time 624 * to complete, you might consider putting a page of type 625 * %GTK_ASSISTANT_PAGE_PROGRESS after the confirmation page and handle 626 * this operation within the #GtkAssistant::prepare signal of the progress 627 * page. 628 * 629 * Since: 2.10 630 */ 631 gulong addOnApply(void delegate(Assistant) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 632 { 633 auto wrapper = new OnApplyDelegateWrapper(dlg); 634 wrapper.handlerId = Signals.connectData( 635 this, 636 "apply", 637 cast(GCallback)&callBackApply, 638 cast(void*)wrapper, 639 cast(GClosureNotify)&callBackApplyDestroy, 640 connectFlags); 641 return wrapper.handlerId; 642 } 643 644 extern(C) static void callBackApply(GtkAssistant* assistantStruct, OnApplyDelegateWrapper wrapper) 645 { 646 wrapper.dlg(wrapper.outer); 647 } 648 649 extern(C) static void callBackApplyDestroy(OnApplyDelegateWrapper wrapper, GClosure* closure) 650 { 651 wrapper.remove(wrapper); 652 } 653 654 protected class OnCancelDelegateWrapper 655 { 656 static OnCancelDelegateWrapper[] listeners; 657 void delegate(Assistant) dlg; 658 gulong handlerId; 659 660 this(void delegate(Assistant) dlg) 661 { 662 this.dlg = dlg; 663 this.listeners ~= this; 664 } 665 666 void remove(OnCancelDelegateWrapper source) 667 { 668 foreach(index, wrapper; listeners) 669 { 670 if (wrapper.handlerId == source.handlerId) 671 { 672 listeners[index] = null; 673 listeners = std.algorithm.remove(listeners, index); 674 break; 675 } 676 } 677 } 678 } 679 680 /** 681 * The ::cancel signal is emitted when then the cancel button is clicked. 682 * 683 * Since: 2.10 684 */ 685 gulong addOnCancel(void delegate(Assistant) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 686 { 687 auto wrapper = new OnCancelDelegateWrapper(dlg); 688 wrapper.handlerId = Signals.connectData( 689 this, 690 "cancel", 691 cast(GCallback)&callBackCancel, 692 cast(void*)wrapper, 693 cast(GClosureNotify)&callBackCancelDestroy, 694 connectFlags); 695 return wrapper.handlerId; 696 } 697 698 extern(C) static void callBackCancel(GtkAssistant* assistantStruct, OnCancelDelegateWrapper wrapper) 699 { 700 wrapper.dlg(wrapper.outer); 701 } 702 703 extern(C) static void callBackCancelDestroy(OnCancelDelegateWrapper wrapper, GClosure* closure) 704 { 705 wrapper.remove(wrapper); 706 } 707 708 protected class OnCloseDelegateWrapper 709 { 710 static OnCloseDelegateWrapper[] listeners; 711 void delegate(Assistant) dlg; 712 gulong handlerId; 713 714 this(void delegate(Assistant) dlg) 715 { 716 this.dlg = dlg; 717 this.listeners ~= this; 718 } 719 720 void remove(OnCloseDelegateWrapper source) 721 { 722 foreach(index, wrapper; listeners) 723 { 724 if (wrapper.handlerId == source.handlerId) 725 { 726 listeners[index] = null; 727 listeners = std.algorithm.remove(listeners, index); 728 break; 729 } 730 } 731 } 732 } 733 734 /** 735 * The ::close signal is emitted either when the close button of 736 * a summary page is clicked, or when the apply button in the last 737 * page in the flow (of type %GTK_ASSISTANT_PAGE_CONFIRM) is clicked. 738 * 739 * Since: 2.10 740 */ 741 gulong addOnClose(void delegate(Assistant) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 742 { 743 auto wrapper = new OnCloseDelegateWrapper(dlg); 744 wrapper.handlerId = Signals.connectData( 745 this, 746 "close", 747 cast(GCallback)&callBackClose, 748 cast(void*)wrapper, 749 cast(GClosureNotify)&callBackCloseDestroy, 750 connectFlags); 751 return wrapper.handlerId; 752 } 753 754 extern(C) static void callBackClose(GtkAssistant* assistantStruct, OnCloseDelegateWrapper wrapper) 755 { 756 wrapper.dlg(wrapper.outer); 757 } 758 759 extern(C) static void callBackCloseDestroy(OnCloseDelegateWrapper wrapper, GClosure* closure) 760 { 761 wrapper.remove(wrapper); 762 } 763 764 protected class OnEscapeDelegateWrapper 765 { 766 static OnEscapeDelegateWrapper[] listeners; 767 void delegate(Assistant) dlg; 768 gulong handlerId; 769 770 this(void delegate(Assistant) dlg) 771 { 772 this.dlg = dlg; 773 this.listeners ~= this; 774 } 775 776 void remove(OnEscapeDelegateWrapper source) 777 { 778 foreach(index, wrapper; listeners) 779 { 780 if (wrapper.handlerId == source.handlerId) 781 { 782 listeners[index] = null; 783 listeners = std.algorithm.remove(listeners, index); 784 break; 785 } 786 } 787 } 788 } 789 790 /** */ 791 gulong addOnEscape(void delegate(Assistant) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 792 { 793 auto wrapper = new OnEscapeDelegateWrapper(dlg); 794 wrapper.handlerId = Signals.connectData( 795 this, 796 "escape", 797 cast(GCallback)&callBackEscape, 798 cast(void*)wrapper, 799 cast(GClosureNotify)&callBackEscapeDestroy, 800 connectFlags); 801 return wrapper.handlerId; 802 } 803 804 extern(C) static void callBackEscape(GtkAssistant* assistantStruct, OnEscapeDelegateWrapper wrapper) 805 { 806 wrapper.dlg(wrapper.outer); 807 } 808 809 extern(C) static void callBackEscapeDestroy(OnEscapeDelegateWrapper wrapper, GClosure* closure) 810 { 811 wrapper.remove(wrapper); 812 } 813 814 protected class OnPrepareDelegateWrapper 815 { 816 static OnPrepareDelegateWrapper[] listeners; 817 void delegate(Widget, Assistant) dlg; 818 gulong handlerId; 819 820 this(void delegate(Widget, Assistant) dlg) 821 { 822 this.dlg = dlg; 823 this.listeners ~= this; 824 } 825 826 void remove(OnPrepareDelegateWrapper source) 827 { 828 foreach(index, wrapper; listeners) 829 { 830 if (wrapper.handlerId == source.handlerId) 831 { 832 listeners[index] = null; 833 listeners = std.algorithm.remove(listeners, index); 834 break; 835 } 836 } 837 } 838 } 839 840 /** 841 * The ::prepare signal is emitted when a new page is set as the 842 * assistant's current page, before making the new page visible. 843 * 844 * A handler for this signal can do any preparations which are 845 * necessary before showing @page. 846 * 847 * Params: 848 * page = the current page 849 * 850 * Since: 2.10 851 */ 852 gulong addOnPrepare(void delegate(Widget, Assistant) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 853 { 854 auto wrapper = new OnPrepareDelegateWrapper(dlg); 855 wrapper.handlerId = Signals.connectData( 856 this, 857 "prepare", 858 cast(GCallback)&callBackPrepare, 859 cast(void*)wrapper, 860 cast(GClosureNotify)&callBackPrepareDestroy, 861 connectFlags); 862 return wrapper.handlerId; 863 } 864 865 extern(C) static void callBackPrepare(GtkAssistant* assistantStruct, GtkWidget* page, OnPrepareDelegateWrapper wrapper) 866 { 867 wrapper.dlg(ObjectG.getDObject!(Widget)(page), wrapper.outer); 868 } 869 870 extern(C) static void callBackPrepareDestroy(OnPrepareDelegateWrapper wrapper, GClosure* closure) 871 { 872 wrapper.remove(wrapper); 873 } 874 }