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 * Conversion parameters: 26 * inFile = GtkNotebook.html 27 * outPack = gtk 28 * outFile = Notebook 29 * strct = GtkNotebook 30 * realStrct= 31 * ctorStrct= 32 * clss = Notebook 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_notebook_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gtk.Label 48 * - gtk.Widget 49 * structWrap: 50 * - GtkWidget* -> Widget 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module gtk.Notebook; 57 58 public import gtkc.gtktypes; 59 60 private import gtkc.gtk; 61 private import glib.ConstructionException; 62 private import gobject.ObjectG; 63 64 private import gobject.Signals; 65 public import gtkc.gdktypes; 66 private import glib.Str; 67 private import gtk.Label; 68 private import gtk.Widget; 69 70 71 private import gtk.Container; 72 73 /** 74 * The GtkNotebook widget is a GtkContainer whose children are pages that 75 * can be switched between using tab labels along one edge. 76 * 77 * There are many configuration options for GtkNotebook. Among other 78 * things, you can choose on which edge the tabs appear 79 * (see gtk_notebook_set_tab_pos()), whether, if there are too many 80 * tabs to fit the notebook should be made bigger or scrolling 81 * arrows added (see gtk_notebook_set_scrollable()), and whether there 82 * will be a popup menu allowing the users to switch pages. 83 * (see gtk_notebook_popup_enable(), gtk_notebook_popup_disable()) 84 * 85 * GtkNotebook as GtkBuildable 86 * 87 * The GtkNotebook implementation of the GtkBuildable interface 88 * supports placing children into tabs by specifying "tab" as the 89 * "type" attribute of a <child> element. Note that the content 90 * of the tab must be created before the tab can be filled. 91 * A tab child can be specified without specifying a <child> 92 * type attribute. 93 * 94 * To add a child widget in the notebooks action area, specify 95 * "action-start" or "action-end" as the "type" attribute of the <child> 96 * element. 97 * 98 * $(DDOC_COMMENT example) 99 */ 100 public class Notebook : Container 101 { 102 103 /** the main Gtk struct */ 104 protected GtkNotebook* gtkNotebook; 105 106 107 /** Get the main Gtk struct */ 108 public GtkNotebook* getNotebookStruct() 109 { 110 return gtkNotebook; 111 } 112 113 114 /** the main Gtk struct as a void* */ 115 protected override void* getStruct() 116 { 117 return cast(void*)gtkNotebook; 118 } 119 120 /** 121 * Sets our main struct and passes it to the parent class 122 */ 123 public this (GtkNotebook* gtkNotebook) 124 { 125 super(cast(GtkContainer*)gtkNotebook); 126 this.gtkNotebook = gtkNotebook; 127 } 128 129 protected override void setStruct(GObject* obj) 130 { 131 super.setStruct(obj); 132 gtkNotebook = cast(GtkNotebook*)obj; 133 } 134 135 /** 136 * Append a page with a widget and a text for a label 137 */ 138 public int appendPage(Widget child, string tabLabel) 139 { 140 return appendPage(child, new Label(tabLabel)); 141 } 142 143 /** */ 144 void setCurrentPage(Widget child) 145 { 146 gtk_notebook_set_current_page(gtkNotebook,gtk_notebook_page_num(gtkNotebook, child.getWidgetStruct())); 147 } 148 149 /** 150 */ 151 int[string] connectedSignals; 152 153 bool delegate(gint, Notebook)[] onChangeCurrentPageListeners; 154 /** 155 */ 156 void addOnChangeCurrentPage(bool delegate(gint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 157 { 158 if ( !("change-current-page" in connectedSignals) ) 159 { 160 Signals.connectData( 161 getStruct(), 162 "change-current-page", 163 cast(GCallback)&callBackChangeCurrentPage, 164 cast(void*)this, 165 null, 166 connectFlags); 167 connectedSignals["change-current-page"] = 1; 168 } 169 onChangeCurrentPageListeners ~= dlg; 170 } 171 extern(C) static gboolean callBackChangeCurrentPage(GtkNotebook* notebookStruct, gint arg1, Notebook _notebook) 172 { 173 foreach ( bool delegate(gint, Notebook) dlg ; _notebook.onChangeCurrentPageListeners ) 174 { 175 if ( dlg(arg1, _notebook) ) 176 { 177 return 1; 178 } 179 } 180 181 return 0; 182 } 183 184 GtkNotebook* delegate(Widget, gint, gint, Notebook)[] onCreateWindowListeners; 185 /** 186 * The ::create-window signal is emitted when a detachable 187 * tab is dropped on the root window. 188 * A handler for this signal can create a window containing 189 * a notebook where the tab will be attached. It is also 190 * responsible for moving/resizing the window and adding the 191 * necessary properties to the notebook (e.g. the 192 * "group-name" ). 193 * Since 2.12 194 */ 195 void addOnCreateWindow(GtkNotebook* delegate(Widget, gint, gint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 196 { 197 if ( !("create-window" in connectedSignals) ) 198 { 199 Signals.connectData( 200 getStruct(), 201 "create-window", 202 cast(GCallback)&callBackCreateWindow, 203 cast(void*)this, 204 null, 205 connectFlags); 206 connectedSignals["create-window"] = 1; 207 } 208 onCreateWindowListeners ~= dlg; 209 } 210 extern(C) static void callBackCreateWindow(GtkNotebook* notebookStruct, GtkWidget* page, gint x, gint y, Notebook _notebook) 211 { 212 foreach ( GtkNotebook* delegate(Widget, gint, gint, Notebook) dlg ; _notebook.onCreateWindowListeners ) 213 { 214 dlg(ObjectG.getDObject!(Widget)(page), x, y, _notebook); 215 } 216 } 217 218 bool delegate(GtkNotebookTab, Notebook)[] onFocusTabListeners; 219 /** 220 */ 221 void addOnFocusTab(bool delegate(GtkNotebookTab, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 222 { 223 if ( !("focus-tab" in connectedSignals) ) 224 { 225 Signals.connectData( 226 getStruct(), 227 "focus-tab", 228 cast(GCallback)&callBackFocusTab, 229 cast(void*)this, 230 null, 231 connectFlags); 232 connectedSignals["focus-tab"] = 1; 233 } 234 onFocusTabListeners ~= dlg; 235 } 236 extern(C) static gboolean callBackFocusTab(GtkNotebook* notebookStruct, GtkNotebookTab arg1, Notebook _notebook) 237 { 238 foreach ( bool delegate(GtkNotebookTab, Notebook) dlg ; _notebook.onFocusTabListeners ) 239 { 240 if ( dlg(arg1, _notebook) ) 241 { 242 return 1; 243 } 244 } 245 246 return 0; 247 } 248 249 void delegate(GtkDirectionType, Notebook)[] onMoveFocusOutListeners; 250 /** 251 */ 252 void addOnMoveFocusOut(void delegate(GtkDirectionType, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 253 { 254 if ( !("move-focus-out" in connectedSignals) ) 255 { 256 Signals.connectData( 257 getStruct(), 258 "move-focus-out", 259 cast(GCallback)&callBackMoveFocusOut, 260 cast(void*)this, 261 null, 262 connectFlags); 263 connectedSignals["move-focus-out"] = 1; 264 } 265 onMoveFocusOutListeners ~= dlg; 266 } 267 extern(C) static void callBackMoveFocusOut(GtkNotebook* notebookStruct, GtkDirectionType arg1, Notebook _notebook) 268 { 269 foreach ( void delegate(GtkDirectionType, Notebook) dlg ; _notebook.onMoveFocusOutListeners ) 270 { 271 dlg(arg1, _notebook); 272 } 273 } 274 275 void delegate(Widget, guint, Notebook)[] onPageAddedListeners; 276 /** 277 * the ::page-added signal is emitted in the notebook 278 * right after a page is added to the notebook. 279 * Since 2.10 280 */ 281 void addOnPageAdded(void delegate(Widget, guint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 282 { 283 if ( !("page-added" in connectedSignals) ) 284 { 285 Signals.connectData( 286 getStruct(), 287 "page-added", 288 cast(GCallback)&callBackPageAdded, 289 cast(void*)this, 290 null, 291 connectFlags); 292 connectedSignals["page-added"] = 1; 293 } 294 onPageAddedListeners ~= dlg; 295 } 296 extern(C) static void callBackPageAdded(GtkNotebook* notebookStruct, GtkWidget* child, guint pageNum, Notebook _notebook) 297 { 298 foreach ( void delegate(Widget, guint, Notebook) dlg ; _notebook.onPageAddedListeners ) 299 { 300 dlg(ObjectG.getDObject!(Widget)(child), pageNum, _notebook); 301 } 302 } 303 304 void delegate(Widget, guint, Notebook)[] onPageRemovedListeners; 305 /** 306 * the ::page-removed signal is emitted in the notebook 307 * right after a page is removed from the notebook. 308 * Since 2.10 309 */ 310 void addOnPageRemoved(void delegate(Widget, guint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 311 { 312 if ( !("page-removed" in connectedSignals) ) 313 { 314 Signals.connectData( 315 getStruct(), 316 "page-removed", 317 cast(GCallback)&callBackPageRemoved, 318 cast(void*)this, 319 null, 320 connectFlags); 321 connectedSignals["page-removed"] = 1; 322 } 323 onPageRemovedListeners ~= dlg; 324 } 325 extern(C) static void callBackPageRemoved(GtkNotebook* notebookStruct, GtkWidget* child, guint pageNum, Notebook _notebook) 326 { 327 foreach ( void delegate(Widget, guint, Notebook) dlg ; _notebook.onPageRemovedListeners ) 328 { 329 dlg(ObjectG.getDObject!(Widget)(child), pageNum, _notebook); 330 } 331 } 332 333 void delegate(Widget, guint, Notebook)[] onPageReorderedListeners; 334 /** 335 * the ::page-reordered signal is emitted in the notebook 336 * right after a page has been reordered. 337 * Since 2.10 338 */ 339 void addOnPageReordered(void delegate(Widget, guint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 340 { 341 if ( !("page-reordered" in connectedSignals) ) 342 { 343 Signals.connectData( 344 getStruct(), 345 "page-reordered", 346 cast(GCallback)&callBackPageReordered, 347 cast(void*)this, 348 null, 349 connectFlags); 350 connectedSignals["page-reordered"] = 1; 351 } 352 onPageReorderedListeners ~= dlg; 353 } 354 extern(C) static void callBackPageReordered(GtkNotebook* notebookStruct, GtkWidget* child, guint pageNum, Notebook _notebook) 355 { 356 foreach ( void delegate(Widget, guint, Notebook) dlg ; _notebook.onPageReorderedListeners ) 357 { 358 dlg(ObjectG.getDObject!(Widget)(child), pageNum, _notebook); 359 } 360 } 361 362 bool delegate(GtkDirectionType, gboolean, Notebook)[] onReorderTabListeners; 363 /** 364 */ 365 void addOnReorderTab(bool delegate(GtkDirectionType, gboolean, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 366 { 367 if ( !("reorder-tab" in connectedSignals) ) 368 { 369 Signals.connectData( 370 getStruct(), 371 "reorder-tab", 372 cast(GCallback)&callBackReorderTab, 373 cast(void*)this, 374 null, 375 connectFlags); 376 connectedSignals["reorder-tab"] = 1; 377 } 378 onReorderTabListeners ~= dlg; 379 } 380 extern(C) static gboolean callBackReorderTab(GtkNotebook* notebookStruct, GtkDirectionType arg1, gboolean arg2, Notebook _notebook) 381 { 382 foreach ( bool delegate(GtkDirectionType, gboolean, Notebook) dlg ; _notebook.onReorderTabListeners ) 383 { 384 if ( dlg(arg1, arg2, _notebook) ) 385 { 386 return 1; 387 } 388 } 389 390 return 0; 391 } 392 393 bool delegate(gboolean, Notebook)[] onSelectPageListeners; 394 /** 395 */ 396 void addOnSelectPage(bool delegate(gboolean, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 397 { 398 if ( !("select-page" in connectedSignals) ) 399 { 400 Signals.connectData( 401 getStruct(), 402 "select-page", 403 cast(GCallback)&callBackSelectPage, 404 cast(void*)this, 405 null, 406 connectFlags); 407 connectedSignals["select-page"] = 1; 408 } 409 onSelectPageListeners ~= dlg; 410 } 411 extern(C) static gboolean callBackSelectPage(GtkNotebook* notebookStruct, gboolean arg1, Notebook _notebook) 412 { 413 foreach ( bool delegate(gboolean, Notebook) dlg ; _notebook.onSelectPageListeners ) 414 { 415 if ( dlg(arg1, _notebook) ) 416 { 417 return 1; 418 } 419 } 420 421 return 0; 422 } 423 424 void delegate(Widget, guint, Notebook)[] onSwitchPageListeners; 425 /** 426 * Emitted when the user or a function changes the current page. 427 * See Also 428 * GtkContainer 429 */ 430 void addOnSwitchPage(void delegate(Widget, guint, Notebook) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 431 { 432 if ( !("switch-page" in connectedSignals) ) 433 { 434 Signals.connectData( 435 getStruct(), 436 "switch-page", 437 cast(GCallback)&callBackSwitchPage, 438 cast(void*)this, 439 null, 440 connectFlags); 441 connectedSignals["switch-page"] = 1; 442 } 443 onSwitchPageListeners ~= dlg; 444 } 445 extern(C) static void callBackSwitchPage(GtkNotebook* notebookStruct, GtkWidget* page, guint pageNum, Notebook _notebook) 446 { 447 foreach ( void delegate(Widget, guint, Notebook) dlg ; _notebook.onSwitchPageListeners ) 448 { 449 dlg(ObjectG.getDObject!(Widget)(page), pageNum, _notebook); 450 } 451 } 452 453 454 /** 455 * Creates a new GtkNotebook widget with no pages. 456 * Throws: ConstructionException GTK+ fails to create the object. 457 */ 458 public this () 459 { 460 // GtkWidget * gtk_notebook_new (void); 461 auto p = gtk_notebook_new(); 462 if(p is null) 463 { 464 throw new ConstructionException("null returned by gtk_notebook_new()"); 465 } 466 this(cast(GtkNotebook*) p); 467 } 468 469 /** 470 * Appends a page to notebook. 471 * Params: 472 * child = the GtkWidget to use as the contents of the page 473 * tabLabel = the GtkWidget to be used as the label 474 * for the page, or NULL to use the default label, 'page N'. [allow-none] 475 * Returns: the index (starting from 0) of the appended page in the notebook, or -1 if function fails 476 */ 477 public int appendPage(Widget child, Widget tabLabel) 478 { 479 // gint gtk_notebook_append_page (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label); 480 return gtk_notebook_append_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct()); 481 } 482 483 /** 484 * Appends a page to notebook, specifying the widget to use as the 485 * label in the popup menu. 486 * Params: 487 * child = the GtkWidget to use as the contents of the page 488 * tabLabel = the GtkWidget to be used as the label 489 * for the page, or NULL to use the default label, 'page N'. [allow-none] 490 * menuLabel = the widget to use as a label for the 491 * page-switch menu, if that is enabled. If NULL, and tab_label 492 * is a GtkLabel or NULL, then the menu label will be a newly 493 * created label with the same text as tab_label; if tab_label 494 * is not a GtkLabel, menu_label must be specified if the 495 * page-switch menu is to be used. [allow-none] 496 * Returns: the index (starting from 0) of the appended page in the notebook, or -1 if function fails 497 */ 498 public int appendPageMenu(Widget child, Widget tabLabel, Widget menuLabel) 499 { 500 // gint gtk_notebook_append_page_menu (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, GtkWidget *menu_label); 501 return gtk_notebook_append_page_menu(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct()); 502 } 503 504 /** 505 * Prepends a page to notebook. 506 * Params: 507 * child = the GtkWidget to use as the contents of the page 508 * tabLabel = the GtkWidget to be used as the label 509 * for the page, or NULL to use the default label, 'page N'. [allow-none] 510 * Returns: the index (starting from 0) of the prepended page in the notebook, or -1 if function fails 511 */ 512 public int prependPage(Widget child, Widget tabLabel) 513 { 514 // gint gtk_notebook_prepend_page (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label); 515 return gtk_notebook_prepend_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct()); 516 } 517 518 /** 519 * Prepends a page to notebook, specifying the widget to use as the 520 * label in the popup menu. 521 * Params: 522 * child = the GtkWidget to use as the contents of the page 523 * tabLabel = the GtkWidget to be used as the label 524 * for the page, or NULL to use the default label, 'page N'. [allow-none] 525 * menuLabel = the widget to use as a label for the 526 * page-switch menu, if that is enabled. If NULL, and tab_label 527 * is a GtkLabel or NULL, then the menu label will be a newly 528 * created label with the same text as tab_label; if tab_label 529 * is not a GtkLabel, menu_label must be specified if the 530 * page-switch menu is to be used. [allow-none] 531 * Returns: the index (starting from 0) of the prepended page in the notebook, or -1 if function fails 532 */ 533 public int prependPageMenu(Widget child, Widget tabLabel, Widget menuLabel) 534 { 535 // gint gtk_notebook_prepend_page_menu (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, GtkWidget *menu_label); 536 return gtk_notebook_prepend_page_menu(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct()); 537 } 538 539 /** 540 * Insert a page into notebook at the given position. 541 * Params: 542 * child = the GtkWidget to use as the contents of the page 543 * tabLabel = the GtkWidget to be used as the label 544 * for the page, or NULL to use the default label, 'page N'. [allow-none] 545 * position = the index (starting at 0) at which to insert the page, 546 * or -1 to append the page after all other pages 547 * Returns: the index (starting from 0) of the inserted page in the notebook, or -1 if function fails 548 */ 549 public int insertPage(Widget child, Widget tabLabel, int position) 550 { 551 // gint gtk_notebook_insert_page (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, gint position); 552 return gtk_notebook_insert_page(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), position); 553 } 554 555 /** 556 * Insert a page into notebook at the given position, specifying 557 * the widget to use as the label in the popup menu. 558 * Params: 559 * child = the GtkWidget to use as the contents of the page 560 * tabLabel = the GtkWidget to be used as the label 561 * for the page, or NULL to use the default label, 'page N'. [allow-none] 562 * menuLabel = the widget to use as a label for the 563 * page-switch menu, if that is enabled. If NULL, and tab_label 564 * is a GtkLabel or NULL, then the menu label will be a newly 565 * created label with the same text as tab_label; if tab_label 566 * is not a GtkLabel, menu_label must be specified if the 567 * page-switch menu is to be used. [allow-none] 568 * position = the index (starting at 0) at which to insert the page, 569 * or -1 to append the page after all other pages. 570 * Returns: the index (starting from 0) of the inserted page in the notebook 571 */ 572 public int insertPageMenu(Widget child, Widget tabLabel, Widget menuLabel, int position) 573 { 574 // gint gtk_notebook_insert_page_menu (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label, GtkWidget *menu_label, gint position); 575 return gtk_notebook_insert_page_menu(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct(), position); 576 } 577 578 /** 579 * Removes a page from the notebook given its index 580 * in the notebook. 581 * Params: 582 * pageNum = the index of a notebook page, starting 583 * from 0. If -1, the last page will be removed. 584 */ 585 public void removePage(int pageNum) 586 { 587 // void gtk_notebook_remove_page (GtkNotebook *notebook, gint page_num); 588 gtk_notebook_remove_page(gtkNotebook, pageNum); 589 } 590 591 /** 592 * Finds the index of the page which contains the given child 593 * widget. 594 * Params: 595 * child = a GtkWidget 596 * Returns: the index of the page containing child, or -1 if child is not in the notebook 597 */ 598 public int pageNum(Widget child) 599 { 600 // gint gtk_notebook_page_num (GtkNotebook *notebook, GtkWidget *child); 601 return gtk_notebook_page_num(gtkNotebook, (child is null) ? null : child.getWidgetStruct()); 602 } 603 604 /** 605 * Switches to the next page. Nothing happens if the current page is 606 * the last page. 607 */ 608 public void nextPage() 609 { 610 // void gtk_notebook_next_page (GtkNotebook *notebook); 611 gtk_notebook_next_page(gtkNotebook); 612 } 613 614 /** 615 * Switches to the previous page. Nothing happens if the current page 616 * is the first page. 617 */ 618 public void prevPage() 619 { 620 // void gtk_notebook_prev_page (GtkNotebook *notebook); 621 gtk_notebook_prev_page(gtkNotebook); 622 } 623 624 /** 625 * Reorders the page containing child, so that it appears in position 626 * position. If position is greater than or equal to the number of 627 * children in the list or negative, child will be moved to the end 628 * of the list. 629 * Params: 630 * child = the child to move 631 * position = the new position, or -1 to move to the end 632 */ 633 public void reorderChild(Widget child, int position) 634 { 635 // void gtk_notebook_reorder_child (GtkNotebook *notebook, GtkWidget *child, gint position); 636 gtk_notebook_reorder_child(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), position); 637 } 638 639 /** 640 * Sets the edge at which the tabs for switching pages in the 641 * notebook are drawn. 642 * Params: 643 * pos = the edge to draw the tabs at 644 */ 645 public void setTabPos(GtkPositionType pos) 646 { 647 // void gtk_notebook_set_tab_pos (GtkNotebook *notebook, GtkPositionType pos); 648 gtk_notebook_set_tab_pos(gtkNotebook, pos); 649 } 650 651 /** 652 * Sets whether to show the tabs for the notebook or not. 653 * Params: 654 * showTabs = TRUE if the tabs should be shown 655 */ 656 public void setShowTabs(int showTabs) 657 { 658 // void gtk_notebook_set_show_tabs (GtkNotebook *notebook, gboolean show_tabs); 659 gtk_notebook_set_show_tabs(gtkNotebook, showTabs); 660 } 661 662 /** 663 * Sets whether a bevel will be drawn around the notebook pages. 664 * This only has a visual effect when the tabs are not shown. 665 * See gtk_notebook_set_show_tabs(). 666 * Params: 667 * showBorder = TRUE if a bevel should be drawn around the notebook 668 */ 669 public void setShowBorder(int showBorder) 670 { 671 // void gtk_notebook_set_show_border (GtkNotebook *notebook, gboolean show_border); 672 gtk_notebook_set_show_border(gtkNotebook, showBorder); 673 } 674 675 /** 676 * Sets whether the tab label area will have arrows for 677 * scrolling if there are too many tabs to fit in the area. 678 * Params: 679 * scrollable = TRUE if scroll arrows should be added 680 */ 681 public void setScrollable(int scrollable) 682 { 683 // void gtk_notebook_set_scrollable (GtkNotebook *notebook, gboolean scrollable); 684 gtk_notebook_set_scrollable(gtkNotebook, scrollable); 685 } 686 687 /** 688 * Enables the popup menu: if the user clicks with the right 689 * mouse button on the tab labels, a menu with all the pages 690 * will be popped up. 691 */ 692 public void popupEnable() 693 { 694 // void gtk_notebook_popup_enable (GtkNotebook *notebook); 695 gtk_notebook_popup_enable(gtkNotebook); 696 } 697 698 /** 699 * Disables the popup menu. 700 */ 701 public void popupDisable() 702 { 703 // void gtk_notebook_popup_disable (GtkNotebook *notebook); 704 gtk_notebook_popup_disable(gtkNotebook); 705 } 706 707 /** 708 * Returns the page number of the current page. 709 * Returns: the index (starting from 0) of the current page in the notebook. If the notebook has no pages, then -1 will be returned. 710 */ 711 public int getCurrentPage() 712 { 713 // gint gtk_notebook_get_current_page (GtkNotebook *notebook); 714 return gtk_notebook_get_current_page(gtkNotebook); 715 } 716 717 /** 718 * Retrieves the menu label widget of the page containing child. 719 * Params: 720 * child = a widget contained in a page of notebook 721 * Returns: the menu label, or NULL if the notebook page does not have a menu label other than the default (the tab label). [transfer none] 722 */ 723 public Widget getMenuLabel(Widget child) 724 { 725 // GtkWidget * gtk_notebook_get_menu_label (GtkNotebook *notebook, GtkWidget *child); 726 auto p = gtk_notebook_get_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct()); 727 728 if(p is null) 729 { 730 return null; 731 } 732 733 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 734 } 735 736 /** 737 * Returns the child widget contained in page number page_num. 738 * Params: 739 * pageNum = the index of a page in the notebook, or -1 740 * to get the last page 741 * Returns: the child widget, or NULL if page_num is out of bounds. [transfer none] 742 */ 743 public Widget getNthPage(int pageNum) 744 { 745 // GtkWidget * gtk_notebook_get_nth_page (GtkNotebook *notebook, gint page_num); 746 auto p = gtk_notebook_get_nth_page(gtkNotebook, pageNum); 747 748 if(p is null) 749 { 750 return null; 751 } 752 753 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 754 } 755 756 /** 757 * Gets the number of pages in a notebook. 758 * Since 2.2 759 * Returns: the number of pages in the notebook 760 */ 761 public int getNPages() 762 { 763 // gint gtk_notebook_get_n_pages (GtkNotebook *notebook); 764 return gtk_notebook_get_n_pages(gtkNotebook); 765 } 766 767 /** 768 * Returns the tab label widget for the page child. 769 * NULL is returned if child is not in notebook or 770 * if no tab label has specifically been set for child. 771 * Params: 772 * child = the page 773 * Returns: the tab label. [transfer none] 774 */ 775 public Widget getTabLabel(Widget child) 776 { 777 // GtkWidget * gtk_notebook_get_tab_label (GtkNotebook *notebook, GtkWidget *child); 778 auto p = gtk_notebook_get_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct()); 779 780 if(p is null) 781 { 782 return null; 783 } 784 785 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 786 } 787 788 /** 789 * Changes the menu label for the page containing child. 790 * Params: 791 * child = the child widget 792 * menuLabel = the menu label, or NULL for default. [allow-none] 793 */ 794 public void setMenuLabel(Widget child, Widget menuLabel) 795 { 796 // void gtk_notebook_set_menu_label (GtkNotebook *notebook, GtkWidget *child, GtkWidget *menu_label); 797 gtk_notebook_set_menu_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (menuLabel is null) ? null : menuLabel.getWidgetStruct()); 798 } 799 800 /** 801 * Creates a new label and sets it as the menu label of child. 802 * Params: 803 * child = the child widget 804 * menuText = the label text 805 */ 806 public void setMenuLabelText(Widget child, string menuText) 807 { 808 // void gtk_notebook_set_menu_label_text (GtkNotebook *notebook, GtkWidget *child, const gchar *menu_text); 809 gtk_notebook_set_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(menuText)); 810 } 811 812 /** 813 * Changes the tab label for child. 814 * If NULL is specified for tab_label, then the page will 815 * have the label 'page N'. 816 * Params: 817 * child = the page 818 * tabLabel = the tab label widget to use, or NULL 819 * for default tab label. [allow-none] 820 */ 821 public void setTabLabel(Widget child, Widget tabLabel) 822 { 823 // void gtk_notebook_set_tab_label (GtkNotebook *notebook, GtkWidget *child, GtkWidget *tab_label); 824 gtk_notebook_set_tab_label(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), (tabLabel is null) ? null : tabLabel.getWidgetStruct()); 825 } 826 827 /** 828 * Creates a new label and sets it as the tab label for the page 829 * containing child. 830 * Params: 831 * child = the page 832 * tabText = the label text 833 */ 834 public void setTabLabelText(Widget child, string tabText) 835 { 836 // void gtk_notebook_set_tab_label_text (GtkNotebook *notebook, GtkWidget *child, const gchar *tab_text); 837 gtk_notebook_set_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(tabText)); 838 } 839 840 /** 841 * Sets whether the notebook tab can be reordered 842 * via drag and drop or not. 843 * Since 2.10 844 * Params: 845 * child = a child GtkWidget 846 * reorderable = whether the tab is reorderable or not 847 */ 848 public void setTabReorderable(Widget child, int reorderable) 849 { 850 // void gtk_notebook_set_tab_reorderable (GtkNotebook *notebook, GtkWidget *child, gboolean reorderable); 851 gtk_notebook_set_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), reorderable); 852 } 853 854 /** 855 * Sets whether the tab can be detached from notebook to another 856 * notebook or widget. 857 * Note that 2 notebooks must share a common group identificator 858 * (see gtk_notebook_set_group_name()) to allow automatic tabs 859 * interchange between them. 860 * If you want a widget to interact with a notebook through DnD 861 * (i.e.: accept dragged tabs from it) it must be set as a drop 862 * destination and accept the target "GTK_NOTEBOOK_TAB". The notebook 863 * will fill the selection with a GtkWidget** pointing to the child 864 * widget that corresponds to the dropped tab. 865 * $(DDOC_COMMENT example) 866 * If you want a notebook to accept drags from other widgets, 867 * you will have to set your own DnD code to do it. 868 * Since 2.10 869 * Params: 870 * child = a child GtkWidget 871 * detachable = whether the tab is detachable or not 872 */ 873 public void setTabDetachable(Widget child, int detachable) 874 { 875 // void gtk_notebook_set_tab_detachable (GtkNotebook *notebook, GtkWidget *child, gboolean detachable); 876 gtk_notebook_set_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct(), detachable); 877 } 878 879 /** 880 * Retrieves the text of the menu label for the page containing 881 * child. 882 * Params: 883 * child = the child widget of a page of the notebook. 884 * Returns: the text of the tab label, or NULL if the widget does not have a menu label other than the default menu label, or the menu label widget is not a GtkLabel. The string is owned by the widget and must not be freed. 885 */ 886 public string getMenuLabelText(Widget child) 887 { 888 // const gchar * gtk_notebook_get_menu_label_text (GtkNotebook *notebook, GtkWidget *child); 889 return Str.toString(gtk_notebook_get_menu_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct())); 890 } 891 892 /** 893 * Returns whether the tab label area has arrows for scrolling. 894 * See gtk_notebook_set_scrollable(). 895 * Returns: TRUE if arrows for scrolling are present 896 */ 897 public int getScrollable() 898 { 899 // gboolean gtk_notebook_get_scrollable (GtkNotebook *notebook); 900 return gtk_notebook_get_scrollable(gtkNotebook); 901 } 902 903 /** 904 * Returns whether a bevel will be drawn around the notebook pages. 905 * See gtk_notebook_set_show_border(). 906 * Returns: TRUE if the bevel is drawn 907 */ 908 public int getShowBorder() 909 { 910 // gboolean gtk_notebook_get_show_border (GtkNotebook *notebook); 911 return gtk_notebook_get_show_border(gtkNotebook); 912 } 913 914 /** 915 * Returns whether the tabs of the notebook are shown. 916 * See gtk_notebook_set_show_tabs(). 917 * Returns: TRUE if the tabs are shown 918 */ 919 public int getShowTabs() 920 { 921 // gboolean gtk_notebook_get_show_tabs (GtkNotebook *notebook); 922 return gtk_notebook_get_show_tabs(gtkNotebook); 923 } 924 925 /** 926 * Retrieves the text of the tab label for the page containing 927 * child. 928 * Params: 929 * child = a widget contained in a page of notebook 930 * Returns: the text of the tab label, or NULL if the tab label widget is not a GtkLabel. The string is owned by the widget and must not be freed. 931 */ 932 public string getTabLabelText(Widget child) 933 { 934 // const gchar * gtk_notebook_get_tab_label_text (GtkNotebook *notebook, GtkWidget *child); 935 return Str.toString(gtk_notebook_get_tab_label_text(gtkNotebook, (child is null) ? null : child.getWidgetStruct())); 936 } 937 938 /** 939 * Gets the edge at which the tabs for switching pages in the 940 * notebook are drawn. 941 * Returns: the edge at which the tabs are drawn 942 */ 943 public GtkPositionType getTabPos() 944 { 945 // GtkPositionType gtk_notebook_get_tab_pos (GtkNotebook *notebook); 946 return gtk_notebook_get_tab_pos(gtkNotebook); 947 } 948 949 /** 950 * Gets whether the tab can be reordered via drag and drop or not. 951 * Since 2.10 952 * Params: 953 * child = a child GtkWidget 954 * Returns: TRUE if the tab is reorderable. 955 */ 956 public int getTabReorderable(Widget child) 957 { 958 // gboolean gtk_notebook_get_tab_reorderable (GtkNotebook *notebook, GtkWidget *child); 959 return gtk_notebook_get_tab_reorderable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()); 960 } 961 962 /** 963 * Returns whether the tab contents can be detached from notebook. 964 * Since 2.10 965 * Params: 966 * child = a child GtkWidget 967 * Returns: TRUE if the tab is detachable. 968 */ 969 public int getTabDetachable(Widget child) 970 { 971 // gboolean gtk_notebook_get_tab_detachable (GtkNotebook *notebook, GtkWidget *child); 972 return gtk_notebook_get_tab_detachable(gtkNotebook, (child is null) ? null : child.getWidgetStruct()); 973 } 974 975 /** 976 * Warning 977 * gtk_notebook_get_tab_hborder has been deprecated since version 3.4 and should not be used in newly-written code. this function returns zero 978 * Returns the horizontal width of a tab border. 979 * Since 2.22 980 * Returns: horizontal width of a tab border 981 */ 982 public ushort getTabHborder() 983 { 984 // guint16 gtk_notebook_get_tab_hborder (GtkNotebook *notebook); 985 return gtk_notebook_get_tab_hborder(gtkNotebook); 986 } 987 988 /** 989 * Warning 990 * gtk_notebook_get_tab_vborder has been deprecated since version 3.4 and should not be used in newly-written code. this function returns zero 991 * Returns the vertical width of a tab border. 992 * Since 2.22 993 * Returns: vertical width of a tab border 994 */ 995 public ushort getTabVborder() 996 { 997 // guint16 gtk_notebook_get_tab_vborder (GtkNotebook *notebook); 998 return gtk_notebook_get_tab_vborder(gtkNotebook); 999 } 1000 1001 /** 1002 * Switches to the page number page_num. 1003 * Note that due to historical reasons, GtkNotebook refuses 1004 * to switch to a page unless the child widget is visible. 1005 * Therefore, it is recommended to show child widgets before 1006 * adding them to a notebook. 1007 * Params: 1008 * pageNum = index of the page to switch to, starting from 0. 1009 * If negative, the last page will be used. If greater 1010 * than the number of pages in the notebook, nothing 1011 * will be done. 1012 */ 1013 public void setCurrentPage(int pageNum) 1014 { 1015 // void gtk_notebook_set_current_page (GtkNotebook *notebook, gint page_num); 1016 gtk_notebook_set_current_page(gtkNotebook, pageNum); 1017 } 1018 1019 /** 1020 * Sets a group name for notebook. 1021 * Notebooks with the same name will be able to exchange tabs 1022 * via drag and drop. A notebook with a NULL group name will 1023 * not be able to exchange tabs with any other notebook. 1024 * Since 2.24 1025 * Params: 1026 * groupName = the name of the notebook group, 1027 * or NULL to unset it. [allow-none] 1028 */ 1029 public void setGroupName(string groupName) 1030 { 1031 // void gtk_notebook_set_group_name (GtkNotebook *notebook, const gchar *group_name); 1032 gtk_notebook_set_group_name(gtkNotebook, Str.toStringz(groupName)); 1033 } 1034 1035 /** 1036 * Gets the current group name for notebook. 1037 * Since 2.24 1038 * Returns: the group name, or NULL if none is set. [transfer none] 1039 */ 1040 public string getGroupName() 1041 { 1042 // const gchar * gtk_notebook_get_group_name (GtkNotebook *notebook); 1043 return Str.toString(gtk_notebook_get_group_name(gtkNotebook)); 1044 } 1045 1046 /** 1047 * Sets widget as one of the action widgets. Depending on the pack type 1048 * the widget will be placed before or after the tabs. You can use 1049 * a GtkBox if you need to pack more than one widget on the same side. 1050 * Note that action widgets are "internal" children of the notebook and thus 1051 * not included in the list returned from gtk_container_foreach(). 1052 * Since 2.20 1053 * Params: 1054 * widget = a GtkWidget 1055 * packType = pack type of the action widget 1056 */ 1057 public void setActionWidget(Widget widget, GtkPackType packType) 1058 { 1059 // void gtk_notebook_set_action_widget (GtkNotebook *notebook, GtkWidget *widget, GtkPackType pack_type); 1060 gtk_notebook_set_action_widget(gtkNotebook, (widget is null) ? null : widget.getWidgetStruct(), packType); 1061 } 1062 1063 /** 1064 * Gets one of the action widgets. See gtk_notebook_set_action_widget(). 1065 * Since 2.20 1066 * Params: 1067 * packType = pack type of the action widget to receive 1068 * Returns: The action widget with the given pack_type or NULL when this action widget has not been set. [transfer none] 1069 */ 1070 public Widget getActionWidget(GtkPackType packType) 1071 { 1072 // GtkWidget * gtk_notebook_get_action_widget (GtkNotebook *notebook, GtkPackType pack_type); 1073 auto p = gtk_notebook_get_action_widget(gtkNotebook, packType); 1074 1075 if(p is null) 1076 { 1077 return null; 1078 } 1079 1080 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 1081 } 1082 }