/usr/include/d/gtkd-3/gtk/Toolbar.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gtk.Toolbar;
private import glib.ConstructionException;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.Container;
private import gtk.OrientableIF;
private import gtk.OrientableT;
private import gtk.ToolItem;
private import gtk.ToolShellIF;
private import gtk.ToolShellT;
private import gtk.Widget;
private import gtk.c.functions;
public import gtk.c.types;
public import gtkc.gtktypes;
private import std.algorithm;
/**
* A toolbar is created with a call to gtk_toolbar_new().
*
* A toolbar can contain instances of a subclass of #GtkToolItem. To add
* a #GtkToolItem to the a toolbar, use gtk_toolbar_insert(). To remove
* an item from the toolbar use gtk_container_remove(). To add a button
* to the toolbar, add an instance of #GtkToolButton.
*
* Toolbar items can be visually grouped by adding instances of
* #GtkSeparatorToolItem to the toolbar. If the GtkToolbar child property
* “expand” is #TRUE and the property #GtkSeparatorToolItem:draw is set to
* #FALSE, the effect is to force all following items to the end of the toolbar.
*
* By default, a toolbar can be shrunk, upon which it will add an arrow button
* to show an overflow menu offering access to any #GtkToolItem child that has
* a proxy menu item. To disable this and request enough size for all children,
* call gtk_toolbar_set_show_arrow() to set #GtkToolbar:show-arrow to %FALSE.
*
* Creating a context menu for the toolbar can be done by connecting to
* the #GtkToolbar::popup-context-menu signal.
*
* # CSS nodes
*
* GtkToolbar has a single CSS node with name toolbar.
*/
public class Toolbar : Container, OrientableIF, ToolShellIF
{
/** the main Gtk struct */
protected GtkToolbar* gtkToolbar;
/** Get the main Gtk struct */
public GtkToolbar* getToolbarStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gtkToolbar;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkToolbar;
}
protected override void setStruct(GObject* obj)
{
gtkToolbar = cast(GtkToolbar*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GtkToolbar* gtkToolbar, bool ownedRef = false)
{
this.gtkToolbar = gtkToolbar;
super(cast(GtkContainer*)gtkToolbar, ownedRef);
}
// add the Orientable capabilities
mixin OrientableT!(GtkToolbar);
// add the ToolShell capabilities
mixin ToolShellT!(GtkToolbar);
/**
* Insert a GtkToolItem into the toolbar at position pos.
* 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.
* Since 2.4
* Params:
* toolItem = a GtkToolItem
* pos = the position of the new item
*/
public void insert(ToolItem toolItem, int pos=-1)
{
gtk_toolbar_insert(gtkToolbar, toolItem.getToolItemStruct(), pos);
}
/**
*/
/** */
public static GType getType()
{
return gtk_toolbar_get_type();
}
/**
* Creates a new toolbar.
*
* Returns: the newly-created toolbar.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = gtk_toolbar_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GtkToolbar*) p);
}
/**
* Returns the position corresponding to the indicated point on
* @toolbar. This is useful when dragging items to the toolbar:
* this function returns the position a new item should be
* inserted.
*
* @x and @y are in @toolbar coordinates.
*
* Params:
* x = x coordinate of a point on the toolbar
* y = y coordinate of a point on the toolbar
*
* Returns: The position corresponding to the point (@x, @y) on the toolbar.
*
* Since: 2.4
*/
public int getDropIndex(int x, int y)
{
return gtk_toolbar_get_drop_index(gtkToolbar, x, y);
}
/**
* Returns the position of @item on the toolbar, starting from 0.
* It is an error if @item is not a child of the toolbar.
*
* Params:
* item = a #GtkToolItem that is a child of @toolbar
*
* Returns: the position of item on the toolbar.
*
* Since: 2.4
*/
public int getItemIndex(ToolItem item)
{
return gtk_toolbar_get_item_index(gtkToolbar, (item is null) ? null : item.getToolItemStruct());
}
/**
* Returns the number of items on the toolbar.
*
* Returns: the number of items on the toolbar
*
* Since: 2.4
*/
public int getNItems()
{
return gtk_toolbar_get_n_items(gtkToolbar);
}
/**
* Returns the @n'th item on @toolbar, or %NULL if the
* toolbar does not contain an @n'th item.
*
* Params:
* n = A position on the toolbar
*
* Returns: The @n'th #GtkToolItem on @toolbar,
* or %NULL if there isn’t an @n'th item.
*
* Since: 2.4
*/
public ToolItem getNthItem(int n)
{
auto p = gtk_toolbar_get_nth_item(gtkToolbar, n);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(ToolItem)(cast(GtkToolItem*) p);
}
/**
* Returns whether the toolbar has an overflow menu.
* See gtk_toolbar_set_show_arrow().
*
* Returns: %TRUE if the toolbar has an overflow menu.
*
* Since: 2.4
*/
public bool getShowArrow()
{
return gtk_toolbar_get_show_arrow(gtkToolbar) != 0;
}
/**
* Retrieves whether the toolbar has text, icons, or both . See
* gtk_toolbar_set_style().
*
* Returns: the current style of @toolbar
*/
public GtkToolbarStyle getToolbarStyle()
{
return gtk_toolbar_get_style(gtkToolbar);
}
/**
* Highlights @toolbar to give an idea of what it would look like
* if @item was added to @toolbar at the position indicated by @index_.
* If @item is %NULL, highlighting is turned off. In that case @index_
* is ignored.
*
* The @tool_item passed to this function must not be part of any widget
* hierarchy. When an item is set as drop highlight item it can not
* added to any widget hierarchy or used as highlight item for another
* toolbar.
*
* Params:
* toolItem = a #GtkToolItem, or %NULL to turn of highlighting
* index = a position on @toolbar
*
* Since: 2.4
*/
public void setDropHighlightItem(ToolItem toolItem, int index)
{
gtk_toolbar_set_drop_highlight_item(gtkToolbar, (toolItem is null) ? null : toolItem.getToolItemStruct(), index);
}
/**
* This function sets the size of stock icons in the toolbar. You
* can call it both before you add the icons and after they’ve been
* added. The size you set will override user preferences for the default
* icon size.
*
* This should only be used for special-purpose toolbars, normal
* application toolbars should respect the user preferences for the
* size of icons.
*
* Params:
* iconSize = The #GtkIconSize that stock icons in the toolbar shall have.
*/
public void setIconSize(GtkIconSize iconSize)
{
gtk_toolbar_set_icon_size(gtkToolbar, iconSize);
}
/**
* Sets whether to show an overflow menu when @toolbar isn’t allocated enough
* size to show all of its items. If %TRUE, items which can’t fit in @toolbar,
* and which have a proxy menu item set by gtk_tool_item_set_proxy_menu_item()
* or #GtkToolItem::create-menu-proxy, will be available in an overflow menu,
* which can be opened by an added arrow button. If %FALSE, @toolbar will
* request enough size to fit all of its child items without any overflow.
*
* Params:
* showArrow = Whether to show an overflow menu
*
* Since: 2.4
*/
public void setShowArrow(bool showArrow)
{
gtk_toolbar_set_show_arrow(gtkToolbar, showArrow);
}
/**
* Alters the view of @toolbar to display either icons only, text only, or both.
*
* Params:
* style = the new style for @toolbar.
*/
public void setStyle(GtkToolbarStyle style)
{
gtk_toolbar_set_style(gtkToolbar, style);
}
/**
* Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that
* user preferences will be used to determine the icon size.
*/
public void unsetIconSize()
{
gtk_toolbar_unset_icon_size(gtkToolbar);
}
/**
* Unsets a toolbar style set with gtk_toolbar_set_style(), so that
* user preferences will be used to determine the toolbar style.
*/
public void unsetStyle()
{
gtk_toolbar_unset_style(gtkToolbar);
}
protected class OnFocusHomeOrEndDelegateWrapper
{
bool delegate(bool, Toolbar) dlg;
gulong handlerId;
this(bool delegate(bool, Toolbar) dlg)
{
this.dlg = dlg;
onFocusHomeOrEndListeners ~= this;
}
void remove(OnFocusHomeOrEndDelegateWrapper source)
{
foreach(index, wrapper; onFocusHomeOrEndListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onFocusHomeOrEndListeners[index] = null;
onFocusHomeOrEndListeners = std.algorithm.remove(onFocusHomeOrEndListeners, index);
break;
}
}
}
}
OnFocusHomeOrEndDelegateWrapper[] onFocusHomeOrEndListeners;
/**
* A keybinding signal used internally by GTK+. This signal can't
* be used in application code
*
* Params:
* focusHome = %TRUE if the first item should be focused
*
* Returns: %TRUE if the signal was handled, %FALSE if not
*/
gulong addOnFocusHomeOrEnd(bool delegate(bool, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnFocusHomeOrEndDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"focus-home-or-end",
cast(GCallback)&callBackFocusHomeOrEnd,
cast(void*)wrapper,
cast(GClosureNotify)&callBackFocusHomeOrEndDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static int callBackFocusHomeOrEnd(GtkToolbar* toolbarStruct, bool focusHome, OnFocusHomeOrEndDelegateWrapper wrapper)
{
return wrapper.dlg(focusHome, wrapper.outer);
}
extern(C) static void callBackFocusHomeOrEndDestroy(OnFocusHomeOrEndDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnOrientationChangedDelegateWrapper
{
void delegate(GtkOrientation, Toolbar) dlg;
gulong handlerId;
this(void delegate(GtkOrientation, Toolbar) dlg)
{
this.dlg = dlg;
onOrientationChangedListeners ~= this;
}
void remove(OnOrientationChangedDelegateWrapper source)
{
foreach(index, wrapper; onOrientationChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onOrientationChangedListeners[index] = null;
onOrientationChangedListeners = std.algorithm.remove(onOrientationChangedListeners, index);
break;
}
}
}
}
OnOrientationChangedDelegateWrapper[] onOrientationChangedListeners;
/**
* Emitted when the orientation of the toolbar changes.
*
* Params:
* orientation = the new #GtkOrientation of the toolbar
*/
gulong addOnOrientationChanged(void delegate(GtkOrientation, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnOrientationChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"orientation-changed",
cast(GCallback)&callBackOrientationChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackOrientationChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackOrientationChanged(GtkToolbar* toolbarStruct, GtkOrientation orientation, OnOrientationChangedDelegateWrapper wrapper)
{
wrapper.dlg(orientation, wrapper.outer);
}
extern(C) static void callBackOrientationChangedDestroy(OnOrientationChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnPopupContextMenuDelegateWrapper
{
bool delegate(int, int, int, Toolbar) dlg;
gulong handlerId;
this(bool delegate(int, int, int, Toolbar) dlg)
{
this.dlg = dlg;
onPopupContextMenuListeners ~= this;
}
void remove(OnPopupContextMenuDelegateWrapper source)
{
foreach(index, wrapper; onPopupContextMenuListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onPopupContextMenuListeners[index] = null;
onPopupContextMenuListeners = std.algorithm.remove(onPopupContextMenuListeners, index);
break;
}
}
}
}
OnPopupContextMenuDelegateWrapper[] onPopupContextMenuListeners;
/**
* Emitted when the user right-clicks the toolbar or uses the
* keybinding to display a popup menu.
*
* Application developers should handle this signal if they want
* to display a context menu on the toolbar. The context-menu should
* appear at the coordinates given by @x and @y. The mouse button
* number is given by the @button parameter. If the menu was popped
* up using the keybaord, @button is -1.
*
* Params:
* x = the x coordinate of the point where the menu should appear
* y = the y coordinate of the point where the menu should appear
* button = the mouse button the user pressed, or -1
*
* Returns: return %TRUE if the signal was handled, %FALSE if not
*/
gulong addOnPopupContextMenu(bool delegate(int, int, int, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnPopupContextMenuDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"popup-context-menu",
cast(GCallback)&callBackPopupContextMenu,
cast(void*)wrapper,
cast(GClosureNotify)&callBackPopupContextMenuDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static int callBackPopupContextMenu(GtkToolbar* toolbarStruct, int x, int y, int button, OnPopupContextMenuDelegateWrapper wrapper)
{
return wrapper.dlg(x, y, button, wrapper.outer);
}
extern(C) static void callBackPopupContextMenuDestroy(OnPopupContextMenuDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnStyleChangedDelegateWrapper
{
void delegate(GtkToolbarStyle, Toolbar) dlg;
gulong handlerId;
this(void delegate(GtkToolbarStyle, Toolbar) dlg)
{
this.dlg = dlg;
onStyleChangedListeners ~= this;
}
void remove(OnStyleChangedDelegateWrapper source)
{
foreach(index, wrapper; onStyleChangedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onStyleChangedListeners[index] = null;
onStyleChangedListeners = std.algorithm.remove(onStyleChangedListeners, index);
break;
}
}
}
}
OnStyleChangedDelegateWrapper[] onStyleChangedListeners;
/**
* Emitted when the style of the toolbar changes.
*
* Params:
* style = the new #GtkToolbarStyle of the toolbar
*/
gulong addOnStyleChanged(void delegate(GtkToolbarStyle, Toolbar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnStyleChangedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"style-changed",
cast(GCallback)&callBackStyleChanged,
cast(void*)wrapper,
cast(GClosureNotify)&callBackStyleChangedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackStyleChanged(GtkToolbar* toolbarStruct, GtkToolbarStyle style, OnStyleChangedDelegateWrapper wrapper)
{
wrapper.dlg(style, wrapper.outer);
}
extern(C) static void callBackStyleChangedDestroy(OnStyleChangedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|