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 = GtkToolbar.html 27 * outPack = gtk 28 * outFile = Toolbar 29 * strct = GtkToolbar 30 * realStrct= 31 * ctorStrct= 32 * clss = Toolbar 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - OrientableIF 40 * - ToolShellIF 41 * prefixes: 42 * - gtk_toolbar_ 43 * - gtk_ 44 * omit structs: 45 * omit prefixes: 46 * omit code: 47 * - gtk_toolbar_set_orientation 48 * - gtk_toolbar_get_orientation 49 * - gtk_toolbar_get_icon_size 50 * - gtk_toolbar_get_relief_style 51 * - gtk_toolbar_insert 52 * omit signals: 53 * imports: 54 * - glib.Str 55 * - gtk.Widget 56 * - gtk.Button 57 * - gtk.ToolItem 58 * - gtk.OrientableIF 59 * - gtk.OrientableT 60 * - gtk.ToolShellIF 61 * - gtk.ToolShellT 62 * structWrap: 63 * - GtkToolItem* -> ToolItem 64 * - GtkWidget* -> Widget 65 * module aliases: 66 * local aliases: 67 * - getStyle -> toolbarGetStyle 68 * overrides: 69 */ 70 71 module gtk.Toolbar; 72 73 public import gtkc.gtktypes; 74 75 private import gtkc.gtk; 76 private import glib.ConstructionException; 77 private import gobject.ObjectG; 78 79 private import gobject.Signals; 80 public import gtkc.gdktypes; 81 82 private import glib.Str; 83 private import gtk.Widget; 84 private import gtk.Button; 85 private import gtk.ToolItem; 86 private import gtk.OrientableIF; 87 private import gtk.OrientableT; 88 private import gtk.ToolShellIF; 89 private import gtk.ToolShellT; 90 91 92 93 private import gtk.Container; 94 95 /** 96 * Description 97 * A toolbar is created with a call to gtk_toolbar_new(). 98 * A toolbar can contain instances of a subclass of GtkToolItem. To add 99 * a GtkToolItem to the a toolbar, use gtk_toolbar_insert(). To remove 100 * an item from the toolbar use gtk_container_remove(). To add a button 101 * to the toolbar, add an instance of GtkToolButton. 102 * Toolbar items can be visually grouped by adding instances of 103 * GtkSeparatorToolItem to the toolbar. If a GtkSeparatorToolItem has 104 * the "expand" property set to TRUE and the "draw" property set to 105 * FALSE the effect is to force all following items to the end of the 106 * toolbar. 107 * Creating a context menu for the toolbar can be done by connecting to 108 * the "popup-context-menu" signal. 109 */ 110 public class Toolbar : Container, OrientableIF, ToolShellIF 111 { 112 113 /** the main Gtk struct */ 114 protected GtkToolbar* gtkToolbar; 115 116 117 public GtkToolbar* getToolbarStruct() 118 { 119 return gtkToolbar; 120 } 121 122 123 /** the main Gtk struct as a void* */ 124 protected override void* getStruct() 125 { 126 return cast(void*)gtkToolbar; 127 } 128 129 /** 130 * Sets our main struct and passes it to the parent class 131 */ 132 public this (GtkToolbar* gtkToolbar) 133 { 134 super(cast(GtkContainer*)gtkToolbar); 135 this.gtkToolbar = gtkToolbar; 136 } 137 138 protected override void setStruct(GObject* obj) 139 { 140 super.setStruct(obj); 141 gtkToolbar = cast(GtkToolbar*)obj; 142 } 143 144 // add the Orientable capabilities 145 mixin OrientableT!(GtkToolbar); 146 147 // add the ToolShell capabilities 148 mixin ToolShellT!(GtkToolbar); 149 150 /** 151 * Insert a GtkToolItem into the toolbar at position pos. 152 * If pos is 0 the item is prepended to the start of the toolbar. If pos is negative, the item is appended to the end of the toolbar. 153 * Since 2.4 154 * Params: 155 * toolItem = a GtkToolItem 156 * pos = the position of the new item 157 */ 158 public void insert (ToolItem toolItem, int pos=-1) 159 { 160 gtk_toolbar_insert(gtkToolbar, toolItem.getToolItemStruct(), pos); 161 } 162 163 /** */ 164 public Widget insertStock(StockID stockId, string tooltipText, string tooltipPrivateText, GCallback callback, void* userData, int position) 165 { 166 return insertStock(getId(stockId), tooltipText, tooltipPrivateText, callback, userData, position); 167 } 168 169 /** */ 170 public Widget insertStock(string stockId, string tooltipText, string tooltipPrivateText, int position) 171 { 172 return insertStock(stockId, tooltipText, tooltipPrivateText, null, null, position); 173 } 174 175 /** */ 176 public Widget insertStock(StockID stockId, string tooltipText, string tooltipPrivateText, int position) 177 { 178 return insertStock(getId(stockId), tooltipText, tooltipPrivateText, null, null, position); 179 } 180 181 /** */ 182 Button insertButton(StockID stockID, 183 string tooltipText, string tooltipPrivateText, 184 gint position) 185 { 186 Button button = new Button( 187 cast(GtkButton*)gtk_toolbar_insert_stock( 188 gtkToolbar, 189 Str.toStringz(StockDesc[stockID]), 190 Str.toStringz(tooltipText), 191 Str.toStringz(tooltipPrivateText), 192 null, null, 193 position) 194 ); 195 return button; 196 } 197 198 /** 199 */ 200 int[string] connectedSignals; 201 202 bool delegate(gboolean, Toolbar)[] onFocusHomeOrEndListeners; 203 /** 204 * A keybinding signal used internally by GTK+. This signal can't 205 * be used in application code 206 * TRUE if the first item should be focused 207 * TRUE if the signal was handled, FALSE if not 208 */ 209 void addOnFocusHomeOrEnd(bool delegate(gboolean, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 210 { 211 if ( !("focus-home-or-end" in connectedSignals) ) 212 { 213 Signals.connectData( 214 getStruct(), 215 "focus-home-or-end", 216 cast(GCallback)&callBackFocusHomeOrEnd, 217 cast(void*)this, 218 null, 219 connectFlags); 220 connectedSignals["focus-home-or-end"] = 1; 221 } 222 onFocusHomeOrEndListeners ~= dlg; 223 } 224 extern(C) static gboolean callBackFocusHomeOrEnd(GtkToolbar* toolbarStruct, gboolean focusHome, Toolbar _toolbar) 225 { 226 foreach ( bool delegate(gboolean, Toolbar) dlg ; _toolbar.onFocusHomeOrEndListeners ) 227 { 228 if ( dlg(focusHome, _toolbar) ) 229 { 230 return 1; 231 } 232 } 233 234 return 0; 235 } 236 237 void delegate(GtkOrientation, Toolbar)[] onOrientationChangedListeners; 238 /** 239 * Emitted when the orientation of the toolbar changes. 240 */ 241 void addOnOrientationChanged(void delegate(GtkOrientation, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 242 { 243 if ( !("orientation-changed" in connectedSignals) ) 244 { 245 Signals.connectData( 246 getStruct(), 247 "orientation-changed", 248 cast(GCallback)&callBackOrientationChanged, 249 cast(void*)this, 250 null, 251 connectFlags); 252 connectedSignals["orientation-changed"] = 1; 253 } 254 onOrientationChangedListeners ~= dlg; 255 } 256 extern(C) static void callBackOrientationChanged(GtkToolbar* toolbarStruct, GtkOrientation orientation, Toolbar _toolbar) 257 { 258 foreach ( void delegate(GtkOrientation, Toolbar) dlg ; _toolbar.onOrientationChangedListeners ) 259 { 260 dlg(orientation, _toolbar); 261 } 262 } 263 264 bool delegate(gint, gint, gint, Toolbar)[] onPopupContextMenuListeners; 265 /** 266 * Emitted when the user right-clicks the toolbar or uses the 267 * keybinding to display a popup menu. 268 * Application developers should handle this signal if they want 269 * to display a context menu on the toolbar. The context-menu should 270 * appear at the coordinates given by x and y. The mouse button 271 * number is given by the button parameter. If the menu was popped 272 * up using the keybaord, button is -1. 273 */ 274 void addOnPopupContextMenu(bool delegate(gint, gint, gint, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 275 { 276 if ( !("popup-context-menu" in connectedSignals) ) 277 { 278 Signals.connectData( 279 getStruct(), 280 "popup-context-menu", 281 cast(GCallback)&callBackPopupContextMenu, 282 cast(void*)this, 283 null, 284 connectFlags); 285 connectedSignals["popup-context-menu"] = 1; 286 } 287 onPopupContextMenuListeners ~= dlg; 288 } 289 extern(C) static gboolean callBackPopupContextMenu(GtkToolbar* toolbarStruct, gint x, gint y, gint button, Toolbar _toolbar) 290 { 291 foreach ( bool delegate(gint, gint, gint, Toolbar) dlg ; _toolbar.onPopupContextMenuListeners ) 292 { 293 if ( dlg(x, y, button, _toolbar) ) 294 { 295 return 1; 296 } 297 } 298 299 return 0; 300 } 301 302 void delegate(GtkToolbarStyle, Toolbar)[] onStyleChangedListeners; 303 /** 304 * Emitted when the style of the toolbar changes. 305 * See Also 306 * GtkToolItem 307 * Base class of widgets that can be added to a toolbar. 308 */ 309 void addOnStyleChanged(void delegate(GtkToolbarStyle, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 310 { 311 if ( !("style-changed" in connectedSignals) ) 312 { 313 Signals.connectData( 314 getStruct(), 315 "style-changed", 316 cast(GCallback)&callBackStyleChanged, 317 cast(void*)this, 318 null, 319 connectFlags); 320 connectedSignals["style-changed"] = 1; 321 } 322 onStyleChangedListeners ~= dlg; 323 } 324 extern(C) static void callBackStyleChanged(GtkToolbar* toolbarStruct, GtkToolbarStyle style, Toolbar _toolbar) 325 { 326 foreach ( void delegate(GtkToolbarStyle, Toolbar) dlg ; _toolbar.onStyleChangedListeners ) 327 { 328 dlg(style, _toolbar); 329 } 330 } 331 332 333 /** 334 * Creates a new toolbar. 335 * Throws: ConstructionException GTK+ fails to create the object. 336 */ 337 public this () 338 { 339 // GtkWidget * gtk_toolbar_new (void); 340 auto p = gtk_toolbar_new(); 341 if(p is null) 342 { 343 throw new ConstructionException("null returned by gtk_toolbar_new()"); 344 } 345 this(cast(GtkToolbar*) p); 346 } 347 348 /** 349 * Returns the position of item on the toolbar, starting from 0. 350 * It is an error if item is not a child of the toolbar. 351 * Since 2.4 352 * Params: 353 * item = a GtkToolItem that is a child of toolbar 354 * Returns: the position of item on the toolbar. 355 */ 356 public int getItemIndex(ToolItem item) 357 { 358 // gint gtk_toolbar_get_item_index (GtkToolbar *toolbar, GtkToolItem *item); 359 return gtk_toolbar_get_item_index(gtkToolbar, (item is null) ? null : item.getToolItemStruct()); 360 } 361 362 /** 363 * Returns the number of items on the toolbar. 364 * Since 2.4 365 * Returns: the number of items on the toolbar 366 */ 367 public int getNItems() 368 { 369 // gint gtk_toolbar_get_n_items (GtkToolbar *toolbar); 370 return gtk_toolbar_get_n_items(gtkToolbar); 371 } 372 373 /** 374 * Returns the n'th item on toolbar, or NULL if the 375 * toolbar does not contain an n'th item. 376 * Since 2.4 377 * Params: 378 * n = A position on the toolbar 379 * Returns: The n'th GtkToolItem on toolbar, or NULL if there isn't an n'th item. [transfer none] 380 */ 381 public ToolItem getNthItem(int n) 382 { 383 // GtkToolItem * gtk_toolbar_get_nth_item (GtkToolbar *toolbar, gint n); 384 auto p = gtk_toolbar_get_nth_item(gtkToolbar, n); 385 386 if(p is null) 387 { 388 return null; 389 } 390 391 return ObjectG.getDObject!(ToolItem)(cast(GtkToolItem*) p); 392 } 393 394 /** 395 * Returns the position corresponding to the indicated point on 396 * Since 2.4 397 * Params: 398 * x = x coordinate of a point on the toolbar 399 * y = y coordinate of a point on the toolbar 400 * Returns: The position corresponding to the point (x, y) on the toolbar. 401 */ 402 public int getDropIndex(int x, int y) 403 { 404 // gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar, gint x, gint y); 405 return gtk_toolbar_get_drop_index(gtkToolbar, x, y); 406 } 407 408 /** 409 * Highlights toolbar to give an idea of what it would look like 410 * if item was added to toolbar at the position indicated by index_. 411 * If item is NULL, highlighting is turned off. In that case index_ 412 * is ignored. 413 * The tool_item passed to this function must not be part of any widget 414 * hierarchy. When an item is set as drop highlight item it can not 415 * added to any widget hierarchy or used as highlight item for another 416 * toolbar. 417 * Since 2.4 418 * Params: 419 * toolItem = a GtkToolItem, or NULL to turn of highlighting. [allow-none] 420 * index = a position on toolbar 421 */ 422 public void setDropHighlightItem(ToolItem toolItem, int index) 423 { 424 // void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar, GtkToolItem *tool_item, gint index_); 425 gtk_toolbar_set_drop_highlight_item(gtkToolbar, (toolItem is null) ? null : toolItem.getToolItemStruct(), index); 426 } 427 428 /** 429 * Sets whether to show an overflow menu when 430 * toolbar doesn't have room for all items on it. If TRUE, 431 * items that there are not room are available through an 432 * overflow menu. 433 * Since 2.4 434 * Params: 435 * showArrow = Whether to show an overflow menu 436 */ 437 public void setShowArrow(int showArrow) 438 { 439 // void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar, gboolean show_arrow); 440 gtk_toolbar_set_show_arrow(gtkToolbar, showArrow); 441 } 442 443 /** 444 * Warning 445 * gtk_toolbar_set_tooltips has been deprecated since version 2.14 and should not be used in newly-written code. The toolkit-wide "gtk-enable-tooltips" property 446 * is now used instead. 447 * Sets if the tooltips of a toolbar should be active or not. 448 * Params: 449 * enable = set to FALSE to disable the tooltips, or TRUE to enable them. 450 */ 451 public void setTooltips(int enable) 452 { 453 // void gtk_toolbar_set_tooltips (GtkToolbar *toolbar, gboolean enable); 454 gtk_toolbar_set_tooltips(gtkToolbar, enable); 455 } 456 457 /** 458 * Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that 459 * user preferences will be used to determine the icon size. 460 */ 461 public void unsetIconSize() 462 { 463 // void gtk_toolbar_unset_icon_size (GtkToolbar *toolbar); 464 gtk_toolbar_unset_icon_size(gtkToolbar); 465 } 466 467 /** 468 * Returns whether the toolbar has an overflow menu. 469 * See gtk_toolbar_set_show_arrow(). 470 * Since 2.4 471 * Returns: TRUE if the toolbar has an overflow menu. 472 */ 473 public int getShowArrow() 474 { 475 // gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar); 476 return gtk_toolbar_get_show_arrow(gtkToolbar); 477 } 478 479 /** 480 * Retrieves whether the toolbar has text, icons, or both . See 481 * gtk_toolbar_set_style(). 482 * Params: 483 * toolbar = a GtkToolbar 484 * Returns: the current style of toolbar 485 */ 486 public GtkToolbarStyle toolbarGetStyle() 487 { 488 // GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar); 489 return gtk_toolbar_get_style(gtkToolbar); 490 } 491 492 /** 493 * Warning 494 * gtk_toolbar_get_tooltips has been deprecated since version 2.14 and should not be used in newly-written code. The toolkit-wide "gtk-enable-tooltips" property 495 * is now used instead. 496 * Retrieves whether tooltips are enabled. See 497 * gtk_toolbar_set_tooltips(). 498 * Returns: TRUE if tooltips are enabled 499 */ 500 public int getTooltips() 501 { 502 // gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar); 503 return gtk_toolbar_get_tooltips(gtkToolbar); 504 } 505 506 /** 507 * Warning 508 * gtk_toolbar_append_item has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 509 * Inserts a new item into the toolbar. You must specify the position 510 * in the toolbar where it will be inserted. 511 * callback must be a pointer to a function taking a GtkWidget and a gpointer as 512 * arguments. Use G_CALLBACK() to cast the function to GCallback. 513 * Params: 514 * text = give your toolbar button a label. 515 * tooltipText = a string that appears when the user holds the mouse over this item. 516 * tooltipPrivateText = use with GtkTipsQuery. 517 * icon = a GtkWidget that should be used as the button's icon. 518 * callback = the function to be executed when the button is pressed. 519 * userData = a pointer to any data you wish to be passed to the callback. 520 * Returns: the new toolbar item as a GtkWidget. 521 */ 522 public Widget appendItem(string text, string tooltipText, string tooltipPrivateText, Widget icon, GCallback callback, void* userData) 523 { 524 // GtkWidget * gtk_toolbar_append_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GCallback callback, gpointer user_data); 525 auto p = gtk_toolbar_append_item(gtkToolbar, Str.toStringz(text), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), (icon is null) ? null : icon.getWidgetStruct(), callback, userData); 526 527 if(p is null) 528 { 529 return null; 530 } 531 532 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 533 } 534 535 /** 536 * Warning 537 * gtk_toolbar_prepend_item has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 538 * Adds a new button to the beginning (top or left edges) of the given toolbar. 539 * callback must be a pointer to a function taking a GtkWidget and a gpointer as 540 * arguments. Use G_CALLBACK() to cast the function to GCallback. 541 * Params: 542 * text = give your toolbar button a label. 543 * tooltipText = a string that appears when the user holds the mouse over this item. 544 * tooltipPrivateText = use with GtkTipsQuery. 545 * icon = a GtkWidget that should be used as the button's icon. 546 * callback = the function to be executed when the button is pressed. 547 * userData = a pointer to any data you wish to be passed to the callback. 548 * Returns: the new toolbar item as a GtkWidget. 549 */ 550 public Widget prependItem(string text, string tooltipText, string tooltipPrivateText, Widget icon, GCallback callback, void* userData) 551 { 552 // GtkWidget * gtk_toolbar_prepend_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GCallback callback, gpointer user_data); 553 auto p = gtk_toolbar_prepend_item(gtkToolbar, Str.toStringz(text), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), (icon is null) ? null : icon.getWidgetStruct(), callback, userData); 554 555 if(p is null) 556 { 557 return null; 558 } 559 560 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 561 } 562 563 /** 564 * Warning 565 * gtk_toolbar_insert_item has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 566 * Inserts a new item into the toolbar. You must specify the position in the 567 * toolbar where it will be inserted. 568 * callback must be a pointer to a function taking a GtkWidget and a gpointer as 569 * arguments. Use G_CALLBACK() to cast the function to GCallback. 570 * Params: 571 * text = give your toolbar button a label. 572 * tooltipText = a string that appears when the user holds the mouse over this item. 573 * tooltipPrivateText = use with GtkTipsQuery. 574 * icon = a GtkWidget that should be used as the button's icon. 575 * callback = the function to be executed when the button is pressed. 576 * userData = a pointer to any data you wish to be passed to the callback. 577 * position = the number of widgets to insert this item after. 578 * Returns: the new toolbar item as a GtkWidget. 579 */ 580 public Widget insertItem(string text, string tooltipText, string tooltipPrivateText, Widget icon, GCallback callback, void* userData, int position) 581 { 582 // GtkWidget * gtk_toolbar_insert_item (GtkToolbar *toolbar, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GCallback callback, gpointer user_data, gint position); 583 auto p = gtk_toolbar_insert_item(gtkToolbar, Str.toStringz(text), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), (icon is null) ? null : icon.getWidgetStruct(), callback, userData, position); 584 585 if(p is null) 586 { 587 return null; 588 } 589 590 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 591 } 592 593 /** 594 * Warning 595 * gtk_toolbar_append_space has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 596 * Adds a new space to the end of the toolbar. 597 */ 598 public void appendSpace() 599 { 600 // void gtk_toolbar_append_space (GtkToolbar *toolbar); 601 gtk_toolbar_append_space(gtkToolbar); 602 } 603 604 /** 605 * Warning 606 * gtk_toolbar_prepend_space has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 607 * Adds a new space to the beginning of the toolbar. 608 */ 609 public void prependSpace() 610 { 611 // void gtk_toolbar_prepend_space (GtkToolbar *toolbar); 612 gtk_toolbar_prepend_space(gtkToolbar); 613 } 614 615 /** 616 * Warning 617 * gtk_toolbar_insert_space has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 618 * Inserts a new space in the toolbar at the specified position. 619 * Params: 620 * position = the number of widgets after which a space should be inserted. 621 */ 622 public void insertSpace(int position) 623 { 624 // void gtk_toolbar_insert_space (GtkToolbar *toolbar, gint position); 625 gtk_toolbar_insert_space(gtkToolbar, position); 626 } 627 628 /** 629 * Warning 630 * gtk_toolbar_append_element has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 631 * Adds a new element to the end of a toolbar. 632 * If type == GTK_TOOLBAR_CHILD_WIDGET, widget is used as the new element. 633 * If type == GTK_TOOLBAR_CHILD_RADIOBUTTON, widget is used to determine 634 * the radio group for the new element. In all other cases, widget must 635 * be NULL. 636 * callback must be a pointer to a function taking a GtkWidget and a gpointer as 637 * arguments. Use G_CALLBACK() to cast the function to GCallback. 638 * Params: 639 * type = a value of type GtkToolbarChildType that determines what widget will be. 640 * widget = a GtkWidget, or NULL. [allow-none] 641 * text = the element's label. 642 * tooltipText = the element's tooltip. 643 * tooltipPrivateText = used for context-sensitive help about this toolbar element. 644 * icon = a GtkWidget that provides pictorial representation of the element's function. 645 * callback = the function to be executed when the button is pressed. 646 * userData = any data you wish to pass to the callback. 647 * Returns: the new toolbar element as a GtkWidget. 648 */ 649 public Widget appendElement(GtkToolbarChildType type, Widget widget, string text, string tooltipText, string tooltipPrivateText, Widget icon, GCallback callback, void* userData) 650 { 651 // GtkWidget * gtk_toolbar_append_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GCallback callback, gpointer user_data); 652 auto p = gtk_toolbar_append_element(gtkToolbar, type, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(text), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), (icon is null) ? null : icon.getWidgetStruct(), callback, userData); 653 654 if(p is null) 655 { 656 return null; 657 } 658 659 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 660 } 661 662 /** 663 * Warning 664 * gtk_toolbar_prepend_element has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 665 * Adds a new element to the beginning of a toolbar. 666 * If type == GTK_TOOLBAR_CHILD_WIDGET, widget is used as the new element. 667 * If type == GTK_TOOLBAR_CHILD_RADIOBUTTON, widget is used to determine 668 * the radio group for the new element. In all other cases, widget must 669 * be NULL. 670 * callback must be a pointer to a function taking a GtkWidget and a gpointer as 671 * arguments. Use G_CALLBACK() to cast the function to GCallback. 672 * Params: 673 * type = a value of type GtkToolbarChildType that determines what widget will be. 674 * widget = a GtkWidget, or NULL. [allow-none] 675 * text = the element's label. 676 * tooltipText = the element's tooltip. 677 * tooltipPrivateText = used for context-sensitive help about this toolbar element. 678 * icon = a GtkWidget that provides pictorial representation of the element's function. 679 * callback = the function to be executed when the button is pressed. 680 * userData = any data you wish to pass to the callback. 681 * Returns: the new toolbar element as a GtkWidget. 682 */ 683 public Widget prependElement(GtkToolbarChildType type, Widget widget, string text, string tooltipText, string tooltipPrivateText, Widget icon, GCallback callback, void* userData) 684 { 685 // GtkWidget * gtk_toolbar_prepend_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GCallback callback, gpointer user_data); 686 auto p = gtk_toolbar_prepend_element(gtkToolbar, type, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(text), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), (icon is null) ? null : icon.getWidgetStruct(), callback, userData); 687 688 if(p is null) 689 { 690 return null; 691 } 692 693 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 694 } 695 696 /** 697 * Warning 698 * gtk_toolbar_insert_element has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 699 * Inserts a new element in the toolbar at the given position. 700 * If type == GTK_TOOLBAR_CHILD_WIDGET, widget is used as the new element. 701 * If type == GTK_TOOLBAR_CHILD_RADIOBUTTON, widget is used to determine 702 * the radio group for the new element. In all other cases, widget must 703 * be NULL. 704 * callback must be a pointer to a function taking a GtkWidget and a gpointer as 705 * arguments. Use G_CALLBACK() to cast the function to GCallback. 706 * Params: 707 * type = a value of type GtkToolbarChildType that determines what widget 708 * will be. 709 * widget = a GtkWidget, or NULL. [allow-none] 710 * text = the element's label. 711 * tooltipText = the element's tooltip. 712 * tooltipPrivateText = used for context-sensitive help about this toolbar element. 713 * icon = a GtkWidget that provides pictorial representation of the element's function. 714 * callback = the function to be executed when the button is pressed. 715 * userData = any data you wish to pass to the callback. 716 * position = the number of widgets to insert this element after. 717 * Returns: the new toolbar element as a GtkWidget. 718 */ 719 public Widget insertElement(GtkToolbarChildType type, Widget widget, string text, string tooltipText, string tooltipPrivateText, Widget icon, GCallback callback, void* userData, int position) 720 { 721 // GtkWidget * gtk_toolbar_insert_element (GtkToolbar *toolbar, GtkToolbarChildType type, GtkWidget *widget, const char *text, const char *tooltip_text, const char *tooltip_private_text, GtkWidget *icon, GCallback callback, gpointer user_data, gint position); 722 auto p = gtk_toolbar_insert_element(gtkToolbar, type, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(text), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), (icon is null) ? null : icon.getWidgetStruct(), callback, userData, position); 723 724 if(p is null) 725 { 726 return null; 727 } 728 729 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 730 } 731 732 /** 733 * Warning 734 * gtk_toolbar_append_widget has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 735 * Adds a widget to the end of the given toolbar. 736 * Params: 737 * widget = a GtkWidget to add to the toolbar. 738 * tooltipText = the element's tooltip. [allow-none] 739 * tooltipPrivateText = used for context-sensitive help about this toolbar element. [allow-none] 740 */ 741 public void appendWidget(Widget widget, string tooltipText, string tooltipPrivateText) 742 { 743 // void gtk_toolbar_append_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text); 744 gtk_toolbar_append_widget(gtkToolbar, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText)); 745 } 746 747 /** 748 * Warning 749 * gtk_toolbar_prepend_widget has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 750 * Adds a widget to the beginning of the given toolbar. 751 * Params: 752 * widget = a GtkWidget to add to the toolbar. 753 * tooltipText = the element's tooltip. [allow-none] 754 * tooltipPrivateText = used for context-sensitive help about this toolbar element. [allow-none] 755 */ 756 public void prependWidget(Widget widget, string tooltipText, string tooltipPrivateText) 757 { 758 // void gtk_toolbar_prepend_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text); 759 gtk_toolbar_prepend_widget(gtkToolbar, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText)); 760 } 761 762 /** 763 * Warning 764 * gtk_toolbar_insert_widget has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 765 * Inserts a widget in the toolbar at the given position. 766 * Params: 767 * widget = a GtkWidget to add to the toolbar. 768 * tooltipText = the element's tooltip. [allow-none] 769 * tooltipPrivateText = used for context-sensitive help about this toolbar element. [allow-none] 770 * position = the number of widgets to insert this widget after. 771 */ 772 public void insertWidget(Widget widget, string tooltipText, string tooltipPrivateText, int position) 773 { 774 // void gtk_toolbar_insert_widget (GtkToolbar *toolbar, GtkWidget *widget, const char *tooltip_text, const char *tooltip_private_text, gint position); 775 gtk_toolbar_insert_widget(gtkToolbar, (widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), position); 776 } 777 778 /** 779 * Alters the view of toolbar to display either icons only, text only, or both. 780 * Params: 781 * style = the new style for toolbar. 782 */ 783 public void setStyle(GtkToolbarStyle style) 784 { 785 // void gtk_toolbar_set_style (GtkToolbar *toolbar, GtkToolbarStyle style); 786 gtk_toolbar_set_style(gtkToolbar, style); 787 } 788 789 /** 790 * Warning 791 * gtk_toolbar_insert_stock has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 792 * Inserts a stock item at the specified position of the toolbar. If 793 * stock_id is not a known stock item ID, it's inserted verbatim, 794 * except that underscores used to mark mnemonics are removed. 795 * callback must be a pointer to a function taking a GtkWidget and a gpointer as 796 * arguments. Use G_CALLBACK() to cast the function to GCallback. 797 * Params: 798 * stockId = The id of the stock item you want to insert 799 * tooltipText = The text in the tooltip of the toolbar button 800 * tooltipPrivateText = The private text of the tooltip 801 * callback = The callback called when the toolbar button is clicked. 802 * userData = user data passed to callback 803 * position = The position the button shall be inserted at. 804 * -1 means at the end. 805 * Returns: the inserted widget 806 */ 807 public Widget insertStock(string stockId, string tooltipText, string tooltipPrivateText, GCallback callback, void* userData, int position) 808 { 809 // GtkWidget * gtk_toolbar_insert_stock (GtkToolbar *toolbar, const gchar *stock_id, const char *tooltip_text, const char *tooltip_private_text, GCallback callback, gpointer user_data, gint position); 810 auto p = gtk_toolbar_insert_stock(gtkToolbar, Str.toStringz(stockId), Str.toStringz(tooltipText), Str.toStringz(tooltipPrivateText), callback, userData, position); 811 812 if(p is null) 813 { 814 return null; 815 } 816 817 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 818 } 819 820 /** 821 * This function sets the size of stock icons in the toolbar. You 822 * can call it both before you add the icons and after they've been 823 * added. The size you set will override user preferences for the default 824 * icon size. 825 * This should only be used for special-purpose toolbars, normal 826 * application toolbars should respect the user preferences for the 827 * size of icons. 828 * Params: 829 * iconSize = The GtkIconSize that stock icons in the 830 * toolbar shall have. [type int] 831 */ 832 public void setIconSize(GtkIconSize iconSize) 833 { 834 // void gtk_toolbar_set_icon_size (GtkToolbar *toolbar, GtkIconSize icon_size); 835 gtk_toolbar_set_icon_size(gtkToolbar, iconSize); 836 } 837 838 /** 839 * Warning 840 * gtk_toolbar_remove_space has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_toolbar_insert() instead. 841 * Removes a space from the specified position. 842 * Params: 843 * position = the index of the space to remove. 844 */ 845 public void removeSpace(int position) 846 { 847 // void gtk_toolbar_remove_space (GtkToolbar *toolbar, gint position); 848 gtk_toolbar_remove_space(gtkToolbar, position); 849 } 850 851 /** 852 * Unsets a toolbar style set with gtk_toolbar_set_style(), so that 853 * user preferences will be used to determine the toolbar style. 854 */ 855 public void unsetStyle() 856 { 857 // void gtk_toolbar_unset_style (GtkToolbar *toolbar); 858 gtk_toolbar_unset_style(gtkToolbar); 859 } 860 }