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