1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.Widget; 26 27 private import atk.ImplementorIF; 28 private import atk.ImplementorT; 29 private import atk.ObjectAtk; 30 private import cairo.Context; 31 private import cairo.FontOption; 32 private import cairo.Region; 33 private import gdk.Color; 34 private import gdk.Cursor; 35 private import gdk.Device; 36 private import gdk.Display; 37 private import gdk.DragContext; 38 private import gdk.Event; 39 private import gdk.FrameClock; 40 private import gdk.RGBA; 41 private import gdk.Screen; 42 private import gdk.Visual; 43 private import gdk.Window : GdkWin = Window; 44 private import gdkpixbuf.Pixbuf; 45 private import gio.ActionGroupIF; 46 private import gio.IconIF; 47 private import glib.ConstructionException; 48 private import glib.ListG; 49 private import glib.Str; 50 private import gobject.ObjectG; 51 private import gobject.ParamSpec; 52 private import gobject.Signals; 53 private import gobject.Type; 54 private import gobject.Value; 55 private import gtk.AccelGroup; 56 private import gtk.BuildableIF; 57 private import gtk.BuildableT; 58 private import gtk.Clipboard; 59 private import gtk.RcStyle; 60 private import gtk.Requisition; 61 private import gtk.SelectionData; 62 private import gtk.Settings; 63 private import gtk.Style; 64 private import gtk.StyleContext; 65 private import gtk.TargetEntry; 66 private import gtk.TargetList; 67 private import gtk.Tooltip; 68 private import gtk.WidgetPath; 69 private import gtk.Window; 70 private import gtk.c.functions; 71 public import gtk.c.types; 72 public import gtkc.gtktypes; 73 private import pango.PgContext; 74 private import pango.PgFontDescription; 75 private import pango.PgFontMap; 76 private import pango.PgLayout; 77 private import std.algorithm; 78 private import std.conv; 79 80 81 /** 82 * GtkWidget is the base class all widgets in GTK+ derive from. It manages the 83 * widget lifecycle, states and style. 84 * 85 * # Height-for-width Geometry Management # {#geometry-management} 86 * 87 * GTK+ uses a height-for-width (and width-for-height) geometry management 88 * system. Height-for-width means that a widget can change how much 89 * vertical space it needs, depending on the amount of horizontal space 90 * that it is given (and similar for width-for-height). The most common 91 * example is a label that reflows to fill up the available width, wraps 92 * to fewer lines, and therefore needs less height. 93 * 94 * Height-for-width geometry management is implemented in GTK+ by way 95 * of five virtual methods: 96 * 97 * - #GtkWidgetClass.get_request_mode() 98 * - #GtkWidgetClass.get_preferred_width() 99 * - #GtkWidgetClass.get_preferred_height() 100 * - #GtkWidgetClass.get_preferred_height_for_width() 101 * - #GtkWidgetClass.get_preferred_width_for_height() 102 * - #GtkWidgetClass.get_preferred_height_and_baseline_for_width() 103 * 104 * There are some important things to keep in mind when implementing 105 * height-for-width and when using it in container implementations. 106 * 107 * The geometry management system will query a widget hierarchy in 108 * only one orientation at a time. When widgets are initially queried 109 * for their minimum sizes it is generally done in two initial passes 110 * in the #GtkSizeRequestMode chosen by the toplevel. 111 * 112 * For example, when queried in the normal 113 * %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH mode: 114 * First, the default minimum and natural width for each widget 115 * in the interface will be computed using gtk_widget_get_preferred_width(). 116 * Because the preferred widths for each container depend on the preferred 117 * widths of their children, this information propagates up the hierarchy, 118 * and finally a minimum and natural width is determined for the entire 119 * toplevel. Next, the toplevel will use the minimum width to query for the 120 * minimum height contextual to that width using 121 * gtk_widget_get_preferred_height_for_width(), which will also be a highly 122 * recursive operation. The minimum height for the minimum width is normally 123 * used to set the minimum size constraint on the toplevel 124 * (unless gtk_window_set_geometry_hints() is explicitly used instead). 125 * 126 * After the toplevel window has initially requested its size in both 127 * dimensions it can go on to allocate itself a reasonable size (or a size 128 * previously specified with gtk_window_set_default_size()). During the 129 * recursive allocation process it’s important to note that request cycles 130 * will be recursively executed while container widgets allocate their children. 131 * Each container widget, once allocated a size, will go on to first share the 132 * space in one orientation among its children and then request each child's 133 * height for its target allocated width or its width for allocated height, 134 * depending. In this way a #GtkWidget will typically be requested its size 135 * a number of times before actually being allocated a size. The size a 136 * widget is finally allocated can of course differ from the size it has 137 * requested. For this reason, #GtkWidget caches a small number of results 138 * to avoid re-querying for the same sizes in one allocation cycle. 139 * 140 * See 141 * [GtkContainer’s geometry management section][container-geometry-management] 142 * to learn more about how height-for-width allocations are performed 143 * by container widgets. 144 * 145 * If a widget does move content around to intelligently use up the 146 * allocated size then it must support the request in both 147 * #GtkSizeRequestModes even if the widget in question only 148 * trades sizes in a single orientation. 149 * 150 * For instance, a #GtkLabel that does height-for-width word wrapping 151 * will not expect to have #GtkWidgetClass.get_preferred_height() called 152 * because that call is specific to a width-for-height request. In this 153 * case the label must return the height required for its own minimum 154 * possible width. By following this rule any widget that handles 155 * height-for-width or width-for-height requests will always be allocated 156 * at least enough space to fit its own content. 157 * 158 * Here are some examples of how a %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH widget 159 * generally deals with width-for-height requests, for #GtkWidgetClass.get_preferred_height() 160 * it will do: 161 * 162 * |[<!-- language="C" --> 163 * static void 164 * foo_widget_get_preferred_height (GtkWidget *widget, 165 * gint *min_height, 166 * gint *nat_height) 167 * { 168 * if (i_am_in_height_for_width_mode) 169 * { 170 * gint min_width, nat_width; 171 * 172 * GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, 173 * &min_width, 174 * &nat_width); 175 * GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width 176 * (widget, 177 * min_width, 178 * min_height, 179 * nat_height); 180 * } 181 * else 182 * { 183 * ... some widgets do both. For instance, if a GtkLabel is 184 * rotated to 90 degrees it will return the minimum and 185 * natural height for the rotated label here. 186 * } 187 * } 188 * ]| 189 * 190 * And in #GtkWidgetClass.get_preferred_width_for_height() it will simply return 191 * the minimum and natural width: 192 * |[<!-- language="C" --> 193 * static void 194 * foo_widget_get_preferred_width_for_height (GtkWidget *widget, 195 * gint for_height, 196 * gint *min_width, 197 * gint *nat_width) 198 * { 199 * if (i_am_in_height_for_width_mode) 200 * { 201 * GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, 202 * min_width, 203 * nat_width); 204 * } 205 * else 206 * { 207 * ... again if a widget is sometimes operating in 208 * width-for-height mode (like a rotated GtkLabel) it can go 209 * ahead and do its real width for height calculation here. 210 * } 211 * } 212 * ]| 213 * 214 * Often a widget needs to get its own request during size request or 215 * allocation. For example, when computing height it may need to also 216 * compute width. Or when deciding how to use an allocation, the widget 217 * may need to know its natural size. In these cases, the widget should 218 * be careful to call its virtual methods directly, like this: 219 * 220 * |[<!-- language="C" --> 221 * GTK_WIDGET_GET_CLASS(widget)->get_preferred_width (widget, 222 * &min, 223 * &natural); 224 * ]| 225 * 226 * It will not work to use the wrapper functions, such as 227 * gtk_widget_get_preferred_width() inside your own size request 228 * implementation. These return a request adjusted by #GtkSizeGroup 229 * and by the #GtkWidgetClass.adjust_size_request() virtual method. If a 230 * widget used the wrappers inside its virtual method implementations, 231 * then the adjustments (such as widget margins) would be applied 232 * twice. GTK+ therefore does not allow this and will warn if you try 233 * to do it. 234 * 235 * Of course if you are getting the size request for 236 * another widget, such as a child of a 237 * container, you must use the wrapper APIs. 238 * Otherwise, you would not properly consider widget margins, 239 * #GtkSizeGroup, and so forth. 240 * 241 * Since 3.10 GTK+ also supports baseline vertical alignment of widgets. This 242 * means that widgets are positioned such that the typographical baseline of 243 * widgets in the same row are aligned. This happens if a widget supports baselines, 244 * has a vertical alignment of %GTK_ALIGN_BASELINE, and is inside a container 245 * that supports baselines and has a natural “row” that it aligns to the baseline, 246 * or a baseline assigned to it by the grandparent. 247 * 248 * Baseline alignment support for a widget is done by the #GtkWidgetClass.get_preferred_height_and_baseline_for_width() 249 * virtual function. It allows you to report a baseline in combination with the 250 * minimum and natural height. If there is no baseline you can return -1 to indicate 251 * this. The default implementation of this virtual function calls into the 252 * #GtkWidgetClass.get_preferred_height() and #GtkWidgetClass.get_preferred_height_for_width(), 253 * so if baselines are not supported it doesn’t need to be implemented. 254 * 255 * If a widget ends up baseline aligned it will be allocated all the space in the parent 256 * as if it was %GTK_ALIGN_FILL, but the selected baseline can be found via gtk_widget_get_allocated_baseline(). 257 * If this has a value other than -1 you need to align the widget such that the baseline 258 * appears at the position. 259 * 260 * # Style Properties 261 * 262 * #GtkWidget introduces “style 263 * properties” - these are basically object properties that are stored 264 * not on the object, but in the style object associated to the widget. Style 265 * properties are set in [resource files][gtk3-Resource-Files]. 266 * This mechanism is used for configuring such things as the location of the 267 * scrollbar arrows through the theme, giving theme authors more control over the 268 * look of applications without the need to write a theme engine in C. 269 * 270 * Use gtk_widget_class_install_style_property() to install style properties for 271 * a widget class, gtk_widget_class_find_style_property() or 272 * gtk_widget_class_list_style_properties() to get information about existing 273 * style properties and gtk_widget_style_get_property(), gtk_widget_style_get() or 274 * gtk_widget_style_get_valist() to obtain the value of a style property. 275 * 276 * # GtkWidget as GtkBuildable 277 * 278 * The GtkWidget implementation of the GtkBuildable interface supports a 279 * custom <accelerator> element, which has attributes named ”key”, ”modifiers” 280 * and ”signal” and allows to specify accelerators. 281 * 282 * An example of a UI definition fragment specifying an accelerator: 283 * |[ 284 * <object class="GtkButton"> 285 * <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/> 286 * </object> 287 * ]| 288 * 289 * In addition to accelerators, GtkWidget also support a custom <accessible> 290 * element, which supports actions and relations. Properties on the accessible 291 * implementation of an object can be set by accessing the internal child 292 * “accessible” of a #GtkWidget. 293 * 294 * An example of a UI definition fragment specifying an accessible: 295 * |[ 296 * <object class="GtkButton" id="label1"/> 297 * <property name="label">I am a Label for a Button</property> 298 * </object> 299 * <object class="GtkButton" id="button1"> 300 * <accessibility> 301 * <action action_name="click" translatable="yes">Click the button.</action> 302 * <relation target="label1" type="labelled-by"/> 303 * </accessibility> 304 * <child internal-child="accessible"> 305 * <object class="AtkObject" id="a11y-button1"> 306 * <property name="accessible-name">Clickable Button</property> 307 * </object> 308 * </child> 309 * </object> 310 * ]| 311 * 312 * Finally, GtkWidget allows style information such as style classes to 313 * be associated with widgets, using the custom <style> element: 314 * |[ 315 * <object class="GtkButton" id="button1"> 316 * <style> 317 * <class name="my-special-button-class"/> 318 * <class name="dark-button"/> 319 * </style> 320 * </object> 321 * ]| 322 * 323 * # Building composite widgets from template XML ## {#composite-templates} 324 * 325 * GtkWidget exposes some facilities to automate the procedure 326 * of creating composite widgets using #GtkBuilder interface description 327 * language. 328 * 329 * To create composite widgets with #GtkBuilder XML, one must associate 330 * the interface description with the widget class at class initialization 331 * time using gtk_widget_class_set_template(). 332 * 333 * The interface description semantics expected in composite template descriptions 334 * is slightly different from regular #GtkBuilder XML. 335 * 336 * Unlike regular interface descriptions, gtk_widget_class_set_template() will 337 * expect a <template> tag as a direct child of the toplevel <interface> 338 * tag. The <template> tag must specify the “class” attribute which must be 339 * the type name of the widget. Optionally, the “parent” attribute may be 340 * specified to specify the direct parent type of the widget type, this is 341 * ignored by the GtkBuilder but required for Glade to introspect what kind 342 * of properties and internal children exist for a given type when the actual 343 * type does not exist. 344 * 345 * The XML which is contained inside the <template> tag behaves as if it were 346 * added to the <object> tag defining @widget itself. You may set properties 347 * on @widget by inserting <property> tags into the <template> tag, and also 348 * add <child> tags to add children and extend @widget in the normal way you 349 * would with <object> tags. 350 * 351 * Additionally, <object> tags can also be added before and after the initial 352 * <template> tag in the normal way, allowing one to define auxiliary objects 353 * which might be referenced by other widgets declared as children of the 354 * <template> tag. 355 * 356 * An example of a GtkBuilder Template Definition: 357 * |[ 358 * <interface> 359 * <template class="FooWidget" parent="GtkBox"> 360 * <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> 361 * <property name="spacing">4</property> 362 * <child> 363 * <object class="GtkButton" id="hello_button"> 364 * <property name="label">Hello World</property> 365 * <signal name="clicked" handler="hello_button_clicked" object="FooWidget" swapped="yes"/> 366 * </object> 367 * </child> 368 * <child> 369 * <object class="GtkButton" id="goodbye_button"> 370 * <property name="label">Goodbye World</property> 371 * </object> 372 * </child> 373 * </template> 374 * </interface> 375 * ]| 376 * 377 * Typically, you'll place the template fragment into a file that is 378 * bundled with your project, using #GResource. In order to load the 379 * template, you need to call gtk_widget_class_set_template_from_resource() 380 * from the class initialization of your #GtkWidget type: 381 * 382 * |[<!-- language="C" --> 383 * static void 384 * foo_widget_class_init (FooWidgetClass *klass) 385 * { 386 * // ... 387 * 388 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 389 * "/com/example/ui/foowidget.ui"); 390 * } 391 * ]| 392 * 393 * You will also need to call gtk_widget_init_template() from the instance 394 * initialization function: 395 * 396 * |[<!-- language="C" --> 397 * static void 398 * foo_widget_init (FooWidget *self) 399 * { 400 * // ... 401 * gtk_widget_init_template (GTK_WIDGET (self)); 402 * } 403 * ]| 404 * 405 * You can access widgets defined in the template using the 406 * gtk_widget_get_template_child() function, but you will typically declare 407 * a pointer in the instance private data structure of your type using the same 408 * name as the widget in the template definition, and call 409 * gtk_widget_class_bind_template_child_private() with that name, e.g. 410 * 411 * |[<!-- language="C" --> 412 * typedef struct { 413 * GtkWidget *hello_button; 414 * GtkWidget *goodbye_button; 415 * } FooWidgetPrivate; 416 * 417 * G_DEFINE_TYPE_WITH_PRIVATE (FooWidget, foo_widget, GTK_TYPE_BOX) 418 * 419 * static void 420 * foo_widget_class_init (FooWidgetClass *klass) 421 * { 422 * // ... 423 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 424 * "/com/example/ui/foowidget.ui"); 425 * gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), 426 * FooWidget, hello_button); 427 * gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), 428 * FooWidget, goodbye_button); 429 * } 430 * ]| 431 * 432 * You can also use gtk_widget_class_bind_template_callback() to connect a signal 433 * callback defined in the template with a function visible in the scope of the 434 * class, e.g. 435 * 436 * |[<!-- language="C" --> 437 * // the signal handler has the instance and user data swapped 438 * // because of the swapped="yes" attribute in the template XML 439 * static void 440 * hello_button_clicked (FooWidget *self, 441 * GtkButton *button) 442 * { 443 * g_print ("Hello, world!\n"); 444 * } 445 * 446 * static void 447 * foo_widget_class_init (FooWidgetClass *klass) 448 * { 449 * // ... 450 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 451 * "/com/example/ui/foowidget.ui"); 452 * gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked); 453 * } 454 * ]| 455 */ 456 public class Widget : ObjectG, ImplementorIF, BuildableIF 457 { 458 /** the main Gtk struct */ 459 protected GtkWidget* gtkWidget; 460 461 /** Get the main Gtk struct */ 462 public GtkWidget* getWidgetStruct(bool transferOwnership = false) 463 { 464 if (transferOwnership) 465 ownedRef = false; 466 return gtkWidget; 467 } 468 469 /** the main Gtk struct as a void* */ 470 protected override void* getStruct() 471 { 472 return cast(void*)gtkWidget; 473 } 474 475 /** 476 * Sets our main struct and passes it to the parent class. 477 */ 478 public this (GtkWidget* gtkWidget, bool ownedRef = false) 479 { 480 this.gtkWidget = gtkWidget; 481 super(cast(GObject*)gtkWidget, ownedRef); 482 } 483 484 // add the Implementor capabilities 485 mixin ImplementorT!(GtkWidget); 486 487 // add the Buildable capabilities 488 mixin BuildableT!(GtkWidget); 489 490 public GtkWidgetClass* getWidgetClass() 491 { 492 return Type.getInstanceClass!(GtkWidgetClass)(this); 493 } 494 495 /** */ 496 public int getWidth() 497 { 498 int width; 499 gtk_widget_get_size_request(gtkWidget, &width, null); 500 return width; 501 } 502 503 /** */ 504 public int getHeight() 505 { 506 int height; 507 gtk_widget_get_size_request(gtkWidget, null, &height); 508 return height; 509 } 510 511 /** 512 * Sets the cursor. 513 * Params: 514 * cursor = the new cursor 515 * Bugs: the cursor changes to the parent widget also 516 */ 517 void setCursor(Cursor cursor) 518 { 519 getWindow().setCursor(cursor); 520 } 521 522 /** 523 * Resets the cursor. 524 * don't know if this is implemented by GTK+. Seems that it's not 525 * Bugs: does nothing 526 */ 527 public void resetCursor() 528 { 529 getWindow().setCursor(null); 530 } 531 532 /** 533 * Modifies the font for this widget. 534 * This just calls modifyFont(new PgFontDescription(PgFontDescription.fromString(family ~ " " ~ size))); 535 */ 536 public void modifyFont(string family, int size) 537 { 538 if ( size < 0 ) size = -size; // hack to workaround leds bug - TO BE REMOVED 539 540 modifyFont( 541 PgFontDescription.fromString( 542 family ~ " " ~ to!(string)(size) 543 ) 544 ); 545 } 546 547 /** */ 548 public bool onEvent(GdkEvent* event) 549 { 550 return getWidgetClass().event(getWidgetStruct(), event) == 0 ? false : true; 551 } 552 553 /** */ 554 public bool onButtonPressEvent(GdkEventButton* event) 555 { 556 return getWidgetClass().buttonPressEvent(getWidgetStruct(), event) == 0 ? false : true; 557 } 558 559 /** */ 560 public bool onButtonReleaseEvent(GdkEventButton* event) 561 { 562 return getWidgetClass().buttonReleaseEvent(getWidgetStruct(), event) == 0 ? false : true; 563 } 564 565 /** */ 566 public bool onScrollEvent(GdkEventScroll* event) 567 { 568 return getWidgetClass().scrollEvent(getWidgetStruct(), event) == 0 ? false : true; 569 } 570 571 /** */ 572 public bool onMotionNotifyEvent(GdkEventMotion* event) 573 { 574 return getWidgetClass().motionNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 575 } 576 577 /** */ 578 public bool onDeleteEvent(GdkEventAny* event) 579 { 580 return getWidgetClass().deleteEvent(getWidgetStruct(), event) == 0 ? false : true; 581 } 582 583 /** */ 584 public bool onDestroyEvent(GdkEventAny* event) 585 { 586 return getWidgetClass().destroyEvent(getWidgetStruct(), event) == 0 ? false : true; 587 } 588 589 /** */ 590 public bool onKeyPressEvent(GdkEventKey* event) 591 { 592 return getWidgetClass().keyPressEvent(getWidgetStruct(), event) == 0 ? false : true; 593 } 594 595 /** */ 596 public bool onKeyReleaseEvent(GdkEventKey* event) 597 { 598 return getWidgetClass().keyReleaseEvent(getWidgetStruct(), event) == 0 ? false : true; 599 } 600 601 /** */ 602 public bool onEnterNotifyEvent(GdkEventCrossing* event) 603 { 604 return getWidgetClass().enterNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 605 } 606 607 /** */ 608 public bool onLeaveNotifyEvent(GdkEventCrossing* event) 609 { 610 return getWidgetClass().leaveNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 611 } 612 613 /** */ 614 public bool onConfigureEvent(GdkEventConfigure* event) 615 { 616 return getWidgetClass().configureEvent(getWidgetStruct(), event) == 0 ? false : true; 617 } 618 619 /** */ 620 public bool onFocusInEvent(GdkEventFocus* event) 621 { 622 return getWidgetClass().focusInEvent(getWidgetStruct(), event) == 0 ? false : true; 623 } 624 625 /** */ 626 public bool onFocusOutEvent(GdkEventFocus* event) 627 { 628 return getWidgetClass().focusOutEvent(getWidgetStruct(), event) == 0 ? false : true; 629 } 630 631 /** */ 632 public bool onMapEvent(GdkEventAny* event) 633 { 634 return getWidgetClass().mapEvent(getWidgetStruct(), event) == 0 ? false : true; 635 } 636 637 /** */ 638 public bool onUnmapEvent(GdkEventAny* event) 639 { 640 return getWidgetClass().unmapEvent(getWidgetStruct(), event) == 0 ? false : true; 641 } 642 643 /** */ 644 public bool onPropertyNotifyEvent(GdkEventProperty* event) 645 { 646 return getWidgetClass().propertyNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 647 } 648 649 /** */ 650 public bool onSelectionClearEvent(GdkEventSelection* event) 651 { 652 return getWidgetClass().selectionClearEvent(getWidgetStruct(), event) == 0 ? false : true; 653 } 654 655 /** */ 656 public bool onSelectionRequestEvent(GdkEventSelection* event) 657 { 658 return getWidgetClass().selectionRequestEvent(getWidgetStruct(), event) == 0 ? false : true; 659 } 660 661 /** */ 662 public bool onSelectionNotifyEvent(GdkEventSelection* event) 663 { 664 return getWidgetClass().selectionNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 665 } 666 667 /** */ 668 public bool onProximityInEvent(GdkEventProximity* event) 669 { 670 return getWidgetClass().proximityInEvent(getWidgetStruct(), event) == 0 ? false : true; 671 } 672 673 /** */ 674 public bool onProximityOutEvent(GdkEventProximity* event) 675 { 676 return getWidgetClass().proximityOutEvent(getWidgetStruct(), event) == 0 ? false : true; 677 } 678 679 /** */ 680 public bool onVisibilityNotifyEvent(GdkEventVisibility* event) 681 { 682 return getWidgetClass().visibilityNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 683 } 684 685 /** */ 686 public bool onWindowStateEvent(GdkEventWindowState* event) 687 { 688 return getWidgetClass().windowStateEvent(getWidgetStruct(), event) == 0 ? false : true; 689 } 690 691 /** */ 692 public bool onDamageEvent(GdkEventExpose* event) 693 { 694 return getWidgetClass().damageEvent(getWidgetStruct(), event) == 0 ? false : true; 695 } 696 697 /** */ 698 public bool onGrabBrokenEvent(GdkEventGrabBroken* event) 699 { 700 return getWidgetClass().grabBrokenEvent(getWidgetStruct(), event) == 0 ? false : true; 701 } 702 703 /** 704 * Queues an animation frame update and adds a callback to be called 705 * before each frame. Until the tick callback is removed, it will be 706 * called frequently (usually at the frame rate of the output device 707 * or as quickly as the application can be repainted, whichever is 708 * slower). For this reason, is most suitable for handling graphics 709 * that change every frame or every few frames. The tick callback does 710 * not automatically imply a relayout or repaint. If you want a 711 * repaint or relayout, and aren't changing widget properties that 712 * would trigger that (for example, changing the text of a gtk.Label), 713 * then you will have to call queueResize() or queuDrawArea() yourself. 714 * 715 * gdk.FrameClock.FrameClock.getFrameTime() should generally be used for timing 716 * continuous animations and gdk.FrameTimings.FrameTimings.getPredictedPresentationPime() 717 * if you are trying to display isolated frames at particular times. 718 * 719 * This is a more convenient alternative to connecting directly to the 720 * "update" signal of GdkFrameClock, since you don't 721 * have to worry about when a GdkFrameClock is assigned to a widget. 722 * 723 * Params: 724 * callback = function to call for updating animations 725 */ 726 public void addTickCallback(bool delegate(Widget, FrameClock) callback) 727 { 728 tickCallbackListeners ~= callback; 729 static bool connected; 730 731 if ( connected ) 732 { 733 return; 734 } 735 736 addTickCallback(cast(GtkTickCallback)>kTickCallback, cast(void*)this, null); 737 connected = true; 738 } 739 bool delegate(Widget, FrameClock)[] tickCallbackListeners; 740 extern(C) static int gtkTickCallback(GtkWidget* widgetStruct, GdkFrameClock* frameClock, Widget _widget) 741 { 742 foreach ( dlg ; _widget.tickCallbackListeners ) 743 { 744 if(dlg(_widget, new FrameClock(frameClock))) 745 return 1; 746 } 747 return 0; 748 } 749 750 protected class ScopedOnDrawDelegateWrapper 751 { 752 bool delegate(Scoped!Context, Widget) dlg; 753 gulong handlerId; 754 755 this(bool delegate(Scoped!Context, Widget) dlg) 756 { 757 this.dlg = dlg; 758 scopedOnDrawListeners ~= this; 759 } 760 761 void remove(ScopedOnDrawDelegateWrapper source) 762 { 763 foreach(index, wrapper; scopedOnDrawListeners) 764 { 765 if (wrapper.handlerId == source.handlerId) 766 { 767 scopedOnDrawListeners[index] = null; 768 scopedOnDrawListeners = std.algorithm.remove(scopedOnDrawListeners, index); 769 break; 770 } 771 } 772 } 773 } 774 ScopedOnDrawDelegateWrapper[] scopedOnDrawListeners; 775 776 /** 777 * This signal is emitted when a widget is supposed to render itself. 778 * The @widget's top left corner must be painted at the origin of 779 * the passed in context and be sized to the values returned by 780 * gtk_widget_get_allocated_width() and 781 * gtk_widget_get_allocated_height(). 782 * 783 * Signal handlers connected to this signal can modify the cairo 784 * context passed as @cr in any way they like and don't need to 785 * restore it. The signal emission takes care of calling cairo_save() 786 * before and cairo_restore() after invoking the handler. 787 * 788 * The signal handler will get a @cr with a clip region already set to the 789 * widget's dirty region, i.e. to the area that needs repainting. Complicated 790 * widgets that want to avoid redrawing themselves completely can get the full 791 * extents of the clip region with gdk_cairo_get_clip_rectangle(), or they can 792 * get a finer-grained representation of the dirty region with 793 * cairo_copy_clip_rectangle_list(). 794 * 795 * Params: 796 * cr = the cairo context to draw to 797 * 798 * Return: %TRUE to stop other handlers from being invoked for the event. 799 * %FALSE to propagate the event further. 800 * 801 * Since: 3.0 802 */ 803 gulong addOnDraw(bool delegate(Scoped!Context, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 804 { 805 auto wrapper = new ScopedOnDrawDelegateWrapper(dlg); 806 wrapper.handlerId = Signals.connectData( 807 this, 808 "draw", 809 cast(GCallback)&callBackScopedDraw, 810 cast(void*)wrapper, 811 cast(GClosureNotify)&callBackDrawScopedDestroy, 812 connectFlags); 813 return wrapper.handlerId; 814 } 815 816 extern(C) static int callBackScopedDraw(GtkWidget* widgetStruct, cairo_t* cr, ScopedOnDrawDelegateWrapper wrapper) 817 { 818 return wrapper.dlg(scoped!Context(cr), wrapper.outer); 819 } 820 821 extern(C) static void callBackDrawScopedDestroy(ScopedOnDrawDelegateWrapper wrapper, GClosure* closure) 822 { 823 wrapper.remove(wrapper); 824 } 825 826 protected class OnDrawDelegateWrapper 827 { 828 bool delegate(Context, Widget) dlg; 829 gulong handlerId; 830 831 this(bool delegate(Context, Widget) dlg) 832 { 833 this.dlg = dlg; 834 onDrawListeners ~= this; 835 } 836 837 void remove(OnDrawDelegateWrapper source) 838 { 839 foreach(index, wrapper; onDrawListeners) 840 { 841 if (wrapper.handlerId == source.handlerId) 842 { 843 onDrawListeners[index] = null; 844 onDrawListeners = std.algorithm.remove(onDrawListeners, index); 845 break; 846 } 847 } 848 } 849 } 850 OnDrawDelegateWrapper[] onDrawListeners; 851 852 /** 853 * This signal is emitted when a widget is supposed to render itself. 854 * The @widget's top left corner must be painted at the origin of 855 * the passed in context and be sized to the values returned by 856 * gtk_widget_get_allocated_width() and 857 * gtk_widget_get_allocated_height(). 858 * 859 * Signal handlers connected to this signal can modify the cairo 860 * context passed as @cr in any way they like and don't need to 861 * restore it. The signal emission takes care of calling cairo_save() 862 * before and cairo_restore() after invoking the handler. 863 * 864 * The signal handler will get a @cr with a clip region already set to the 865 * widget's dirty region, i.e. to the area that needs repainting. Complicated 866 * widgets that want to avoid redrawing themselves completely can get the full 867 * extents of the clip region with gdk_cairo_get_clip_rectangle(), or they can 868 * get a finer-grained representation of the dirty region with 869 * cairo_copy_clip_rectangle_list(). 870 * 871 * Params: 872 * cr = the cairo context to draw to 873 * 874 * Return: %TRUE to stop other handlers from being invoked for the event. 875 * %FALSE to propagate the event further. 876 * 877 * Since: 3.0 878 */ 879 deprecated gulong addOnDraw(bool delegate(Context, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 880 { 881 auto wrapper = new OnDrawDelegateWrapper(dlg); 882 wrapper.handlerId = Signals.connectData( 883 this, 884 "draw", 885 cast(GCallback)&callBackDraw, 886 cast(void*)wrapper, 887 cast(GClosureNotify)&callBackDrawDestroy, 888 connectFlags); 889 return wrapper.handlerId; 890 } 891 892 extern(C) static int callBackDraw(GtkWidget* widgetStruct, cairo_t* cr,OnDrawDelegateWrapper wrapper) 893 { 894 return wrapper.dlg(new Context(cr), wrapper.outer); 895 } 896 897 extern(C) static void callBackDrawDestroy(OnDrawDelegateWrapper wrapper, GClosure* closure) 898 { 899 wrapper.remove(wrapper); 900 } 901 902 /** 903 */ 904 905 /** */ 906 public static GType getType() 907 { 908 return gtk_widget_get_type(); 909 } 910 911 /** 912 * Obtains the current default reading direction. See 913 * gtk_widget_set_default_direction(). 914 * 915 * Returns: the current default direction. 916 */ 917 public static GtkTextDirection getDefaultDirection() 918 { 919 return gtk_widget_get_default_direction(); 920 } 921 922 /** 923 * Returns the default style used by all widgets initially. 924 * 925 * Deprecated: Use #GtkStyleContext instead, and 926 * gtk_css_provider_get_default() to obtain a #GtkStyleProvider 927 * with the default widget style information. 928 * 929 * Returns: the default style. This #GtkStyle 930 * object is owned by GTK+ and should not be modified or freed. 931 */ 932 public static Style getDefaultStyle() 933 { 934 auto p = gtk_widget_get_default_style(); 935 936 if(p is null) 937 { 938 return null; 939 } 940 941 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 942 } 943 944 /** 945 * Cancels the effect of a previous call to gtk_widget_push_composite_child(). 946 * 947 * Deprecated: Use gtk_widget_class_set_template(), or don’t use this API at all. 948 */ 949 public static void popCompositeChild() 950 { 951 gtk_widget_pop_composite_child(); 952 } 953 954 /** 955 * Makes all newly-created widgets as composite children until 956 * the corresponding gtk_widget_pop_composite_child() call. 957 * 958 * A composite child is a child that’s an implementation detail of the 959 * container it’s inside and should not be visible to people using the 960 * container. Composite children aren’t treated differently by GTK+ (but 961 * see gtk_container_foreach() vs. gtk_container_forall()), but e.g. GUI 962 * builders might want to treat them in a different way. 963 * 964 * Deprecated: This API never really worked well and was mostly unused, now 965 * we have a more complete mechanism for composite children, see gtk_widget_class_set_template(). 966 */ 967 public static void pushCompositeChild() 968 { 969 gtk_widget_push_composite_child(); 970 } 971 972 /** 973 * Sets the default reading direction for widgets where the 974 * direction has not been explicitly set by gtk_widget_set_direction(). 975 * 976 * Params: 977 * dir = the new default direction. This cannot be 978 * %GTK_TEXT_DIR_NONE. 979 */ 980 public static void setDefaultDirection(GtkTextDirection dir) 981 { 982 gtk_widget_set_default_direction(dir); 983 } 984 985 /** 986 * For widgets that can be “activated” (buttons, menu items, etc.) 987 * this function activates them. Activation is what happens when you 988 * press Enter on a widget during key navigation. If @widget isn't 989 * activatable, the function returns %FALSE. 990 * 991 * Returns: %TRUE if the widget was activatable 992 */ 993 public bool activate() 994 { 995 return gtk_widget_activate(gtkWidget) != 0; 996 } 997 998 /** 999 * Installs an accelerator for this @widget in @accel_group that causes 1000 * @accel_signal to be emitted if the accelerator is activated. 1001 * The @accel_group needs to be added to the widget’s toplevel via 1002 * gtk_window_add_accel_group(), and the signal must be of type %G_SIGNAL_ACTION. 1003 * Accelerators added through this function are not user changeable during 1004 * runtime. If you want to support accelerators that can be changed by the 1005 * user, use gtk_accel_map_add_entry() and gtk_widget_set_accel_path() or 1006 * gtk_menu_item_set_accel_path() instead. 1007 * 1008 * Params: 1009 * accelSignal = widget signal to emit on accelerator activation 1010 * accelGroup = accel group for this widget, added to its toplevel 1011 * accelKey = GDK keyval of the accelerator 1012 * accelMods = modifier key combination of the accelerator 1013 * accelFlags = flag accelerators, e.g. %GTK_ACCEL_VISIBLE 1014 */ 1015 public void addAccelerator(string accelSignal, AccelGroup accelGroup, uint accelKey, GdkModifierType accelMods, GtkAccelFlags accelFlags) 1016 { 1017 gtk_widget_add_accelerator(gtkWidget, Str.toStringz(accelSignal), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct(), accelKey, accelMods, accelFlags); 1018 } 1019 1020 /** 1021 * Adds the device events in the bitfield @events to the event mask for 1022 * @widget. See gtk_widget_set_device_events() for details. 1023 * 1024 * Params: 1025 * device = a #GdkDevice 1026 * events = an event mask, see #GdkEventMask 1027 * 1028 * Since: 3.0 1029 */ 1030 public void addDeviceEvents(Device device, GdkEventMask events) 1031 { 1032 gtk_widget_add_device_events(gtkWidget, (device is null) ? null : device.getDeviceStruct(), events); 1033 } 1034 1035 /** 1036 * Adds the events in the bitfield @events to the event mask for 1037 * @widget. See gtk_widget_set_events() and the 1038 * [input handling overview][event-masks] for details. 1039 * 1040 * Params: 1041 * events = an event mask, see #GdkEventMask 1042 */ 1043 public void addEvents(int events) 1044 { 1045 gtk_widget_add_events(gtkWidget, events); 1046 } 1047 1048 /** 1049 * Adds a widget to the list of mnemonic labels for 1050 * this widget. (See gtk_widget_list_mnemonic_labels()). Note the 1051 * list of mnemonic labels for the widget is cleared when the 1052 * widget is destroyed, so the caller must make sure to update 1053 * its internal state at this point as well, by using a connection 1054 * to the #GtkWidget::destroy signal or a weak notifier. 1055 * 1056 * Params: 1057 * label = a #GtkWidget that acts as a mnemonic label for @widget 1058 * 1059 * Since: 2.4 1060 */ 1061 public void addMnemonicLabel(Widget label) 1062 { 1063 gtk_widget_add_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 1064 } 1065 1066 /** 1067 * Queues an animation frame update and adds a callback to be called 1068 * before each frame. Until the tick callback is removed, it will be 1069 * called frequently (usually at the frame rate of the output device 1070 * or as quickly as the application can be repainted, whichever is 1071 * slower). For this reason, is most suitable for handling graphics 1072 * that change every frame or every few frames. The tick callback does 1073 * not automatically imply a relayout or repaint. If you want a 1074 * repaint or relayout, and aren’t changing widget properties that 1075 * would trigger that (for example, changing the text of a #GtkLabel), 1076 * then you will have to call gtk_widget_queue_resize() or 1077 * gtk_widget_queue_draw_area() yourself. 1078 * 1079 * gdk_frame_clock_get_frame_time() should generally be used for timing 1080 * continuous animations and 1081 * gdk_frame_timings_get_predicted_presentation_time() if you are 1082 * trying to display isolated frames at particular times. 1083 * 1084 * This is a more convenient alternative to connecting directly to the 1085 * #GdkFrameClock::update signal of #GdkFrameClock, since you don't 1086 * have to worry about when a #GdkFrameClock is assigned to a widget. 1087 * 1088 * Params: 1089 * callback = function to call for updating animations 1090 * userData = data to pass to @callback 1091 * notify = function to call to free @user_data when the callback is removed. 1092 * 1093 * Returns: an id for the connection of this callback. Remove the callback 1094 * by passing it to gtk_widget_remove_tick_callback() 1095 * 1096 * Since: 3.8 1097 */ 1098 public uint addTickCallback(GtkTickCallback callback, void* userData, GDestroyNotify notify) 1099 { 1100 return gtk_widget_add_tick_callback(gtkWidget, callback, userData, notify); 1101 } 1102 1103 /** 1104 * Determines whether an accelerator that activates the signal 1105 * identified by @signal_id can currently be activated. 1106 * This is done by emitting the #GtkWidget::can-activate-accel 1107 * signal on @widget; if the signal isn’t overridden by a 1108 * handler or in a derived widget, then the default check is 1109 * that the widget must be sensitive, and the widget and all 1110 * its ancestors mapped. 1111 * 1112 * Params: 1113 * signalId = the ID of a signal installed on @widget 1114 * 1115 * Returns: %TRUE if the accelerator can be activated. 1116 * 1117 * Since: 2.4 1118 */ 1119 public bool canActivateAccel(uint signalId) 1120 { 1121 return gtk_widget_can_activate_accel(gtkWidget, signalId) != 0; 1122 } 1123 1124 /** 1125 * This function is used by custom widget implementations; if you're 1126 * writing an app, you’d use gtk_widget_grab_focus() to move the focus 1127 * to a particular widget, and gtk_container_set_focus_chain() to 1128 * change the focus tab order. So you may want to investigate those 1129 * functions instead. 1130 * 1131 * gtk_widget_child_focus() is called by containers as the user moves 1132 * around the window using keyboard shortcuts. @direction indicates 1133 * what kind of motion is taking place (up, down, left, right, tab 1134 * forward, tab backward). gtk_widget_child_focus() emits the 1135 * #GtkWidget::focus signal; widgets override the default handler 1136 * for this signal in order to implement appropriate focus behavior. 1137 * 1138 * The default ::focus handler for a widget should return %TRUE if 1139 * moving in @direction left the focus on a focusable location inside 1140 * that widget, and %FALSE if moving in @direction moved the focus 1141 * outside the widget. If returning %TRUE, widgets normally 1142 * call gtk_widget_grab_focus() to place the focus accordingly; 1143 * if returning %FALSE, they don’t modify the current focus location. 1144 * 1145 * Params: 1146 * direction = direction of focus movement 1147 * 1148 * Returns: %TRUE if focus ended up inside @widget 1149 */ 1150 public bool childFocus(GtkDirectionType direction) 1151 { 1152 return gtk_widget_child_focus(gtkWidget, direction) != 0; 1153 } 1154 1155 /** 1156 * Emits a #GtkWidget::child-notify signal for the 1157 * [child property][child-properties] @child_property 1158 * on @widget. 1159 * 1160 * This is the analogue of g_object_notify() for child properties. 1161 * 1162 * Also see gtk_container_child_notify(). 1163 * 1164 * Params: 1165 * childProperty = the name of a child property installed on the 1166 * class of @widget’s parent 1167 */ 1168 public void childNotify(string childProperty) 1169 { 1170 gtk_widget_child_notify(gtkWidget, Str.toStringz(childProperty)); 1171 } 1172 1173 /** 1174 * Same as gtk_widget_path(), but always uses the name of a widget’s type, 1175 * never uses a custom name set with gtk_widget_set_name(). 1176 * 1177 * Deprecated: Use gtk_widget_get_path() instead 1178 * 1179 * Params: 1180 * pathLength = location to store the length of the 1181 * class path, or %NULL 1182 * path = location to store the class path as an 1183 * allocated string, or %NULL 1184 * pathReversed = location to store the reverse 1185 * class path as an allocated string, or %NULL 1186 */ 1187 public void classPath(out uint pathLength, out string path, out string pathReversed) 1188 { 1189 char* outpath = null; 1190 char* outpathReversed = null; 1191 1192 gtk_widget_class_path(gtkWidget, &pathLength, &outpath, &outpathReversed); 1193 1194 path = Str.toString(outpath); 1195 pathReversed = Str.toString(outpathReversed); 1196 } 1197 1198 /** 1199 * Computes whether a container should give this widget extra space 1200 * when possible. Containers should check this, rather than 1201 * looking at gtk_widget_get_hexpand() or gtk_widget_get_vexpand(). 1202 * 1203 * This function already checks whether the widget is visible, so 1204 * visibility does not need to be checked separately. Non-visible 1205 * widgets are not expanded. 1206 * 1207 * The computed expand value uses either the expand setting explicitly 1208 * set on the widget itself, or, if none has been explicitly set, 1209 * the widget may expand if some of its children do. 1210 * 1211 * Params: 1212 * orientation = expand direction 1213 * 1214 * Returns: whether widget tree rooted here should be expanded 1215 */ 1216 public bool computeExpand(GtkOrientation orientation) 1217 { 1218 return gtk_widget_compute_expand(gtkWidget, orientation) != 0; 1219 } 1220 1221 /** 1222 * Creates a new #PangoContext with the appropriate font map, 1223 * font options, font description, and base direction for drawing 1224 * text for this widget. See also gtk_widget_get_pango_context(). 1225 * 1226 * Returns: the new #PangoContext 1227 */ 1228 public PgContext createPangoContext() 1229 { 1230 auto p = gtk_widget_create_pango_context(gtkWidget); 1231 1232 if(p is null) 1233 { 1234 return null; 1235 } 1236 1237 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p, true); 1238 } 1239 1240 /** 1241 * Creates a new #PangoLayout with the appropriate font map, 1242 * font description, and base direction for drawing text for 1243 * this widget. 1244 * 1245 * If you keep a #PangoLayout created in this way around, you need 1246 * to re-create it when the widget #PangoContext is replaced. 1247 * This can be tracked by using the #GtkWidget::screen-changed signal 1248 * on the widget. 1249 * 1250 * Params: 1251 * text = text to set on the layout (can be %NULL) 1252 * 1253 * Returns: the new #PangoLayout 1254 */ 1255 public PgLayout createPangoLayout(string text) 1256 { 1257 auto p = gtk_widget_create_pango_layout(gtkWidget, Str.toStringz(text)); 1258 1259 if(p is null) 1260 { 1261 return null; 1262 } 1263 1264 return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) p, true); 1265 } 1266 1267 /** 1268 * Destroys a widget. 1269 * 1270 * When a widget is destroyed all references it holds on other objects 1271 * will be released: 1272 * 1273 * - if the widget is inside a container, it will be removed from its 1274 * parent 1275 * - if the widget is a container, all its children will be destroyed, 1276 * recursively 1277 * - if the widget is a top level, it will be removed from the list 1278 * of top level widgets that GTK+ maintains internally 1279 * 1280 * It's expected that all references held on the widget will also 1281 * be released; you should connect to the #GtkWidget::destroy signal 1282 * if you hold a reference to @widget and you wish to remove it when 1283 * this function is called. It is not necessary to do so if you are 1284 * implementing a #GtkContainer, as you'll be able to use the 1285 * #GtkContainerClass.remove() virtual function for that. 1286 * 1287 * It's important to notice that gtk_widget_destroy() will only cause 1288 * the @widget to be finalized if no additional references, acquired 1289 * using g_object_ref(), are held on it. In case additional references 1290 * are in place, the @widget will be in an "inert" state after calling 1291 * this function; @widget will still point to valid memory, allowing you 1292 * to release the references you hold, but you may not query the widget's 1293 * own state. 1294 * 1295 * You should typically call this function on top level widgets, and 1296 * rarely on child widgets. 1297 * 1298 * See also: gtk_container_remove() 1299 */ 1300 public void destroy() 1301 { 1302 gtk_widget_destroy(gtkWidget); 1303 } 1304 1305 /** 1306 * This function sets *@widget_pointer to %NULL if @widget_pointer != 1307 * %NULL. It’s intended to be used as a callback connected to the 1308 * “destroy” signal of a widget. You connect gtk_widget_destroyed() 1309 * as a signal handler, and pass the address of your widget variable 1310 * as user data. Then when the widget is destroyed, the variable will 1311 * be set to %NULL. Useful for example to avoid multiple copies 1312 * of the same dialog. 1313 * 1314 * Params: 1315 * widgetPointer = address of a variable that contains @widget 1316 */ 1317 public void destroyed(ref Widget widgetPointer) 1318 { 1319 GtkWidget* outwidgetPointer = widgetPointer.getWidgetStruct(); 1320 1321 gtk_widget_destroyed(gtkWidget, &outwidgetPointer); 1322 1323 widgetPointer = ObjectG.getDObject!(Widget)(outwidgetPointer); 1324 } 1325 1326 /** 1327 * Returns %TRUE if @device has been shadowed by a GTK+ 1328 * device grab on another widget, so it would stop sending 1329 * events to @widget. This may be used in the 1330 * #GtkWidget::grab-notify signal to check for specific 1331 * devices. See gtk_device_grab_add(). 1332 * 1333 * Params: 1334 * device = a #GdkDevice 1335 * 1336 * Returns: %TRUE if there is an ongoing grab on @device 1337 * by another #GtkWidget than @widget. 1338 * 1339 * Since: 3.0 1340 */ 1341 public bool deviceIsShadowed(Device device) 1342 { 1343 return gtk_widget_device_is_shadowed(gtkWidget, (device is null) ? null : device.getDeviceStruct()) != 0; 1344 } 1345 1346 /** 1347 * This function is equivalent to gtk_drag_begin_with_coordinates(), 1348 * passing -1, -1 as coordinates. 1349 * 1350 * Deprecated: Use gtk_drag_begin_with_coordinates() instead 1351 * 1352 * Params: 1353 * targets = The targets (data formats) in which the 1354 * source can provide the data 1355 * actions = A bitmask of the allowed drag actions for this drag 1356 * button = The button the user clicked to start the drag 1357 * event = The event that triggered the start of the drag, 1358 * or %NULL if none can be obtained. 1359 * 1360 * Returns: the context for this drag 1361 */ 1362 public DragContext dragBegin(TargetList targets, GdkDragAction actions, int button, Event event) 1363 { 1364 auto p = gtk_drag_begin(gtkWidget, (targets is null) ? null : targets.getTargetListStruct(), actions, button, (event is null) ? null : event.getEventStruct()); 1365 1366 if(p is null) 1367 { 1368 return null; 1369 } 1370 1371 return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p); 1372 } 1373 1374 /** 1375 * Initiates a drag on the source side. The function only needs to be used 1376 * when the application is starting drags itself, and is not needed when 1377 * gtk_drag_source_set() is used. 1378 * 1379 * The @event is used to retrieve the timestamp that will be used internally to 1380 * grab the pointer. If @event is %NULL, then %GDK_CURRENT_TIME will be used. 1381 * However, you should try to pass a real event in all cases, since that can be 1382 * used to get information about the drag. 1383 * 1384 * Generally there are three cases when you want to start a drag by hand by 1385 * calling this function: 1386 * 1387 * 1. During a #GtkWidget::button-press-event handler, if you want to start a drag 1388 * immediately when the user presses the mouse button. Pass the @event 1389 * that you have in your #GtkWidget::button-press-event handler. 1390 * 1391 * 2. During a #GtkWidget::motion-notify-event handler, if you want to start a drag 1392 * when the mouse moves past a certain threshold distance after a button-press. 1393 * Pass the @event that you have in your #GtkWidget::motion-notify-event handler. 1394 * 1395 * 3. During a timeout handler, if you want to start a drag after the mouse 1396 * button is held down for some time. Try to save the last event that you got 1397 * from the mouse, using gdk_event_copy(), and pass it to this function 1398 * (remember to free the event with gdk_event_free() when you are done). 1399 * If you can really not pass a real event, pass #NULL instead. 1400 * 1401 * Params: 1402 * targets = The targets (data formats) in which the 1403 * source can provide the data 1404 * actions = A bitmask of the allowed drag actions for this drag 1405 * button = The button the user clicked to start the drag 1406 * event = The event that triggered the start of the drag, 1407 * or %NULL if none can be obtained. 1408 * x = The initial x coordinate to start dragging from, in the coordinate space 1409 * of @widget. If -1 is passed, the coordinates are retrieved from @event or 1410 * the current pointer position 1411 * y = The initial y coordinate to start dragging from, in the coordinate space 1412 * of @widget. If -1 is passed, the coordinates are retrieved from @event or 1413 * the current pointer position 1414 * 1415 * Returns: the context for this drag 1416 * 1417 * Since: 3.10 1418 */ 1419 public DragContext dragBeginWithCoordinates(TargetList targets, GdkDragAction actions, int button, Event event, int x, int y) 1420 { 1421 auto p = gtk_drag_begin_with_coordinates(gtkWidget, (targets is null) ? null : targets.getTargetListStruct(), actions, button, (event is null) ? null : event.getEventStruct(), x, y); 1422 1423 if(p is null) 1424 { 1425 return null; 1426 } 1427 1428 return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p); 1429 } 1430 1431 /** 1432 * Checks to see if a mouse drag starting at (@start_x, @start_y) and ending 1433 * at (@current_x, @current_y) has passed the GTK+ drag threshold, and thus 1434 * should trigger the beginning of a drag-and-drop operation. 1435 * 1436 * Params: 1437 * startX = X coordinate of start of drag 1438 * startY = Y coordinate of start of drag 1439 * currentX = current X coordinate 1440 * currentY = current Y coordinate 1441 * 1442 * Returns: %TRUE if the drag threshold has been passed. 1443 */ 1444 public bool dragCheckThreshold(int startX, int startY, int currentX, int currentY) 1445 { 1446 return gtk_drag_check_threshold(gtkWidget, startX, startY, currentX, currentY) != 0; 1447 } 1448 1449 /** 1450 * Add the image targets supported by #GtkSelectionData to 1451 * the target list of the drag destination. The targets 1452 * are added with @info = 0. If you need another value, 1453 * use gtk_target_list_add_image_targets() and 1454 * gtk_drag_dest_set_target_list(). 1455 * 1456 * Since: 2.6 1457 */ 1458 public void dragDestAddImageTargets() 1459 { 1460 gtk_drag_dest_add_image_targets(gtkWidget); 1461 } 1462 1463 /** 1464 * Add the text targets supported by #GtkSelectionData to 1465 * the target list of the drag destination. The targets 1466 * are added with @info = 0. If you need another value, 1467 * use gtk_target_list_add_text_targets() and 1468 * gtk_drag_dest_set_target_list(). 1469 * 1470 * Since: 2.6 1471 */ 1472 public void dragDestAddTextTargets() 1473 { 1474 gtk_drag_dest_add_text_targets(gtkWidget); 1475 } 1476 1477 /** 1478 * Add the URI targets supported by #GtkSelectionData to 1479 * the target list of the drag destination. The targets 1480 * are added with @info = 0. If you need another value, 1481 * use gtk_target_list_add_uri_targets() and 1482 * gtk_drag_dest_set_target_list(). 1483 * 1484 * Since: 2.6 1485 */ 1486 public void dragDestAddUriTargets() 1487 { 1488 gtk_drag_dest_add_uri_targets(gtkWidget); 1489 } 1490 1491 /** 1492 * Looks for a match between the supported targets of @context and the 1493 * @dest_target_list, returning the first matching target, otherwise 1494 * returning %GDK_NONE. @dest_target_list should usually be the return 1495 * value from gtk_drag_dest_get_target_list(), but some widgets may 1496 * have different valid targets for different parts of the widget; in 1497 * that case, they will have to implement a drag_motion handler that 1498 * passes the correct target list to this function. 1499 * 1500 * Params: 1501 * context = drag context 1502 * targetList = list of droppable targets, or %NULL to use 1503 * gtk_drag_dest_get_target_list (@widget). 1504 * 1505 * Returns: first target that the source offers 1506 * and the dest can accept, or %GDK_NONE 1507 */ 1508 public GdkAtom dragDestFindTarget(DragContext context, TargetList targetList) 1509 { 1510 return gtk_drag_dest_find_target(gtkWidget, (context is null) ? null : context.getDragContextStruct(), (targetList is null) ? null : targetList.getTargetListStruct()); 1511 } 1512 1513 /** 1514 * Returns the list of targets this widget can accept from 1515 * drag-and-drop. 1516 * 1517 * Returns: the #GtkTargetList, or %NULL if none 1518 */ 1519 public TargetList dragDestGetTargetList() 1520 { 1521 auto p = gtk_drag_dest_get_target_list(gtkWidget); 1522 1523 if(p is null) 1524 { 1525 return null; 1526 } 1527 1528 return ObjectG.getDObject!(TargetList)(cast(GtkTargetList*) p); 1529 } 1530 1531 /** 1532 * Returns whether the widget has been configured to always 1533 * emit #GtkWidget::drag-motion signals. 1534 * 1535 * Returns: %TRUE if the widget always emits 1536 * #GtkWidget::drag-motion events 1537 * 1538 * Since: 2.10 1539 */ 1540 public bool dragDestGetTrackMotion() 1541 { 1542 return gtk_drag_dest_get_track_motion(gtkWidget) != 0; 1543 } 1544 1545 /** 1546 * Sets a widget as a potential drop destination, and adds default behaviors. 1547 * 1548 * The default behaviors listed in @flags have an effect similar 1549 * to installing default handlers for the widget’s drag-and-drop signals 1550 * (#GtkWidget::drag-motion, #GtkWidget::drag-drop, ...). They all exist 1551 * for convenience. When passing #GTK_DEST_DEFAULT_ALL for instance it is 1552 * sufficient to connect to the widget’s #GtkWidget::drag-data-received 1553 * signal to get primitive, but consistent drag-and-drop support. 1554 * 1555 * Things become more complicated when you try to preview the dragged data, 1556 * as described in the documentation for #GtkWidget::drag-motion. The default 1557 * behaviors described by @flags make some assumptions, that can conflict 1558 * with your own signal handlers. For instance #GTK_DEST_DEFAULT_DROP causes 1559 * invokations of gdk_drag_status() in the context of #GtkWidget::drag-motion, 1560 * and invokations of gtk_drag_finish() in #GtkWidget::drag-data-received. 1561 * Especially the later is dramatic, when your own #GtkWidget::drag-motion 1562 * handler calls gtk_drag_get_data() to inspect the dragged data. 1563 * 1564 * There’s no way to set a default action here, you can use the 1565 * #GtkWidget::drag-motion callback for that. Here’s an example which selects 1566 * the action to use depending on whether the control key is pressed or not: 1567 * |[<!-- language="C" --> 1568 * static void 1569 * drag_motion (GtkWidget *widget, 1570 * GdkDragContext *context, 1571 * gint x, 1572 * gint y, 1573 * guint time) 1574 * { 1575 * GdkModifierType mask; 1576 * 1577 * gdk_window_get_pointer (gtk_widget_get_window (widget), 1578 * NULL, NULL, &mask); 1579 * if (mask & GDK_CONTROL_MASK) 1580 * gdk_drag_status (context, GDK_ACTION_COPY, time); 1581 * else 1582 * gdk_drag_status (context, GDK_ACTION_MOVE, time); 1583 * } 1584 * ]| 1585 * 1586 * Params: 1587 * flags = which types of default drag behavior to use 1588 * targets = a pointer to an array of 1589 * #GtkTargetEntrys indicating the drop types that this @widget will 1590 * accept, or %NULL. Later you can access the list with 1591 * gtk_drag_dest_get_target_list() and gtk_drag_dest_find_target(). 1592 * actions = a bitmask of possible actions for a drop onto this @widget. 1593 */ 1594 public void dragDestSet(GtkDestDefaults flags, TargetEntry[] targets, GdkDragAction actions) 1595 { 1596 GtkTargetEntry[] targetsArray = new GtkTargetEntry[targets.length]; 1597 for ( int i = 0; i < targets.length; i++ ) 1598 { 1599 targetsArray[i] = *(targets[i].getTargetEntryStruct()); 1600 } 1601 1602 gtk_drag_dest_set(gtkWidget, flags, targetsArray.ptr, cast(int)targets.length, actions); 1603 } 1604 1605 /** 1606 * Sets this widget as a proxy for drops to another window. 1607 * 1608 * Params: 1609 * proxyWindow = the window to which to forward drag events 1610 * protocol = the drag protocol which the @proxy_window accepts 1611 * (You can use gdk_drag_get_protocol() to determine this) 1612 * useCoordinates = If %TRUE, send the same coordinates to the 1613 * destination, because it is an embedded 1614 * subwindow. 1615 */ 1616 public void dragDestSetProxy(GdkWin proxyWindow, GdkDragProtocol protocol, bool useCoordinates) 1617 { 1618 gtk_drag_dest_set_proxy(gtkWidget, (proxyWindow is null) ? null : proxyWindow.getWindowStruct(), protocol, useCoordinates); 1619 } 1620 1621 /** 1622 * Sets the target types that this widget can accept from drag-and-drop. 1623 * The widget must first be made into a drag destination with 1624 * gtk_drag_dest_set(). 1625 * 1626 * Params: 1627 * targetList = list of droppable targets, or %NULL for none 1628 */ 1629 public void dragDestSetTargetList(TargetList targetList) 1630 { 1631 gtk_drag_dest_set_target_list(gtkWidget, (targetList is null) ? null : targetList.getTargetListStruct()); 1632 } 1633 1634 /** 1635 * Tells the widget to emit #GtkWidget::drag-motion and 1636 * #GtkWidget::drag-leave events regardless of the targets and the 1637 * %GTK_DEST_DEFAULT_MOTION flag. 1638 * 1639 * This may be used when a widget wants to do generic 1640 * actions regardless of the targets that the source offers. 1641 * 1642 * Params: 1643 * trackMotion = whether to accept all targets 1644 * 1645 * Since: 2.10 1646 */ 1647 public void dragDestSetTrackMotion(bool trackMotion) 1648 { 1649 gtk_drag_dest_set_track_motion(gtkWidget, trackMotion); 1650 } 1651 1652 /** 1653 * Clears information about a drop destination set with 1654 * gtk_drag_dest_set(). The widget will no longer receive 1655 * notification of drags. 1656 */ 1657 public void dragDestUnset() 1658 { 1659 gtk_drag_dest_unset(gtkWidget); 1660 } 1661 1662 /** 1663 * Gets the data associated with a drag. When the data 1664 * is received or the retrieval fails, GTK+ will emit a 1665 * #GtkWidget::drag-data-received signal. Failure of the retrieval 1666 * is indicated by the length field of the @selection_data 1667 * signal parameter being negative. However, when gtk_drag_get_data() 1668 * is called implicitely because the %GTK_DEST_DEFAULT_DROP was set, 1669 * then the widget will not receive notification of failed 1670 * drops. 1671 * 1672 * Params: 1673 * context = the drag context 1674 * target = the target (form of the data) to retrieve 1675 * time = a timestamp for retrieving the data. This will 1676 * generally be the time received in a #GtkWidget::drag-motion 1677 * or #GtkWidget::drag-drop signal 1678 */ 1679 public void dragGetData(DragContext context, GdkAtom target, uint time) 1680 { 1681 gtk_drag_get_data(gtkWidget, (context is null) ? null : context.getDragContextStruct(), target, time); 1682 } 1683 1684 /** 1685 * Highlights a widget as a currently hovered drop target. 1686 * To end the highlight, call gtk_drag_unhighlight(). 1687 * GTK+ calls this automatically if %GTK_DEST_DEFAULT_HIGHLIGHT is set. 1688 */ 1689 public void dragHighlight() 1690 { 1691 gtk_drag_highlight(gtkWidget); 1692 } 1693 1694 /** 1695 * Add the writable image targets supported by #GtkSelectionData to 1696 * the target list of the drag source. The targets 1697 * are added with @info = 0. If you need another value, 1698 * use gtk_target_list_add_image_targets() and 1699 * gtk_drag_source_set_target_list(). 1700 * 1701 * Since: 2.6 1702 */ 1703 public void dragSourceAddImageTargets() 1704 { 1705 gtk_drag_source_add_image_targets(gtkWidget); 1706 } 1707 1708 /** 1709 * Add the text targets supported by #GtkSelectionData to 1710 * the target list of the drag source. The targets 1711 * are added with @info = 0. If you need another value, 1712 * use gtk_target_list_add_text_targets() and 1713 * gtk_drag_source_set_target_list(). 1714 * 1715 * Since: 2.6 1716 */ 1717 public void dragSourceAddTextTargets() 1718 { 1719 gtk_drag_source_add_text_targets(gtkWidget); 1720 } 1721 1722 /** 1723 * Add the URI targets supported by #GtkSelectionData to 1724 * the target list of the drag source. The targets 1725 * are added with @info = 0. If you need another value, 1726 * use gtk_target_list_add_uri_targets() and 1727 * gtk_drag_source_set_target_list(). 1728 * 1729 * Since: 2.6 1730 */ 1731 public void dragSourceAddUriTargets() 1732 { 1733 gtk_drag_source_add_uri_targets(gtkWidget); 1734 } 1735 1736 /** 1737 * Gets the list of targets this widget can provide for 1738 * drag-and-drop. 1739 * 1740 * Returns: the #GtkTargetList, or %NULL if none 1741 * 1742 * Since: 2.4 1743 */ 1744 public TargetList dragSourceGetTargetList() 1745 { 1746 auto p = gtk_drag_source_get_target_list(gtkWidget); 1747 1748 if(p is null) 1749 { 1750 return null; 1751 } 1752 1753 return ObjectG.getDObject!(TargetList)(cast(GtkTargetList*) p); 1754 } 1755 1756 /** 1757 * Sets up a widget so that GTK+ will start a drag operation when the user 1758 * clicks and drags on the widget. The widget must have a window. 1759 * 1760 * Params: 1761 * startButtonMask = the bitmask of buttons that can start the drag 1762 * targets = the table of targets 1763 * that the drag will support, may be %NULL 1764 * actions = the bitmask of possible actions for a drag from this widget 1765 */ 1766 public void dragSourceSet(GdkModifierType startButtonMask, TargetEntry[] targets, GdkDragAction actions) 1767 { 1768 GtkTargetEntry[] targetsArray = new GtkTargetEntry[targets.length]; 1769 for ( int i = 0; i < targets.length; i++ ) 1770 { 1771 targetsArray[i] = *(targets[i].getTargetEntryStruct()); 1772 } 1773 1774 gtk_drag_source_set(gtkWidget, startButtonMask, targetsArray.ptr, cast(int)targets.length, actions); 1775 } 1776 1777 /** 1778 * Sets the icon that will be used for drags from a particular source 1779 * to @icon. See the docs for #GtkIconTheme for more details. 1780 * 1781 * Params: 1782 * icon = A #GIcon 1783 * 1784 * Since: 3.2 1785 */ 1786 public void dragSourceSetIconGicon(IconIF icon) 1787 { 1788 gtk_drag_source_set_icon_gicon(gtkWidget, (icon is null) ? null : icon.getIconStruct()); 1789 } 1790 1791 /** 1792 * Sets the icon that will be used for drags from a particular source 1793 * to a themed icon. See the docs for #GtkIconTheme for more details. 1794 * 1795 * Params: 1796 * iconName = name of icon to use 1797 * 1798 * Since: 2.8 1799 */ 1800 public void dragSourceSetIconName(string iconName) 1801 { 1802 gtk_drag_source_set_icon_name(gtkWidget, Str.toStringz(iconName)); 1803 } 1804 1805 /** 1806 * Sets the icon that will be used for drags from a particular widget 1807 * from a #GdkPixbuf. GTK+ retains a reference for @pixbuf and will 1808 * release it when it is no longer needed. 1809 * 1810 * Params: 1811 * pixbuf = the #GdkPixbuf for the drag icon 1812 */ 1813 public void dragSourceSetIconPixbuf(Pixbuf pixbuf) 1814 { 1815 gtk_drag_source_set_icon_pixbuf(gtkWidget, (pixbuf is null) ? null : pixbuf.getPixbufStruct()); 1816 } 1817 1818 /** 1819 * Sets the icon that will be used for drags from a particular source 1820 * to a stock icon. 1821 * 1822 * Deprecated: Use gtk_drag_source_set_icon_name() instead. 1823 * 1824 * Params: 1825 * stockId = the ID of the stock icon to use 1826 */ 1827 public void dragSourceSetIconStock(string stockId) 1828 { 1829 gtk_drag_source_set_icon_stock(gtkWidget, Str.toStringz(stockId)); 1830 } 1831 1832 /** 1833 * Changes the target types that this widget offers for drag-and-drop. 1834 * The widget must first be made into a drag source with 1835 * gtk_drag_source_set(). 1836 * 1837 * Params: 1838 * targetList = list of draggable targets, or %NULL for none 1839 * 1840 * Since: 2.4 1841 */ 1842 public void dragSourceSetTargetList(TargetList targetList) 1843 { 1844 gtk_drag_source_set_target_list(gtkWidget, (targetList is null) ? null : targetList.getTargetListStruct()); 1845 } 1846 1847 /** 1848 * Undoes the effects of gtk_drag_source_set(). 1849 */ 1850 public void dragSourceUnset() 1851 { 1852 gtk_drag_source_unset(gtkWidget); 1853 } 1854 1855 /** 1856 * Removes a highlight set by gtk_drag_highlight() from 1857 * a widget. 1858 */ 1859 public void dragUnhighlight() 1860 { 1861 gtk_drag_unhighlight(gtkWidget); 1862 } 1863 1864 /** 1865 * Draws @widget to @cr. The top left corner of the widget will be 1866 * drawn to the currently set origin point of @cr. 1867 * 1868 * You should pass a cairo context as @cr argument that is in an 1869 * original state. Otherwise the resulting drawing is undefined. For 1870 * example changing the operator using cairo_set_operator() or the 1871 * line width using cairo_set_line_width() might have unwanted side 1872 * effects. 1873 * You may however change the context’s transform matrix - like with 1874 * cairo_scale(), cairo_translate() or cairo_set_matrix() and clip 1875 * region with cairo_clip() prior to calling this function. Also, it 1876 * is fine to modify the context with cairo_save() and 1877 * cairo_push_group() prior to calling this function. 1878 * 1879 * Note that special-purpose widgets may contain special code for 1880 * rendering to the screen and might appear differently on screen 1881 * and when rendered using gtk_widget_draw(). 1882 * 1883 * Params: 1884 * cr = a cairo context to draw to 1885 * 1886 * Since: 3.0 1887 */ 1888 public void draw(Context cr) 1889 { 1890 gtk_widget_draw(gtkWidget, (cr is null) ? null : cr.getContextStruct()); 1891 } 1892 1893 /** 1894 * Ensures that @widget has a style (@widget->style). 1895 * 1896 * Not a very useful function; most of the time, if you 1897 * want the style, the widget is realized, and realized 1898 * widgets are guaranteed to have a style already. 1899 * 1900 * Deprecated: Use #GtkStyleContext instead 1901 */ 1902 public void ensureStyle() 1903 { 1904 gtk_widget_ensure_style(gtkWidget); 1905 } 1906 1907 /** 1908 * Notifies the user about an input-related error on this widget. 1909 * If the #GtkSettings:gtk-error-bell setting is %TRUE, it calls 1910 * gdk_window_beep(), otherwise it does nothing. 1911 * 1912 * Note that the effect of gdk_window_beep() can be configured in many 1913 * ways, depending on the windowing backend and the desktop environment 1914 * or window manager that is used. 1915 * 1916 * Since: 2.12 1917 */ 1918 public void errorBell() 1919 { 1920 gtk_widget_error_bell(gtkWidget); 1921 } 1922 1923 /** 1924 * Rarely-used function. This function is used to emit 1925 * the event signals on a widget (those signals should never 1926 * be emitted without using this function to do so). 1927 * If you want to synthesize an event though, don’t use this function; 1928 * instead, use gtk_main_do_event() so the event will behave as if 1929 * it were in the event queue. Don’t synthesize expose events; instead, 1930 * use gdk_window_invalidate_rect() to invalidate a region of the 1931 * window. 1932 * 1933 * Params: 1934 * event = a #GdkEvent 1935 * 1936 * Returns: return from the event signal emission (%TRUE if 1937 * the event was handled) 1938 */ 1939 public bool event(Event event) 1940 { 1941 return gtk_widget_event(gtkWidget, (event is null) ? null : event.getEventStruct()) != 0; 1942 } 1943 1944 /** 1945 * Stops emission of #GtkWidget::child-notify signals on @widget. The 1946 * signals are queued until gtk_widget_thaw_child_notify() is called 1947 * on @widget. 1948 * 1949 * This is the analogue of g_object_freeze_notify() for child properties. 1950 */ 1951 public void freezeChildNotify() 1952 { 1953 gtk_widget_freeze_child_notify(gtkWidget); 1954 } 1955 1956 /** 1957 * Returns the accessible object that describes the widget to an 1958 * assistive technology. 1959 * 1960 * If accessibility support is not available, this #AtkObject 1961 * instance may be a no-op. Likewise, if no class-specific #AtkObject 1962 * implementation is available for the widget instance in question, 1963 * it will inherit an #AtkObject implementation from the first ancestor 1964 * class for which such an implementation is defined. 1965 * 1966 * The documentation of the 1967 * [ATK](http://developer.gnome.org/atk/stable/) 1968 * library contains more information about accessible objects and their uses. 1969 * 1970 * Returns: the #AtkObject associated with @widget 1971 */ 1972 public ObjectAtk getAccessible() 1973 { 1974 auto p = gtk_widget_get_accessible(gtkWidget); 1975 1976 if(p is null) 1977 { 1978 return null; 1979 } 1980 1981 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 1982 } 1983 1984 /** 1985 * Retrieves the #GActionGroup that was registered using @prefix. The resulting 1986 * #GActionGroup may have been registered to @widget or any #GtkWidget in its 1987 * ancestry. 1988 * 1989 * If no action group was found matching @prefix, then %NULL is returned. 1990 * 1991 * Params: 1992 * prefix = The “prefix” of the action group. 1993 * 1994 * Returns: A #GActionGroup or %NULL. 1995 * 1996 * Since: 3.16 1997 */ 1998 public ActionGroupIF getActionGroup(string prefix) 1999 { 2000 auto p = gtk_widget_get_action_group(gtkWidget, Str.toStringz(prefix)); 2001 2002 if(p is null) 2003 { 2004 return null; 2005 } 2006 2007 return ObjectG.getDObject!(ActionGroupIF)(cast(GActionGroup*) p); 2008 } 2009 2010 /** 2011 * Returns the baseline that has currently been allocated to @widget. 2012 * This function is intended to be used when implementing handlers 2013 * for the #GtkWidget::draw function, and when allocating child 2014 * widgets in #GtkWidget::size_allocate. 2015 * 2016 * Returns: the baseline of the @widget, or -1 if none 2017 * 2018 * Since: 3.10 2019 */ 2020 public int getAllocatedBaseline() 2021 { 2022 return gtk_widget_get_allocated_baseline(gtkWidget); 2023 } 2024 2025 /** 2026 * Returns the height that has currently been allocated to @widget. 2027 * This function is intended to be used when implementing handlers 2028 * for the #GtkWidget::draw function. 2029 * 2030 * Returns: the height of the @widget 2031 */ 2032 public int getAllocatedHeight() 2033 { 2034 return gtk_widget_get_allocated_height(gtkWidget); 2035 } 2036 2037 /** 2038 * Retrieves the widget’s allocated size. 2039 * 2040 * This function returns the last values passed to 2041 * gtk_widget_size_allocate_with_baseline(). The value differs from 2042 * the size returned in gtk_widget_get_allocation() in that functions 2043 * like gtk_widget_set_halign() can adjust the allocation, but not 2044 * the value returned by this function. 2045 * 2046 * If a widget is not visible, its allocated size is 0. 2047 * 2048 * Params: 2049 * allocation = a pointer to a #GtkAllocation to copy to 2050 * baseline = a pointer to an integer to copy to 2051 * 2052 * Since: 3.20 2053 */ 2054 public void getAllocatedSize(out GtkAllocation allocation, out int baseline) 2055 { 2056 gtk_widget_get_allocated_size(gtkWidget, &allocation, &baseline); 2057 } 2058 2059 /** 2060 * Returns the width that has currently been allocated to @widget. 2061 * This function is intended to be used when implementing handlers 2062 * for the #GtkWidget::draw function. 2063 * 2064 * Returns: the width of the @widget 2065 */ 2066 public int getAllocatedWidth() 2067 { 2068 return gtk_widget_get_allocated_width(gtkWidget); 2069 } 2070 2071 /** 2072 * Retrieves the widget’s allocation. 2073 * 2074 * Note, when implementing a #GtkContainer: a widget’s allocation will 2075 * be its “adjusted” allocation, that is, the widget’s parent 2076 * container typically calls gtk_widget_size_allocate() with an 2077 * allocation, and that allocation is then adjusted (to handle margin 2078 * and alignment for example) before assignment to the widget. 2079 * gtk_widget_get_allocation() returns the adjusted allocation that 2080 * was actually assigned to the widget. The adjusted allocation is 2081 * guaranteed to be completely contained within the 2082 * gtk_widget_size_allocate() allocation, however. So a #GtkContainer 2083 * is guaranteed that its children stay inside the assigned bounds, 2084 * but not that they have exactly the bounds the container assigned. 2085 * There is no way to get the original allocation assigned by 2086 * gtk_widget_size_allocate(), since it isn’t stored; if a container 2087 * implementation needs that information it will have to track it itself. 2088 * 2089 * Params: 2090 * allocation = a pointer to a #GtkAllocation to copy to 2091 * 2092 * Since: 2.18 2093 */ 2094 public void getAllocation(out GtkAllocation allocation) 2095 { 2096 gtk_widget_get_allocation(gtkWidget, &allocation); 2097 } 2098 2099 /** 2100 * Gets the first ancestor of @widget with type @widget_type. For example, 2101 * `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` gets 2102 * the first #GtkBox that’s an ancestor of @widget. No reference will be 2103 * added to the returned widget; it should not be unreferenced. See note 2104 * about checking for a toplevel #GtkWindow in the docs for 2105 * gtk_widget_get_toplevel(). 2106 * 2107 * Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor() 2108 * considers @widget to be an ancestor of itself. 2109 * 2110 * Params: 2111 * widgetType = ancestor type 2112 * 2113 * Returns: the ancestor widget, or %NULL if not found 2114 */ 2115 public Widget getAncestor(GType widgetType) 2116 { 2117 auto p = gtk_widget_get_ancestor(gtkWidget, widgetType); 2118 2119 if(p is null) 2120 { 2121 return null; 2122 } 2123 2124 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 2125 } 2126 2127 /** 2128 * Determines whether the application intends to draw on the widget in 2129 * an #GtkWidget::draw handler. 2130 * 2131 * See gtk_widget_set_app_paintable() 2132 * 2133 * Returns: %TRUE if the widget is app paintable 2134 * 2135 * Since: 2.18 2136 */ 2137 public bool getAppPaintable() 2138 { 2139 return gtk_widget_get_app_paintable(gtkWidget) != 0; 2140 } 2141 2142 /** 2143 * Determines whether @widget can be a default widget. See 2144 * gtk_widget_set_can_default(). 2145 * 2146 * Returns: %TRUE if @widget can be a default widget, %FALSE otherwise 2147 * 2148 * Since: 2.18 2149 */ 2150 public bool getCanDefault() 2151 { 2152 return gtk_widget_get_can_default(gtkWidget) != 0; 2153 } 2154 2155 /** 2156 * Determines whether @widget can own the input focus. See 2157 * gtk_widget_set_can_focus(). 2158 * 2159 * Returns: %TRUE if @widget can own the input focus, %FALSE otherwise 2160 * 2161 * Since: 2.18 2162 */ 2163 public bool getCanFocus() 2164 { 2165 return gtk_widget_get_can_focus(gtkWidget) != 0; 2166 } 2167 2168 /** 2169 * This function is only for use in widget implementations. Obtains 2170 * @widget->requisition, unless someone has forced a particular 2171 * geometry on the widget (e.g. with gtk_widget_set_size_request()), 2172 * in which case it returns that geometry instead of the widget's 2173 * requisition. 2174 * 2175 * This function differs from gtk_widget_size_request() in that 2176 * it retrieves the last size request value from @widget->requisition, 2177 * while gtk_widget_size_request() actually calls the "size_request" method 2178 * on @widget to compute the size request and fill in @widget->requisition, 2179 * and only then returns @widget->requisition. 2180 * 2181 * Because this function does not call the “size_request” method, it 2182 * can only be used when you know that @widget->requisition is 2183 * up-to-date, that is, gtk_widget_size_request() has been called 2184 * since the last time a resize was queued. In general, only container 2185 * implementations have this information; applications should use 2186 * gtk_widget_size_request(). 2187 * 2188 * Deprecated: Use gtk_widget_get_preferred_size() instead. 2189 * 2190 * Params: 2191 * requisition = a #GtkRequisition to be filled in 2192 */ 2193 public void getChildRequisition(out Requisition requisition) 2194 { 2195 GtkRequisition* outrequisition = gMalloc!GtkRequisition(); 2196 2197 gtk_widget_get_child_requisition(gtkWidget, outrequisition); 2198 2199 requisition = ObjectG.getDObject!(Requisition)(outrequisition, true); 2200 } 2201 2202 /** 2203 * Gets the value set with gtk_widget_set_child_visible(). 2204 * If you feel a need to use this function, your code probably 2205 * needs reorganization. 2206 * 2207 * This function is only useful for container implementations and 2208 * never should be called by an application. 2209 * 2210 * Returns: %TRUE if the widget is mapped with the parent. 2211 */ 2212 public bool getChildVisible() 2213 { 2214 return gtk_widget_get_child_visible(gtkWidget) != 0; 2215 } 2216 2217 /** 2218 * Retrieves the widget’s clip area. 2219 * 2220 * The clip area is the area in which all of @widget's drawing will 2221 * happen. Other toolkits call it the bounding box. 2222 * 2223 * Historically, in GTK+ the clip area has been equal to the allocation 2224 * retrieved via gtk_widget_get_allocation(). 2225 * 2226 * Params: 2227 * clip = a pointer to a #GtkAllocation to copy to 2228 * 2229 * Since: 3.14 2230 */ 2231 public void getClip(out GtkAllocation clip) 2232 { 2233 gtk_widget_get_clip(gtkWidget, &clip); 2234 } 2235 2236 /** 2237 * Returns the clipboard object for the given selection to 2238 * be used with @widget. @widget must have a #GdkDisplay 2239 * associated with it, so must be attached to a toplevel 2240 * window. 2241 * 2242 * Params: 2243 * selection = a #GdkAtom which identifies the clipboard 2244 * to use. %GDK_SELECTION_CLIPBOARD gives the 2245 * default clipboard. Another common value 2246 * is %GDK_SELECTION_PRIMARY, which gives 2247 * the primary X selection. 2248 * 2249 * Returns: the appropriate clipboard object. If no 2250 * clipboard already exists, a new one will 2251 * be created. Once a clipboard object has 2252 * been created, it is persistent for all time. 2253 * 2254 * Since: 2.2 2255 */ 2256 public Clipboard getClipboard(GdkAtom selection) 2257 { 2258 auto p = gtk_widget_get_clipboard(gtkWidget, selection); 2259 2260 if(p is null) 2261 { 2262 return null; 2263 } 2264 2265 return ObjectG.getDObject!(Clipboard)(cast(GtkClipboard*) p); 2266 } 2267 2268 /** 2269 * Obtains the composite name of a widget. 2270 * 2271 * Deprecated: Use gtk_widget_class_set_template(), or don’t use this API at all. 2272 * 2273 * Returns: the composite name of @widget, or %NULL if @widget is not 2274 * a composite child. The string should be freed when it is no 2275 * longer needed. 2276 */ 2277 public string getCompositeName() 2278 { 2279 auto retStr = gtk_widget_get_composite_name(gtkWidget); 2280 2281 scope(exit) Str.freeString(retStr); 2282 return Str.toString(retStr); 2283 } 2284 2285 /** 2286 * Returns whether @device can interact with @widget and its 2287 * children. See gtk_widget_set_device_enabled(). 2288 * 2289 * Params: 2290 * device = a #GdkDevice 2291 * 2292 * Returns: %TRUE is @device is enabled for @widget 2293 * 2294 * Since: 3.0 2295 */ 2296 public bool getDeviceEnabled(Device device) 2297 { 2298 return gtk_widget_get_device_enabled(gtkWidget, (device is null) ? null : device.getDeviceStruct()) != 0; 2299 } 2300 2301 /** 2302 * Returns the events mask for the widget corresponding to an specific device. These 2303 * are the events that the widget will receive when @device operates on it. 2304 * 2305 * Params: 2306 * device = a #GdkDevice 2307 * 2308 * Returns: device event mask for @widget 2309 * 2310 * Since: 3.0 2311 */ 2312 public GdkEventMask getDeviceEvents(Device device) 2313 { 2314 return gtk_widget_get_device_events(gtkWidget, (device is null) ? null : device.getDeviceStruct()); 2315 } 2316 2317 /** 2318 * Gets the reading direction for a particular widget. See 2319 * gtk_widget_set_direction(). 2320 * 2321 * Returns: the reading direction for the widget. 2322 */ 2323 public GtkTextDirection getDirection() 2324 { 2325 return gtk_widget_get_direction(gtkWidget); 2326 } 2327 2328 /** 2329 * Get the #GdkDisplay for the toplevel window associated with 2330 * this widget. This function can only be called after the widget 2331 * has been added to a widget hierarchy with a #GtkWindow at the top. 2332 * 2333 * In general, you should only create display specific 2334 * resources when a widget has been realized, and you should 2335 * free those resources when the widget is unrealized. 2336 * 2337 * Returns: the #GdkDisplay for the toplevel for this widget. 2338 * 2339 * Since: 2.2 2340 */ 2341 public Display getDisplay() 2342 { 2343 auto p = gtk_widget_get_display(gtkWidget); 2344 2345 if(p is null) 2346 { 2347 return null; 2348 } 2349 2350 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 2351 } 2352 2353 /** 2354 * Determines whether the widget is double buffered. 2355 * 2356 * See gtk_widget_set_double_buffered() 2357 * 2358 * Returns: %TRUE if the widget is double buffered 2359 * 2360 * Since: 2.18 2361 */ 2362 public bool getDoubleBuffered() 2363 { 2364 return gtk_widget_get_double_buffered(gtkWidget) != 0; 2365 } 2366 2367 /** 2368 * Returns the event mask (see #GdkEventMask) for the widget. These are the 2369 * events that the widget will receive. 2370 * 2371 * Note: Internally, the widget event mask will be the logical OR of the event 2372 * mask set through gtk_widget_set_events() or gtk_widget_add_events(), and the 2373 * event mask necessary to cater for every #GtkEventController created for the 2374 * widget. 2375 * 2376 * Returns: event mask for @widget 2377 */ 2378 public int getEvents() 2379 { 2380 return gtk_widget_get_events(gtkWidget); 2381 } 2382 2383 /** 2384 * Returns whether the widget should grab focus when it is clicked with the mouse. 2385 * See gtk_widget_set_focus_on_click(). 2386 * 2387 * Returns: %TRUE if the widget should grab focus when it is clicked with 2388 * the mouse. 2389 * 2390 * Since: 3.20 2391 */ 2392 public bool getFocusOnClick() 2393 { 2394 return gtk_widget_get_focus_on_click(gtkWidget) != 0; 2395 } 2396 2397 /** 2398 * Gets the font map that has been set with gtk_widget_set_font_map(). 2399 * 2400 * Returns: A #PangoFontMap, or %NULL 2401 * 2402 * Since: 3.18 2403 */ 2404 public PgFontMap getFontMap() 2405 { 2406 auto p = gtk_widget_get_font_map(gtkWidget); 2407 2408 if(p is null) 2409 { 2410 return null; 2411 } 2412 2413 return ObjectG.getDObject!(PgFontMap)(cast(PangoFontMap*) p); 2414 } 2415 2416 /** 2417 * Returns the #cairo_font_options_t used for Pango rendering. When not set, 2418 * the defaults font options for the #GdkScreen will be used. 2419 * 2420 * Returns: the #cairo_font_options_t or %NULL if not set 2421 * 2422 * Since: 3.18 2423 */ 2424 public FontOption getFontOptions() 2425 { 2426 auto p = gtk_widget_get_font_options(gtkWidget); 2427 2428 if(p is null) 2429 { 2430 return null; 2431 } 2432 2433 return new FontOption(cast(cairo_font_options_t*) p); 2434 } 2435 2436 /** 2437 * Obtains the frame clock for a widget. The frame clock is a global 2438 * “ticker” that can be used to drive animations and repaints. The 2439 * most common reason to get the frame clock is to call 2440 * gdk_frame_clock_get_frame_time(), in order to get a time to use for 2441 * animating. For example you might record the start of the animation 2442 * with an initial value from gdk_frame_clock_get_frame_time(), and 2443 * then update the animation by calling 2444 * gdk_frame_clock_get_frame_time() again during each repaint. 2445 * 2446 * gdk_frame_clock_request_phase() will result in a new frame on the 2447 * clock, but won’t necessarily repaint any widgets. To repaint a 2448 * widget, you have to use gtk_widget_queue_draw() which invalidates 2449 * the widget (thus scheduling it to receive a draw on the next 2450 * frame). gtk_widget_queue_draw() will also end up requesting a frame 2451 * on the appropriate frame clock. 2452 * 2453 * A widget’s frame clock will not change while the widget is 2454 * mapped. Reparenting a widget (which implies a temporary unmap) can 2455 * change the widget’s frame clock. 2456 * 2457 * Unrealized widgets do not have a frame clock. 2458 * 2459 * Returns: a #GdkFrameClock, 2460 * or #NULL if widget is unrealized 2461 * 2462 * Since: 3.8 2463 */ 2464 public FrameClock getFrameClock() 2465 { 2466 auto p = gtk_widget_get_frame_clock(gtkWidget); 2467 2468 if(p is null) 2469 { 2470 return null; 2471 } 2472 2473 return ObjectG.getDObject!(FrameClock)(cast(GdkFrameClock*) p); 2474 } 2475 2476 /** 2477 * Gets the value of the #GtkWidget:halign property. 2478 * 2479 * For backwards compatibility reasons this method will never return 2480 * %GTK_ALIGN_BASELINE, but instead it will convert it to 2481 * %GTK_ALIGN_FILL. Baselines are not supported for horizontal 2482 * alignment. 2483 * 2484 * Returns: the horizontal alignment of @widget 2485 */ 2486 public GtkAlign getHalign() 2487 { 2488 return gtk_widget_get_halign(gtkWidget); 2489 } 2490 2491 /** 2492 * Returns the current value of the has-tooltip property. See 2493 * #GtkWidget:has-tooltip for more information. 2494 * 2495 * Returns: current value of has-tooltip on @widget. 2496 * 2497 * Since: 2.12 2498 */ 2499 public bool getHasTooltip() 2500 { 2501 return gtk_widget_get_has_tooltip(gtkWidget) != 0; 2502 } 2503 2504 /** 2505 * Determines whether @widget has a #GdkWindow of its own. See 2506 * gtk_widget_set_has_window(). 2507 * 2508 * Returns: %TRUE if @widget has a window, %FALSE otherwise 2509 * 2510 * Since: 2.18 2511 */ 2512 public bool getHasWindow() 2513 { 2514 return gtk_widget_get_has_window(gtkWidget) != 0; 2515 } 2516 2517 /** 2518 * Gets whether the widget would like any available extra horizontal 2519 * space. When a user resizes a #GtkWindow, widgets with expand=TRUE 2520 * generally receive the extra space. For example, a list or 2521 * scrollable area or document in your window would often be set to 2522 * expand. 2523 * 2524 * Containers should use gtk_widget_compute_expand() rather than 2525 * this function, to see whether a widget, or any of its children, 2526 * has the expand flag set. If any child of a widget wants to 2527 * expand, the parent may ask to expand also. 2528 * 2529 * This function only looks at the widget’s own hexpand flag, rather 2530 * than computing whether the entire widget tree rooted at this widget 2531 * wants to expand. 2532 * 2533 * Returns: whether hexpand flag is set 2534 */ 2535 public bool getHexpand() 2536 { 2537 return gtk_widget_get_hexpand(gtkWidget) != 0; 2538 } 2539 2540 /** 2541 * Gets whether gtk_widget_set_hexpand() has been used to 2542 * explicitly set the expand flag on this widget. 2543 * 2544 * If hexpand is set, then it overrides any computed 2545 * expand value based on child widgets. If hexpand is not 2546 * set, then the expand value depends on whether any 2547 * children of the widget would like to expand. 2548 * 2549 * There are few reasons to use this function, but it’s here 2550 * for completeness and consistency. 2551 * 2552 * Returns: whether hexpand has been explicitly set 2553 */ 2554 public bool getHexpandSet() 2555 { 2556 return gtk_widget_get_hexpand_set(gtkWidget) != 0; 2557 } 2558 2559 /** 2560 * Whether the widget is mapped. 2561 * 2562 * Returns: %TRUE if the widget is mapped, %FALSE otherwise. 2563 * 2564 * Since: 2.20 2565 */ 2566 public bool getMapped() 2567 { 2568 return gtk_widget_get_mapped(gtkWidget) != 0; 2569 } 2570 2571 /** 2572 * Gets the value of the #GtkWidget:margin-bottom property. 2573 * 2574 * Returns: The bottom margin of @widget 2575 * 2576 * Since: 3.0 2577 */ 2578 public int getMarginBottom() 2579 { 2580 return gtk_widget_get_margin_bottom(gtkWidget); 2581 } 2582 2583 /** 2584 * Gets the value of the #GtkWidget:margin-end property. 2585 * 2586 * Returns: The end margin of @widget 2587 * 2588 * Since: 3.12 2589 */ 2590 public int getMarginEnd() 2591 { 2592 return gtk_widget_get_margin_end(gtkWidget); 2593 } 2594 2595 /** 2596 * Gets the value of the #GtkWidget:margin-left property. 2597 * 2598 * Deprecated: Use gtk_widget_get_margin_start() instead. 2599 * 2600 * Returns: The left margin of @widget 2601 * 2602 * Since: 3.0 2603 */ 2604 public int getMarginLeft() 2605 { 2606 return gtk_widget_get_margin_left(gtkWidget); 2607 } 2608 2609 /** 2610 * Gets the value of the #GtkWidget:margin-right property. 2611 * 2612 * Deprecated: Use gtk_widget_get_margin_end() instead. 2613 * 2614 * Returns: The right margin of @widget 2615 * 2616 * Since: 3.0 2617 */ 2618 public int getMarginRight() 2619 { 2620 return gtk_widget_get_margin_right(gtkWidget); 2621 } 2622 2623 /** 2624 * Gets the value of the #GtkWidget:margin-start property. 2625 * 2626 * Returns: The start margin of @widget 2627 * 2628 * Since: 3.12 2629 */ 2630 public int getMarginStart() 2631 { 2632 return gtk_widget_get_margin_start(gtkWidget); 2633 } 2634 2635 /** 2636 * Gets the value of the #GtkWidget:margin-top property. 2637 * 2638 * Returns: The top margin of @widget 2639 * 2640 * Since: 3.0 2641 */ 2642 public int getMarginTop() 2643 { 2644 return gtk_widget_get_margin_top(gtkWidget); 2645 } 2646 2647 /** 2648 * Returns the modifier mask the @widget’s windowing system backend 2649 * uses for a particular purpose. 2650 * 2651 * See gdk_keymap_get_modifier_mask(). 2652 * 2653 * Params: 2654 * intent = the use case for the modifier mask 2655 * 2656 * Returns: the modifier mask used for @intent. 2657 * 2658 * Since: 3.4 2659 */ 2660 public GdkModifierType getModifierMask(GdkModifierIntent intent) 2661 { 2662 return gtk_widget_get_modifier_mask(gtkWidget, intent); 2663 } 2664 2665 /** 2666 * Returns the current modifier style for the widget. (As set by 2667 * gtk_widget_modify_style().) If no style has previously set, a new 2668 * #GtkRcStyle will be created with all values unset, and set as the 2669 * modifier style for the widget. If you make changes to this rc 2670 * style, you must call gtk_widget_modify_style(), passing in the 2671 * returned rc style, to make sure that your changes take effect. 2672 * 2673 * Caution: passing the style back to gtk_widget_modify_style() will 2674 * normally end up destroying it, because gtk_widget_modify_style() copies 2675 * the passed-in style and sets the copy as the new modifier style, 2676 * thus dropping any reference to the old modifier style. Add a reference 2677 * to the modifier style if you want to keep it alive. 2678 * 2679 * Deprecated: Use #GtkStyleContext with a custom #GtkStyleProvider instead 2680 * 2681 * Returns: the modifier style for the widget. 2682 * This rc style is owned by the widget. If you want to keep a 2683 * pointer to value this around, you must add a refcount using 2684 * g_object_ref(). 2685 */ 2686 public RcStyle getModifierStyle() 2687 { 2688 auto p = gtk_widget_get_modifier_style(gtkWidget); 2689 2690 if(p is null) 2691 { 2692 return null; 2693 } 2694 2695 return ObjectG.getDObject!(RcStyle)(cast(GtkRcStyle*) p); 2696 } 2697 2698 /** 2699 * Retrieves the name of a widget. See gtk_widget_set_name() for the 2700 * significance of widget names. 2701 * 2702 * Returns: name of the widget. This string is owned by GTK+ and 2703 * should not be modified or freed 2704 */ 2705 public string getName() 2706 { 2707 return Str.toString(gtk_widget_get_name(gtkWidget)); 2708 } 2709 2710 /** 2711 * Returns the current value of the #GtkWidget:no-show-all property, 2712 * which determines whether calls to gtk_widget_show_all() 2713 * will affect this widget. 2714 * 2715 * Returns: the current value of the “no-show-all” property. 2716 * 2717 * Since: 2.4 2718 */ 2719 public bool getNoShowAll() 2720 { 2721 return gtk_widget_get_no_show_all(gtkWidget) != 0; 2722 } 2723 2724 /** 2725 * Fetches the requested opacity for this widget. 2726 * See gtk_widget_set_opacity(). 2727 * 2728 * Returns: the requested opacity for this widget. 2729 * 2730 * Since: 3.8 2731 */ 2732 public double getOpacity() 2733 { 2734 return gtk_widget_get_opacity(gtkWidget); 2735 } 2736 2737 /** 2738 * Gets a #PangoContext with the appropriate font map, font description, 2739 * and base direction for this widget. Unlike the context returned 2740 * by gtk_widget_create_pango_context(), this context is owned by 2741 * the widget (it can be used until the screen for the widget changes 2742 * or the widget is removed from its toplevel), and will be updated to 2743 * match any changes to the widget’s attributes. This can be tracked 2744 * by using the #GtkWidget::screen-changed signal on the widget. 2745 * 2746 * Returns: the #PangoContext for the widget. 2747 */ 2748 public PgContext getPangoContext() 2749 { 2750 auto p = gtk_widget_get_pango_context(gtkWidget); 2751 2752 if(p is null) 2753 { 2754 return null; 2755 } 2756 2757 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p); 2758 } 2759 2760 /** 2761 * Returns the parent container of @widget. 2762 * 2763 * Returns: the parent container of @widget, or %NULL 2764 */ 2765 public Widget getParent() 2766 { 2767 auto p = gtk_widget_get_parent(gtkWidget); 2768 2769 if(p is null) 2770 { 2771 return null; 2772 } 2773 2774 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 2775 } 2776 2777 /** 2778 * Gets @widget’s parent window, or %NULL if it does not have one. 2779 * 2780 * Returns: the parent window of @widget, or %NULL 2781 * if it does not have a parent window. 2782 */ 2783 public GdkWin getParentWindow() 2784 { 2785 auto p = gtk_widget_get_parent_window(gtkWidget); 2786 2787 if(p is null) 2788 { 2789 return null; 2790 } 2791 2792 return ObjectG.getDObject!(GdkWin)(cast(GdkWindow*) p); 2793 } 2794 2795 /** 2796 * Returns the #GtkWidgetPath representing @widget, if the widget 2797 * is not connected to a toplevel widget, a partial path will be 2798 * created. 2799 * 2800 * Returns: The #GtkWidgetPath representing @widget 2801 */ 2802 public WidgetPath getPath() 2803 { 2804 auto p = gtk_widget_get_path(gtkWidget); 2805 2806 if(p is null) 2807 { 2808 return null; 2809 } 2810 2811 return ObjectG.getDObject!(WidgetPath)(cast(GtkWidgetPath*) p); 2812 } 2813 2814 /** 2815 * Obtains the location of the mouse pointer in widget coordinates. 2816 * Widget coordinates are a bit odd; for historical reasons, they are 2817 * defined as @widget->window coordinates for widgets that return %TRUE for 2818 * gtk_widget_get_has_window(); and are relative to @widget->allocation.x, 2819 * @widget->allocation.y otherwise. 2820 * 2821 * Deprecated: Use gdk_window_get_device_position() instead. 2822 * 2823 * Params: 2824 * x = return location for the X coordinate, or %NULL 2825 * y = return location for the Y coordinate, or %NULL 2826 */ 2827 public void getPointer(out int x, out int y) 2828 { 2829 gtk_widget_get_pointer(gtkWidget, &x, &y); 2830 } 2831 2832 /** 2833 * Retrieves a widget’s initial minimum and natural height. 2834 * 2835 * This call is specific to width-for-height requests. 2836 * 2837 * The returned request will be modified by the 2838 * GtkWidgetClass::adjust_size_request virtual method and by any 2839 * #GtkSizeGroups that have been applied. That is, the returned request 2840 * is the one that should be used for layout, not necessarily the one 2841 * returned by the widget itself. 2842 * 2843 * Params: 2844 * minimumHeight = location to store the minimum height, or %NULL 2845 * naturalHeight = location to store the natural height, or %NULL 2846 * 2847 * Since: 3.0 2848 */ 2849 public void getPreferredHeight(out int minimumHeight, out int naturalHeight) 2850 { 2851 gtk_widget_get_preferred_height(gtkWidget, &minimumHeight, &naturalHeight); 2852 } 2853 2854 /** 2855 * Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given 2856 * the specified @width, or the default height if @width is -1. The baselines may be -1 which means 2857 * that no baseline is requested for this widget. 2858 * 2859 * The returned request will be modified by the 2860 * GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods 2861 * and by any #GtkSizeGroups that have been applied. That is, the returned request 2862 * is the one that should be used for layout, not necessarily the one 2863 * returned by the widget itself. 2864 * 2865 * Params: 2866 * width = the width which is available for allocation, or -1 if none 2867 * minimumHeight = location for storing the minimum height, or %NULL 2868 * naturalHeight = location for storing the natural height, or %NULL 2869 * minimumBaseline = location for storing the baseline for the minimum height, or %NULL 2870 * naturalBaseline = location for storing the baseline for the natural height, or %NULL 2871 * 2872 * Since: 3.10 2873 */ 2874 public void getPreferredHeightAndBaselineForWidth(int width, out int minimumHeight, out int naturalHeight, out int minimumBaseline, out int naturalBaseline) 2875 { 2876 gtk_widget_get_preferred_height_and_baseline_for_width(gtkWidget, width, &minimumHeight, &naturalHeight, &minimumBaseline, &naturalBaseline); 2877 } 2878 2879 /** 2880 * Retrieves a widget’s minimum and natural height if it would be given 2881 * the specified @width. 2882 * 2883 * The returned request will be modified by the 2884 * GtkWidgetClass::adjust_size_request virtual method and by any 2885 * #GtkSizeGroups that have been applied. That is, the returned request 2886 * is the one that should be used for layout, not necessarily the one 2887 * returned by the widget itself. 2888 * 2889 * Params: 2890 * width = the width which is available for allocation 2891 * minimumHeight = location for storing the minimum height, or %NULL 2892 * naturalHeight = location for storing the natural height, or %NULL 2893 * 2894 * Since: 3.0 2895 */ 2896 public void getPreferredHeightForWidth(int width, out int minimumHeight, out int naturalHeight) 2897 { 2898 gtk_widget_get_preferred_height_for_width(gtkWidget, width, &minimumHeight, &naturalHeight); 2899 } 2900 2901 /** 2902 * Retrieves the minimum and natural size of a widget, taking 2903 * into account the widget’s preference for height-for-width management. 2904 * 2905 * This is used to retrieve a suitable size by container widgets which do 2906 * not impose any restrictions on the child placement. It can be used 2907 * to deduce toplevel window and menu sizes as well as child widgets in 2908 * free-form containers such as GtkLayout. 2909 * 2910 * Handle with care. Note that the natural height of a height-for-width 2911 * widget will generally be a smaller size than the minimum height, since the required 2912 * height for the natural width is generally smaller than the required height for 2913 * the minimum width. 2914 * 2915 * Use gtk_widget_get_preferred_height_and_baseline_for_width() if you want to support 2916 * baseline alignment. 2917 * 2918 * Params: 2919 * minimumSize = location for storing the minimum size, or %NULL 2920 * naturalSize = location for storing the natural size, or %NULL 2921 * 2922 * Since: 3.0 2923 */ 2924 public void getPreferredSize(out Requisition minimumSize, out Requisition naturalSize) 2925 { 2926 GtkRequisition* outminimumSize = gMalloc!GtkRequisition(); 2927 GtkRequisition* outnaturalSize = gMalloc!GtkRequisition(); 2928 2929 gtk_widget_get_preferred_size(gtkWidget, outminimumSize, outnaturalSize); 2930 2931 minimumSize = ObjectG.getDObject!(Requisition)(outminimumSize, true); 2932 naturalSize = ObjectG.getDObject!(Requisition)(outnaturalSize, true); 2933 } 2934 2935 /** 2936 * Retrieves a widget’s initial minimum and natural width. 2937 * 2938 * This call is specific to height-for-width requests. 2939 * 2940 * The returned request will be modified by the 2941 * GtkWidgetClass::adjust_size_request virtual method and by any 2942 * #GtkSizeGroups that have been applied. That is, the returned request 2943 * is the one that should be used for layout, not necessarily the one 2944 * returned by the widget itself. 2945 * 2946 * Params: 2947 * minimumWidth = location to store the minimum width, or %NULL 2948 * naturalWidth = location to store the natural width, or %NULL 2949 * 2950 * Since: 3.0 2951 */ 2952 public void getPreferredWidth(out int minimumWidth, out int naturalWidth) 2953 { 2954 gtk_widget_get_preferred_width(gtkWidget, &minimumWidth, &naturalWidth); 2955 } 2956 2957 /** 2958 * Retrieves a widget’s minimum and natural width if it would be given 2959 * the specified @height. 2960 * 2961 * The returned request will be modified by the 2962 * GtkWidgetClass::adjust_size_request virtual method and by any 2963 * #GtkSizeGroups that have been applied. That is, the returned request 2964 * is the one that should be used for layout, not necessarily the one 2965 * returned by the widget itself. 2966 * 2967 * Params: 2968 * height = the height which is available for allocation 2969 * minimumWidth = location for storing the minimum width, or %NULL 2970 * naturalWidth = location for storing the natural width, or %NULL 2971 * 2972 * Since: 3.0 2973 */ 2974 public void getPreferredWidthForHeight(int height, out int minimumWidth, out int naturalWidth) 2975 { 2976 gtk_widget_get_preferred_width_for_height(gtkWidget, height, &minimumWidth, &naturalWidth); 2977 } 2978 2979 /** 2980 * Determines whether @widget is realized. 2981 * 2982 * Returns: %TRUE if @widget is realized, %FALSE otherwise 2983 * 2984 * Since: 2.20 2985 */ 2986 public bool getRealized() 2987 { 2988 return gtk_widget_get_realized(gtkWidget) != 0; 2989 } 2990 2991 /** 2992 * Determines whether @widget is always treated as the default widget 2993 * within its toplevel when it has the focus, even if another widget 2994 * is the default. 2995 * 2996 * See gtk_widget_set_receives_default(). 2997 * 2998 * Returns: %TRUE if @widget acts as the default widget when focused, 2999 * %FALSE otherwise 3000 * 3001 * Since: 2.18 3002 */ 3003 public bool getReceivesDefault() 3004 { 3005 return gtk_widget_get_receives_default(gtkWidget) != 0; 3006 } 3007 3008 /** 3009 * Gets whether the widget prefers a height-for-width layout 3010 * or a width-for-height layout. 3011 * 3012 * #GtkBin widgets generally propagate the preference of 3013 * their child, container widgets need to request something either in 3014 * context of their children or in context of their allocation 3015 * capabilities. 3016 * 3017 * Returns: The #GtkSizeRequestMode preferred by @widget. 3018 * 3019 * Since: 3.0 3020 */ 3021 public GtkSizeRequestMode getRequestMode() 3022 { 3023 return gtk_widget_get_request_mode(gtkWidget); 3024 } 3025 3026 /** 3027 * Retrieves the widget’s requisition. 3028 * 3029 * This function should only be used by widget implementations in 3030 * order to figure whether the widget’s requisition has actually 3031 * changed after some internal state change (so that they can call 3032 * gtk_widget_queue_resize() instead of gtk_widget_queue_draw()). 3033 * 3034 * Normally, gtk_widget_size_request() should be used. 3035 * 3036 * Deprecated: The #GtkRequisition cache on the widget was 3037 * removed, If you need to cache sizes across requests and allocations, 3038 * add an explicit cache to the widget in question instead. 3039 * 3040 * Params: 3041 * requisition = a pointer to a #GtkRequisition to copy to 3042 * 3043 * Since: 2.20 3044 */ 3045 public void getRequisition(out Requisition requisition) 3046 { 3047 GtkRequisition* outrequisition = gMalloc!GtkRequisition(); 3048 3049 gtk_widget_get_requisition(gtkWidget, outrequisition); 3050 3051 requisition = ObjectG.getDObject!(Requisition)(outrequisition, true); 3052 } 3053 3054 /** 3055 * Get the root window where this widget is located. This function can 3056 * only be called after the widget has been added to a widget 3057 * hierarchy with #GtkWindow at the top. 3058 * 3059 * The root window is useful for such purposes as creating a popup 3060 * #GdkWindow associated with the window. In general, you should only 3061 * create display specific resources when a widget has been realized, 3062 * and you should free those resources when the widget is unrealized. 3063 * 3064 * Deprecated: Use gdk_screen_get_root_window() instead 3065 * 3066 * Returns: the #GdkWindow root window for the toplevel for this widget. 3067 * 3068 * Since: 2.2 3069 */ 3070 public GdkWin getRootWindow() 3071 { 3072 auto p = gtk_widget_get_root_window(gtkWidget); 3073 3074 if(p is null) 3075 { 3076 return null; 3077 } 3078 3079 return ObjectG.getDObject!(GdkWin)(cast(GdkWindow*) p); 3080 } 3081 3082 /** 3083 * Retrieves the internal scale factor that maps from window coordinates 3084 * to the actual device pixels. On traditional systems this is 1, on 3085 * high density outputs, it can be a higher value (typically 2). 3086 * 3087 * See gdk_window_get_scale_factor(). 3088 * 3089 * Returns: the scale factor for @widget 3090 * 3091 * Since: 3.10 3092 */ 3093 public int getScaleFactor() 3094 { 3095 return gtk_widget_get_scale_factor(gtkWidget); 3096 } 3097 3098 /** 3099 * Get the #GdkScreen from the toplevel window associated with 3100 * this widget. This function can only be called after the widget 3101 * has been added to a widget hierarchy with a #GtkWindow 3102 * at the top. 3103 * 3104 * In general, you should only create screen specific 3105 * resources when a widget has been realized, and you should 3106 * free those resources when the widget is unrealized. 3107 * 3108 * Returns: the #GdkScreen for the toplevel for this widget. 3109 * 3110 * Since: 2.2 3111 */ 3112 public Screen getScreen() 3113 { 3114 auto p = gtk_widget_get_screen(gtkWidget); 3115 3116 if(p is null) 3117 { 3118 return null; 3119 } 3120 3121 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 3122 } 3123 3124 /** 3125 * Returns the widget’s sensitivity (in the sense of returning 3126 * the value that has been set using gtk_widget_set_sensitive()). 3127 * 3128 * The effective sensitivity of a widget is however determined by both its 3129 * own and its parent widget’s sensitivity. See gtk_widget_is_sensitive(). 3130 * 3131 * Returns: %TRUE if the widget is sensitive 3132 * 3133 * Since: 2.18 3134 */ 3135 public bool getSensitive() 3136 { 3137 return gtk_widget_get_sensitive(gtkWidget) != 0; 3138 } 3139 3140 /** 3141 * Gets the settings object holding the settings used for this widget. 3142 * 3143 * Note that this function can only be called when the #GtkWidget 3144 * is attached to a toplevel, since the settings object is specific 3145 * to a particular #GdkScreen. 3146 * 3147 * Returns: the relevant #GtkSettings object 3148 */ 3149 public Settings getSettings() 3150 { 3151 auto p = gtk_widget_get_settings(gtkWidget); 3152 3153 if(p is null) 3154 { 3155 return null; 3156 } 3157 3158 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) p); 3159 } 3160 3161 /** 3162 * Gets the size request that was explicitly set for the widget using 3163 * gtk_widget_set_size_request(). A value of -1 stored in @width or 3164 * @height indicates that that dimension has not been set explicitly 3165 * and the natural requisition of the widget will be used instead. See 3166 * gtk_widget_set_size_request(). To get the size a widget will 3167 * actually request, call gtk_widget_get_preferred_size() instead of 3168 * this function. 3169 * 3170 * Params: 3171 * width = return location for width, or %NULL 3172 * height = return location for height, or %NULL 3173 */ 3174 public void getSizeRequest(out int width, out int height) 3175 { 3176 gtk_widget_get_size_request(gtkWidget, &width, &height); 3177 } 3178 3179 /** 3180 * Returns the widget state as a flag set. It is worth mentioning 3181 * that the effective %GTK_STATE_FLAG_INSENSITIVE state will be 3182 * returned, that is, also based on parent insensitivity, even if 3183 * @widget itself is sensitive. 3184 * 3185 * Also note that if you are looking for a way to obtain the 3186 * #GtkStateFlags to pass to a #GtkStyleContext method, you 3187 * should look at gtk_style_context_get_state(). 3188 * 3189 * Returns: The state flags for widget 3190 * 3191 * Since: 3.0 3192 */ 3193 public GtkStateFlags getStateFlags() 3194 { 3195 return gtk_widget_get_state_flags(gtkWidget); 3196 } 3197 3198 /** 3199 * Simply an accessor function that returns @widget->style. 3200 * 3201 * Deprecated: Use #GtkStyleContext instead 3202 * 3203 * Returns: the widget’s #GtkStyle 3204 */ 3205 public Style getStyle() 3206 { 3207 auto p = gtk_widget_get_style(gtkWidget); 3208 3209 if(p is null) 3210 { 3211 return null; 3212 } 3213 3214 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 3215 } 3216 3217 /** 3218 * Returns the style context associated to @widget. The returned object is 3219 * guaranteed to be the same for the lifetime of @widget. 3220 * 3221 * Returns: a #GtkStyleContext. This memory is owned by @widget and 3222 * must not be freed. 3223 */ 3224 public StyleContext getStyleContext() 3225 { 3226 auto p = gtk_widget_get_style_context(gtkWidget); 3227 3228 if(p is null) 3229 { 3230 return null; 3231 } 3232 3233 return ObjectG.getDObject!(StyleContext)(cast(GtkStyleContext*) p); 3234 } 3235 3236 /** 3237 * Returns %TRUE if @widget is multiple pointer aware. See 3238 * gtk_widget_set_support_multidevice() for more information. 3239 * 3240 * Returns: %TRUE if @widget is multidevice aware. 3241 */ 3242 public bool getSupportMultidevice() 3243 { 3244 return gtk_widget_get_support_multidevice(gtkWidget) != 0; 3245 } 3246 3247 /** 3248 * Fetch an object build from the template XML for @widget_type in this @widget instance. 3249 * 3250 * This will only report children which were previously declared with 3251 * gtk_widget_class_bind_template_child_full() or one of its 3252 * variants. 3253 * 3254 * This function is only meant to be called for code which is private to the @widget_type which 3255 * declared the child and is meant for language bindings which cannot easily make use 3256 * of the GObject structure offsets. 3257 * 3258 * Params: 3259 * widgetType = The #GType to get a template child for 3260 * name = The “id” of the child defined in the template XML 3261 * 3262 * Returns: The object built in the template XML with the id @name 3263 */ 3264 public ObjectG getTemplateChild(GType widgetType, string name) 3265 { 3266 auto p = gtk_widget_get_template_child(gtkWidget, widgetType, Str.toStringz(name)); 3267 3268 if(p is null) 3269 { 3270 return null; 3271 } 3272 3273 return ObjectG.getDObject!(ObjectG)(cast(GObject*) p); 3274 } 3275 3276 /** 3277 * Gets the contents of the tooltip for @widget. 3278 * 3279 * Returns: the tooltip text, or %NULL. You should free the 3280 * returned string with g_free() when done. 3281 * 3282 * Since: 2.12 3283 */ 3284 public string getTooltipMarkup() 3285 { 3286 auto retStr = gtk_widget_get_tooltip_markup(gtkWidget); 3287 3288 scope(exit) Str.freeString(retStr); 3289 return Str.toString(retStr); 3290 } 3291 3292 /** 3293 * Gets the contents of the tooltip for @widget. 3294 * 3295 * Returns: the tooltip text, or %NULL. You should free the 3296 * returned string with g_free() when done. 3297 * 3298 * Since: 2.12 3299 */ 3300 public string getTooltipText() 3301 { 3302 auto retStr = gtk_widget_get_tooltip_text(gtkWidget); 3303 3304 scope(exit) Str.freeString(retStr); 3305 return Str.toString(retStr); 3306 } 3307 3308 /** 3309 * Returns the #GtkWindow of the current tooltip. This can be the 3310 * GtkWindow created by default, or the custom tooltip window set 3311 * using gtk_widget_set_tooltip_window(). 3312 * 3313 * Returns: The #GtkWindow of the current tooltip. 3314 * 3315 * Since: 2.12 3316 */ 3317 public Window getTooltipWindow() 3318 { 3319 auto p = gtk_widget_get_tooltip_window(gtkWidget); 3320 3321 if(p is null) 3322 { 3323 return null; 3324 } 3325 3326 return ObjectG.getDObject!(Window)(cast(GtkWindow*) p); 3327 } 3328 3329 /** 3330 * This function returns the topmost widget in the container hierarchy 3331 * @widget is a part of. If @widget has no parent widgets, it will be 3332 * returned as the topmost widget. No reference will be added to the 3333 * returned widget; it should not be unreferenced. 3334 * 3335 * Note the difference in behavior vs. gtk_widget_get_ancestor(); 3336 * `gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)` 3337 * would return 3338 * %NULL if @widget wasn’t inside a toplevel window, and if the 3339 * window was inside a #GtkWindow-derived widget which was in turn 3340 * inside the toplevel #GtkWindow. While the second case may 3341 * seem unlikely, it actually happens when a #GtkPlug is embedded 3342 * inside a #GtkSocket within the same application. 3343 * 3344 * To reliably find the toplevel #GtkWindow, use 3345 * gtk_widget_get_toplevel() and call gtk_widget_is_toplevel() 3346 * on the result. 3347 * |[<!-- language="C" --> 3348 * GtkWidget *toplevel = gtk_widget_get_toplevel (widget); 3349 * if (gtk_widget_is_toplevel (toplevel)) 3350 * { 3351 * // Perform action on toplevel. 3352 * } 3353 * ]| 3354 * 3355 * Returns: the topmost ancestor of @widget, or @widget itself 3356 * if there’s no ancestor. 3357 */ 3358 public Widget getToplevel() 3359 { 3360 auto p = gtk_widget_get_toplevel(gtkWidget); 3361 3362 if(p is null) 3363 { 3364 return null; 3365 } 3366 3367 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 3368 } 3369 3370 /** 3371 * Gets the value of the #GtkWidget:valign property. 3372 * 3373 * For backwards compatibility reasons this method will never return 3374 * %GTK_ALIGN_BASELINE, but instead it will convert it to 3375 * %GTK_ALIGN_FILL. If your widget want to support baseline aligned 3376 * children it must use gtk_widget_get_valign_with_baseline(), or 3377 * `g_object_get (widget, "valign", &value, NULL)`, which will 3378 * also report the true value. 3379 * 3380 * Returns: the vertical alignment of @widget, ignoring baseline alignment 3381 */ 3382 public GtkAlign getValign() 3383 { 3384 return gtk_widget_get_valign(gtkWidget); 3385 } 3386 3387 /** 3388 * Gets the value of the #GtkWidget:valign property, including 3389 * %GTK_ALIGN_BASELINE. 3390 * 3391 * Returns: the vertical alignment of @widget 3392 * 3393 * Since: 3.10 3394 */ 3395 public GtkAlign getValignWithBaseline() 3396 { 3397 return gtk_widget_get_valign_with_baseline(gtkWidget); 3398 } 3399 3400 /** 3401 * Gets whether the widget would like any available extra vertical 3402 * space. 3403 * 3404 * See gtk_widget_get_hexpand() for more detail. 3405 * 3406 * Returns: whether vexpand flag is set 3407 */ 3408 public bool getVexpand() 3409 { 3410 return gtk_widget_get_vexpand(gtkWidget) != 0; 3411 } 3412 3413 /** 3414 * Gets whether gtk_widget_set_vexpand() has been used to 3415 * explicitly set the expand flag on this widget. 3416 * 3417 * See gtk_widget_get_hexpand_set() for more detail. 3418 * 3419 * Returns: whether vexpand has been explicitly set 3420 */ 3421 public bool getVexpandSet() 3422 { 3423 return gtk_widget_get_vexpand_set(gtkWidget) != 0; 3424 } 3425 3426 /** 3427 * Determines whether the widget is visible. If you want to 3428 * take into account whether the widget’s parent is also marked as 3429 * visible, use gtk_widget_is_visible() instead. 3430 * 3431 * This function does not check if the widget is obscured in any way. 3432 * 3433 * See gtk_widget_set_visible(). 3434 * 3435 * Returns: %TRUE if the widget is visible 3436 * 3437 * Since: 2.18 3438 */ 3439 public bool getVisible() 3440 { 3441 return gtk_widget_get_visible(gtkWidget) != 0; 3442 } 3443 3444 /** 3445 * Gets the visual that will be used to render @widget. 3446 * 3447 * Returns: the visual for @widget 3448 */ 3449 public Visual getVisual() 3450 { 3451 auto p = gtk_widget_get_visual(gtkWidget); 3452 3453 if(p is null) 3454 { 3455 return null; 3456 } 3457 3458 return ObjectG.getDObject!(Visual)(cast(GdkVisual*) p); 3459 } 3460 3461 /** 3462 * Returns the widget’s window if it is realized, %NULL otherwise 3463 * 3464 * Returns: @widget’s window. 3465 * 3466 * Since: 2.14 3467 */ 3468 public GdkWin getWindow() 3469 { 3470 auto p = gtk_widget_get_window(gtkWidget); 3471 3472 if(p is null) 3473 { 3474 return null; 3475 } 3476 3477 return ObjectG.getDObject!(GdkWin)(cast(GdkWindow*) p); 3478 } 3479 3480 /** 3481 * Makes @widget the current grabbed widget. 3482 * 3483 * This means that interaction with other widgets in the same 3484 * application is blocked and mouse as well as keyboard events 3485 * are delivered to this widget. 3486 * 3487 * If @widget is not sensitive, it is not set as the current 3488 * grabbed widget and this function does nothing. 3489 */ 3490 public void grabAdd() 3491 { 3492 gtk_grab_add(gtkWidget); 3493 } 3494 3495 /** 3496 * Causes @widget to become the default widget. @widget must be able to be 3497 * a default widget; typically you would ensure this yourself 3498 * by calling gtk_widget_set_can_default() with a %TRUE value. 3499 * The default widget is activated when 3500 * the user presses Enter in a window. Default widgets must be 3501 * activatable, that is, gtk_widget_activate() should affect them. Note 3502 * that #GtkEntry widgets require the “activates-default” property 3503 * set to %TRUE before they activate the default widget when Enter 3504 * is pressed and the #GtkEntry is focused. 3505 */ 3506 public void grabDefault() 3507 { 3508 gtk_widget_grab_default(gtkWidget); 3509 } 3510 3511 /** 3512 * Causes @widget to have the keyboard focus for the #GtkWindow it's 3513 * inside. @widget must be a focusable widget, such as a #GtkEntry; 3514 * something like #GtkFrame won’t work. 3515 * 3516 * More precisely, it must have the %GTK_CAN_FOCUS flag set. Use 3517 * gtk_widget_set_can_focus() to modify that flag. 3518 * 3519 * The widget also needs to be realized and mapped. This is indicated by the 3520 * related signals. Grabbing the focus immediately after creating the widget 3521 * will likely fail and cause critical warnings. 3522 */ 3523 public void grabFocus() 3524 { 3525 gtk_widget_grab_focus(gtkWidget); 3526 } 3527 3528 /** 3529 * Removes the grab from the given widget. 3530 * 3531 * You have to pair calls to gtk_grab_add() and gtk_grab_remove(). 3532 * 3533 * If @widget does not have the grab, this function does nothing. 3534 */ 3535 public void grabRemove() 3536 { 3537 gtk_grab_remove(gtkWidget); 3538 } 3539 3540 /** 3541 * Determines whether @widget is the current default widget within its 3542 * toplevel. See gtk_widget_set_can_default(). 3543 * 3544 * Returns: %TRUE if @widget is the current default widget within 3545 * its toplevel, %FALSE otherwise 3546 * 3547 * Since: 2.18 3548 */ 3549 public bool hasDefault() 3550 { 3551 return gtk_widget_has_default(gtkWidget) != 0; 3552 } 3553 3554 /** 3555 * Determines if the widget has the global input focus. See 3556 * gtk_widget_is_focus() for the difference between having the global 3557 * input focus, and only having the focus within a toplevel. 3558 * 3559 * Returns: %TRUE if the widget has the global input focus. 3560 * 3561 * Since: 2.18 3562 */ 3563 public bool hasFocus() 3564 { 3565 return gtk_widget_has_focus(gtkWidget) != 0; 3566 } 3567 3568 /** 3569 * Determines whether the widget is currently grabbing events, so it 3570 * is the only widget receiving input events (keyboard and mouse). 3571 * 3572 * See also gtk_grab_add(). 3573 * 3574 * Returns: %TRUE if the widget is in the grab_widgets stack 3575 * 3576 * Since: 2.18 3577 */ 3578 public bool hasGrab() 3579 { 3580 return gtk_widget_has_grab(gtkWidget) != 0; 3581 } 3582 3583 /** 3584 * Determines if the widget style has been looked up through the rc mechanism. 3585 * 3586 * Deprecated: Use #GtkStyleContext instead 3587 * 3588 * Returns: %TRUE if the widget has been looked up through the rc 3589 * mechanism, %FALSE otherwise. 3590 * 3591 * Since: 2.20 3592 */ 3593 public bool hasRcStyle() 3594 { 3595 return gtk_widget_has_rc_style(gtkWidget) != 0; 3596 } 3597 3598 /** 3599 * Checks whether there is a #GdkScreen is associated with 3600 * this widget. All toplevel widgets have an associated 3601 * screen, and all widgets added into a hierarchy with a toplevel 3602 * window at the top. 3603 * 3604 * Returns: %TRUE if there is a #GdkScreen associated 3605 * with the widget. 3606 * 3607 * Since: 2.2 3608 */ 3609 public bool hasScreen() 3610 { 3611 return gtk_widget_has_screen(gtkWidget) != 0; 3612 } 3613 3614 /** 3615 * Determines if the widget should show a visible indication that 3616 * it has the global input focus. This is a convenience function for 3617 * use in ::draw handlers that takes into account whether focus 3618 * indication should currently be shown in the toplevel window of 3619 * @widget. See gtk_window_get_focus_visible() for more information 3620 * about focus indication. 3621 * 3622 * To find out if the widget has the global input focus, use 3623 * gtk_widget_has_focus(). 3624 * 3625 * Returns: %TRUE if the widget should display a “focus rectangle” 3626 * 3627 * Since: 3.2 3628 */ 3629 public bool hasVisibleFocus() 3630 { 3631 return gtk_widget_has_visible_focus(gtkWidget) != 0; 3632 } 3633 3634 /** 3635 * Reverses the effects of gtk_widget_show(), causing the widget to be 3636 * hidden (invisible to the user). 3637 */ 3638 public void hide() 3639 { 3640 gtk_widget_hide(gtkWidget); 3641 } 3642 3643 /** 3644 * Utility function; intended to be connected to the #GtkWidget::delete-event 3645 * signal on a #GtkWindow. The function calls gtk_widget_hide() on its 3646 * argument, then returns %TRUE. If connected to ::delete-event, the 3647 * result is that clicking the close button for a window (on the 3648 * window frame, top right corner usually) will hide but not destroy 3649 * the window. By default, GTK+ destroys windows when ::delete-event 3650 * is received. 3651 * 3652 * Returns: %TRUE 3653 */ 3654 public bool hideOnDelete() 3655 { 3656 return gtk_widget_hide_on_delete(gtkWidget) != 0; 3657 } 3658 3659 /** 3660 * Returns whether the widget is currently being destroyed. 3661 * This information can sometimes be used to avoid doing 3662 * unnecessary work. 3663 * 3664 * Returns: %TRUE if @widget is being destroyed 3665 */ 3666 public bool inDestruction() 3667 { 3668 return gtk_widget_in_destruction(gtkWidget) != 0; 3669 } 3670 3671 /** 3672 * Creates and initializes child widgets defined in templates. This 3673 * function must be called in the instance initializer for any 3674 * class which assigned itself a template using gtk_widget_class_set_template() 3675 * 3676 * It is important to call this function in the instance initializer 3677 * of a #GtkWidget subclass and not in #GObject.constructed() or 3678 * #GObject.constructor() for two reasons. 3679 * 3680 * One reason is that generally derived widgets will assume that parent 3681 * class composite widgets have been created in their instance 3682 * initializers. 3683 * 3684 * Another reason is that when calling g_object_new() on a widget with 3685 * composite templates, it’s important to build the composite widgets 3686 * before the construct properties are set. Properties passed to g_object_new() 3687 * should take precedence over properties set in the private template XML. 3688 * 3689 * Since: 3.10 3690 */ 3691 public void initTemplate() 3692 { 3693 gtk_widget_init_template(gtkWidget); 3694 } 3695 3696 /** 3697 * Sets an input shape for this widget’s GDK window. This allows for 3698 * windows which react to mouse click in a nonrectangular region, see 3699 * gdk_window_input_shape_combine_region() for more information. 3700 * 3701 * Params: 3702 * region = shape to be added, or %NULL to remove an existing shape 3703 * 3704 * Since: 3.0 3705 */ 3706 public void inputShapeCombineRegion(Region region) 3707 { 3708 gtk_widget_input_shape_combine_region(gtkWidget, (region is null) ? null : region.getRegionStruct()); 3709 } 3710 3711 /** 3712 * Inserts @group into @widget. Children of @widget that implement 3713 * #GtkActionable can then be associated with actions in @group by 3714 * setting their “action-name” to 3715 * @prefix.`action-name`. 3716 * 3717 * If @group is %NULL, a previously inserted group for @name is removed 3718 * from @widget. 3719 * 3720 * Params: 3721 * name = the prefix for actions in @group 3722 * group = a #GActionGroup, or %NULL 3723 * 3724 * Since: 3.6 3725 */ 3726 public void insertActionGroup(string name, ActionGroupIF group) 3727 { 3728 gtk_widget_insert_action_group(gtkWidget, Str.toStringz(name), (group is null) ? null : group.getActionGroupStruct()); 3729 } 3730 3731 /** 3732 * Computes the intersection of a @widget’s area and @area, storing 3733 * the intersection in @intersection, and returns %TRUE if there was 3734 * an intersection. @intersection may be %NULL if you’re only 3735 * interested in whether there was an intersection. 3736 * 3737 * Params: 3738 * area = a rectangle 3739 * intersection = rectangle to store 3740 * intersection of @widget and @area 3741 * 3742 * Returns: %TRUE if there was an intersection 3743 */ 3744 public bool intersect(GdkRectangle* area, out GdkRectangle intersection) 3745 { 3746 return gtk_widget_intersect(gtkWidget, area, &intersection) != 0; 3747 } 3748 3749 /** 3750 * Determines whether @widget is somewhere inside @ancestor, possibly with 3751 * intermediate containers. 3752 * 3753 * Params: 3754 * ancestor = another #GtkWidget 3755 * 3756 * Returns: %TRUE if @ancestor contains @widget as a child, 3757 * grandchild, great grandchild, etc. 3758 */ 3759 public bool isAncestor(Widget ancestor) 3760 { 3761 return gtk_widget_is_ancestor(gtkWidget, (ancestor is null) ? null : ancestor.getWidgetStruct()) != 0; 3762 } 3763 3764 /** 3765 * Whether @widget can rely on having its alpha channel 3766 * drawn correctly. On X11 this function returns whether a 3767 * compositing manager is running for @widget’s screen. 3768 * 3769 * Please note that the semantics of this call will change 3770 * in the future if used on a widget that has a composited 3771 * window in its hierarchy (as set by gdk_window_set_composited()). 3772 * 3773 * Deprecated: Use gdk_screen_is_composited() instead. 3774 * 3775 * Returns: %TRUE if the widget can rely on its alpha 3776 * channel being drawn correctly. 3777 * 3778 * Since: 2.10 3779 */ 3780 public bool isComposited() 3781 { 3782 return gtk_widget_is_composited(gtkWidget) != 0; 3783 } 3784 3785 /** 3786 * Determines whether @widget can be drawn to. A widget can be drawn 3787 * to if it is mapped and visible. 3788 * 3789 * Returns: %TRUE if @widget is drawable, %FALSE otherwise 3790 * 3791 * Since: 2.18 3792 */ 3793 public bool isDrawable() 3794 { 3795 return gtk_widget_is_drawable(gtkWidget) != 0; 3796 } 3797 3798 /** 3799 * Determines if the widget is the focus widget within its 3800 * toplevel. (This does not mean that the #GtkWidget:has-focus property is 3801 * necessarily set; #GtkWidget:has-focus will only be set if the 3802 * toplevel widget additionally has the global input focus.) 3803 * 3804 * Returns: %TRUE if the widget is the focus widget. 3805 */ 3806 public bool isFocus() 3807 { 3808 return gtk_widget_is_focus(gtkWidget) != 0; 3809 } 3810 3811 /** 3812 * Returns the widget’s effective sensitivity, which means 3813 * it is sensitive itself and also its parent widget is sensitive 3814 * 3815 * Returns: %TRUE if the widget is effectively sensitive 3816 * 3817 * Since: 2.18 3818 */ 3819 public bool isSensitive() 3820 { 3821 return gtk_widget_is_sensitive(gtkWidget) != 0; 3822 } 3823 3824 /** 3825 * Determines whether @widget is a toplevel widget. 3826 * 3827 * Currently only #GtkWindow and #GtkInvisible (and out-of-process 3828 * #GtkPlugs) are toplevel widgets. Toplevel widgets have no parent 3829 * widget. 3830 * 3831 * Returns: %TRUE if @widget is a toplevel, %FALSE otherwise 3832 * 3833 * Since: 2.18 3834 */ 3835 public bool isToplevel() 3836 { 3837 return gtk_widget_is_toplevel(gtkWidget) != 0; 3838 } 3839 3840 /** 3841 * Determines whether the widget and all its parents are marked as 3842 * visible. 3843 * 3844 * This function does not check if the widget is obscured in any way. 3845 * 3846 * See also gtk_widget_get_visible() and gtk_widget_set_visible() 3847 * 3848 * Returns: %TRUE if the widget and all its parents are visible 3849 * 3850 * Since: 3.8 3851 */ 3852 public bool isVisible() 3853 { 3854 return gtk_widget_is_visible(gtkWidget) != 0; 3855 } 3856 3857 /** 3858 * This function should be called whenever keyboard navigation within 3859 * a single widget hits a boundary. The function emits the 3860 * #GtkWidget::keynav-failed signal on the widget and its return 3861 * value should be interpreted in a way similar to the return value of 3862 * gtk_widget_child_focus(): 3863 * 3864 * When %TRUE is returned, stay in the widget, the failed keyboard 3865 * navigation is OK and/or there is nowhere we can/should move the 3866 * focus to. 3867 * 3868 * When %FALSE is returned, the caller should continue with keyboard 3869 * navigation outside the widget, e.g. by calling 3870 * gtk_widget_child_focus() on the widget’s toplevel. 3871 * 3872 * The default ::keynav-failed handler returns %TRUE for 3873 * %GTK_DIR_TAB_FORWARD and %GTK_DIR_TAB_BACKWARD. For the other 3874 * values of #GtkDirectionType it returns %FALSE. 3875 * 3876 * Whenever the default handler returns %TRUE, it also calls 3877 * gtk_widget_error_bell() to notify the user of the failed keyboard 3878 * navigation. 3879 * 3880 * A use case for providing an own implementation of ::keynav-failed 3881 * (either by connecting to it or by overriding it) would be a row of 3882 * #GtkEntry widgets where the user should be able to navigate the 3883 * entire row with the cursor keys, as e.g. known from user interfaces 3884 * that require entering license keys. 3885 * 3886 * Params: 3887 * direction = direction of focus movement 3888 * 3889 * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE 3890 * if the emitting widget should try to handle the keyboard 3891 * navigation attempt in its parent container(s). 3892 * 3893 * Since: 2.12 3894 */ 3895 public bool keynavFailed(GtkDirectionType direction) 3896 { 3897 return gtk_widget_keynav_failed(gtkWidget, direction) != 0; 3898 } 3899 3900 /** 3901 * Lists the closures used by @widget for accelerator group connections 3902 * with gtk_accel_group_connect_by_path() or gtk_accel_group_connect(). 3903 * The closures can be used to monitor accelerator changes on @widget, 3904 * by connecting to the @GtkAccelGroup::accel-changed signal of the 3905 * #GtkAccelGroup of a closure which can be found out with 3906 * gtk_accel_group_from_accel_closure(). 3907 * 3908 * Returns: a newly allocated #GList of closures 3909 */ 3910 public ListG listAccelClosures() 3911 { 3912 auto p = gtk_widget_list_accel_closures(gtkWidget); 3913 3914 if(p is null) 3915 { 3916 return null; 3917 } 3918 3919 return new ListG(cast(GList*) p); 3920 } 3921 3922 /** 3923 * Retrieves a %NULL-terminated array of strings containing the prefixes of 3924 * #GActionGroup's available to @widget. 3925 * 3926 * Returns: a %NULL-terminated array of strings. 3927 * 3928 * Since: 3.16 3929 */ 3930 public string[] listActionPrefixes() 3931 { 3932 return Str.toStringArray(gtk_widget_list_action_prefixes(gtkWidget)); 3933 } 3934 3935 /** 3936 * Returns a newly allocated list of the widgets, normally labels, for 3937 * which this widget is the target of a mnemonic (see for example, 3938 * gtk_label_set_mnemonic_widget()). 3939 * 3940 * The widgets in the list are not individually referenced. If you 3941 * want to iterate through the list and perform actions involving 3942 * callbacks that might destroy the widgets, you 3943 * must call `g_list_foreach (result, 3944 * (GFunc)g_object_ref, NULL)` first, and then unref all the 3945 * widgets afterwards. 3946 * 3947 * Returns: the list of 3948 * mnemonic labels; free this list 3949 * with g_list_free() when you are done with it. 3950 * 3951 * Since: 2.4 3952 */ 3953 public ListG listMnemonicLabels() 3954 { 3955 auto p = gtk_widget_list_mnemonic_labels(gtkWidget); 3956 3957 if(p is null) 3958 { 3959 return null; 3960 } 3961 3962 return new ListG(cast(GList*) p); 3963 } 3964 3965 /** 3966 * This function is only for use in widget implementations. Causes 3967 * a widget to be mapped if it isn’t already. 3968 */ 3969 public void map() 3970 { 3971 gtk_widget_map(gtkWidget); 3972 } 3973 3974 /** 3975 * Emits the #GtkWidget::mnemonic-activate signal. 3976 * 3977 * Params: 3978 * groupCycling = %TRUE if there are other widgets with the same mnemonic 3979 * 3980 * Returns: %TRUE if the signal has been handled 3981 */ 3982 public bool mnemonicActivate(bool groupCycling) 3983 { 3984 return gtk_widget_mnemonic_activate(gtkWidget, groupCycling) != 0; 3985 } 3986 3987 /** 3988 * Sets the base color for a widget in a particular state. 3989 * All other style values are left untouched. The base color 3990 * is the background color used along with the text color 3991 * (see gtk_widget_modify_text()) for widgets such as #GtkEntry 3992 * and #GtkTextView. See also gtk_widget_modify_style(). 3993 * 3994 * > Note that “no window” widgets (which have the %GTK_NO_WINDOW 3995 * > flag set) draw on their parent container’s window and thus may 3996 * > not draw any background themselves. This is the case for e.g. 3997 * > #GtkLabel. 3998 * > 3999 * > To modify the background of such widgets, you have to set the 4000 * > base color on their parent; if you want to set the background 4001 * > of a rectangular area around a label, try placing the label in 4002 * > a #GtkEventBox widget and setting the base color on that. 4003 * 4004 * Deprecated: Use gtk_widget_override_background_color() instead 4005 * 4006 * Params: 4007 * state = the state for which to set the base color 4008 * color = the color to assign (does not need to 4009 * be allocated), or %NULL to undo the effect of previous 4010 * calls to of gtk_widget_modify_base(). 4011 */ 4012 public void modifyBase(GtkStateType state, Color color) 4013 { 4014 gtk_widget_modify_base(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4015 } 4016 4017 /** 4018 * Sets the background color for a widget in a particular state. 4019 * 4020 * All other style values are left untouched. 4021 * See also gtk_widget_modify_style(). 4022 * 4023 * > Note that “no window” widgets (which have the %GTK_NO_WINDOW 4024 * > flag set) draw on their parent container’s window and thus may 4025 * > not draw any background themselves. This is the case for e.g. 4026 * > #GtkLabel. 4027 * > 4028 * > To modify the background of such widgets, you have to set the 4029 * > background color on their parent; if you want to set the background 4030 * > of a rectangular area around a label, try placing the label in 4031 * > a #GtkEventBox widget and setting the background color on that. 4032 * 4033 * Deprecated: Use gtk_widget_override_background_color() instead 4034 * 4035 * Params: 4036 * state = the state for which to set the background color 4037 * color = the color to assign (does not need 4038 * to be allocated), or %NULL to undo the effect of previous 4039 * calls to of gtk_widget_modify_bg(). 4040 */ 4041 public void modifyBg(GtkStateType state, Color color) 4042 { 4043 gtk_widget_modify_bg(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4044 } 4045 4046 /** 4047 * Sets the cursor color to use in a widget, overriding the #GtkWidget 4048 * cursor-color and secondary-cursor-color 4049 * style properties. 4050 * 4051 * All other style values are left untouched. 4052 * See also gtk_widget_modify_style(). 4053 * 4054 * Deprecated: Use gtk_widget_override_cursor() instead. 4055 * 4056 * Params: 4057 * primary = the color to use for primary cursor (does not 4058 * need to be allocated), or %NULL to undo the effect of previous 4059 * calls to of gtk_widget_modify_cursor(). 4060 * secondary = the color to use for secondary cursor (does 4061 * not need to be allocated), or %NULL to undo the effect of 4062 * previous calls to of gtk_widget_modify_cursor(). 4063 * 4064 * Since: 2.12 4065 */ 4066 public void modifyCursor(Color primary, Color secondary) 4067 { 4068 gtk_widget_modify_cursor(gtkWidget, (primary is null) ? null : primary.getColorStruct(), (secondary is null) ? null : secondary.getColorStruct()); 4069 } 4070 4071 /** 4072 * Sets the foreground color for a widget in a particular state. 4073 * 4074 * All other style values are left untouched. 4075 * See also gtk_widget_modify_style(). 4076 * 4077 * Deprecated: Use gtk_widget_override_color() instead 4078 * 4079 * Params: 4080 * state = the state for which to set the foreground color 4081 * color = the color to assign (does not need to be allocated), 4082 * or %NULL to undo the effect of previous calls to 4083 * of gtk_widget_modify_fg(). 4084 */ 4085 public void modifyFg(GtkStateType state, Color color) 4086 { 4087 gtk_widget_modify_fg(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4088 } 4089 4090 /** 4091 * Sets the font to use for a widget. 4092 * 4093 * All other style values are left untouched. 4094 * See also gtk_widget_modify_style(). 4095 * 4096 * Deprecated: Use gtk_widget_override_font() instead 4097 * 4098 * Params: 4099 * fontDesc = the font description to use, or %NULL 4100 * to undo the effect of previous calls to gtk_widget_modify_font() 4101 */ 4102 public void modifyFont(PgFontDescription fontDesc) 4103 { 4104 gtk_widget_modify_font(gtkWidget, (fontDesc is null) ? null : fontDesc.getPgFontDescriptionStruct()); 4105 } 4106 4107 /** 4108 * Modifies style values on the widget. 4109 * 4110 * Modifications made using this technique take precedence over 4111 * style values set via an RC file, however, they will be overridden 4112 * if a style is explicitly set on the widget using gtk_widget_set_style(). 4113 * The #GtkRcStyle-struct is designed so each field can either be 4114 * set or unset, so it is possible, using this function, to modify some 4115 * style values and leave the others unchanged. 4116 * 4117 * Note that modifications made with this function are not cumulative 4118 * with previous calls to gtk_widget_modify_style() or with such 4119 * functions as gtk_widget_modify_fg(). If you wish to retain 4120 * previous values, you must first call gtk_widget_get_modifier_style(), 4121 * make your modifications to the returned style, then call 4122 * gtk_widget_modify_style() with that style. On the other hand, 4123 * if you first call gtk_widget_modify_style(), subsequent calls 4124 * to such functions gtk_widget_modify_fg() will have a cumulative 4125 * effect with the initial modifications. 4126 * 4127 * Deprecated: Use #GtkStyleContext with a custom #GtkStyleProvider instead 4128 * 4129 * Params: 4130 * style = the #GtkRcStyle-struct holding the style modifications 4131 */ 4132 public void modifyStyle(RcStyle style) 4133 { 4134 gtk_widget_modify_style(gtkWidget, (style is null) ? null : style.getRcStyleStruct()); 4135 } 4136 4137 /** 4138 * Sets the text color for a widget in a particular state. 4139 * 4140 * All other style values are left untouched. 4141 * The text color is the foreground color used along with the 4142 * base color (see gtk_widget_modify_base()) for widgets such 4143 * as #GtkEntry and #GtkTextView. 4144 * See also gtk_widget_modify_style(). 4145 * 4146 * Deprecated: Use gtk_widget_override_color() instead 4147 * 4148 * Params: 4149 * state = the state for which to set the text color 4150 * color = the color to assign (does not need to 4151 * be allocated), or %NULL to undo the effect of previous 4152 * calls to of gtk_widget_modify_text(). 4153 */ 4154 public void modifyText(GtkStateType state, Color color) 4155 { 4156 gtk_widget_modify_text(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4157 } 4158 4159 /** 4160 * Sets the background color to use for a widget. 4161 * 4162 * All other style values are left untouched. 4163 * See gtk_widget_override_color(). 4164 * 4165 * Deprecated: This function is not useful in the context of CSS-based 4166 * rendering. If you wish to change the way a widget renders its background 4167 * you should use a custom CSS style, through an application-specific 4168 * #GtkStyleProvider and a CSS style class. You can also override the default 4169 * drawing of a widget through the #GtkWidget::draw signal, and use Cairo to 4170 * draw a specific color, regardless of the CSS style. 4171 * 4172 * Params: 4173 * state = the state for which to set the background color 4174 * color = the color to assign, or %NULL to undo the effect 4175 * of previous calls to gtk_widget_override_background_color() 4176 * 4177 * Since: 3.0 4178 */ 4179 public void overrideBackgroundColor(GtkStateFlags state, RGBA color) 4180 { 4181 gtk_widget_override_background_color(gtkWidget, state, (color is null) ? null : color.getRGBAStruct()); 4182 } 4183 4184 /** 4185 * Sets the color to use for a widget. 4186 * 4187 * All other style values are left untouched. 4188 * 4189 * This function does not act recursively. Setting the color of a 4190 * container does not affect its children. Note that some widgets that 4191 * you may not think of as containers, for instance #GtkButtons, 4192 * are actually containers. 4193 * 4194 * This API is mostly meant as a quick way for applications to 4195 * change a widget appearance. If you are developing a widgets 4196 * library and intend this change to be themeable, it is better 4197 * done by setting meaningful CSS classes in your 4198 * widget/container implementation through gtk_style_context_add_class(). 4199 * 4200 * This way, your widget library can install a #GtkCssProvider 4201 * with the %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order 4202 * to provide a default styling for those widgets that need so, and 4203 * this theming may fully overridden by the user’s theme. 4204 * 4205 * Note that for complex widgets this may bring in undesired 4206 * results (such as uniform background color everywhere), in 4207 * these cases it is better to fully style such widgets through a 4208 * #GtkCssProvider with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION 4209 * priority. 4210 * 4211 * Deprecated: Use a custom style provider and style classes instead 4212 * 4213 * Params: 4214 * state = the state for which to set the color 4215 * color = the color to assign, or %NULL to undo the effect 4216 * of previous calls to gtk_widget_override_color() 4217 * 4218 * Since: 3.0 4219 */ 4220 public void overrideColor(GtkStateFlags state, RGBA color) 4221 { 4222 gtk_widget_override_color(gtkWidget, state, (color is null) ? null : color.getRGBAStruct()); 4223 } 4224 4225 /** 4226 * Sets the cursor color to use in a widget, overriding the 4227 * cursor-color and secondary-cursor-color 4228 * style properties. All other style values are left untouched. 4229 * See also gtk_widget_modify_style(). 4230 * 4231 * Note that the underlying properties have the #GdkColor type, 4232 * so the alpha value in @primary and @secondary will be ignored. 4233 * 4234 * Deprecated: This function is not useful in the context of CSS-based 4235 * rendering. If you wish to change the color used to render the primary 4236 * and secondary cursors you should use a custom CSS style, through an 4237 * application-specific #GtkStyleProvider and a CSS style class. 4238 * 4239 * Params: 4240 * cursor = the color to use for primary cursor (does not need to be 4241 * allocated), or %NULL to undo the effect of previous calls to 4242 * of gtk_widget_override_cursor(). 4243 * secondaryCursor = the color to use for secondary cursor (does not 4244 * need to be allocated), or %NULL to undo the effect of previous 4245 * calls to of gtk_widget_override_cursor(). 4246 * 4247 * Since: 3.0 4248 */ 4249 public void overrideCursor(RGBA cursor, RGBA secondaryCursor) 4250 { 4251 gtk_widget_override_cursor(gtkWidget, (cursor is null) ? null : cursor.getRGBAStruct(), (secondaryCursor is null) ? null : secondaryCursor.getRGBAStruct()); 4252 } 4253 4254 /** 4255 * Sets the font to use for a widget. All other style values are 4256 * left untouched. See gtk_widget_override_color(). 4257 * 4258 * Deprecated: This function is not useful in the context of CSS-based 4259 * rendering. If you wish to change the font a widget uses to render its text 4260 * you should use a custom CSS style, through an application-specific 4261 * #GtkStyleProvider and a CSS style class. 4262 * 4263 * Params: 4264 * fontDesc = the font description to use, or %NULL to undo 4265 * the effect of previous calls to gtk_widget_override_font() 4266 * 4267 * Since: 3.0 4268 */ 4269 public void overrideFont(PgFontDescription fontDesc) 4270 { 4271 gtk_widget_override_font(gtkWidget, (fontDesc is null) ? null : fontDesc.getPgFontDescriptionStruct()); 4272 } 4273 4274 /** 4275 * Sets a symbolic color for a widget. 4276 * 4277 * All other style values are left untouched. 4278 * See gtk_widget_override_color() for overriding the foreground 4279 * or background color. 4280 * 4281 * Deprecated: This function is not useful in the context of CSS-based 4282 * rendering. If you wish to change the color used to render symbolic icons 4283 * you should use a custom CSS style, through an application-specific 4284 * #GtkStyleProvider and a CSS style class. 4285 * 4286 * Params: 4287 * name = the name of the symbolic color to modify 4288 * color = the color to assign (does not need 4289 * to be allocated), or %NULL to undo the effect of previous 4290 * calls to gtk_widget_override_symbolic_color() 4291 * 4292 * Since: 3.0 4293 */ 4294 public void overrideSymbolicColor(string name, RGBA color) 4295 { 4296 gtk_widget_override_symbolic_color(gtkWidget, Str.toStringz(name), (color is null) ? null : color.getRGBAStruct()); 4297 } 4298 4299 /** 4300 * Obtains the full path to @widget. The path is simply the name of a 4301 * widget and all its parents in the container hierarchy, separated by 4302 * periods. The name of a widget comes from 4303 * gtk_widget_get_name(). Paths are used to apply styles to a widget 4304 * in gtkrc configuration files. Widget names are the type of the 4305 * widget by default (e.g. “GtkButton”) or can be set to an 4306 * application-specific value with gtk_widget_set_name(). By setting 4307 * the name of a widget, you allow users or theme authors to apply 4308 * styles to that specific widget in their gtkrc 4309 * file. @path_reversed_p fills in the path in reverse order, 4310 * i.e. starting with @widget’s name instead of starting with the name 4311 * of @widget’s outermost ancestor. 4312 * 4313 * Deprecated: Use gtk_widget_get_path() instead 4314 * 4315 * Params: 4316 * pathLength = location to store length of the path, 4317 * or %NULL 4318 * path = location to store allocated path string, 4319 * or %NULL 4320 * pathReversed = location to store allocated reverse 4321 * path string, or %NULL 4322 */ 4323 public void path(out uint pathLength, out string path, out string pathReversed) 4324 { 4325 char* outpath = null; 4326 char* outpathReversed = null; 4327 4328 gtk_widget_path(gtkWidget, &pathLength, &outpath, &outpathReversed); 4329 4330 path = Str.toString(outpath); 4331 pathReversed = Str.toString(outpathReversed); 4332 } 4333 4334 /** 4335 * This function is only for use in widget implementations. 4336 * 4337 * Flags the widget for a rerun of the GtkWidgetClass::size_allocate 4338 * function. Use this function instead of gtk_widget_queue_resize() 4339 * when the @widget's size request didn't change but it wants to 4340 * reposition its contents. 4341 * 4342 * An example user of this function is gtk_widget_set_halign(). 4343 * 4344 * Since: 3.20 4345 */ 4346 public void queueAllocate() 4347 { 4348 gtk_widget_queue_allocate(gtkWidget); 4349 } 4350 4351 /** 4352 * Mark @widget as needing to recompute its expand flags. Call 4353 * this function when setting legacy expand child properties 4354 * on the child of a container. 4355 * 4356 * See gtk_widget_compute_expand(). 4357 */ 4358 public void queueComputeExpand() 4359 { 4360 gtk_widget_queue_compute_expand(gtkWidget); 4361 } 4362 4363 /** 4364 * Equivalent to calling gtk_widget_queue_draw_area() for the 4365 * entire area of a widget. 4366 */ 4367 public void queueDraw() 4368 { 4369 gtk_widget_queue_draw(gtkWidget); 4370 } 4371 4372 /** 4373 * Convenience function that calls gtk_widget_queue_draw_region() on 4374 * the region created from the given coordinates. 4375 * 4376 * The region here is specified in widget coordinates. 4377 * Widget coordinates are a bit odd; for historical reasons, they are 4378 * defined as @widget->window coordinates for widgets that return %TRUE for 4379 * gtk_widget_get_has_window(), and are relative to @widget->allocation.x, 4380 * @widget->allocation.y otherwise. 4381 * 4382 * @width or @height may be 0, in this case this function does 4383 * nothing. Negative values for @width and @height are not allowed. 4384 * 4385 * Params: 4386 * x = x coordinate of upper-left corner of rectangle to redraw 4387 * y = y coordinate of upper-left corner of rectangle to redraw 4388 * width = width of region to draw 4389 * height = height of region to draw 4390 */ 4391 public void queueDrawArea(int x, int y, int width, int height) 4392 { 4393 gtk_widget_queue_draw_area(gtkWidget, x, y, width, height); 4394 } 4395 4396 /** 4397 * Invalidates the area of @widget defined by @region by calling 4398 * gdk_window_invalidate_region() on the widget’s window and all its 4399 * child windows. Once the main loop becomes idle (after the current 4400 * batch of events has been processed, roughly), the window will 4401 * receive expose events for the union of all regions that have been 4402 * invalidated. 4403 * 4404 * Normally you would only use this function in widget 4405 * implementations. You might also use it to schedule a redraw of a 4406 * #GtkDrawingArea or some portion thereof. 4407 * 4408 * Params: 4409 * region = region to draw 4410 * 4411 * Since: 3.0 4412 */ 4413 public void queueDrawRegion(Region region) 4414 { 4415 gtk_widget_queue_draw_region(gtkWidget, (region is null) ? null : region.getRegionStruct()); 4416 } 4417 4418 /** 4419 * This function is only for use in widget implementations. 4420 * Flags a widget to have its size renegotiated; should 4421 * be called when a widget for some reason has a new size request. 4422 * For example, when you change the text in a #GtkLabel, #GtkLabel 4423 * queues a resize to ensure there’s enough space for the new text. 4424 * 4425 * Note that you cannot call gtk_widget_queue_resize() on a widget 4426 * from inside its implementation of the GtkWidgetClass::size_allocate 4427 * virtual method. Calls to gtk_widget_queue_resize() from inside 4428 * GtkWidgetClass::size_allocate will be silently ignored. 4429 */ 4430 public void queueResize() 4431 { 4432 gtk_widget_queue_resize(gtkWidget); 4433 } 4434 4435 /** 4436 * This function works like gtk_widget_queue_resize(), 4437 * except that the widget is not invalidated. 4438 * 4439 * Since: 2.4 4440 */ 4441 public void queueResizeNoRedraw() 4442 { 4443 gtk_widget_queue_resize_no_redraw(gtkWidget); 4444 } 4445 4446 /** 4447 * Creates the GDK (windowing system) resources associated with a 4448 * widget. For example, @widget->window will be created when a widget 4449 * is realized. Normally realization happens implicitly; if you show 4450 * a widget and all its parent containers, then the widget will be 4451 * realized and mapped automatically. 4452 * 4453 * Realizing a widget requires all 4454 * the widget’s parent widgets to be realized; calling 4455 * gtk_widget_realize() realizes the widget’s parents in addition to 4456 * @widget itself. If a widget is not yet inside a toplevel window 4457 * when you realize it, bad things will happen. 4458 * 4459 * This function is primarily used in widget implementations, and 4460 * isn’t very useful otherwise. Many times when you think you might 4461 * need it, a better approach is to connect to a signal that will be 4462 * called after the widget is realized automatically, such as 4463 * #GtkWidget::draw. Or simply g_signal_connect () to the 4464 * #GtkWidget::realize signal. 4465 */ 4466 public void realize() 4467 { 4468 gtk_widget_realize(gtkWidget); 4469 } 4470 4471 /** 4472 * Computes the intersection of a @widget’s area and @region, returning 4473 * the intersection. The result may be empty, use cairo_region_is_empty() to 4474 * check. 4475 * 4476 * Deprecated: Use gtk_widget_get_allocation() and 4477 * cairo_region_intersect_rectangle() to get the same behavior. 4478 * 4479 * Params: 4480 * region = a #cairo_region_t, in the same coordinate system as 4481 * @widget->allocation. That is, relative to @widget->window 4482 * for widgets which return %FALSE from gtk_widget_get_has_window(); 4483 * relative to the parent window of @widget->window otherwise. 4484 * 4485 * Returns: A newly allocated region holding the intersection of @widget 4486 * and @region. 4487 */ 4488 public Region regionIntersect(Region region) 4489 { 4490 auto p = gtk_widget_region_intersect(gtkWidget, (region is null) ? null : region.getRegionStruct()); 4491 4492 if(p is null) 4493 { 4494 return null; 4495 } 4496 4497 return new Region(cast(cairo_region_t*) p); 4498 } 4499 4500 /** 4501 * Registers a #GdkWindow with the widget and sets it up so that 4502 * the widget receives events for it. Call gtk_widget_unregister_window() 4503 * when destroying the window. 4504 * 4505 * Before 3.8 you needed to call gdk_window_set_user_data() directly to set 4506 * this up. This is now deprecated and you should use gtk_widget_register_window() 4507 * instead. Old code will keep working as is, although some new features like 4508 * transparency might not work perfectly. 4509 * 4510 * Params: 4511 * window = a #GdkWindow 4512 * 4513 * Since: 3.8 4514 */ 4515 public void registerWindow(GdkWin window) 4516 { 4517 gtk_widget_register_window(gtkWidget, (window is null) ? null : window.getWindowStruct()); 4518 } 4519 4520 /** 4521 * Removes an accelerator from @widget, previously installed with 4522 * gtk_widget_add_accelerator(). 4523 * 4524 * Params: 4525 * accelGroup = accel group for this widget 4526 * accelKey = GDK keyval of the accelerator 4527 * accelMods = modifier key combination of the accelerator 4528 * 4529 * Returns: whether an accelerator was installed and could be removed 4530 */ 4531 public bool removeAccelerator(AccelGroup accelGroup, uint accelKey, GdkModifierType accelMods) 4532 { 4533 return gtk_widget_remove_accelerator(gtkWidget, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct(), accelKey, accelMods) != 0; 4534 } 4535 4536 /** 4537 * Removes a widget from the list of mnemonic labels for 4538 * this widget. (See gtk_widget_list_mnemonic_labels()). The widget 4539 * must have previously been added to the list with 4540 * gtk_widget_add_mnemonic_label(). 4541 * 4542 * Params: 4543 * label = a #GtkWidget that was previously set as a mnemonic label for 4544 * @widget with gtk_widget_add_mnemonic_label(). 4545 * 4546 * Since: 2.4 4547 */ 4548 public void removeMnemonicLabel(Widget label) 4549 { 4550 gtk_widget_remove_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 4551 } 4552 4553 /** 4554 * Removes a tick callback previously registered with 4555 * gtk_widget_add_tick_callback(). 4556 * 4557 * Params: 4558 * id = an id returned by gtk_widget_add_tick_callback() 4559 * 4560 * Since: 3.8 4561 */ 4562 public void removeTickCallback(uint id) 4563 { 4564 gtk_widget_remove_tick_callback(gtkWidget, id); 4565 } 4566 4567 /** 4568 * A convenience function that uses the theme settings for @widget 4569 * to look up @stock_id and render it to a pixbuf. @stock_id should 4570 * be a stock icon ID such as #GTK_STOCK_OPEN or #GTK_STOCK_OK. @size 4571 * should be a size such as #GTK_ICON_SIZE_MENU. @detail should be a 4572 * string that identifies the widget or code doing the rendering, so 4573 * that theme engines can special-case rendering for that widget or 4574 * code. 4575 * 4576 * The pixels in the returned #GdkPixbuf are shared with the rest of 4577 * the application and should not be modified. The pixbuf should be 4578 * freed after use with g_object_unref(). 4579 * 4580 * Deprecated: Use gtk_widget_render_icon_pixbuf() instead. 4581 * 4582 * Params: 4583 * stockId = a stock ID 4584 * size = a stock size (#GtkIconSize). A size of `(GtkIconSize)-1` 4585 * means render at the size of the source and don’t scale (if there are 4586 * multiple source sizes, GTK+ picks one of the available sizes). 4587 * detail = render detail to pass to theme engine 4588 * 4589 * Returns: a new pixbuf, or %NULL if the 4590 * stock ID wasn’t known 4591 */ 4592 public Pixbuf renderIcon(string stockId, GtkIconSize size, string detail) 4593 { 4594 auto p = gtk_widget_render_icon(gtkWidget, Str.toStringz(stockId), size, Str.toStringz(detail)); 4595 4596 if(p is null) 4597 { 4598 return null; 4599 } 4600 4601 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true); 4602 } 4603 4604 /** 4605 * A convenience function that uses the theme engine and style 4606 * settings for @widget to look up @stock_id and render it to 4607 * a pixbuf. @stock_id should be a stock icon ID such as 4608 * #GTK_STOCK_OPEN or #GTK_STOCK_OK. @size should be a size 4609 * such as #GTK_ICON_SIZE_MENU. 4610 * 4611 * The pixels in the returned #GdkPixbuf are shared with the rest of 4612 * the application and should not be modified. The pixbuf should be freed 4613 * after use with g_object_unref(). 4614 * 4615 * Deprecated: Use gtk_icon_theme_load_icon() instead. 4616 * 4617 * Params: 4618 * stockId = a stock ID 4619 * size = a stock size (#GtkIconSize). A size of `(GtkIconSize)-1` 4620 * means render at the size of the source and don’t scale (if there are 4621 * multiple source sizes, GTK+ picks one of the available sizes). 4622 * 4623 * Returns: a new pixbuf, or %NULL if the 4624 * stock ID wasn’t known 4625 * 4626 * Since: 3.0 4627 */ 4628 public Pixbuf renderIconPixbuf(string stockId, GtkIconSize size) 4629 { 4630 auto p = gtk_widget_render_icon_pixbuf(gtkWidget, Str.toStringz(stockId), size); 4631 4632 if(p is null) 4633 { 4634 return null; 4635 } 4636 4637 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p, true); 4638 } 4639 4640 /** 4641 * Moves a widget from one #GtkContainer to another, handling reference 4642 * count issues to avoid destroying the widget. 4643 * 4644 * Deprecated: Use gtk_container_remove() and gtk_container_add(). 4645 * 4646 * Params: 4647 * newParent = a #GtkContainer to move the widget into 4648 */ 4649 public void reparent(Widget newParent) 4650 { 4651 gtk_widget_reparent(gtkWidget, (newParent is null) ? null : newParent.getWidgetStruct()); 4652 } 4653 4654 /** 4655 * Reset the styles of @widget and all descendents, so when 4656 * they are looked up again, they get the correct values 4657 * for the currently loaded RC file settings. 4658 * 4659 * This function is not useful for applications. 4660 * 4661 * Deprecated: Use #GtkStyleContext instead, and gtk_widget_reset_style() 4662 */ 4663 public void resetRcStyles() 4664 { 4665 gtk_widget_reset_rc_styles(gtkWidget); 4666 } 4667 4668 /** 4669 * Updates the style context of @widget and all descendants 4670 * by updating its widget path. #GtkContainers may want 4671 * to use this on a child when reordering it in a way that a different 4672 * style might apply to it. See also gtk_container_get_path_for_child(). 4673 * 4674 * Since: 3.0 4675 */ 4676 public void resetStyle() 4677 { 4678 gtk_widget_reset_style(gtkWidget); 4679 } 4680 4681 /** 4682 * Very rarely-used function. This function is used to emit 4683 * an expose event on a widget. This function is not normally used 4684 * directly. The only time it is used is when propagating an expose 4685 * event to a windowless child widget (gtk_widget_get_has_window() is %FALSE), 4686 * and that is normally done using gtk_container_propagate_draw(). 4687 * 4688 * If you want to force an area of a window to be redrawn, 4689 * use gdk_window_invalidate_rect() or gdk_window_invalidate_region(). 4690 * To cause the redraw to be done immediately, follow that call 4691 * with a call to gdk_window_process_updates(). 4692 * 4693 * Deprecated: Application and widget code should not handle 4694 * expose events directly; invalidation should use the #GtkWidget 4695 * API, and drawing should only happen inside #GtkWidget::draw 4696 * implementations 4697 * 4698 * Params: 4699 * event = a expose #GdkEvent 4700 * 4701 * Returns: return from the event signal emission (%TRUE if 4702 * the event was handled) 4703 */ 4704 public int sendExpose(Event event) 4705 { 4706 return gtk_widget_send_expose(gtkWidget, (event is null) ? null : event.getEventStruct()); 4707 } 4708 4709 /** 4710 * Sends the focus change @event to @widget 4711 * 4712 * This function is not meant to be used by applications. The only time it 4713 * should be used is when it is necessary for a #GtkWidget to assign focus 4714 * to a widget that is semantically owned by the first widget even though 4715 * it’s not a direct child - for instance, a search entry in a floating 4716 * window similar to the quick search in #GtkTreeView. 4717 * 4718 * An example of its usage is: 4719 * 4720 * |[<!-- language="C" --> 4721 * GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE); 4722 * 4723 * fevent->focus_change.type = GDK_FOCUS_CHANGE; 4724 * fevent->focus_change.in = TRUE; 4725 * fevent->focus_change.window = _gtk_widget_get_window (widget); 4726 * if (fevent->focus_change.window != NULL) 4727 * g_object_ref (fevent->focus_change.window); 4728 * 4729 * gtk_widget_send_focus_change (widget, fevent); 4730 * 4731 * gdk_event_free (event); 4732 * ]| 4733 * 4734 * Params: 4735 * event = a #GdkEvent of type GDK_FOCUS_CHANGE 4736 * 4737 * Returns: the return value from the event signal emission: %TRUE 4738 * if the event was handled, and %FALSE otherwise 4739 * 4740 * Since: 2.20 4741 */ 4742 public bool sendFocusChange(Event event) 4743 { 4744 return gtk_widget_send_focus_change(gtkWidget, (event is null) ? null : event.getEventStruct()) != 0; 4745 } 4746 4747 /** 4748 * Given an accelerator group, @accel_group, and an accelerator path, 4749 * @accel_path, sets up an accelerator in @accel_group so whenever the 4750 * key binding that is defined for @accel_path is pressed, @widget 4751 * will be activated. This removes any accelerators (for any 4752 * accelerator group) installed by previous calls to 4753 * gtk_widget_set_accel_path(). Associating accelerators with 4754 * paths allows them to be modified by the user and the modifications 4755 * to be saved for future use. (See gtk_accel_map_save().) 4756 * 4757 * This function is a low level function that would most likely 4758 * be used by a menu creation system like #GtkUIManager. If you 4759 * use #GtkUIManager, setting up accelerator paths will be done 4760 * automatically. 4761 * 4762 * Even when you you aren’t using #GtkUIManager, if you only want to 4763 * set up accelerators on menu items gtk_menu_item_set_accel_path() 4764 * provides a somewhat more convenient interface. 4765 * 4766 * Note that @accel_path string will be stored in a #GQuark. Therefore, if you 4767 * pass a static string, you can save some memory by interning it first with 4768 * g_intern_static_string(). 4769 * 4770 * Params: 4771 * accelPath = path used to look up the accelerator 4772 * accelGroup = a #GtkAccelGroup. 4773 */ 4774 public void setAccelPath(string accelPath, AccelGroup accelGroup) 4775 { 4776 gtk_widget_set_accel_path(gtkWidget, Str.toStringz(accelPath), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 4777 } 4778 4779 /** 4780 * Sets the widget’s allocation. This should not be used 4781 * directly, but from within a widget’s size_allocate method. 4782 * 4783 * The allocation set should be the “adjusted” or actual 4784 * allocation. If you’re implementing a #GtkContainer, you want to use 4785 * gtk_widget_size_allocate() instead of gtk_widget_set_allocation(). 4786 * The GtkWidgetClass::adjust_size_allocation virtual method adjusts the 4787 * allocation inside gtk_widget_size_allocate() to create an adjusted 4788 * allocation. 4789 * 4790 * Params: 4791 * allocation = a pointer to a #GtkAllocation to copy from 4792 * 4793 * Since: 2.18 4794 */ 4795 public void setAllocation(GtkAllocation* allocation) 4796 { 4797 gtk_widget_set_allocation(gtkWidget, allocation); 4798 } 4799 4800 /** 4801 * Sets whether the application intends to draw on the widget in 4802 * an #GtkWidget::draw handler. 4803 * 4804 * This is a hint to the widget and does not affect the behavior of 4805 * the GTK+ core; many widgets ignore this flag entirely. For widgets 4806 * that do pay attention to the flag, such as #GtkEventBox and #GtkWindow, 4807 * the effect is to suppress default themed drawing of the widget's 4808 * background. (Children of the widget will still be drawn.) The application 4809 * is then entirely responsible for drawing the widget background. 4810 * 4811 * Note that the background is still drawn when the widget is mapped. 4812 * 4813 * Params: 4814 * appPaintable = %TRUE if the application will paint on the widget 4815 */ 4816 public void setAppPaintable(bool appPaintable) 4817 { 4818 gtk_widget_set_app_paintable(gtkWidget, appPaintable); 4819 } 4820 4821 /** 4822 * Specifies whether @widget can be a default widget. See 4823 * gtk_widget_grab_default() for details about the meaning of 4824 * “default”. 4825 * 4826 * Params: 4827 * canDefault = whether or not @widget can be a default widget. 4828 * 4829 * Since: 2.18 4830 */ 4831 public void setCanDefault(bool canDefault) 4832 { 4833 gtk_widget_set_can_default(gtkWidget, canDefault); 4834 } 4835 4836 /** 4837 * Specifies whether @widget can own the input focus. See 4838 * gtk_widget_grab_focus() for actually setting the input focus on a 4839 * widget. 4840 * 4841 * Params: 4842 * canFocus = whether or not @widget can own the input focus. 4843 * 4844 * Since: 2.18 4845 */ 4846 public void setCanFocus(bool canFocus) 4847 { 4848 gtk_widget_set_can_focus(gtkWidget, canFocus); 4849 } 4850 4851 /** 4852 * Sets whether @widget should be mapped along with its when its parent 4853 * is mapped and @widget has been shown with gtk_widget_show(). 4854 * 4855 * The child visibility can be set for widget before it is added to 4856 * a container with gtk_widget_set_parent(), to avoid mapping 4857 * children unnecessary before immediately unmapping them. However 4858 * it will be reset to its default state of %TRUE when the widget 4859 * is removed from a container. 4860 * 4861 * Note that changing the child visibility of a widget does not 4862 * queue a resize on the widget. Most of the time, the size of 4863 * a widget is computed from all visible children, whether or 4864 * not they are mapped. If this is not the case, the container 4865 * can queue a resize itself. 4866 * 4867 * This function is only useful for container implementations and 4868 * never should be called by an application. 4869 * 4870 * Params: 4871 * isVisible = if %TRUE, @widget should be mapped along with its parent. 4872 */ 4873 public void setChildVisible(bool isVisible) 4874 { 4875 gtk_widget_set_child_visible(gtkWidget, isVisible); 4876 } 4877 4878 /** 4879 * Sets the widget’s clip. This must not be used directly, 4880 * but from within a widget’s size_allocate method. 4881 * It must be called after gtk_widget_set_allocation() (or after chaining up 4882 * to the parent class), because that function resets the clip. 4883 * 4884 * The clip set should be the area that @widget draws on. If @widget is a 4885 * #GtkContainer, the area must contain all children's clips. 4886 * 4887 * If this function is not called by @widget during a ::size-allocate handler, 4888 * the clip will be set to @widget's allocation. 4889 * 4890 * Params: 4891 * clip = a pointer to a #GtkAllocation to copy from 4892 * 4893 * Since: 3.14 4894 */ 4895 public void setClip(GtkAllocation* clip) 4896 { 4897 gtk_widget_set_clip(gtkWidget, clip); 4898 } 4899 4900 /** 4901 * Sets a widgets composite name. The widget must be 4902 * a composite child of its parent; see gtk_widget_push_composite_child(). 4903 * 4904 * Deprecated: Use gtk_widget_class_set_template(), or don’t use this API at all. 4905 * 4906 * Params: 4907 * name = the name to set 4908 */ 4909 public void setCompositeName(string name) 4910 { 4911 gtk_widget_set_composite_name(gtkWidget, Str.toStringz(name)); 4912 } 4913 4914 /** 4915 * Enables or disables a #GdkDevice to interact with @widget 4916 * and all its children. 4917 * 4918 * It does so by descending through the #GdkWindow hierarchy 4919 * and enabling the same mask that is has for core events 4920 * (i.e. the one that gdk_window_get_events() returns). 4921 * 4922 * Params: 4923 * device = a #GdkDevice 4924 * enabled = whether to enable the device 4925 * 4926 * Since: 3.0 4927 */ 4928 public void setDeviceEnabled(Device device, bool enabled) 4929 { 4930 gtk_widget_set_device_enabled(gtkWidget, (device is null) ? null : device.getDeviceStruct(), enabled); 4931 } 4932 4933 /** 4934 * Sets the device event mask (see #GdkEventMask) for a widget. The event 4935 * mask determines which events a widget will receive from @device. Keep 4936 * in mind that different widgets have different default event masks, and by 4937 * changing the event mask you may disrupt a widget’s functionality, 4938 * so be careful. This function must be called while a widget is 4939 * unrealized. Consider gtk_widget_add_device_events() for widgets that are 4940 * already realized, or if you want to preserve the existing event 4941 * mask. This function can’t be used with windowless widgets (which return 4942 * %FALSE from gtk_widget_get_has_window()); 4943 * to get events on those widgets, place them inside a #GtkEventBox 4944 * and receive events on the event box. 4945 * 4946 * Params: 4947 * device = a #GdkDevice 4948 * events = event mask 4949 * 4950 * Since: 3.0 4951 */ 4952 public void setDeviceEvents(Device device, GdkEventMask events) 4953 { 4954 gtk_widget_set_device_events(gtkWidget, (device is null) ? null : device.getDeviceStruct(), events); 4955 } 4956 4957 /** 4958 * Sets the reading direction on a particular widget. This direction 4959 * controls the primary direction for widgets containing text, 4960 * and also the direction in which the children of a container are 4961 * packed. The ability to set the direction is present in order 4962 * so that correct localization into languages with right-to-left 4963 * reading directions can be done. Generally, applications will 4964 * let the default reading direction present, except for containers 4965 * where the containers are arranged in an order that is explicitly 4966 * visual rather than logical (such as buttons for text justification). 4967 * 4968 * If the direction is set to %GTK_TEXT_DIR_NONE, then the value 4969 * set by gtk_widget_set_default_direction() will be used. 4970 * 4971 * Params: 4972 * dir = the new direction 4973 */ 4974 public void setDirection(GtkTextDirection dir) 4975 { 4976 gtk_widget_set_direction(gtkWidget, dir); 4977 } 4978 4979 /** 4980 * Widgets are double buffered by default; you can use this function 4981 * to turn off the buffering. “Double buffered” simply means that 4982 * gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() are called 4983 * automatically around expose events sent to the 4984 * widget. gdk_window_begin_draw_frame() diverts all drawing to a widget's 4985 * window to an offscreen buffer, and gdk_window_end_draw_frame() draws the 4986 * buffer to the screen. The result is that users see the window 4987 * update in one smooth step, and don’t see individual graphics 4988 * primitives being rendered. 4989 * 4990 * In very simple terms, double buffered widgets don’t flicker, 4991 * so you would only use this function to turn off double buffering 4992 * if you had special needs and really knew what you were doing. 4993 * 4994 * Note: if you turn off double-buffering, you have to handle 4995 * expose events, since even the clearing to the background color or 4996 * pixmap will not happen automatically (as it is done in 4997 * gdk_window_begin_draw_frame()). 4998 * 4999 * In 3.10 GTK and GDK have been restructured for translucent drawing. Since 5000 * then expose events for double-buffered widgets are culled into a single 5001 * event to the toplevel GDK window. If you now unset double buffering, you 5002 * will cause a separate rendering pass for every widget. This will likely 5003 * cause rendering problems - in particular related to stacking - and usually 5004 * increases rendering times significantly. 5005 * 5006 * Deprecated: This function does not work under non-X11 backends or with 5007 * non-native windows. 5008 * It should not be used in newly written code. 5009 * 5010 * Params: 5011 * doubleBuffered = %TRUE to double-buffer a widget 5012 */ 5013 public void setDoubleBuffered(bool doubleBuffered) 5014 { 5015 gtk_widget_set_double_buffered(gtkWidget, doubleBuffered); 5016 } 5017 5018 /** 5019 * Sets the event mask (see #GdkEventMask) for a widget. The event 5020 * mask determines which events a widget will receive. Keep in mind 5021 * that different widgets have different default event masks, and by 5022 * changing the event mask you may disrupt a widget’s functionality, 5023 * so be careful. This function must be called while a widget is 5024 * unrealized. Consider gtk_widget_add_events() for widgets that are 5025 * already realized, or if you want to preserve the existing event 5026 * mask. This function can’t be used with widgets that have no window. 5027 * (See gtk_widget_get_has_window()). To get events on those widgets, 5028 * place them inside a #GtkEventBox and receive events on the event 5029 * box. 5030 * 5031 * Params: 5032 * events = event mask 5033 */ 5034 public void setEvents(int events) 5035 { 5036 gtk_widget_set_events(gtkWidget, events); 5037 } 5038 5039 /** 5040 * Sets whether the widget should grab focus when it is clicked with the mouse. 5041 * Making mouse clicks not grab focus is useful in places like toolbars where 5042 * you don’t want the keyboard focus removed from the main area of the 5043 * application. 5044 * 5045 * Params: 5046 * focusOnClick = whether the widget should grab focus when clicked with the mouse 5047 * 5048 * Since: 3.20 5049 */ 5050 public void setFocusOnClick(bool focusOnClick) 5051 { 5052 gtk_widget_set_focus_on_click(gtkWidget, focusOnClick); 5053 } 5054 5055 /** 5056 * Sets the font map to use for Pango rendering. When not set, the widget 5057 * will inherit the font map from its parent. 5058 * 5059 * Params: 5060 * fontMap = a #PangoFontMap, or %NULL to unset any previously 5061 * set font map 5062 * 5063 * Since: 3.18 5064 */ 5065 public void setFontMap(PgFontMap fontMap) 5066 { 5067 gtk_widget_set_font_map(gtkWidget, (fontMap is null) ? null : fontMap.getPgFontMapStruct()); 5068 } 5069 5070 /** 5071 * Sets the #cairo_font_options_t used for Pango rendering in this widget. 5072 * When not set, the default font options for the #GdkScreen will be used. 5073 * 5074 * Params: 5075 * options = a #cairo_font_options_t, or %NULL to unset any 5076 * previously set default font options. 5077 * 5078 * Since: 3.18 5079 */ 5080 public void setFontOptions(FontOption options) 5081 { 5082 gtk_widget_set_font_options(gtkWidget, (options is null) ? null : options.getFontOptionStruct()); 5083 } 5084 5085 /** 5086 * Sets the horizontal alignment of @widget. 5087 * See the #GtkWidget:halign property. 5088 * 5089 * Params: 5090 * alig = the horizontal alignment 5091 */ 5092 public void setHalign(GtkAlign alig) 5093 { 5094 gtk_widget_set_halign(gtkWidget, alig); 5095 } 5096 5097 /** 5098 * Sets the has-tooltip property on @widget to @has_tooltip. See 5099 * #GtkWidget:has-tooltip for more information. 5100 * 5101 * Params: 5102 * hasTooltip = whether or not @widget has a tooltip. 5103 * 5104 * Since: 2.12 5105 */ 5106 public void setHasTooltip(bool hasTooltip) 5107 { 5108 gtk_widget_set_has_tooltip(gtkWidget, hasTooltip); 5109 } 5110 5111 /** 5112 * Specifies whether @widget has a #GdkWindow of its own. Note that 5113 * all realized widgets have a non-%NULL “window” pointer 5114 * (gtk_widget_get_window() never returns a %NULL window when a widget 5115 * is realized), but for many of them it’s actually the #GdkWindow of 5116 * one of its parent widgets. Widgets that do not create a %window for 5117 * themselves in #GtkWidget::realize must announce this by 5118 * calling this function with @has_window = %FALSE. 5119 * 5120 * This function should only be called by widget implementations, 5121 * and they should call it in their init() function. 5122 * 5123 * Params: 5124 * hasWindow = whether or not @widget has a window. 5125 * 5126 * Since: 2.18 5127 */ 5128 public void setHasWindow(bool hasWindow) 5129 { 5130 gtk_widget_set_has_window(gtkWidget, hasWindow); 5131 } 5132 5133 /** 5134 * Sets whether the widget would like any available extra horizontal 5135 * space. When a user resizes a #GtkWindow, widgets with expand=TRUE 5136 * generally receive the extra space. For example, a list or 5137 * scrollable area or document in your window would often be set to 5138 * expand. 5139 * 5140 * Call this function to set the expand flag if you would like your 5141 * widget to become larger horizontally when the window has extra 5142 * room. 5143 * 5144 * By default, widgets automatically expand if any of their children 5145 * want to expand. (To see if a widget will automatically expand given 5146 * its current children and state, call gtk_widget_compute_expand(). A 5147 * container can decide how the expandability of children affects the 5148 * expansion of the container by overriding the compute_expand virtual 5149 * method on #GtkWidget.). 5150 * 5151 * Setting hexpand explicitly with this function will override the 5152 * automatic expand behavior. 5153 * 5154 * This function forces the widget to expand or not to expand, 5155 * regardless of children. The override occurs because 5156 * gtk_widget_set_hexpand() sets the hexpand-set property (see 5157 * gtk_widget_set_hexpand_set()) which causes the widget’s hexpand 5158 * value to be used, rather than looking at children and widget state. 5159 * 5160 * Params: 5161 * expand = whether to expand 5162 */ 5163 public void setHexpand(bool expand) 5164 { 5165 gtk_widget_set_hexpand(gtkWidget, expand); 5166 } 5167 5168 /** 5169 * Sets whether the hexpand flag (see gtk_widget_get_hexpand()) will 5170 * be used. 5171 * 5172 * The hexpand-set property will be set automatically when you call 5173 * gtk_widget_set_hexpand() to set hexpand, so the most likely 5174 * reason to use this function would be to unset an explicit expand 5175 * flag. 5176 * 5177 * If hexpand is set, then it overrides any computed 5178 * expand value based on child widgets. If hexpand is not 5179 * set, then the expand value depends on whether any 5180 * children of the widget would like to expand. 5181 * 5182 * There are few reasons to use this function, but it’s here 5183 * for completeness and consistency. 5184 * 5185 * Params: 5186 * set = value for hexpand-set property 5187 */ 5188 public void setHexpandSet(bool set) 5189 { 5190 gtk_widget_set_hexpand_set(gtkWidget, set); 5191 } 5192 5193 /** 5194 * Marks the widget as being mapped. 5195 * 5196 * This function should only ever be called in a derived widget's 5197 * “map” or “unmap” implementation. 5198 * 5199 * Params: 5200 * mapped = %TRUE to mark the widget as mapped 5201 * 5202 * Since: 2.20 5203 */ 5204 public void setMapped(bool mapped) 5205 { 5206 gtk_widget_set_mapped(gtkWidget, mapped); 5207 } 5208 5209 /** 5210 * Sets the bottom margin of @widget. 5211 * See the #GtkWidget:margin-bottom property. 5212 * 5213 * Params: 5214 * margin = the bottom margin 5215 * 5216 * Since: 3.0 5217 */ 5218 public void setMarginBottom(int margin) 5219 { 5220 gtk_widget_set_margin_bottom(gtkWidget, margin); 5221 } 5222 5223 /** 5224 * Sets the end margin of @widget. 5225 * See the #GtkWidget:margin-end property. 5226 * 5227 * Params: 5228 * margin = the end margin 5229 * 5230 * Since: 3.12 5231 */ 5232 public void setMarginEnd(int margin) 5233 { 5234 gtk_widget_set_margin_end(gtkWidget, margin); 5235 } 5236 5237 /** 5238 * Sets the left margin of @widget. 5239 * See the #GtkWidget:margin-left property. 5240 * 5241 * Deprecated: Use gtk_widget_set_margin_start() instead. 5242 * 5243 * Params: 5244 * margin = the left margin 5245 * 5246 * Since: 3.0 5247 */ 5248 public void setMarginLeft(int margin) 5249 { 5250 gtk_widget_set_margin_left(gtkWidget, margin); 5251 } 5252 5253 /** 5254 * Sets the right margin of @widget. 5255 * See the #GtkWidget:margin-right property. 5256 * 5257 * Deprecated: Use gtk_widget_set_margin_end() instead. 5258 * 5259 * Params: 5260 * margin = the right margin 5261 * 5262 * Since: 3.0 5263 */ 5264 public void setMarginRight(int margin) 5265 { 5266 gtk_widget_set_margin_right(gtkWidget, margin); 5267 } 5268 5269 /** 5270 * Sets the start margin of @widget. 5271 * See the #GtkWidget:margin-start property. 5272 * 5273 * Params: 5274 * margin = the start margin 5275 * 5276 * Since: 3.12 5277 */ 5278 public void setMarginStart(int margin) 5279 { 5280 gtk_widget_set_margin_start(gtkWidget, margin); 5281 } 5282 5283 /** 5284 * Sets the top margin of @widget. 5285 * See the #GtkWidget:margin-top property. 5286 * 5287 * Params: 5288 * margin = the top margin 5289 * 5290 * Since: 3.0 5291 */ 5292 public void setMarginTop(int margin) 5293 { 5294 gtk_widget_set_margin_top(gtkWidget, margin); 5295 } 5296 5297 /** 5298 * Widgets can be named, which allows you to refer to them from a 5299 * CSS file. You can apply a style to widgets with a particular name 5300 * in the CSS file. See the documentation for the CSS syntax (on the 5301 * same page as the docs for #GtkStyleContext). 5302 * 5303 * Note that the CSS syntax has certain special characters to delimit 5304 * and represent elements in a selector (period, #, >, *...), so using 5305 * these will make your widget impossible to match by name. Any combination 5306 * of alphanumeric symbols, dashes and underscores will suffice. 5307 * 5308 * Params: 5309 * name = name for the widget 5310 */ 5311 public void setName(string name) 5312 { 5313 gtk_widget_set_name(gtkWidget, Str.toStringz(name)); 5314 } 5315 5316 /** 5317 * Sets the #GtkWidget:no-show-all property, which determines whether 5318 * calls to gtk_widget_show_all() will affect this widget. 5319 * 5320 * This is mostly for use in constructing widget hierarchies with externally 5321 * controlled visibility, see #GtkUIManager. 5322 * 5323 * Params: 5324 * noShowAll = the new value for the “no-show-all” property 5325 * 5326 * Since: 2.4 5327 */ 5328 public void setNoShowAll(bool noShowAll) 5329 { 5330 gtk_widget_set_no_show_all(gtkWidget, noShowAll); 5331 } 5332 5333 /** 5334 * Request the @widget to be rendered partially transparent, 5335 * with opacity 0 being fully transparent and 1 fully opaque. (Opacity values 5336 * are clamped to the [0,1] range.). 5337 * This works on both toplevel widget, and child widgets, although there 5338 * are some limitations: 5339 * 5340 * For toplevel widgets this depends on the capabilities of the windowing 5341 * system. On X11 this has any effect only on X screens with a compositing manager 5342 * running. See gtk_widget_is_composited(). On Windows it should work 5343 * always, although setting a window’s opacity after the window has been 5344 * shown causes it to flicker once on Windows. 5345 * 5346 * For child widgets it doesn’t work if any affected widget has a native window, or 5347 * disables double buffering. 5348 * 5349 * Params: 5350 * opacity = desired opacity, between 0 and 1 5351 * 5352 * Since: 3.8 5353 */ 5354 public void setOpacity(double opacity) 5355 { 5356 gtk_widget_set_opacity(gtkWidget, opacity); 5357 } 5358 5359 /** 5360 * This function is useful only when implementing subclasses of 5361 * #GtkContainer. 5362 * Sets the container as the parent of @widget, and takes care of 5363 * some details such as updating the state and style of the child 5364 * to reflect its new location. The opposite function is 5365 * gtk_widget_unparent(). 5366 * 5367 * Params: 5368 * parent = parent container 5369 */ 5370 public void setParent(Widget parent) 5371 { 5372 gtk_widget_set_parent(gtkWidget, (parent is null) ? null : parent.getWidgetStruct()); 5373 } 5374 5375 /** 5376 * Sets a non default parent window for @widget. 5377 * 5378 * For #GtkWindow classes, setting a @parent_window effects whether 5379 * the window is a toplevel window or can be embedded into other 5380 * widgets. 5381 * 5382 * For #GtkWindow classes, this needs to be called before the 5383 * window is realized. 5384 * 5385 * Params: 5386 * parentWindow = the new parent window. 5387 */ 5388 public void setParentWindow(GdkWin parentWindow) 5389 { 5390 gtk_widget_set_parent_window(gtkWidget, (parentWindow is null) ? null : parentWindow.getWindowStruct()); 5391 } 5392 5393 /** 5394 * Marks the widget as being realized. This function must only be 5395 * called after all #GdkWindows for the @widget have been created 5396 * and registered. 5397 * 5398 * This function should only ever be called in a derived widget's 5399 * “realize” or “unrealize” implementation. 5400 * 5401 * Params: 5402 * realized = %TRUE to mark the widget as realized 5403 * 5404 * Since: 2.20 5405 */ 5406 public void setRealized(bool realized) 5407 { 5408 gtk_widget_set_realized(gtkWidget, realized); 5409 } 5410 5411 /** 5412 * Specifies whether @widget will be treated as the default widget 5413 * within its toplevel when it has the focus, even if another widget 5414 * is the default. 5415 * 5416 * See gtk_widget_grab_default() for details about the meaning of 5417 * “default”. 5418 * 5419 * Params: 5420 * receivesDefault = whether or not @widget can be a default widget. 5421 * 5422 * Since: 2.18 5423 */ 5424 public void setReceivesDefault(bool receivesDefault) 5425 { 5426 gtk_widget_set_receives_default(gtkWidget, receivesDefault); 5427 } 5428 5429 /** 5430 * Sets whether the entire widget is queued for drawing when its size 5431 * allocation changes. By default, this setting is %TRUE and 5432 * the entire widget is redrawn on every size change. If your widget 5433 * leaves the upper left unchanged when made bigger, turning this 5434 * setting off will improve performance. 5435 * 5436 * Note that for widgets where gtk_widget_get_has_window() is %FALSE 5437 * setting this flag to %FALSE turns off all allocation on resizing: 5438 * the widget will not even redraw if its position changes; this is to 5439 * allow containers that don’t draw anything to avoid excess 5440 * invalidations. If you set this flag on a widget with no window that 5441 * does draw on @widget->window, you are 5442 * responsible for invalidating both the old and new allocation of the 5443 * widget when the widget is moved and responsible for invalidating 5444 * regions newly when the widget increases size. 5445 * 5446 * Params: 5447 * redrawOnAllocate = if %TRUE, the entire widget will be redrawn 5448 * when it is allocated to a new size. Otherwise, only the 5449 * new portion of the widget will be redrawn. 5450 */ 5451 public void setRedrawOnAllocate(bool redrawOnAllocate) 5452 { 5453 gtk_widget_set_redraw_on_allocate(gtkWidget, redrawOnAllocate); 5454 } 5455 5456 /** 5457 * Sets the sensitivity of a widget. A widget is sensitive if the user 5458 * can interact with it. Insensitive widgets are “grayed out” and the 5459 * user can’t interact with them. Insensitive widgets are known as 5460 * “inactive”, “disabled”, or “ghosted” in some other toolkits. 5461 * 5462 * Params: 5463 * sensitive = %TRUE to make the widget sensitive 5464 */ 5465 public void setSensitive(bool sensitive) 5466 { 5467 gtk_widget_set_sensitive(gtkWidget, sensitive); 5468 } 5469 5470 /** 5471 * Sets the minimum size of a widget; that is, the widget’s size 5472 * request will be at least @width by @height. You can use this 5473 * function to force a widget to be larger than it normally would be. 5474 * 5475 * In most cases, gtk_window_set_default_size() is a better choice for 5476 * toplevel windows than this function; setting the default size will 5477 * still allow users to shrink the window. Setting the size request 5478 * will force them to leave the window at least as large as the size 5479 * request. When dealing with window sizes, 5480 * gtk_window_set_geometry_hints() can be a useful function as well. 5481 * 5482 * Note the inherent danger of setting any fixed size - themes, 5483 * translations into other languages, different fonts, and user action 5484 * can all change the appropriate size for a given widget. So, it's 5485 * basically impossible to hardcode a size that will always be 5486 * correct. 5487 * 5488 * The size request of a widget is the smallest size a widget can 5489 * accept while still functioning well and drawing itself correctly. 5490 * However in some strange cases a widget may be allocated less than 5491 * its requested size, and in many cases a widget may be allocated more 5492 * space than it requested. 5493 * 5494 * If the size request in a given direction is -1 (unset), then 5495 * the “natural” size request of the widget will be used instead. 5496 * 5497 * The size request set here does not include any margin from the 5498 * #GtkWidget properties margin-left, margin-right, margin-top, and 5499 * margin-bottom, but it does include pretty much all other padding 5500 * or border properties set by any subclass of #GtkWidget. 5501 * 5502 * Params: 5503 * width = width @widget should request, or -1 to unset 5504 * height = height @widget should request, or -1 to unset 5505 */ 5506 public void setSizeRequest(int width, int height) 5507 { 5508 gtk_widget_set_size_request(gtkWidget, width, height); 5509 } 5510 5511 /** 5512 * This function is for use in widget implementations. Turns on flag 5513 * values in the current widget state (insensitive, prelighted, etc.). 5514 * 5515 * This function accepts the values %GTK_STATE_FLAG_DIR_LTR and 5516 * %GTK_STATE_FLAG_DIR_RTL but ignores them. If you want to set the widget's 5517 * direction, use gtk_widget_set_direction(). 5518 * 5519 * It is worth mentioning that any other state than %GTK_STATE_FLAG_INSENSITIVE, 5520 * will be propagated down to all non-internal children if @widget is a 5521 * #GtkContainer, while %GTK_STATE_FLAG_INSENSITIVE itself will be propagated 5522 * down to all #GtkContainer children by different means than turning on the 5523 * state flag down the hierarchy, both gtk_widget_get_state_flags() and 5524 * gtk_widget_is_sensitive() will make use of these. 5525 * 5526 * Params: 5527 * flags = State flags to turn on 5528 * clear = Whether to clear state before turning on @flags 5529 * 5530 * Since: 3.0 5531 */ 5532 public void setStateFlags(GtkStateFlags flags, bool clear) 5533 { 5534 gtk_widget_set_state_flags(gtkWidget, flags, clear); 5535 } 5536 5537 /** 5538 * Used to set the #GtkStyle for a widget (@widget->style). Since 5539 * GTK 3, this function does nothing, the passed in style is ignored. 5540 * 5541 * Deprecated: Use #GtkStyleContext instead 5542 * 5543 * Params: 5544 * style = a #GtkStyle, or %NULL to remove the effect 5545 * of a previous call to gtk_widget_set_style() and go back to 5546 * the default style 5547 */ 5548 public void setStyle(Style style) 5549 { 5550 gtk_widget_set_style(gtkWidget, (style is null) ? null : style.getStyleStruct()); 5551 } 5552 5553 /** 5554 * Enables or disables multiple pointer awareness. If this setting is %TRUE, 5555 * @widget will start receiving multiple, per device enter/leave events. Note 5556 * that if custom #GdkWindows are created in #GtkWidget::realize, 5557 * gdk_window_set_support_multidevice() will have to be called manually on them. 5558 * 5559 * Params: 5560 * supportMultidevice = %TRUE to support input from multiple devices. 5561 * 5562 * Since: 3.0 5563 */ 5564 public void setSupportMultidevice(bool supportMultidevice) 5565 { 5566 gtk_widget_set_support_multidevice(gtkWidget, supportMultidevice); 5567 } 5568 5569 /** 5570 * Sets @markup as the contents of the tooltip, which is marked up with 5571 * the [Pango text markup language][PangoMarkupFormat]. 5572 * 5573 * This function will take care of setting #GtkWidget:has-tooltip to %TRUE 5574 * and of the default handler for the #GtkWidget::query-tooltip signal. 5575 * 5576 * See also the #GtkWidget:tooltip-markup property and 5577 * gtk_tooltip_set_markup(). 5578 * 5579 * Params: 5580 * markup = the contents of the tooltip for @widget, or %NULL 5581 * 5582 * Since: 2.12 5583 */ 5584 public void setTooltipMarkup(string markup) 5585 { 5586 gtk_widget_set_tooltip_markup(gtkWidget, Str.toStringz(markup)); 5587 } 5588 5589 /** 5590 * Sets @text as the contents of the tooltip. This function will take 5591 * care of setting #GtkWidget:has-tooltip to %TRUE and of the default 5592 * handler for the #GtkWidget::query-tooltip signal. 5593 * 5594 * See also the #GtkWidget:tooltip-text property and gtk_tooltip_set_text(). 5595 * 5596 * Params: 5597 * text = the contents of the tooltip for @widget 5598 * 5599 * Since: 2.12 5600 */ 5601 public void setTooltipText(string text) 5602 { 5603 gtk_widget_set_tooltip_text(gtkWidget, Str.toStringz(text)); 5604 } 5605 5606 /** 5607 * Replaces the default window used for displaying 5608 * tooltips with @custom_window. GTK+ will take care of showing and 5609 * hiding @custom_window at the right moment, to behave likewise as 5610 * the default tooltip window. If @custom_window is %NULL, the default 5611 * tooltip window will be used. 5612 * 5613 * Params: 5614 * customWindow = a #GtkWindow, or %NULL 5615 * 5616 * Since: 2.12 5617 */ 5618 public void setTooltipWindow(Window customWindow) 5619 { 5620 gtk_widget_set_tooltip_window(gtkWidget, (customWindow is null) ? null : customWindow.getWindowStruct()); 5621 } 5622 5623 /** 5624 * Sets the vertical alignment of @widget. 5625 * See the #GtkWidget:valign property. 5626 * 5627 * Params: 5628 * alig = the vertical alignment 5629 */ 5630 public void setValign(GtkAlign alig) 5631 { 5632 gtk_widget_set_valign(gtkWidget, alig); 5633 } 5634 5635 /** 5636 * Sets whether the widget would like any available extra vertical 5637 * space. 5638 * 5639 * See gtk_widget_set_hexpand() for more detail. 5640 * 5641 * Params: 5642 * expand = whether to expand 5643 */ 5644 public void setVexpand(bool expand) 5645 { 5646 gtk_widget_set_vexpand(gtkWidget, expand); 5647 } 5648 5649 /** 5650 * Sets whether the vexpand flag (see gtk_widget_get_vexpand()) will 5651 * be used. 5652 * 5653 * See gtk_widget_set_hexpand_set() for more detail. 5654 * 5655 * Params: 5656 * set = value for vexpand-set property 5657 */ 5658 public void setVexpandSet(bool set) 5659 { 5660 gtk_widget_set_vexpand_set(gtkWidget, set); 5661 } 5662 5663 /** 5664 * Sets the visibility state of @widget. Note that setting this to 5665 * %TRUE doesn’t mean the widget is actually viewable, see 5666 * gtk_widget_get_visible(). 5667 * 5668 * This function simply calls gtk_widget_show() or gtk_widget_hide() 5669 * but is nicer to use when the visibility of the widget depends on 5670 * some condition. 5671 * 5672 * Params: 5673 * visible = whether the widget should be shown or not 5674 * 5675 * Since: 2.18 5676 */ 5677 public void setVisible(bool visible) 5678 { 5679 gtk_widget_set_visible(gtkWidget, visible); 5680 } 5681 5682 /** 5683 * Sets the visual that should be used for by widget and its children for 5684 * creating #GdkWindows. The visual must be on the same #GdkScreen as 5685 * returned by gtk_widget_get_screen(), so handling the 5686 * #GtkWidget::screen-changed signal is necessary. 5687 * 5688 * Setting a new @visual will not cause @widget to recreate its windows, 5689 * so you should call this function before @widget is realized. 5690 * 5691 * Params: 5692 * visual = visual to be used or %NULL to unset a previous one 5693 */ 5694 public void setVisual(Visual visual) 5695 { 5696 gtk_widget_set_visual(gtkWidget, (visual is null) ? null : visual.getVisualStruct()); 5697 } 5698 5699 /** 5700 * Sets a widget’s window. This function should only be used in a 5701 * widget’s #GtkWidget::realize implementation. The %window passed is 5702 * usually either new window created with gdk_window_new(), or the 5703 * window of its parent widget as returned by 5704 * gtk_widget_get_parent_window(). 5705 * 5706 * Widgets must indicate whether they will create their own #GdkWindow 5707 * by calling gtk_widget_set_has_window(). This is usually done in the 5708 * widget’s init() function. 5709 * 5710 * Note that this function does not add any reference to @window. 5711 * 5712 * Params: 5713 * window = a #GdkWindow 5714 * 5715 * Since: 2.18 5716 */ 5717 public void setWindow(GdkWin window) 5718 { 5719 gtk_widget_set_window(gtkWidget, (window is null) ? null : window.getWindowStruct()); 5720 } 5721 5722 /** 5723 * Sets a shape for this widget’s GDK window. This allows for 5724 * transparent windows etc., see gdk_window_shape_combine_region() 5725 * for more information. 5726 * 5727 * Params: 5728 * region = shape to be added, or %NULL to remove an existing shape 5729 * 5730 * Since: 3.0 5731 */ 5732 public void shapeCombineRegion(Region region) 5733 { 5734 gtk_widget_shape_combine_region(gtkWidget, (region is null) ? null : region.getRegionStruct()); 5735 } 5736 5737 /** 5738 * Flags a widget to be displayed. Any widget that isn’t shown will 5739 * not appear on the screen. If you want to show all the widgets in a 5740 * container, it’s easier to call gtk_widget_show_all() on the 5741 * container, instead of individually showing the widgets. 5742 * 5743 * Remember that you have to show the containers containing a widget, 5744 * in addition to the widget itself, before it will appear onscreen. 5745 * 5746 * When a toplevel container is shown, it is immediately realized and 5747 * mapped; other shown widgets are realized and mapped when their 5748 * toplevel container is realized and mapped. 5749 */ 5750 public void show() 5751 { 5752 gtk_widget_show(gtkWidget); 5753 } 5754 5755 /** 5756 * Recursively shows a widget, and any child widgets (if the widget is 5757 * a container). 5758 */ 5759 public void showAll() 5760 { 5761 gtk_widget_show_all(gtkWidget); 5762 } 5763 5764 /** 5765 * Shows a widget. If the widget is an unmapped toplevel widget 5766 * (i.e. a #GtkWindow that has not yet been shown), enter the main 5767 * loop and wait for the window to actually be mapped. Be careful; 5768 * because the main loop is running, anything can happen during 5769 * this function. 5770 */ 5771 public void showNow() 5772 { 5773 gtk_widget_show_now(gtkWidget); 5774 } 5775 5776 /** 5777 * This function is only used by #GtkContainer subclasses, to assign a size 5778 * and position to their child widgets. 5779 * 5780 * In this function, the allocation may be adjusted. It will be forced 5781 * to a 1x1 minimum size, and the adjust_size_allocation virtual 5782 * method on the child will be used to adjust the allocation. Standard 5783 * adjustments include removing the widget’s margins, and applying the 5784 * widget’s #GtkWidget:halign and #GtkWidget:valign properties. 5785 * 5786 * For baseline support in containers you need to use gtk_widget_size_allocate_with_baseline() 5787 * instead. 5788 * 5789 * Params: 5790 * allocation = position and size to be allocated to @widget 5791 */ 5792 public void sizeAllocate(GtkAllocation* allocation) 5793 { 5794 gtk_widget_size_allocate(gtkWidget, allocation); 5795 } 5796 5797 /** 5798 * This function is only used by #GtkContainer subclasses, to assign a size, 5799 * position and (optionally) baseline to their child widgets. 5800 * 5801 * In this function, the allocation and baseline may be adjusted. It 5802 * will be forced to a 1x1 minimum size, and the 5803 * adjust_size_allocation virtual and adjust_baseline_allocation 5804 * methods on the child will be used to adjust the allocation and 5805 * baseline. Standard adjustments include removing the widget's 5806 * margins, and applying the widget’s #GtkWidget:halign and 5807 * #GtkWidget:valign properties. 5808 * 5809 * If the child widget does not have a valign of %GTK_ALIGN_BASELINE the 5810 * baseline argument is ignored and -1 is used instead. 5811 * 5812 * Params: 5813 * allocation = position and size to be allocated to @widget 5814 * baseline = The baseline of the child, or -1 5815 * 5816 * Since: 3.10 5817 */ 5818 public void sizeAllocateWithBaseline(GtkAllocation* allocation, int baseline) 5819 { 5820 gtk_widget_size_allocate_with_baseline(gtkWidget, allocation, baseline); 5821 } 5822 5823 /** 5824 * This function is typically used when implementing a #GtkContainer 5825 * subclass. Obtains the preferred size of a widget. The container 5826 * uses this information to arrange its child widgets and decide what 5827 * size allocations to give them with gtk_widget_size_allocate(). 5828 * 5829 * You can also call this function from an application, with some 5830 * caveats. Most notably, getting a size request requires the widget 5831 * to be associated with a screen, because font information may be 5832 * needed. Multihead-aware applications should keep this in mind. 5833 * 5834 * Also remember that the size request is not necessarily the size 5835 * a widget will actually be allocated. 5836 * 5837 * Deprecated: Use gtk_widget_get_preferred_size() instead. 5838 * 5839 * Params: 5840 * requisition = a #GtkRequisition to be filled in 5841 */ 5842 public void sizeRequest(out Requisition requisition) 5843 { 5844 GtkRequisition* outrequisition = gMalloc!GtkRequisition(); 5845 5846 gtk_widget_size_request(gtkWidget, outrequisition); 5847 5848 requisition = ObjectG.getDObject!(Requisition)(outrequisition, true); 5849 } 5850 5851 /** 5852 * This function attaches the widget’s #GtkStyle to the widget's 5853 * #GdkWindow. It is a replacement for 5854 * 5855 * |[ 5856 * widget->style = gtk_style_attach (widget->style, widget->window); 5857 * ]| 5858 * 5859 * and should only ever be called in a derived widget’s “realize” 5860 * implementation which does not chain up to its parent class' 5861 * “realize” implementation, because one of the parent classes 5862 * (finally #GtkWidget) would attach the style itself. 5863 * 5864 * Deprecated: This step is unnecessary with #GtkStyleContext. 5865 * 5866 * Since: 2.20 5867 */ 5868 public void styleAttach() 5869 { 5870 gtk_widget_style_attach(gtkWidget); 5871 } 5872 5873 /** 5874 * Gets the value of a style property of @widget. 5875 * 5876 * Params: 5877 * propertyName = the name of a style property 5878 * value = location to return the property value 5879 */ 5880 public void styleGetProperty(string propertyName, Value value) 5881 { 5882 gtk_widget_style_get_property(gtkWidget, Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 5883 } 5884 5885 /** 5886 * Non-vararg variant of gtk_widget_style_get(). Used primarily by language 5887 * bindings. 5888 * 5889 * Params: 5890 * firstPropertyName = the name of the first property to get 5891 * varArgs = a va_list of pairs of property names and 5892 * locations to return the property values, starting with the location 5893 * for @first_property_name. 5894 */ 5895 public void styleGetValist(string firstPropertyName, void* varArgs) 5896 { 5897 gtk_widget_style_get_valist(gtkWidget, Str.toStringz(firstPropertyName), varArgs); 5898 } 5899 5900 /** 5901 * Reverts the effect of a previous call to gtk_widget_freeze_child_notify(). 5902 * This causes all queued #GtkWidget::child-notify signals on @widget to be 5903 * emitted. 5904 */ 5905 public void thawChildNotify() 5906 { 5907 gtk_widget_thaw_child_notify(gtkWidget); 5908 } 5909 5910 /** 5911 * Translate coordinates relative to @src_widget’s allocation to coordinates 5912 * relative to @dest_widget’s allocations. In order to perform this 5913 * operation, both widgets must be realized, and must share a common 5914 * toplevel. 5915 * 5916 * Params: 5917 * destWidget = a #GtkWidget 5918 * srcX = X position relative to @src_widget 5919 * srcY = Y position relative to @src_widget 5920 * destX = location to store X position relative to @dest_widget 5921 * destY = location to store Y position relative to @dest_widget 5922 * 5923 * Returns: %FALSE if either widget was not realized, or there 5924 * was no common ancestor. In this case, nothing is stored in 5925 * *@dest_x and *@dest_y. Otherwise %TRUE. 5926 */ 5927 public bool translateCoordinates(Widget destWidget, int srcX, int srcY, out int destX, out int destY) 5928 { 5929 return gtk_widget_translate_coordinates(gtkWidget, (destWidget is null) ? null : destWidget.getWidgetStruct(), srcX, srcY, &destX, &destY) != 0; 5930 } 5931 5932 /** 5933 * Triggers a tooltip query on the display where the toplevel of @widget 5934 * is located. See gtk_tooltip_trigger_tooltip_query() for more 5935 * information. 5936 * 5937 * Since: 2.12 5938 */ 5939 public void triggerTooltipQuery() 5940 { 5941 gtk_widget_trigger_tooltip_query(gtkWidget); 5942 } 5943 5944 /** 5945 * This function is only for use in widget implementations. Causes 5946 * a widget to be unmapped if it’s currently mapped. 5947 */ 5948 public void unmap() 5949 { 5950 gtk_widget_unmap(gtkWidget); 5951 } 5952 5953 /** 5954 * This function is only for use in widget implementations. 5955 * Should be called by implementations of the remove method 5956 * on #GtkContainer, to dissociate a child from the container. 5957 */ 5958 public void unparent() 5959 { 5960 gtk_widget_unparent(gtkWidget); 5961 } 5962 5963 /** 5964 * This function is only useful in widget implementations. 5965 * Causes a widget to be unrealized (frees all GDK resources 5966 * associated with the widget, such as @widget->window). 5967 */ 5968 public void unrealize() 5969 { 5970 gtk_widget_unrealize(gtkWidget); 5971 } 5972 5973 /** 5974 * Unregisters a #GdkWindow from the widget that was previously set up with 5975 * gtk_widget_register_window(). You need to call this when the window is 5976 * no longer used by the widget, such as when you destroy it. 5977 * 5978 * Params: 5979 * window = a #GdkWindow 5980 * 5981 * Since: 3.8 5982 */ 5983 public void unregisterWindow(GdkWin window) 5984 { 5985 gtk_widget_unregister_window(gtkWidget, (window is null) ? null : window.getWindowStruct()); 5986 } 5987 5988 /** 5989 * This function is for use in widget implementations. Turns off flag 5990 * values for the current widget state (insensitive, prelighted, etc.). 5991 * See gtk_widget_set_state_flags(). 5992 * 5993 * Params: 5994 * flags = State flags to turn off 5995 * 5996 * Since: 3.0 5997 */ 5998 public void unsetStateFlags(GtkStateFlags flags) 5999 { 6000 gtk_widget_unset_state_flags(gtkWidget, flags); 6001 } 6002 6003 protected class OnAccelClosuresChangedDelegateWrapper 6004 { 6005 void delegate(Widget) dlg; 6006 gulong handlerId; 6007 6008 this(void delegate(Widget) dlg) 6009 { 6010 this.dlg = dlg; 6011 onAccelClosuresChangedListeners ~= this; 6012 } 6013 6014 void remove(OnAccelClosuresChangedDelegateWrapper source) 6015 { 6016 foreach(index, wrapper; onAccelClosuresChangedListeners) 6017 { 6018 if (wrapper.handlerId == source.handlerId) 6019 { 6020 onAccelClosuresChangedListeners[index] = null; 6021 onAccelClosuresChangedListeners = std.algorithm.remove(onAccelClosuresChangedListeners, index); 6022 break; 6023 } 6024 } 6025 } 6026 } 6027 OnAccelClosuresChangedDelegateWrapper[] onAccelClosuresChangedListeners; 6028 6029 /** */ 6030 gulong addOnAccelClosuresChanged(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6031 { 6032 auto wrapper = new OnAccelClosuresChangedDelegateWrapper(dlg); 6033 wrapper.handlerId = Signals.connectData( 6034 this, 6035 "accel-closures-changed", 6036 cast(GCallback)&callBackAccelClosuresChanged, 6037 cast(void*)wrapper, 6038 cast(GClosureNotify)&callBackAccelClosuresChangedDestroy, 6039 connectFlags); 6040 return wrapper.handlerId; 6041 } 6042 6043 extern(C) static void callBackAccelClosuresChanged(GtkWidget* widgetStruct, OnAccelClosuresChangedDelegateWrapper wrapper) 6044 { 6045 wrapper.dlg(wrapper.outer); 6046 } 6047 6048 extern(C) static void callBackAccelClosuresChangedDestroy(OnAccelClosuresChangedDelegateWrapper wrapper, GClosure* closure) 6049 { 6050 wrapper.remove(wrapper); 6051 } 6052 6053 protected class OnButtonPressDelegateWrapper 6054 { 6055 bool delegate(GdkEventButton*, Widget) dlg; 6056 gulong handlerId; 6057 6058 this(bool delegate(GdkEventButton*, Widget) dlg) 6059 { 6060 this.dlg = dlg; 6061 onButtonPressListeners ~= this; 6062 } 6063 6064 void remove(OnButtonPressDelegateWrapper source) 6065 { 6066 foreach(index, wrapper; onButtonPressListeners) 6067 { 6068 if (wrapper.handlerId == source.handlerId) 6069 { 6070 onButtonPressListeners[index] = null; 6071 onButtonPressListeners = std.algorithm.remove(onButtonPressListeners, index); 6072 break; 6073 } 6074 } 6075 } 6076 } 6077 OnButtonPressDelegateWrapper[] onButtonPressListeners; 6078 6079 /** 6080 * The ::button-press-event signal will be emitted when a button 6081 * (typically from a mouse) is pressed. 6082 * 6083 * To receive this signal, the #GdkWindow associated to the 6084 * widget needs to enable the #GDK_BUTTON_PRESS_MASK mask. 6085 * 6086 * This signal will be sent to the grab widget if there is one. 6087 * 6088 * Params: 6089 * event = the #GdkEventButton which triggered 6090 * this signal. 6091 * 6092 * Returns: %TRUE to stop other handlers from being invoked for the event. 6093 * %FALSE to propagate the event further. 6094 */ 6095 gulong addOnButtonPress(bool delegate(GdkEventButton*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6096 { 6097 addEvents(EventMask.BUTTON_PRESS_MASK); 6098 auto wrapper = new OnButtonPressDelegateWrapper(dlg); 6099 wrapper.handlerId = Signals.connectData( 6100 this, 6101 "button-press-event", 6102 cast(GCallback)&callBackButtonPress, 6103 cast(void*)wrapper, 6104 cast(GClosureNotify)&callBackButtonPressDestroy, 6105 connectFlags); 6106 return wrapper.handlerId; 6107 } 6108 6109 extern(C) static int callBackButtonPress(GtkWidget* widgetStruct, GdkEventButton* event, OnButtonPressDelegateWrapper wrapper) 6110 { 6111 return wrapper.dlg(event, wrapper.outer); 6112 } 6113 6114 extern(C) static void callBackButtonPressDestroy(OnButtonPressDelegateWrapper wrapper, GClosure* closure) 6115 { 6116 wrapper.remove(wrapper); 6117 } 6118 6119 protected class OnButtonPressEventGenericDelegateWrapper 6120 { 6121 bool delegate(Event, Widget) dlg; 6122 gulong handlerId; 6123 6124 this(bool delegate(Event, Widget) dlg) 6125 { 6126 this.dlg = dlg; 6127 onButtonPressEventGenericListeners ~= this; 6128 } 6129 6130 void remove(OnButtonPressEventGenericDelegateWrapper source) 6131 { 6132 foreach(index, wrapper; onButtonPressEventGenericListeners) 6133 { 6134 if (wrapper.handlerId == source.handlerId) 6135 { 6136 onButtonPressEventGenericListeners[index] = null; 6137 onButtonPressEventGenericListeners = std.algorithm.remove(onButtonPressEventGenericListeners, index); 6138 break; 6139 } 6140 } 6141 } 6142 } 6143 OnButtonPressEventGenericDelegateWrapper[] onButtonPressEventGenericListeners; 6144 6145 /** 6146 * The ::button-press-event signal will be emitted when a button 6147 * (typically from a mouse) is pressed. 6148 * 6149 * To receive this signal, the #GdkWindow associated to the 6150 * widget needs to enable the #GDK_BUTTON_PRESS_MASK mask. 6151 * 6152 * This signal will be sent to the grab widget if there is one. 6153 * 6154 * Params: 6155 * event = the #GdkEventButton which triggered 6156 * this signal. 6157 * 6158 * Returns: %TRUE to stop other handlers from being invoked for the event. 6159 * %FALSE to propagate the event further. 6160 */ 6161 gulong addOnButtonPress(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6162 { 6163 addEvents(EventMask.BUTTON_PRESS_MASK); 6164 auto wrapper = new OnButtonPressEventGenericDelegateWrapper(dlg); 6165 wrapper.handlerId = Signals.connectData( 6166 this, 6167 "button-press-event", 6168 cast(GCallback)&callBackButtonPressEventGeneric, 6169 cast(void*)wrapper, 6170 cast(GClosureNotify)&callBackButtonPressEventGenericDestroy, 6171 connectFlags); 6172 return wrapper.handlerId; 6173 } 6174 6175 extern(C) static int callBackButtonPressEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnButtonPressEventGenericDelegateWrapper wrapper) 6176 { 6177 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 6178 } 6179 6180 extern(C) static void callBackButtonPressEventGenericDestroy(OnButtonPressEventGenericDelegateWrapper wrapper, GClosure* closure) 6181 { 6182 wrapper.remove(wrapper); 6183 } 6184 6185 protected class OnButtonReleaseDelegateWrapper 6186 { 6187 bool delegate(GdkEventButton*, Widget) dlg; 6188 gulong handlerId; 6189 6190 this(bool delegate(GdkEventButton*, Widget) dlg) 6191 { 6192 this.dlg = dlg; 6193 onButtonReleaseListeners ~= this; 6194 } 6195 6196 void remove(OnButtonReleaseDelegateWrapper source) 6197 { 6198 foreach(index, wrapper; onButtonReleaseListeners) 6199 { 6200 if (wrapper.handlerId == source.handlerId) 6201 { 6202 onButtonReleaseListeners[index] = null; 6203 onButtonReleaseListeners = std.algorithm.remove(onButtonReleaseListeners, index); 6204 break; 6205 } 6206 } 6207 } 6208 } 6209 OnButtonReleaseDelegateWrapper[] onButtonReleaseListeners; 6210 6211 /** 6212 * The ::button-release-event signal will be emitted when a button 6213 * (typically from a mouse) is released. 6214 * 6215 * To receive this signal, the #GdkWindow associated to the 6216 * widget needs to enable the #GDK_BUTTON_RELEASE_MASK mask. 6217 * 6218 * This signal will be sent to the grab widget if there is one. 6219 * 6220 * Params: 6221 * event = the #GdkEventButton which triggered 6222 * this signal. 6223 * 6224 * Returns: %TRUE to stop other handlers from being invoked for the event. 6225 * %FALSE to propagate the event further. 6226 */ 6227 gulong addOnButtonRelease(bool delegate(GdkEventButton*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6228 { 6229 addEvents(EventMask.BUTTON_RELEASE_MASK); 6230 auto wrapper = new OnButtonReleaseDelegateWrapper(dlg); 6231 wrapper.handlerId = Signals.connectData( 6232 this, 6233 "button-release-event", 6234 cast(GCallback)&callBackButtonRelease, 6235 cast(void*)wrapper, 6236 cast(GClosureNotify)&callBackButtonReleaseDestroy, 6237 connectFlags); 6238 return wrapper.handlerId; 6239 } 6240 6241 extern(C) static int callBackButtonRelease(GtkWidget* widgetStruct, GdkEventButton* event, OnButtonReleaseDelegateWrapper wrapper) 6242 { 6243 return wrapper.dlg(event, wrapper.outer); 6244 } 6245 6246 extern(C) static void callBackButtonReleaseDestroy(OnButtonReleaseDelegateWrapper wrapper, GClosure* closure) 6247 { 6248 wrapper.remove(wrapper); 6249 } 6250 6251 protected class OnButtonReleaseEventGenericDelegateWrapper 6252 { 6253 bool delegate(Event, Widget) dlg; 6254 gulong handlerId; 6255 6256 this(bool delegate(Event, Widget) dlg) 6257 { 6258 this.dlg = dlg; 6259 onButtonReleaseEventGenericListeners ~= this; 6260 } 6261 6262 void remove(OnButtonReleaseEventGenericDelegateWrapper source) 6263 { 6264 foreach(index, wrapper; onButtonReleaseEventGenericListeners) 6265 { 6266 if (wrapper.handlerId == source.handlerId) 6267 { 6268 onButtonReleaseEventGenericListeners[index] = null; 6269 onButtonReleaseEventGenericListeners = std.algorithm.remove(onButtonReleaseEventGenericListeners, index); 6270 break; 6271 } 6272 } 6273 } 6274 } 6275 OnButtonReleaseEventGenericDelegateWrapper[] onButtonReleaseEventGenericListeners; 6276 6277 /** 6278 * The ::button-release-event signal will be emitted when a button 6279 * (typically from a mouse) is released. 6280 * 6281 * To receive this signal, the #GdkWindow associated to the 6282 * widget needs to enable the #GDK_BUTTON_RELEASE_MASK mask. 6283 * 6284 * This signal will be sent to the grab widget if there is one. 6285 * 6286 * Params: 6287 * event = the #GdkEventButton which triggered 6288 * this signal. 6289 * 6290 * Returns: %TRUE to stop other handlers from being invoked for the event. 6291 * %FALSE to propagate the event further. 6292 */ 6293 gulong addOnButtonRelease(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6294 { 6295 addEvents(EventMask.BUTTON_RELEASE_MASK); 6296 auto wrapper = new OnButtonReleaseEventGenericDelegateWrapper(dlg); 6297 wrapper.handlerId = Signals.connectData( 6298 this, 6299 "button-release-event", 6300 cast(GCallback)&callBackButtonReleaseEventGeneric, 6301 cast(void*)wrapper, 6302 cast(GClosureNotify)&callBackButtonReleaseEventGenericDestroy, 6303 connectFlags); 6304 return wrapper.handlerId; 6305 } 6306 6307 extern(C) static int callBackButtonReleaseEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnButtonReleaseEventGenericDelegateWrapper wrapper) 6308 { 6309 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 6310 } 6311 6312 extern(C) static void callBackButtonReleaseEventGenericDestroy(OnButtonReleaseEventGenericDelegateWrapper wrapper, GClosure* closure) 6313 { 6314 wrapper.remove(wrapper); 6315 } 6316 6317 protected class OnCanActivateAccelDelegateWrapper 6318 { 6319 bool delegate(uint, Widget) dlg; 6320 gulong handlerId; 6321 6322 this(bool delegate(uint, Widget) dlg) 6323 { 6324 this.dlg = dlg; 6325 onCanActivateAccelListeners ~= this; 6326 } 6327 6328 void remove(OnCanActivateAccelDelegateWrapper source) 6329 { 6330 foreach(index, wrapper; onCanActivateAccelListeners) 6331 { 6332 if (wrapper.handlerId == source.handlerId) 6333 { 6334 onCanActivateAccelListeners[index] = null; 6335 onCanActivateAccelListeners = std.algorithm.remove(onCanActivateAccelListeners, index); 6336 break; 6337 } 6338 } 6339 } 6340 } 6341 OnCanActivateAccelDelegateWrapper[] onCanActivateAccelListeners; 6342 6343 /** 6344 * Determines whether an accelerator that activates the signal 6345 * identified by @signal_id can currently be activated. 6346 * This signal is present to allow applications and derived 6347 * widgets to override the default #GtkWidget handling 6348 * for determining whether an accelerator can be activated. 6349 * 6350 * Params: 6351 * signalId = the ID of a signal installed on @widget 6352 * 6353 * Returns: %TRUE if the signal can be activated. 6354 */ 6355 gulong addOnCanActivateAccel(bool delegate(uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6356 { 6357 auto wrapper = new OnCanActivateAccelDelegateWrapper(dlg); 6358 wrapper.handlerId = Signals.connectData( 6359 this, 6360 "can-activate-accel", 6361 cast(GCallback)&callBackCanActivateAccel, 6362 cast(void*)wrapper, 6363 cast(GClosureNotify)&callBackCanActivateAccelDestroy, 6364 connectFlags); 6365 return wrapper.handlerId; 6366 } 6367 6368 extern(C) static int callBackCanActivateAccel(GtkWidget* widgetStruct, uint signalId, OnCanActivateAccelDelegateWrapper wrapper) 6369 { 6370 return wrapper.dlg(signalId, wrapper.outer); 6371 } 6372 6373 extern(C) static void callBackCanActivateAccelDestroy(OnCanActivateAccelDelegateWrapper wrapper, GClosure* closure) 6374 { 6375 wrapper.remove(wrapper); 6376 } 6377 6378 protected class OnChildNotifyDelegateWrapper 6379 { 6380 void delegate(ParamSpec, Widget) dlg; 6381 gulong handlerId; 6382 6383 this(void delegate(ParamSpec, Widget) dlg) 6384 { 6385 this.dlg = dlg; 6386 onChildNotifyListeners ~= this; 6387 } 6388 6389 void remove(OnChildNotifyDelegateWrapper source) 6390 { 6391 foreach(index, wrapper; onChildNotifyListeners) 6392 { 6393 if (wrapper.handlerId == source.handlerId) 6394 { 6395 onChildNotifyListeners[index] = null; 6396 onChildNotifyListeners = std.algorithm.remove(onChildNotifyListeners, index); 6397 break; 6398 } 6399 } 6400 } 6401 } 6402 OnChildNotifyDelegateWrapper[] onChildNotifyListeners; 6403 6404 /** 6405 * The ::child-notify signal is emitted for each 6406 * [child property][child-properties] that has 6407 * changed on an object. The signal's detail holds the property name. 6408 * 6409 * Params: 6410 * childProperty = the #GParamSpec of the changed child property 6411 */ 6412 gulong addOnChildNotify(void delegate(ParamSpec, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6413 { 6414 auto wrapper = new OnChildNotifyDelegateWrapper(dlg); 6415 wrapper.handlerId = Signals.connectData( 6416 this, 6417 "child-notify", 6418 cast(GCallback)&callBackChildNotify, 6419 cast(void*)wrapper, 6420 cast(GClosureNotify)&callBackChildNotifyDestroy, 6421 connectFlags); 6422 return wrapper.handlerId; 6423 } 6424 6425 extern(C) static void callBackChildNotify(GtkWidget* widgetStruct, GParamSpec* childProperty, OnChildNotifyDelegateWrapper wrapper) 6426 { 6427 wrapper.dlg(ObjectG.getDObject!(ParamSpec)(childProperty), wrapper.outer); 6428 } 6429 6430 extern(C) static void callBackChildNotifyDestroy(OnChildNotifyDelegateWrapper wrapper, GClosure* closure) 6431 { 6432 wrapper.remove(wrapper); 6433 } 6434 6435 protected class OnCompositedChangedDelegateWrapper 6436 { 6437 void delegate(Widget) dlg; 6438 gulong handlerId; 6439 6440 this(void delegate(Widget) dlg) 6441 { 6442 this.dlg = dlg; 6443 onCompositedChangedListeners ~= this; 6444 } 6445 6446 void remove(OnCompositedChangedDelegateWrapper source) 6447 { 6448 foreach(index, wrapper; onCompositedChangedListeners) 6449 { 6450 if (wrapper.handlerId == source.handlerId) 6451 { 6452 onCompositedChangedListeners[index] = null; 6453 onCompositedChangedListeners = std.algorithm.remove(onCompositedChangedListeners, index); 6454 break; 6455 } 6456 } 6457 } 6458 } 6459 OnCompositedChangedDelegateWrapper[] onCompositedChangedListeners; 6460 6461 /** 6462 * The ::composited-changed signal is emitted when the composited 6463 * status of @widgets screen changes. 6464 * See gdk_screen_is_composited(). 6465 * 6466 * Deprecated: Use GdkScreen::composited-changed instead. 6467 */ 6468 gulong addOnCompositedChanged(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6469 { 6470 auto wrapper = new OnCompositedChangedDelegateWrapper(dlg); 6471 wrapper.handlerId = Signals.connectData( 6472 this, 6473 "composited-changed", 6474 cast(GCallback)&callBackCompositedChanged, 6475 cast(void*)wrapper, 6476 cast(GClosureNotify)&callBackCompositedChangedDestroy, 6477 connectFlags); 6478 return wrapper.handlerId; 6479 } 6480 6481 extern(C) static void callBackCompositedChanged(GtkWidget* widgetStruct, OnCompositedChangedDelegateWrapper wrapper) 6482 { 6483 wrapper.dlg(wrapper.outer); 6484 } 6485 6486 extern(C) static void callBackCompositedChangedDestroy(OnCompositedChangedDelegateWrapper wrapper, GClosure* closure) 6487 { 6488 wrapper.remove(wrapper); 6489 } 6490 6491 protected class OnConfigureDelegateWrapper 6492 { 6493 bool delegate(GdkEventConfigure*, Widget) dlg; 6494 gulong handlerId; 6495 6496 this(bool delegate(GdkEventConfigure*, Widget) dlg) 6497 { 6498 this.dlg = dlg; 6499 onConfigureListeners ~= this; 6500 } 6501 6502 void remove(OnConfigureDelegateWrapper source) 6503 { 6504 foreach(index, wrapper; onConfigureListeners) 6505 { 6506 if (wrapper.handlerId == source.handlerId) 6507 { 6508 onConfigureListeners[index] = null; 6509 onConfigureListeners = std.algorithm.remove(onConfigureListeners, index); 6510 break; 6511 } 6512 } 6513 } 6514 } 6515 OnConfigureDelegateWrapper[] onConfigureListeners; 6516 6517 /** 6518 * The ::configure-event signal will be emitted when the size, position or 6519 * stacking of the @widget's window has changed. 6520 * 6521 * To receive this signal, the #GdkWindow associated to the widget needs 6522 * to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask 6523 * automatically for all new windows. 6524 * 6525 * Params: 6526 * event = the #GdkEventConfigure which triggered 6527 * this signal. 6528 * 6529 * Returns: %TRUE to stop other handlers from being invoked for the event. 6530 * %FALSE to propagate the event further. 6531 */ 6532 gulong addOnConfigure(bool delegate(GdkEventConfigure*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6533 { 6534 auto wrapper = new OnConfigureDelegateWrapper(dlg); 6535 wrapper.handlerId = Signals.connectData( 6536 this, 6537 "configure-event", 6538 cast(GCallback)&callBackConfigure, 6539 cast(void*)wrapper, 6540 cast(GClosureNotify)&callBackConfigureDestroy, 6541 connectFlags); 6542 return wrapper.handlerId; 6543 } 6544 6545 extern(C) static int callBackConfigure(GtkWidget* widgetStruct, GdkEventConfigure* event, OnConfigureDelegateWrapper wrapper) 6546 { 6547 return wrapper.dlg(event, wrapper.outer); 6548 } 6549 6550 extern(C) static void callBackConfigureDestroy(OnConfigureDelegateWrapper wrapper, GClosure* closure) 6551 { 6552 wrapper.remove(wrapper); 6553 } 6554 6555 protected class OnConfigureEventGenericDelegateWrapper 6556 { 6557 bool delegate(Event, Widget) dlg; 6558 gulong handlerId; 6559 6560 this(bool delegate(Event, Widget) dlg) 6561 { 6562 this.dlg = dlg; 6563 onConfigureEventGenericListeners ~= this; 6564 } 6565 6566 void remove(OnConfigureEventGenericDelegateWrapper source) 6567 { 6568 foreach(index, wrapper; onConfigureEventGenericListeners) 6569 { 6570 if (wrapper.handlerId == source.handlerId) 6571 { 6572 onConfigureEventGenericListeners[index] = null; 6573 onConfigureEventGenericListeners = std.algorithm.remove(onConfigureEventGenericListeners, index); 6574 break; 6575 } 6576 } 6577 } 6578 } 6579 OnConfigureEventGenericDelegateWrapper[] onConfigureEventGenericListeners; 6580 6581 /** 6582 * The ::configure-event signal will be emitted when the size, position or 6583 * stacking of the @widget's window has changed. 6584 * 6585 * To receive this signal, the #GdkWindow associated to the widget needs 6586 * to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask 6587 * automatically for all new windows. 6588 * 6589 * Params: 6590 * event = the #GdkEventConfigure which triggered 6591 * this signal. 6592 * 6593 * Returns: %TRUE to stop other handlers from being invoked for the event. 6594 * %FALSE to propagate the event further. 6595 */ 6596 gulong addOnConfigure(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6597 { 6598 auto wrapper = new OnConfigureEventGenericDelegateWrapper(dlg); 6599 wrapper.handlerId = Signals.connectData( 6600 this, 6601 "configure-event", 6602 cast(GCallback)&callBackConfigureEventGeneric, 6603 cast(void*)wrapper, 6604 cast(GClosureNotify)&callBackConfigureEventGenericDestroy, 6605 connectFlags); 6606 return wrapper.handlerId; 6607 } 6608 6609 extern(C) static int callBackConfigureEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnConfigureEventGenericDelegateWrapper wrapper) 6610 { 6611 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 6612 } 6613 6614 extern(C) static void callBackConfigureEventGenericDestroy(OnConfigureEventGenericDelegateWrapper wrapper, GClosure* closure) 6615 { 6616 wrapper.remove(wrapper); 6617 } 6618 6619 protected class OnDamageDelegateWrapper 6620 { 6621 bool delegate(GdkEventExpose*, Widget) dlg; 6622 gulong handlerId; 6623 6624 this(bool delegate(GdkEventExpose*, Widget) dlg) 6625 { 6626 this.dlg = dlg; 6627 onDamageListeners ~= this; 6628 } 6629 6630 void remove(OnDamageDelegateWrapper source) 6631 { 6632 foreach(index, wrapper; onDamageListeners) 6633 { 6634 if (wrapper.handlerId == source.handlerId) 6635 { 6636 onDamageListeners[index] = null; 6637 onDamageListeners = std.algorithm.remove(onDamageListeners, index); 6638 break; 6639 } 6640 } 6641 } 6642 } 6643 OnDamageDelegateWrapper[] onDamageListeners; 6644 6645 /** 6646 * Emitted when a redirected window belonging to @widget gets drawn into. 6647 * The region/area members of the event shows what area of the redirected 6648 * drawable was drawn into. 6649 * 6650 * Params: 6651 * event = the #GdkEventExpose event 6652 * 6653 * Returns: %TRUE to stop other handlers from being invoked for the event. 6654 * %FALSE to propagate the event further. 6655 * 6656 * Since: 2.14 6657 */ 6658 gulong addOnDamage(bool delegate(GdkEventExpose*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6659 { 6660 auto wrapper = new OnDamageDelegateWrapper(dlg); 6661 wrapper.handlerId = Signals.connectData( 6662 this, 6663 "damage-event", 6664 cast(GCallback)&callBackDamage, 6665 cast(void*)wrapper, 6666 cast(GClosureNotify)&callBackDamageDestroy, 6667 connectFlags); 6668 return wrapper.handlerId; 6669 } 6670 6671 extern(C) static int callBackDamage(GtkWidget* widgetStruct, GdkEventExpose* event, OnDamageDelegateWrapper wrapper) 6672 { 6673 return wrapper.dlg(event, wrapper.outer); 6674 } 6675 6676 extern(C) static void callBackDamageDestroy(OnDamageDelegateWrapper wrapper, GClosure* closure) 6677 { 6678 wrapper.remove(wrapper); 6679 } 6680 6681 protected class OnDamageEventGenericDelegateWrapper 6682 { 6683 bool delegate(Event, Widget) dlg; 6684 gulong handlerId; 6685 6686 this(bool delegate(Event, Widget) dlg) 6687 { 6688 this.dlg = dlg; 6689 onDamageEventGenericListeners ~= this; 6690 } 6691 6692 void remove(OnDamageEventGenericDelegateWrapper source) 6693 { 6694 foreach(index, wrapper; onDamageEventGenericListeners) 6695 { 6696 if (wrapper.handlerId == source.handlerId) 6697 { 6698 onDamageEventGenericListeners[index] = null; 6699 onDamageEventGenericListeners = std.algorithm.remove(onDamageEventGenericListeners, index); 6700 break; 6701 } 6702 } 6703 } 6704 } 6705 OnDamageEventGenericDelegateWrapper[] onDamageEventGenericListeners; 6706 6707 /** 6708 * Emitted when a redirected window belonging to @widget gets drawn into. 6709 * The region/area members of the event shows what area of the redirected 6710 * drawable was drawn into. 6711 * 6712 * Params: 6713 * event = the #GdkEventExpose event 6714 * 6715 * Returns: %TRUE to stop other handlers from being invoked for the event. 6716 * %FALSE to propagate the event further. 6717 * 6718 * Since: 2.14 6719 */ 6720 gulong addOnDamage(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6721 { 6722 auto wrapper = new OnDamageEventGenericDelegateWrapper(dlg); 6723 wrapper.handlerId = Signals.connectData( 6724 this, 6725 "damage-event", 6726 cast(GCallback)&callBackDamageEventGeneric, 6727 cast(void*)wrapper, 6728 cast(GClosureNotify)&callBackDamageEventGenericDestroy, 6729 connectFlags); 6730 return wrapper.handlerId; 6731 } 6732 6733 extern(C) static int callBackDamageEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnDamageEventGenericDelegateWrapper wrapper) 6734 { 6735 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 6736 } 6737 6738 extern(C) static void callBackDamageEventGenericDestroy(OnDamageEventGenericDelegateWrapper wrapper, GClosure* closure) 6739 { 6740 wrapper.remove(wrapper); 6741 } 6742 6743 protected class OnDeleteDelegateWrapper 6744 { 6745 bool delegate(Event, Widget) dlg; 6746 gulong handlerId; 6747 6748 this(bool delegate(Event, Widget) dlg) 6749 { 6750 this.dlg = dlg; 6751 onDeleteListeners ~= this; 6752 } 6753 6754 void remove(OnDeleteDelegateWrapper source) 6755 { 6756 foreach(index, wrapper; onDeleteListeners) 6757 { 6758 if (wrapper.handlerId == source.handlerId) 6759 { 6760 onDeleteListeners[index] = null; 6761 onDeleteListeners = std.algorithm.remove(onDeleteListeners, index); 6762 break; 6763 } 6764 } 6765 } 6766 } 6767 OnDeleteDelegateWrapper[] onDeleteListeners; 6768 6769 /** 6770 * The ::delete-event signal is emitted if a user requests that 6771 * a toplevel window is closed. The default handler for this signal 6772 * destroys the window. Connecting gtk_widget_hide_on_delete() to 6773 * this signal will cause the window to be hidden instead, so that 6774 * it can later be shown again without reconstructing it. 6775 * 6776 * Params: 6777 * event = the event which triggered this signal 6778 * 6779 * Returns: %TRUE to stop other handlers from being invoked for the event. 6780 * %FALSE to propagate the event further. 6781 */ 6782 gulong addOnDelete(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6783 { 6784 auto wrapper = new OnDeleteDelegateWrapper(dlg); 6785 wrapper.handlerId = Signals.connectData( 6786 this, 6787 "delete-event", 6788 cast(GCallback)&callBackDelete, 6789 cast(void*)wrapper, 6790 cast(GClosureNotify)&callBackDeleteDestroy, 6791 connectFlags); 6792 return wrapper.handlerId; 6793 } 6794 6795 extern(C) static int callBackDelete(GtkWidget* widgetStruct, GdkEvent* event, OnDeleteDelegateWrapper wrapper) 6796 { 6797 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 6798 } 6799 6800 extern(C) static void callBackDeleteDestroy(OnDeleteDelegateWrapper wrapper, GClosure* closure) 6801 { 6802 wrapper.remove(wrapper); 6803 } 6804 6805 protected class OnDestroyDelegateWrapper 6806 { 6807 void delegate(Widget) dlg; 6808 gulong handlerId; 6809 6810 this(void delegate(Widget) dlg) 6811 { 6812 this.dlg = dlg; 6813 onDestroyListeners ~= this; 6814 } 6815 6816 void remove(OnDestroyDelegateWrapper source) 6817 { 6818 foreach(index, wrapper; onDestroyListeners) 6819 { 6820 if (wrapper.handlerId == source.handlerId) 6821 { 6822 onDestroyListeners[index] = null; 6823 onDestroyListeners = std.algorithm.remove(onDestroyListeners, index); 6824 break; 6825 } 6826 } 6827 } 6828 } 6829 OnDestroyDelegateWrapper[] onDestroyListeners; 6830 6831 /** 6832 * Signals that all holders of a reference to the widget should release 6833 * the reference that they hold. May result in finalization of the widget 6834 * if all references are released. 6835 * 6836 * This signal is not suitable for saving widget state. 6837 */ 6838 gulong addOnDestroy(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6839 { 6840 auto wrapper = new OnDestroyDelegateWrapper(dlg); 6841 wrapper.handlerId = Signals.connectData( 6842 this, 6843 "destroy", 6844 cast(GCallback)&callBackDestroy, 6845 cast(void*)wrapper, 6846 cast(GClosureNotify)&callBackDestroyDestroy, 6847 connectFlags); 6848 return wrapper.handlerId; 6849 } 6850 6851 extern(C) static void callBackDestroy(GtkWidget* widgetStruct, OnDestroyDelegateWrapper wrapper) 6852 { 6853 wrapper.dlg(wrapper.outer); 6854 } 6855 6856 extern(C) static void callBackDestroyDestroy(OnDestroyDelegateWrapper wrapper, GClosure* closure) 6857 { 6858 wrapper.remove(wrapper); 6859 } 6860 6861 protected class OnDestroyEventDelegateWrapper 6862 { 6863 bool delegate(Event, Widget) dlg; 6864 gulong handlerId; 6865 6866 this(bool delegate(Event, Widget) dlg) 6867 { 6868 this.dlg = dlg; 6869 onDestroyEventListeners ~= this; 6870 } 6871 6872 void remove(OnDestroyEventDelegateWrapper source) 6873 { 6874 foreach(index, wrapper; onDestroyEventListeners) 6875 { 6876 if (wrapper.handlerId == source.handlerId) 6877 { 6878 onDestroyEventListeners[index] = null; 6879 onDestroyEventListeners = std.algorithm.remove(onDestroyEventListeners, index); 6880 break; 6881 } 6882 } 6883 } 6884 } 6885 OnDestroyEventDelegateWrapper[] onDestroyEventListeners; 6886 6887 /** 6888 * The ::destroy-event signal is emitted when a #GdkWindow is destroyed. 6889 * You rarely get this signal, because most widgets disconnect themselves 6890 * from their window before they destroy it, so no widget owns the 6891 * window at destroy time. 6892 * 6893 * To receive this signal, the #GdkWindow associated to the widget needs 6894 * to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask 6895 * automatically for all new windows. 6896 * 6897 * Params: 6898 * event = the event which triggered this signal 6899 * 6900 * Returns: %TRUE to stop other handlers from being invoked for the event. 6901 * %FALSE to propagate the event further. 6902 */ 6903 gulong addOnDestroyEvent(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6904 { 6905 auto wrapper = new OnDestroyEventDelegateWrapper(dlg); 6906 wrapper.handlerId = Signals.connectData( 6907 this, 6908 "destroy-event", 6909 cast(GCallback)&callBackDestroyEvent, 6910 cast(void*)wrapper, 6911 cast(GClosureNotify)&callBackDestroyEventDestroy, 6912 connectFlags); 6913 return wrapper.handlerId; 6914 } 6915 6916 extern(C) static int callBackDestroyEvent(GtkWidget* widgetStruct, GdkEvent* event, OnDestroyEventDelegateWrapper wrapper) 6917 { 6918 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 6919 } 6920 6921 extern(C) static void callBackDestroyEventDestroy(OnDestroyEventDelegateWrapper wrapper, GClosure* closure) 6922 { 6923 wrapper.remove(wrapper); 6924 } 6925 6926 protected class OnDirectionChangedDelegateWrapper 6927 { 6928 void delegate(GtkTextDirection, Widget) dlg; 6929 gulong handlerId; 6930 6931 this(void delegate(GtkTextDirection, Widget) dlg) 6932 { 6933 this.dlg = dlg; 6934 onDirectionChangedListeners ~= this; 6935 } 6936 6937 void remove(OnDirectionChangedDelegateWrapper source) 6938 { 6939 foreach(index, wrapper; onDirectionChangedListeners) 6940 { 6941 if (wrapper.handlerId == source.handlerId) 6942 { 6943 onDirectionChangedListeners[index] = null; 6944 onDirectionChangedListeners = std.algorithm.remove(onDirectionChangedListeners, index); 6945 break; 6946 } 6947 } 6948 } 6949 } 6950 OnDirectionChangedDelegateWrapper[] onDirectionChangedListeners; 6951 6952 /** 6953 * The ::direction-changed signal is emitted when the text direction 6954 * of a widget changes. 6955 * 6956 * Params: 6957 * previousDirection = the previous text direction of @widget 6958 */ 6959 gulong addOnDirectionChanged(void delegate(GtkTextDirection, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 6960 { 6961 auto wrapper = new OnDirectionChangedDelegateWrapper(dlg); 6962 wrapper.handlerId = Signals.connectData( 6963 this, 6964 "direction-changed", 6965 cast(GCallback)&callBackDirectionChanged, 6966 cast(void*)wrapper, 6967 cast(GClosureNotify)&callBackDirectionChangedDestroy, 6968 connectFlags); 6969 return wrapper.handlerId; 6970 } 6971 6972 extern(C) static void callBackDirectionChanged(GtkWidget* widgetStruct, GtkTextDirection previousDirection, OnDirectionChangedDelegateWrapper wrapper) 6973 { 6974 wrapper.dlg(previousDirection, wrapper.outer); 6975 } 6976 6977 extern(C) static void callBackDirectionChangedDestroy(OnDirectionChangedDelegateWrapper wrapper, GClosure* closure) 6978 { 6979 wrapper.remove(wrapper); 6980 } 6981 6982 protected class OnDragBeginDelegateWrapper 6983 { 6984 void delegate(DragContext, Widget) dlg; 6985 gulong handlerId; 6986 6987 this(void delegate(DragContext, Widget) dlg) 6988 { 6989 this.dlg = dlg; 6990 onDragBeginListeners ~= this; 6991 } 6992 6993 void remove(OnDragBeginDelegateWrapper source) 6994 { 6995 foreach(index, wrapper; onDragBeginListeners) 6996 { 6997 if (wrapper.handlerId == source.handlerId) 6998 { 6999 onDragBeginListeners[index] = null; 7000 onDragBeginListeners = std.algorithm.remove(onDragBeginListeners, index); 7001 break; 7002 } 7003 } 7004 } 7005 } 7006 OnDragBeginDelegateWrapper[] onDragBeginListeners; 7007 7008 /** 7009 * The ::drag-begin signal is emitted on the drag source when a drag is 7010 * started. A typical reason to connect to this signal is to set up a 7011 * custom drag icon with e.g. gtk_drag_source_set_icon_pixbuf(). 7012 * 7013 * Note that some widgets set up a drag icon in the default handler of 7014 * this signal, so you may have to use g_signal_connect_after() to 7015 * override what the default handler did. 7016 * 7017 * Params: 7018 * context = the drag context 7019 */ 7020 gulong addOnDragBegin(void delegate(DragContext, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7021 { 7022 auto wrapper = new OnDragBeginDelegateWrapper(dlg); 7023 wrapper.handlerId = Signals.connectData( 7024 this, 7025 "drag-begin", 7026 cast(GCallback)&callBackDragBegin, 7027 cast(void*)wrapper, 7028 cast(GClosureNotify)&callBackDragBeginDestroy, 7029 connectFlags); 7030 return wrapper.handlerId; 7031 } 7032 7033 extern(C) static void callBackDragBegin(GtkWidget* widgetStruct, GdkDragContext* context, OnDragBeginDelegateWrapper wrapper) 7034 { 7035 wrapper.dlg(ObjectG.getDObject!(DragContext)(context), wrapper.outer); 7036 } 7037 7038 extern(C) static void callBackDragBeginDestroy(OnDragBeginDelegateWrapper wrapper, GClosure* closure) 7039 { 7040 wrapper.remove(wrapper); 7041 } 7042 7043 protected class OnDragDataDeleteDelegateWrapper 7044 { 7045 void delegate(DragContext, Widget) dlg; 7046 gulong handlerId; 7047 7048 this(void delegate(DragContext, Widget) dlg) 7049 { 7050 this.dlg = dlg; 7051 onDragDataDeleteListeners ~= this; 7052 } 7053 7054 void remove(OnDragDataDeleteDelegateWrapper source) 7055 { 7056 foreach(index, wrapper; onDragDataDeleteListeners) 7057 { 7058 if (wrapper.handlerId == source.handlerId) 7059 { 7060 onDragDataDeleteListeners[index] = null; 7061 onDragDataDeleteListeners = std.algorithm.remove(onDragDataDeleteListeners, index); 7062 break; 7063 } 7064 } 7065 } 7066 } 7067 OnDragDataDeleteDelegateWrapper[] onDragDataDeleteListeners; 7068 7069 /** 7070 * The ::drag-data-delete signal is emitted on the drag source when a drag 7071 * with the action %GDK_ACTION_MOVE is successfully completed. The signal 7072 * handler is responsible for deleting the data that has been dropped. What 7073 * "delete" means depends on the context of the drag operation. 7074 * 7075 * Params: 7076 * context = the drag context 7077 */ 7078 gulong addOnDragDataDelete(void delegate(DragContext, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7079 { 7080 auto wrapper = new OnDragDataDeleteDelegateWrapper(dlg); 7081 wrapper.handlerId = Signals.connectData( 7082 this, 7083 "drag-data-delete", 7084 cast(GCallback)&callBackDragDataDelete, 7085 cast(void*)wrapper, 7086 cast(GClosureNotify)&callBackDragDataDeleteDestroy, 7087 connectFlags); 7088 return wrapper.handlerId; 7089 } 7090 7091 extern(C) static void callBackDragDataDelete(GtkWidget* widgetStruct, GdkDragContext* context, OnDragDataDeleteDelegateWrapper wrapper) 7092 { 7093 wrapper.dlg(ObjectG.getDObject!(DragContext)(context), wrapper.outer); 7094 } 7095 7096 extern(C) static void callBackDragDataDeleteDestroy(OnDragDataDeleteDelegateWrapper wrapper, GClosure* closure) 7097 { 7098 wrapper.remove(wrapper); 7099 } 7100 7101 protected class OnDragDataGetDelegateWrapper 7102 { 7103 void delegate(DragContext, SelectionData, uint, uint, Widget) dlg; 7104 gulong handlerId; 7105 7106 this(void delegate(DragContext, SelectionData, uint, uint, Widget) dlg) 7107 { 7108 this.dlg = dlg; 7109 onDragDataGetListeners ~= this; 7110 } 7111 7112 void remove(OnDragDataGetDelegateWrapper source) 7113 { 7114 foreach(index, wrapper; onDragDataGetListeners) 7115 { 7116 if (wrapper.handlerId == source.handlerId) 7117 { 7118 onDragDataGetListeners[index] = null; 7119 onDragDataGetListeners = std.algorithm.remove(onDragDataGetListeners, index); 7120 break; 7121 } 7122 } 7123 } 7124 } 7125 OnDragDataGetDelegateWrapper[] onDragDataGetListeners; 7126 7127 /** 7128 * The ::drag-data-get signal is emitted on the drag source when the drop 7129 * site requests the data which is dragged. It is the responsibility of 7130 * the signal handler to fill @data with the data in the format which 7131 * is indicated by @info. See gtk_selection_data_set() and 7132 * gtk_selection_data_set_text(). 7133 * 7134 * Params: 7135 * context = the drag context 7136 * data = the #GtkSelectionData to be filled with the dragged data 7137 * info = the info that has been registered with the target in the 7138 * #GtkTargetList 7139 * time = the timestamp at which the data was requested 7140 */ 7141 gulong addOnDragDataGet(void delegate(DragContext, SelectionData, uint, uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7142 { 7143 auto wrapper = new OnDragDataGetDelegateWrapper(dlg); 7144 wrapper.handlerId = Signals.connectData( 7145 this, 7146 "drag-data-get", 7147 cast(GCallback)&callBackDragDataGet, 7148 cast(void*)wrapper, 7149 cast(GClosureNotify)&callBackDragDataGetDestroy, 7150 connectFlags); 7151 return wrapper.handlerId; 7152 } 7153 7154 extern(C) static void callBackDragDataGet(GtkWidget* widgetStruct, GdkDragContext* context, GtkSelectionData* data, uint info, uint time, OnDragDataGetDelegateWrapper wrapper) 7155 { 7156 wrapper.dlg(ObjectG.getDObject!(DragContext)(context), ObjectG.getDObject!(SelectionData)(data), info, time, wrapper.outer); 7157 } 7158 7159 extern(C) static void callBackDragDataGetDestroy(OnDragDataGetDelegateWrapper wrapper, GClosure* closure) 7160 { 7161 wrapper.remove(wrapper); 7162 } 7163 7164 protected class OnDragDataReceivedDelegateWrapper 7165 { 7166 void delegate(DragContext, int, int, SelectionData, uint, uint, Widget) dlg; 7167 gulong handlerId; 7168 7169 this(void delegate(DragContext, int, int, SelectionData, uint, uint, Widget) dlg) 7170 { 7171 this.dlg = dlg; 7172 onDragDataReceivedListeners ~= this; 7173 } 7174 7175 void remove(OnDragDataReceivedDelegateWrapper source) 7176 { 7177 foreach(index, wrapper; onDragDataReceivedListeners) 7178 { 7179 if (wrapper.handlerId == source.handlerId) 7180 { 7181 onDragDataReceivedListeners[index] = null; 7182 onDragDataReceivedListeners = std.algorithm.remove(onDragDataReceivedListeners, index); 7183 break; 7184 } 7185 } 7186 } 7187 } 7188 OnDragDataReceivedDelegateWrapper[] onDragDataReceivedListeners; 7189 7190 /** 7191 * The ::drag-data-received signal is emitted on the drop site when the 7192 * dragged data has been received. If the data was received in order to 7193 * determine whether the drop will be accepted, the handler is expected 7194 * to call gdk_drag_status() and not finish the drag. 7195 * If the data was received in response to a #GtkWidget::drag-drop signal 7196 * (and this is the last target to be received), the handler for this 7197 * signal is expected to process the received data and then call 7198 * gtk_drag_finish(), setting the @success parameter depending on 7199 * whether the data was processed successfully. 7200 * 7201 * Applications must create some means to determine why the signal was emitted 7202 * and therefore whether to call gdk_drag_status() or gtk_drag_finish(). 7203 * 7204 * The handler may inspect the selected action with 7205 * gdk_drag_context_get_selected_action() before calling 7206 * gtk_drag_finish(), e.g. to implement %GDK_ACTION_ASK as 7207 * shown in the following example: 7208 * |[<!-- language="C" --> 7209 * void 7210 * drag_data_received (GtkWidget *widget, 7211 * GdkDragContext *context, 7212 * gint x, 7213 * gint y, 7214 * GtkSelectionData *data, 7215 * guint info, 7216 * guint time) 7217 * { 7218 * if ((data->length >= 0) && (data->format == 8)) 7219 * { 7220 * GdkDragAction action; 7221 * 7222 * // handle data here 7223 * 7224 * action = gdk_drag_context_get_selected_action (context); 7225 * if (action == GDK_ACTION_ASK) 7226 * { 7227 * GtkWidget *dialog; 7228 * gint response; 7229 * 7230 * dialog = gtk_message_dialog_new (NULL, 7231 * GTK_DIALOG_MODAL | 7232 * GTK_DIALOG_DESTROY_WITH_PARENT, 7233 * GTK_MESSAGE_INFO, 7234 * GTK_BUTTONS_YES_NO, 7235 * "Move the data ?\n"); 7236 * response = gtk_dialog_run (GTK_DIALOG (dialog)); 7237 * gtk_widget_destroy (dialog); 7238 * 7239 * if (response == GTK_RESPONSE_YES) 7240 * action = GDK_ACTION_MOVE; 7241 * else 7242 * action = GDK_ACTION_COPY; 7243 * } 7244 * 7245 * gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time); 7246 * } 7247 * else 7248 * gtk_drag_finish (context, FALSE, FALSE, time); 7249 * } 7250 * ]| 7251 * 7252 * Params: 7253 * context = the drag context 7254 * x = where the drop happened 7255 * y = where the drop happened 7256 * data = the received data 7257 * info = the info that has been registered with the target in the 7258 * #GtkTargetList 7259 * time = the timestamp at which the data was received 7260 */ 7261 gulong addOnDragDataReceived(void delegate(DragContext, int, int, SelectionData, uint, uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7262 { 7263 auto wrapper = new OnDragDataReceivedDelegateWrapper(dlg); 7264 wrapper.handlerId = Signals.connectData( 7265 this, 7266 "drag-data-received", 7267 cast(GCallback)&callBackDragDataReceived, 7268 cast(void*)wrapper, 7269 cast(GClosureNotify)&callBackDragDataReceivedDestroy, 7270 connectFlags); 7271 return wrapper.handlerId; 7272 } 7273 7274 extern(C) static void callBackDragDataReceived(GtkWidget* widgetStruct, GdkDragContext* context, int x, int y, GtkSelectionData* data, uint info, uint time, OnDragDataReceivedDelegateWrapper wrapper) 7275 { 7276 wrapper.dlg(ObjectG.getDObject!(DragContext)(context), x, y, ObjectG.getDObject!(SelectionData)(data), info, time, wrapper.outer); 7277 } 7278 7279 extern(C) static void callBackDragDataReceivedDestroy(OnDragDataReceivedDelegateWrapper wrapper, GClosure* closure) 7280 { 7281 wrapper.remove(wrapper); 7282 } 7283 7284 protected class OnDragDropDelegateWrapper 7285 { 7286 bool delegate(DragContext, int, int, uint, Widget) dlg; 7287 gulong handlerId; 7288 7289 this(bool delegate(DragContext, int, int, uint, Widget) dlg) 7290 { 7291 this.dlg = dlg; 7292 onDragDropListeners ~= this; 7293 } 7294 7295 void remove(OnDragDropDelegateWrapper source) 7296 { 7297 foreach(index, wrapper; onDragDropListeners) 7298 { 7299 if (wrapper.handlerId == source.handlerId) 7300 { 7301 onDragDropListeners[index] = null; 7302 onDragDropListeners = std.algorithm.remove(onDragDropListeners, index); 7303 break; 7304 } 7305 } 7306 } 7307 } 7308 OnDragDropDelegateWrapper[] onDragDropListeners; 7309 7310 /** 7311 * The ::drag-drop signal is emitted on the drop site when the user drops 7312 * the data onto the widget. The signal handler must determine whether 7313 * the cursor position is in a drop zone or not. If it is not in a drop 7314 * zone, it returns %FALSE and no further processing is necessary. 7315 * Otherwise, the handler returns %TRUE. In this case, the handler must 7316 * ensure that gtk_drag_finish() is called to let the source know that 7317 * the drop is done. The call to gtk_drag_finish() can be done either 7318 * directly or in a #GtkWidget::drag-data-received handler which gets 7319 * triggered by calling gtk_drag_get_data() to receive the data for one 7320 * or more of the supported targets. 7321 * 7322 * Params: 7323 * context = the drag context 7324 * x = the x coordinate of the current cursor position 7325 * y = the y coordinate of the current cursor position 7326 * time = the timestamp of the motion event 7327 * 7328 * Returns: whether the cursor position is in a drop zone 7329 */ 7330 gulong addOnDragDrop(bool delegate(DragContext, int, int, uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7331 { 7332 auto wrapper = new OnDragDropDelegateWrapper(dlg); 7333 wrapper.handlerId = Signals.connectData( 7334 this, 7335 "drag-drop", 7336 cast(GCallback)&callBackDragDrop, 7337 cast(void*)wrapper, 7338 cast(GClosureNotify)&callBackDragDropDestroy, 7339 connectFlags); 7340 return wrapper.handlerId; 7341 } 7342 7343 extern(C) static int callBackDragDrop(GtkWidget* widgetStruct, GdkDragContext* context, int x, int y, uint time, OnDragDropDelegateWrapper wrapper) 7344 { 7345 return wrapper.dlg(ObjectG.getDObject!(DragContext)(context), x, y, time, wrapper.outer); 7346 } 7347 7348 extern(C) static void callBackDragDropDestroy(OnDragDropDelegateWrapper wrapper, GClosure* closure) 7349 { 7350 wrapper.remove(wrapper); 7351 } 7352 7353 protected class OnDragEndDelegateWrapper 7354 { 7355 void delegate(DragContext, Widget) dlg; 7356 gulong handlerId; 7357 7358 this(void delegate(DragContext, Widget) dlg) 7359 { 7360 this.dlg = dlg; 7361 onDragEndListeners ~= this; 7362 } 7363 7364 void remove(OnDragEndDelegateWrapper source) 7365 { 7366 foreach(index, wrapper; onDragEndListeners) 7367 { 7368 if (wrapper.handlerId == source.handlerId) 7369 { 7370 onDragEndListeners[index] = null; 7371 onDragEndListeners = std.algorithm.remove(onDragEndListeners, index); 7372 break; 7373 } 7374 } 7375 } 7376 } 7377 OnDragEndDelegateWrapper[] onDragEndListeners; 7378 7379 /** 7380 * The ::drag-end signal is emitted on the drag source when a drag is 7381 * finished. A typical reason to connect to this signal is to undo 7382 * things done in #GtkWidget::drag-begin. 7383 * 7384 * Params: 7385 * context = the drag context 7386 */ 7387 gulong addOnDragEnd(void delegate(DragContext, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7388 { 7389 auto wrapper = new OnDragEndDelegateWrapper(dlg); 7390 wrapper.handlerId = Signals.connectData( 7391 this, 7392 "drag-end", 7393 cast(GCallback)&callBackDragEnd, 7394 cast(void*)wrapper, 7395 cast(GClosureNotify)&callBackDragEndDestroy, 7396 connectFlags); 7397 return wrapper.handlerId; 7398 } 7399 7400 extern(C) static void callBackDragEnd(GtkWidget* widgetStruct, GdkDragContext* context, OnDragEndDelegateWrapper wrapper) 7401 { 7402 wrapper.dlg(ObjectG.getDObject!(DragContext)(context), wrapper.outer); 7403 } 7404 7405 extern(C) static void callBackDragEndDestroy(OnDragEndDelegateWrapper wrapper, GClosure* closure) 7406 { 7407 wrapper.remove(wrapper); 7408 } 7409 7410 protected class OnDragFailedDelegateWrapper 7411 { 7412 bool delegate(DragContext, GtkDragResult, Widget) dlg; 7413 gulong handlerId; 7414 7415 this(bool delegate(DragContext, GtkDragResult, Widget) dlg) 7416 { 7417 this.dlg = dlg; 7418 onDragFailedListeners ~= this; 7419 } 7420 7421 void remove(OnDragFailedDelegateWrapper source) 7422 { 7423 foreach(index, wrapper; onDragFailedListeners) 7424 { 7425 if (wrapper.handlerId == source.handlerId) 7426 { 7427 onDragFailedListeners[index] = null; 7428 onDragFailedListeners = std.algorithm.remove(onDragFailedListeners, index); 7429 break; 7430 } 7431 } 7432 } 7433 } 7434 OnDragFailedDelegateWrapper[] onDragFailedListeners; 7435 7436 /** 7437 * The ::drag-failed signal is emitted on the drag source when a drag has 7438 * failed. The signal handler may hook custom code to handle a failed DnD 7439 * operation based on the type of error, it returns %TRUE is the failure has 7440 * been already handled (not showing the default "drag operation failed" 7441 * animation), otherwise it returns %FALSE. 7442 * 7443 * Params: 7444 * context = the drag context 7445 * result = the result of the drag operation 7446 * 7447 * Returns: %TRUE if the failed drag operation has been already handled. 7448 * 7449 * Since: 2.12 7450 */ 7451 gulong addOnDragFailed(bool delegate(DragContext, GtkDragResult, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7452 { 7453 auto wrapper = new OnDragFailedDelegateWrapper(dlg); 7454 wrapper.handlerId = Signals.connectData( 7455 this, 7456 "drag-failed", 7457 cast(GCallback)&callBackDragFailed, 7458 cast(void*)wrapper, 7459 cast(GClosureNotify)&callBackDragFailedDestroy, 7460 connectFlags); 7461 return wrapper.handlerId; 7462 } 7463 7464 extern(C) static int callBackDragFailed(GtkWidget* widgetStruct, GdkDragContext* context, GtkDragResult result, OnDragFailedDelegateWrapper wrapper) 7465 { 7466 return wrapper.dlg(ObjectG.getDObject!(DragContext)(context), result, wrapper.outer); 7467 } 7468 7469 extern(C) static void callBackDragFailedDestroy(OnDragFailedDelegateWrapper wrapper, GClosure* closure) 7470 { 7471 wrapper.remove(wrapper); 7472 } 7473 7474 protected class OnDragLeaveDelegateWrapper 7475 { 7476 void delegate(DragContext, uint, Widget) dlg; 7477 gulong handlerId; 7478 7479 this(void delegate(DragContext, uint, Widget) dlg) 7480 { 7481 this.dlg = dlg; 7482 onDragLeaveListeners ~= this; 7483 } 7484 7485 void remove(OnDragLeaveDelegateWrapper source) 7486 { 7487 foreach(index, wrapper; onDragLeaveListeners) 7488 { 7489 if (wrapper.handlerId == source.handlerId) 7490 { 7491 onDragLeaveListeners[index] = null; 7492 onDragLeaveListeners = std.algorithm.remove(onDragLeaveListeners, index); 7493 break; 7494 } 7495 } 7496 } 7497 } 7498 OnDragLeaveDelegateWrapper[] onDragLeaveListeners; 7499 7500 /** 7501 * The ::drag-leave signal is emitted on the drop site when the cursor 7502 * leaves the widget. A typical reason to connect to this signal is to 7503 * undo things done in #GtkWidget::drag-motion, e.g. undo highlighting 7504 * with gtk_drag_unhighlight(). 7505 * 7506 * 7507 * Likewise, the #GtkWidget::drag-leave signal is also emitted before the 7508 * ::drag-drop signal, for instance to allow cleaning up of a preview item 7509 * created in the #GtkWidget::drag-motion signal handler. 7510 * 7511 * Params: 7512 * context = the drag context 7513 * time = the timestamp of the motion event 7514 */ 7515 gulong addOnDragLeave(void delegate(DragContext, uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7516 { 7517 auto wrapper = new OnDragLeaveDelegateWrapper(dlg); 7518 wrapper.handlerId = Signals.connectData( 7519 this, 7520 "drag-leave", 7521 cast(GCallback)&callBackDragLeave, 7522 cast(void*)wrapper, 7523 cast(GClosureNotify)&callBackDragLeaveDestroy, 7524 connectFlags); 7525 return wrapper.handlerId; 7526 } 7527 7528 extern(C) static void callBackDragLeave(GtkWidget* widgetStruct, GdkDragContext* context, uint time, OnDragLeaveDelegateWrapper wrapper) 7529 { 7530 wrapper.dlg(ObjectG.getDObject!(DragContext)(context), time, wrapper.outer); 7531 } 7532 7533 extern(C) static void callBackDragLeaveDestroy(OnDragLeaveDelegateWrapper wrapper, GClosure* closure) 7534 { 7535 wrapper.remove(wrapper); 7536 } 7537 7538 protected class OnDragMotionDelegateWrapper 7539 { 7540 bool delegate(DragContext, int, int, uint, Widget) dlg; 7541 gulong handlerId; 7542 7543 this(bool delegate(DragContext, int, int, uint, Widget) dlg) 7544 { 7545 this.dlg = dlg; 7546 onDragMotionListeners ~= this; 7547 } 7548 7549 void remove(OnDragMotionDelegateWrapper source) 7550 { 7551 foreach(index, wrapper; onDragMotionListeners) 7552 { 7553 if (wrapper.handlerId == source.handlerId) 7554 { 7555 onDragMotionListeners[index] = null; 7556 onDragMotionListeners = std.algorithm.remove(onDragMotionListeners, index); 7557 break; 7558 } 7559 } 7560 } 7561 } 7562 OnDragMotionDelegateWrapper[] onDragMotionListeners; 7563 7564 /** 7565 * The ::drag-motion signal is emitted on the drop site when the user 7566 * moves the cursor over the widget during a drag. The signal handler 7567 * must determine whether the cursor position is in a drop zone or not. 7568 * If it is not in a drop zone, it returns %FALSE and no further processing 7569 * is necessary. Otherwise, the handler returns %TRUE. In this case, the 7570 * handler is responsible for providing the necessary information for 7571 * displaying feedback to the user, by calling gdk_drag_status(). 7572 * 7573 * If the decision whether the drop will be accepted or rejected can't be 7574 * made based solely on the cursor position and the type of the data, the 7575 * handler may inspect the dragged data by calling gtk_drag_get_data() and 7576 * defer the gdk_drag_status() call to the #GtkWidget::drag-data-received 7577 * handler. Note that you must pass #GTK_DEST_DEFAULT_DROP, 7578 * #GTK_DEST_DEFAULT_MOTION or #GTK_DEST_DEFAULT_ALL to gtk_drag_dest_set() 7579 * when using the drag-motion signal that way. 7580 * 7581 * Also note that there is no drag-enter signal. The drag receiver has to 7582 * keep track of whether he has received any drag-motion signals since the 7583 * last #GtkWidget::drag-leave and if not, treat the drag-motion signal as 7584 * an "enter" signal. Upon an "enter", the handler will typically highlight 7585 * the drop site with gtk_drag_highlight(). 7586 * |[<!-- language="C" --> 7587 * static void 7588 * drag_motion (GtkWidget *widget, 7589 * GdkDragContext *context, 7590 * gint x, 7591 * gint y, 7592 * guint time) 7593 * { 7594 * GdkAtom target; 7595 * 7596 * PrivateData *private_data = GET_PRIVATE_DATA (widget); 7597 * 7598 * if (!private_data->drag_highlight) 7599 * { 7600 * private_data->drag_highlight = 1; 7601 * gtk_drag_highlight (widget); 7602 * } 7603 * 7604 * target = gtk_drag_dest_find_target (widget, context, NULL); 7605 * if (target == GDK_NONE) 7606 * gdk_drag_status (context, 0, time); 7607 * else 7608 * { 7609 * private_data->pending_status 7610 * = gdk_drag_context_get_suggested_action (context); 7611 * gtk_drag_get_data (widget, context, target, time); 7612 * } 7613 * 7614 * return TRUE; 7615 * } 7616 * 7617 * static void 7618 * drag_data_received (GtkWidget *widget, 7619 * GdkDragContext *context, 7620 * gint x, 7621 * gint y, 7622 * GtkSelectionData *selection_data, 7623 * guint info, 7624 * guint time) 7625 * { 7626 * PrivateData *private_data = GET_PRIVATE_DATA (widget); 7627 * 7628 * if (private_data->suggested_action) 7629 * { 7630 * private_data->suggested_action = 0; 7631 * 7632 * // We are getting this data due to a request in drag_motion, 7633 * // rather than due to a request in drag_drop, so we are just 7634 * // supposed to call gdk_drag_status(), not actually paste in 7635 * // the data. 7636 * 7637 * str = gtk_selection_data_get_text (selection_data); 7638 * if (!data_is_acceptable (str)) 7639 * gdk_drag_status (context, 0, time); 7640 * else 7641 * gdk_drag_status (context, 7642 * private_data->suggested_action, 7643 * time); 7644 * } 7645 * else 7646 * { 7647 * // accept the drop 7648 * } 7649 * } 7650 * ]| 7651 * 7652 * Params: 7653 * context = the drag context 7654 * x = the x coordinate of the current cursor position 7655 * y = the y coordinate of the current cursor position 7656 * time = the timestamp of the motion event 7657 * 7658 * Returns: whether the cursor position is in a drop zone 7659 */ 7660 gulong addOnDragMotion(bool delegate(DragContext, int, int, uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7661 { 7662 auto wrapper = new OnDragMotionDelegateWrapper(dlg); 7663 wrapper.handlerId = Signals.connectData( 7664 this, 7665 "drag-motion", 7666 cast(GCallback)&callBackDragMotion, 7667 cast(void*)wrapper, 7668 cast(GClosureNotify)&callBackDragMotionDestroy, 7669 connectFlags); 7670 return wrapper.handlerId; 7671 } 7672 7673 extern(C) static int callBackDragMotion(GtkWidget* widgetStruct, GdkDragContext* context, int x, int y, uint time, OnDragMotionDelegateWrapper wrapper) 7674 { 7675 return wrapper.dlg(ObjectG.getDObject!(DragContext)(context), x, y, time, wrapper.outer); 7676 } 7677 7678 extern(C) static void callBackDragMotionDestroy(OnDragMotionDelegateWrapper wrapper, GClosure* closure) 7679 { 7680 wrapper.remove(wrapper); 7681 } 7682 7683 protected class OnEnterNotifyDelegateWrapper 7684 { 7685 bool delegate(GdkEventCrossing*, Widget) dlg; 7686 gulong handlerId; 7687 7688 this(bool delegate(GdkEventCrossing*, Widget) dlg) 7689 { 7690 this.dlg = dlg; 7691 onEnterNotifyListeners ~= this; 7692 } 7693 7694 void remove(OnEnterNotifyDelegateWrapper source) 7695 { 7696 foreach(index, wrapper; onEnterNotifyListeners) 7697 { 7698 if (wrapper.handlerId == source.handlerId) 7699 { 7700 onEnterNotifyListeners[index] = null; 7701 onEnterNotifyListeners = std.algorithm.remove(onEnterNotifyListeners, index); 7702 break; 7703 } 7704 } 7705 } 7706 } 7707 OnEnterNotifyDelegateWrapper[] onEnterNotifyListeners; 7708 7709 /** 7710 * The ::enter-notify-event will be emitted when the pointer enters 7711 * the @widget's window. 7712 * 7713 * To receive this signal, the #GdkWindow associated to the widget needs 7714 * to enable the #GDK_ENTER_NOTIFY_MASK mask. 7715 * 7716 * This signal will be sent to the grab widget if there is one. 7717 * 7718 * Params: 7719 * event = the #GdkEventCrossing which triggered 7720 * this signal. 7721 * 7722 * Returns: %TRUE to stop other handlers from being invoked for the event. 7723 * %FALSE to propagate the event further. 7724 */ 7725 gulong addOnEnterNotify(bool delegate(GdkEventCrossing*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7726 { 7727 addEvents(EventMask.ENTER_NOTIFY_MASK); 7728 auto wrapper = new OnEnterNotifyDelegateWrapper(dlg); 7729 wrapper.handlerId = Signals.connectData( 7730 this, 7731 "enter-notify-event", 7732 cast(GCallback)&callBackEnterNotify, 7733 cast(void*)wrapper, 7734 cast(GClosureNotify)&callBackEnterNotifyDestroy, 7735 connectFlags); 7736 return wrapper.handlerId; 7737 } 7738 7739 extern(C) static int callBackEnterNotify(GtkWidget* widgetStruct, GdkEventCrossing* event, OnEnterNotifyDelegateWrapper wrapper) 7740 { 7741 return wrapper.dlg(event, wrapper.outer); 7742 } 7743 7744 extern(C) static void callBackEnterNotifyDestroy(OnEnterNotifyDelegateWrapper wrapper, GClosure* closure) 7745 { 7746 wrapper.remove(wrapper); 7747 } 7748 7749 protected class OnEnterNotifyEventGenericDelegateWrapper 7750 { 7751 bool delegate(Event, Widget) dlg; 7752 gulong handlerId; 7753 7754 this(bool delegate(Event, Widget) dlg) 7755 { 7756 this.dlg = dlg; 7757 onEnterNotifyEventGenericListeners ~= this; 7758 } 7759 7760 void remove(OnEnterNotifyEventGenericDelegateWrapper source) 7761 { 7762 foreach(index, wrapper; onEnterNotifyEventGenericListeners) 7763 { 7764 if (wrapper.handlerId == source.handlerId) 7765 { 7766 onEnterNotifyEventGenericListeners[index] = null; 7767 onEnterNotifyEventGenericListeners = std.algorithm.remove(onEnterNotifyEventGenericListeners, index); 7768 break; 7769 } 7770 } 7771 } 7772 } 7773 OnEnterNotifyEventGenericDelegateWrapper[] onEnterNotifyEventGenericListeners; 7774 7775 /** 7776 * The ::enter-notify-event will be emitted when the pointer enters 7777 * the @widget's window. 7778 * 7779 * To receive this signal, the #GdkWindow associated to the widget needs 7780 * to enable the #GDK_ENTER_NOTIFY_MASK mask. 7781 * 7782 * This signal will be sent to the grab widget if there is one. 7783 * 7784 * Params: 7785 * event = the #GdkEventCrossing which triggered 7786 * this signal. 7787 * 7788 * Returns: %TRUE to stop other handlers from being invoked for the event. 7789 * %FALSE to propagate the event further. 7790 */ 7791 gulong addOnEnterNotify(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7792 { 7793 addEvents(EventMask.ENTER_NOTIFY_MASK); 7794 auto wrapper = new OnEnterNotifyEventGenericDelegateWrapper(dlg); 7795 wrapper.handlerId = Signals.connectData( 7796 this, 7797 "enter-notify-event", 7798 cast(GCallback)&callBackEnterNotifyEventGeneric, 7799 cast(void*)wrapper, 7800 cast(GClosureNotify)&callBackEnterNotifyEventGenericDestroy, 7801 connectFlags); 7802 return wrapper.handlerId; 7803 } 7804 7805 extern(C) static int callBackEnterNotifyEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnEnterNotifyEventGenericDelegateWrapper wrapper) 7806 { 7807 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 7808 } 7809 7810 extern(C) static void callBackEnterNotifyEventGenericDestroy(OnEnterNotifyEventGenericDelegateWrapper wrapper, GClosure* closure) 7811 { 7812 wrapper.remove(wrapper); 7813 } 7814 7815 protected class OnDelegateWrapper 7816 { 7817 bool delegate(Event, Widget) dlg; 7818 gulong handlerId; 7819 7820 this(bool delegate(Event, Widget) dlg) 7821 { 7822 this.dlg = dlg; 7823 onListeners ~= this; 7824 } 7825 7826 void remove(OnDelegateWrapper source) 7827 { 7828 foreach(index, wrapper; onListeners) 7829 { 7830 if (wrapper.handlerId == source.handlerId) 7831 { 7832 onListeners[index] = null; 7833 onListeners = std.algorithm.remove(onListeners, index); 7834 break; 7835 } 7836 } 7837 } 7838 } 7839 OnDelegateWrapper[] onListeners; 7840 7841 /** 7842 * The GTK+ main loop will emit three signals for each GDK event delivered 7843 * to a widget: one generic ::event signal, another, more specific, 7844 * signal that matches the type of event delivered (e.g. 7845 * #GtkWidget::key-press-event) and finally a generic 7846 * #GtkWidget::event-after signal. 7847 * 7848 * Params: 7849 * event = the #GdkEvent which triggered this signal 7850 * 7851 * Returns: %TRUE to stop other handlers from being invoked for the event 7852 * and to cancel the emission of the second specific ::event signal. 7853 * %FALSE to propagate the event further and to allow the emission of 7854 * the second signal. The ::event-after signal is emitted regardless of 7855 * the return value. 7856 */ 7857 gulong addOn(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7858 { 7859 auto wrapper = new OnDelegateWrapper(dlg); 7860 wrapper.handlerId = Signals.connectData( 7861 this, 7862 "event", 7863 cast(GCallback)&callBack, 7864 cast(void*)wrapper, 7865 cast(GClosureNotify)&callBackDestroy, 7866 connectFlags); 7867 return wrapper.handlerId; 7868 } 7869 7870 extern(C) static int callBack(GtkWidget* widgetStruct, GdkEvent* event, OnDelegateWrapper wrapper) 7871 { 7872 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 7873 } 7874 7875 extern(C) static void callBackDestroy(OnDelegateWrapper wrapper, GClosure* closure) 7876 { 7877 wrapper.remove(wrapper); 7878 } 7879 7880 protected class OnEventAfterDelegateWrapper 7881 { 7882 void delegate(Event, Widget) dlg; 7883 gulong handlerId; 7884 7885 this(void delegate(Event, Widget) dlg) 7886 { 7887 this.dlg = dlg; 7888 onEventAfterListeners ~= this; 7889 } 7890 7891 void remove(OnEventAfterDelegateWrapper source) 7892 { 7893 foreach(index, wrapper; onEventAfterListeners) 7894 { 7895 if (wrapper.handlerId == source.handlerId) 7896 { 7897 onEventAfterListeners[index] = null; 7898 onEventAfterListeners = std.algorithm.remove(onEventAfterListeners, index); 7899 break; 7900 } 7901 } 7902 } 7903 } 7904 OnEventAfterDelegateWrapper[] onEventAfterListeners; 7905 7906 /** 7907 * After the emission of the #GtkWidget::event signal and (optionally) 7908 * the second more specific signal, ::event-after will be emitted 7909 * regardless of the previous two signals handlers return values. 7910 * 7911 * Params: 7912 * event = the #GdkEvent which triggered this signal 7913 */ 7914 gulong addOnEventAfter(void delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7915 { 7916 auto wrapper = new OnEventAfterDelegateWrapper(dlg); 7917 wrapper.handlerId = Signals.connectData( 7918 this, 7919 "event-after", 7920 cast(GCallback)&callBackEventAfter, 7921 cast(void*)wrapper, 7922 cast(GClosureNotify)&callBackEventAfterDestroy, 7923 connectFlags); 7924 return wrapper.handlerId; 7925 } 7926 7927 extern(C) static void callBackEventAfter(GtkWidget* widgetStruct, GdkEvent* event, OnEventAfterDelegateWrapper wrapper) 7928 { 7929 wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 7930 } 7931 7932 extern(C) static void callBackEventAfterDestroy(OnEventAfterDelegateWrapper wrapper, GClosure* closure) 7933 { 7934 wrapper.remove(wrapper); 7935 } 7936 7937 protected class OnFocusDelegateWrapper 7938 { 7939 bool delegate(GtkDirectionType, Widget) dlg; 7940 gulong handlerId; 7941 7942 this(bool delegate(GtkDirectionType, Widget) dlg) 7943 { 7944 this.dlg = dlg; 7945 onFocusListeners ~= this; 7946 } 7947 7948 void remove(OnFocusDelegateWrapper source) 7949 { 7950 foreach(index, wrapper; onFocusListeners) 7951 { 7952 if (wrapper.handlerId == source.handlerId) 7953 { 7954 onFocusListeners[index] = null; 7955 onFocusListeners = std.algorithm.remove(onFocusListeners, index); 7956 break; 7957 } 7958 } 7959 } 7960 } 7961 OnFocusDelegateWrapper[] onFocusListeners; 7962 7963 /** 7964 * Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further. 7965 */ 7966 gulong addOnFocus(bool delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 7967 { 7968 auto wrapper = new OnFocusDelegateWrapper(dlg); 7969 wrapper.handlerId = Signals.connectData( 7970 this, 7971 "focus", 7972 cast(GCallback)&callBackFocus, 7973 cast(void*)wrapper, 7974 cast(GClosureNotify)&callBackFocusDestroy, 7975 connectFlags); 7976 return wrapper.handlerId; 7977 } 7978 7979 extern(C) static int callBackFocus(GtkWidget* widgetStruct, GtkDirectionType direction, OnFocusDelegateWrapper wrapper) 7980 { 7981 return wrapper.dlg(direction, wrapper.outer); 7982 } 7983 7984 extern(C) static void callBackFocusDestroy(OnFocusDelegateWrapper wrapper, GClosure* closure) 7985 { 7986 wrapper.remove(wrapper); 7987 } 7988 7989 protected class OnFocusInDelegateWrapper 7990 { 7991 bool delegate(GdkEventFocus*, Widget) dlg; 7992 gulong handlerId; 7993 7994 this(bool delegate(GdkEventFocus*, Widget) dlg) 7995 { 7996 this.dlg = dlg; 7997 onFocusInListeners ~= this; 7998 } 7999 8000 void remove(OnFocusInDelegateWrapper source) 8001 { 8002 foreach(index, wrapper; onFocusInListeners) 8003 { 8004 if (wrapper.handlerId == source.handlerId) 8005 { 8006 onFocusInListeners[index] = null; 8007 onFocusInListeners = std.algorithm.remove(onFocusInListeners, index); 8008 break; 8009 } 8010 } 8011 } 8012 } 8013 OnFocusInDelegateWrapper[] onFocusInListeners; 8014 8015 /** 8016 * The ::focus-in-event signal will be emitted when the keyboard focus 8017 * enters the @widget's window. 8018 * 8019 * To receive this signal, the #GdkWindow associated to the widget needs 8020 * to enable the #GDK_FOCUS_CHANGE_MASK mask. 8021 * 8022 * Params: 8023 * event = the #GdkEventFocus which triggered 8024 * this signal. 8025 * 8026 * Returns: %TRUE to stop other handlers from being invoked for the event. 8027 * %FALSE to propagate the event further. 8028 */ 8029 gulong addOnFocusIn(bool delegate(GdkEventFocus*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8030 { 8031 addEvents(EventMask.FOCUS_CHANGE_MASK); 8032 auto wrapper = new OnFocusInDelegateWrapper(dlg); 8033 wrapper.handlerId = Signals.connectData( 8034 this, 8035 "focus-in-event", 8036 cast(GCallback)&callBackFocusIn, 8037 cast(void*)wrapper, 8038 cast(GClosureNotify)&callBackFocusInDestroy, 8039 connectFlags); 8040 return wrapper.handlerId; 8041 } 8042 8043 extern(C) static int callBackFocusIn(GtkWidget* widgetStruct, GdkEventFocus* event, OnFocusInDelegateWrapper wrapper) 8044 { 8045 return wrapper.dlg(event, wrapper.outer); 8046 } 8047 8048 extern(C) static void callBackFocusInDestroy(OnFocusInDelegateWrapper wrapper, GClosure* closure) 8049 { 8050 wrapper.remove(wrapper); 8051 } 8052 8053 protected class OnFocusInEventGenericDelegateWrapper 8054 { 8055 bool delegate(Event, Widget) dlg; 8056 gulong handlerId; 8057 8058 this(bool delegate(Event, Widget) dlg) 8059 { 8060 this.dlg = dlg; 8061 onFocusInEventGenericListeners ~= this; 8062 } 8063 8064 void remove(OnFocusInEventGenericDelegateWrapper source) 8065 { 8066 foreach(index, wrapper; onFocusInEventGenericListeners) 8067 { 8068 if (wrapper.handlerId == source.handlerId) 8069 { 8070 onFocusInEventGenericListeners[index] = null; 8071 onFocusInEventGenericListeners = std.algorithm.remove(onFocusInEventGenericListeners, index); 8072 break; 8073 } 8074 } 8075 } 8076 } 8077 OnFocusInEventGenericDelegateWrapper[] onFocusInEventGenericListeners; 8078 8079 /** 8080 * The ::focus-in-event signal will be emitted when the keyboard focus 8081 * enters the @widget's window. 8082 * 8083 * To receive this signal, the #GdkWindow associated to the widget needs 8084 * to enable the #GDK_FOCUS_CHANGE_MASK mask. 8085 * 8086 * Params: 8087 * event = the #GdkEventFocus which triggered 8088 * this signal. 8089 * 8090 * Returns: %TRUE to stop other handlers from being invoked for the event. 8091 * %FALSE to propagate the event further. 8092 */ 8093 gulong addOnFocusIn(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8094 { 8095 addEvents(EventMask.FOCUS_CHANGE_MASK); 8096 auto wrapper = new OnFocusInEventGenericDelegateWrapper(dlg); 8097 wrapper.handlerId = Signals.connectData( 8098 this, 8099 "focus-in-event", 8100 cast(GCallback)&callBackFocusInEventGeneric, 8101 cast(void*)wrapper, 8102 cast(GClosureNotify)&callBackFocusInEventGenericDestroy, 8103 connectFlags); 8104 return wrapper.handlerId; 8105 } 8106 8107 extern(C) static int callBackFocusInEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnFocusInEventGenericDelegateWrapper wrapper) 8108 { 8109 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 8110 } 8111 8112 extern(C) static void callBackFocusInEventGenericDestroy(OnFocusInEventGenericDelegateWrapper wrapper, GClosure* closure) 8113 { 8114 wrapper.remove(wrapper); 8115 } 8116 8117 protected class OnFocusOutDelegateWrapper 8118 { 8119 bool delegate(GdkEventFocus*, Widget) dlg; 8120 gulong handlerId; 8121 8122 this(bool delegate(GdkEventFocus*, Widget) dlg) 8123 { 8124 this.dlg = dlg; 8125 onFocusOutListeners ~= this; 8126 } 8127 8128 void remove(OnFocusOutDelegateWrapper source) 8129 { 8130 foreach(index, wrapper; onFocusOutListeners) 8131 { 8132 if (wrapper.handlerId == source.handlerId) 8133 { 8134 onFocusOutListeners[index] = null; 8135 onFocusOutListeners = std.algorithm.remove(onFocusOutListeners, index); 8136 break; 8137 } 8138 } 8139 } 8140 } 8141 OnFocusOutDelegateWrapper[] onFocusOutListeners; 8142 8143 /** 8144 * The ::focus-out-event signal will be emitted when the keyboard focus 8145 * leaves the @widget's window. 8146 * 8147 * To receive this signal, the #GdkWindow associated to the widget needs 8148 * to enable the #GDK_FOCUS_CHANGE_MASK mask. 8149 * 8150 * Params: 8151 * event = the #GdkEventFocus which triggered this 8152 * signal. 8153 * 8154 * Returns: %TRUE to stop other handlers from being invoked for the event. 8155 * %FALSE to propagate the event further. 8156 */ 8157 gulong addOnFocusOut(bool delegate(GdkEventFocus*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8158 { 8159 addEvents(EventMask.FOCUS_CHANGE_MASK); 8160 auto wrapper = new OnFocusOutDelegateWrapper(dlg); 8161 wrapper.handlerId = Signals.connectData( 8162 this, 8163 "focus-out-event", 8164 cast(GCallback)&callBackFocusOut, 8165 cast(void*)wrapper, 8166 cast(GClosureNotify)&callBackFocusOutDestroy, 8167 connectFlags); 8168 return wrapper.handlerId; 8169 } 8170 8171 extern(C) static int callBackFocusOut(GtkWidget* widgetStruct, GdkEventFocus* event, OnFocusOutDelegateWrapper wrapper) 8172 { 8173 return wrapper.dlg(event, wrapper.outer); 8174 } 8175 8176 extern(C) static void callBackFocusOutDestroy(OnFocusOutDelegateWrapper wrapper, GClosure* closure) 8177 { 8178 wrapper.remove(wrapper); 8179 } 8180 8181 protected class OnFocusOutEventGenericDelegateWrapper 8182 { 8183 bool delegate(Event, Widget) dlg; 8184 gulong handlerId; 8185 8186 this(bool delegate(Event, Widget) dlg) 8187 { 8188 this.dlg = dlg; 8189 onFocusOutEventGenericListeners ~= this; 8190 } 8191 8192 void remove(OnFocusOutEventGenericDelegateWrapper source) 8193 { 8194 foreach(index, wrapper; onFocusOutEventGenericListeners) 8195 { 8196 if (wrapper.handlerId == source.handlerId) 8197 { 8198 onFocusOutEventGenericListeners[index] = null; 8199 onFocusOutEventGenericListeners = std.algorithm.remove(onFocusOutEventGenericListeners, index); 8200 break; 8201 } 8202 } 8203 } 8204 } 8205 OnFocusOutEventGenericDelegateWrapper[] onFocusOutEventGenericListeners; 8206 8207 /** 8208 * The ::focus-out-event signal will be emitted when the keyboard focus 8209 * leaves the @widget's window. 8210 * 8211 * To receive this signal, the #GdkWindow associated to the widget needs 8212 * to enable the #GDK_FOCUS_CHANGE_MASK mask. 8213 * 8214 * Params: 8215 * event = the #GdkEventFocus which triggered this 8216 * signal. 8217 * 8218 * Returns: %TRUE to stop other handlers from being invoked for the event. 8219 * %FALSE to propagate the event further. 8220 */ 8221 gulong addOnFocusOut(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8222 { 8223 addEvents(EventMask.FOCUS_CHANGE_MASK); 8224 auto wrapper = new OnFocusOutEventGenericDelegateWrapper(dlg); 8225 wrapper.handlerId = Signals.connectData( 8226 this, 8227 "focus-out-event", 8228 cast(GCallback)&callBackFocusOutEventGeneric, 8229 cast(void*)wrapper, 8230 cast(GClosureNotify)&callBackFocusOutEventGenericDestroy, 8231 connectFlags); 8232 return wrapper.handlerId; 8233 } 8234 8235 extern(C) static int callBackFocusOutEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnFocusOutEventGenericDelegateWrapper wrapper) 8236 { 8237 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 8238 } 8239 8240 extern(C) static void callBackFocusOutEventGenericDestroy(OnFocusOutEventGenericDelegateWrapper wrapper, GClosure* closure) 8241 { 8242 wrapper.remove(wrapper); 8243 } 8244 8245 protected class OnGrabBrokenDelegateWrapper 8246 { 8247 bool delegate(GdkEventGrabBroken*, Widget) dlg; 8248 gulong handlerId; 8249 8250 this(bool delegate(GdkEventGrabBroken*, Widget) dlg) 8251 { 8252 this.dlg = dlg; 8253 onGrabBrokenListeners ~= this; 8254 } 8255 8256 void remove(OnGrabBrokenDelegateWrapper source) 8257 { 8258 foreach(index, wrapper; onGrabBrokenListeners) 8259 { 8260 if (wrapper.handlerId == source.handlerId) 8261 { 8262 onGrabBrokenListeners[index] = null; 8263 onGrabBrokenListeners = std.algorithm.remove(onGrabBrokenListeners, index); 8264 break; 8265 } 8266 } 8267 } 8268 } 8269 OnGrabBrokenDelegateWrapper[] onGrabBrokenListeners; 8270 8271 /** 8272 * Emitted when a pointer or keyboard grab on a window belonging 8273 * to @widget gets broken. 8274 * 8275 * On X11, this happens when the grab window becomes unviewable 8276 * (i.e. it or one of its ancestors is unmapped), or if the same 8277 * application grabs the pointer or keyboard again. 8278 * 8279 * Params: 8280 * event = the #GdkEventGrabBroken event 8281 * 8282 * Returns: %TRUE to stop other handlers from being invoked for 8283 * the event. %FALSE to propagate the event further. 8284 * 8285 * Since: 2.8 8286 */ 8287 gulong addOnGrabBroken(bool delegate(GdkEventGrabBroken*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8288 { 8289 auto wrapper = new OnGrabBrokenDelegateWrapper(dlg); 8290 wrapper.handlerId = Signals.connectData( 8291 this, 8292 "grab-broken-event", 8293 cast(GCallback)&callBackGrabBroken, 8294 cast(void*)wrapper, 8295 cast(GClosureNotify)&callBackGrabBrokenDestroy, 8296 connectFlags); 8297 return wrapper.handlerId; 8298 } 8299 8300 extern(C) static int callBackGrabBroken(GtkWidget* widgetStruct, GdkEventGrabBroken* event, OnGrabBrokenDelegateWrapper wrapper) 8301 { 8302 return wrapper.dlg(event, wrapper.outer); 8303 } 8304 8305 extern(C) static void callBackGrabBrokenDestroy(OnGrabBrokenDelegateWrapper wrapper, GClosure* closure) 8306 { 8307 wrapper.remove(wrapper); 8308 } 8309 8310 protected class OnGrabBrokenEventGenericDelegateWrapper 8311 { 8312 bool delegate(Event, Widget) dlg; 8313 gulong handlerId; 8314 8315 this(bool delegate(Event, Widget) dlg) 8316 { 8317 this.dlg = dlg; 8318 onGrabBrokenEventGenericListeners ~= this; 8319 } 8320 8321 void remove(OnGrabBrokenEventGenericDelegateWrapper source) 8322 { 8323 foreach(index, wrapper; onGrabBrokenEventGenericListeners) 8324 { 8325 if (wrapper.handlerId == source.handlerId) 8326 { 8327 onGrabBrokenEventGenericListeners[index] = null; 8328 onGrabBrokenEventGenericListeners = std.algorithm.remove(onGrabBrokenEventGenericListeners, index); 8329 break; 8330 } 8331 } 8332 } 8333 } 8334 OnGrabBrokenEventGenericDelegateWrapper[] onGrabBrokenEventGenericListeners; 8335 8336 /** 8337 * Emitted when a pointer or keyboard grab on a window belonging 8338 * to @widget gets broken. 8339 * 8340 * On X11, this happens when the grab window becomes unviewable 8341 * (i.e. it or one of its ancestors is unmapped), or if the same 8342 * application grabs the pointer or keyboard again. 8343 * 8344 * Params: 8345 * event = the #GdkEventGrabBroken event 8346 * 8347 * Returns: %TRUE to stop other handlers from being invoked for 8348 * the event. %FALSE to propagate the event further. 8349 * 8350 * Since: 2.8 8351 */ 8352 gulong addOnGrabBroken(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8353 { 8354 auto wrapper = new OnGrabBrokenEventGenericDelegateWrapper(dlg); 8355 wrapper.handlerId = Signals.connectData( 8356 this, 8357 "grab-broken-event", 8358 cast(GCallback)&callBackGrabBrokenEventGeneric, 8359 cast(void*)wrapper, 8360 cast(GClosureNotify)&callBackGrabBrokenEventGenericDestroy, 8361 connectFlags); 8362 return wrapper.handlerId; 8363 } 8364 8365 extern(C) static int callBackGrabBrokenEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnGrabBrokenEventGenericDelegateWrapper wrapper) 8366 { 8367 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 8368 } 8369 8370 extern(C) static void callBackGrabBrokenEventGenericDestroy(OnGrabBrokenEventGenericDelegateWrapper wrapper, GClosure* closure) 8371 { 8372 wrapper.remove(wrapper); 8373 } 8374 8375 protected class OnGrabFocusDelegateWrapper 8376 { 8377 void delegate(Widget) dlg; 8378 gulong handlerId; 8379 8380 this(void delegate(Widget) dlg) 8381 { 8382 this.dlg = dlg; 8383 onGrabFocusListeners ~= this; 8384 } 8385 8386 void remove(OnGrabFocusDelegateWrapper source) 8387 { 8388 foreach(index, wrapper; onGrabFocusListeners) 8389 { 8390 if (wrapper.handlerId == source.handlerId) 8391 { 8392 onGrabFocusListeners[index] = null; 8393 onGrabFocusListeners = std.algorithm.remove(onGrabFocusListeners, index); 8394 break; 8395 } 8396 } 8397 } 8398 } 8399 OnGrabFocusDelegateWrapper[] onGrabFocusListeners; 8400 8401 /** */ 8402 gulong addOnGrabFocus(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8403 { 8404 auto wrapper = new OnGrabFocusDelegateWrapper(dlg); 8405 wrapper.handlerId = Signals.connectData( 8406 this, 8407 "grab-focus", 8408 cast(GCallback)&callBackGrabFocus, 8409 cast(void*)wrapper, 8410 cast(GClosureNotify)&callBackGrabFocusDestroy, 8411 connectFlags); 8412 return wrapper.handlerId; 8413 } 8414 8415 extern(C) static void callBackGrabFocus(GtkWidget* widgetStruct, OnGrabFocusDelegateWrapper wrapper) 8416 { 8417 wrapper.dlg(wrapper.outer); 8418 } 8419 8420 extern(C) static void callBackGrabFocusDestroy(OnGrabFocusDelegateWrapper wrapper, GClosure* closure) 8421 { 8422 wrapper.remove(wrapper); 8423 } 8424 8425 protected class OnGrabNotifyDelegateWrapper 8426 { 8427 void delegate(bool, Widget) dlg; 8428 gulong handlerId; 8429 8430 this(void delegate(bool, Widget) dlg) 8431 { 8432 this.dlg = dlg; 8433 onGrabNotifyListeners ~= this; 8434 } 8435 8436 void remove(OnGrabNotifyDelegateWrapper source) 8437 { 8438 foreach(index, wrapper; onGrabNotifyListeners) 8439 { 8440 if (wrapper.handlerId == source.handlerId) 8441 { 8442 onGrabNotifyListeners[index] = null; 8443 onGrabNotifyListeners = std.algorithm.remove(onGrabNotifyListeners, index); 8444 break; 8445 } 8446 } 8447 } 8448 } 8449 OnGrabNotifyDelegateWrapper[] onGrabNotifyListeners; 8450 8451 /** 8452 * The ::grab-notify signal is emitted when a widget becomes 8453 * shadowed by a GTK+ grab (not a pointer or keyboard grab) on 8454 * another widget, or when it becomes unshadowed due to a grab 8455 * being removed. 8456 * 8457 * A widget is shadowed by a gtk_grab_add() when the topmost 8458 * grab widget in the grab stack of its window group is not 8459 * its ancestor. 8460 * 8461 * Params: 8462 * wasGrabbed = %FALSE if the widget becomes shadowed, %TRUE 8463 * if it becomes unshadowed 8464 */ 8465 gulong addOnGrabNotify(void delegate(bool, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8466 { 8467 auto wrapper = new OnGrabNotifyDelegateWrapper(dlg); 8468 wrapper.handlerId = Signals.connectData( 8469 this, 8470 "grab-notify", 8471 cast(GCallback)&callBackGrabNotify, 8472 cast(void*)wrapper, 8473 cast(GClosureNotify)&callBackGrabNotifyDestroy, 8474 connectFlags); 8475 return wrapper.handlerId; 8476 } 8477 8478 extern(C) static void callBackGrabNotify(GtkWidget* widgetStruct, bool wasGrabbed, OnGrabNotifyDelegateWrapper wrapper) 8479 { 8480 wrapper.dlg(wasGrabbed, wrapper.outer); 8481 } 8482 8483 extern(C) static void callBackGrabNotifyDestroy(OnGrabNotifyDelegateWrapper wrapper, GClosure* closure) 8484 { 8485 wrapper.remove(wrapper); 8486 } 8487 8488 protected class OnHideDelegateWrapper 8489 { 8490 void delegate(Widget) dlg; 8491 gulong handlerId; 8492 8493 this(void delegate(Widget) dlg) 8494 { 8495 this.dlg = dlg; 8496 onHideListeners ~= this; 8497 } 8498 8499 void remove(OnHideDelegateWrapper source) 8500 { 8501 foreach(index, wrapper; onHideListeners) 8502 { 8503 if (wrapper.handlerId == source.handlerId) 8504 { 8505 onHideListeners[index] = null; 8506 onHideListeners = std.algorithm.remove(onHideListeners, index); 8507 break; 8508 } 8509 } 8510 } 8511 } 8512 OnHideDelegateWrapper[] onHideListeners; 8513 8514 /** 8515 * The ::hide signal is emitted when @widget is hidden, for example with 8516 * gtk_widget_hide(). 8517 */ 8518 gulong addOnHide(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8519 { 8520 auto wrapper = new OnHideDelegateWrapper(dlg); 8521 wrapper.handlerId = Signals.connectData( 8522 this, 8523 "hide", 8524 cast(GCallback)&callBackHide, 8525 cast(void*)wrapper, 8526 cast(GClosureNotify)&callBackHideDestroy, 8527 connectFlags); 8528 return wrapper.handlerId; 8529 } 8530 8531 extern(C) static void callBackHide(GtkWidget* widgetStruct, OnHideDelegateWrapper wrapper) 8532 { 8533 wrapper.dlg(wrapper.outer); 8534 } 8535 8536 extern(C) static void callBackHideDestroy(OnHideDelegateWrapper wrapper, GClosure* closure) 8537 { 8538 wrapper.remove(wrapper); 8539 } 8540 8541 protected class OnHierarchyChangedDelegateWrapper 8542 { 8543 void delegate(Widget, Widget) dlg; 8544 gulong handlerId; 8545 8546 this(void delegate(Widget, Widget) dlg) 8547 { 8548 this.dlg = dlg; 8549 onHierarchyChangedListeners ~= this; 8550 } 8551 8552 void remove(OnHierarchyChangedDelegateWrapper source) 8553 { 8554 foreach(index, wrapper; onHierarchyChangedListeners) 8555 { 8556 if (wrapper.handlerId == source.handlerId) 8557 { 8558 onHierarchyChangedListeners[index] = null; 8559 onHierarchyChangedListeners = std.algorithm.remove(onHierarchyChangedListeners, index); 8560 break; 8561 } 8562 } 8563 } 8564 } 8565 OnHierarchyChangedDelegateWrapper[] onHierarchyChangedListeners; 8566 8567 /** 8568 * The ::hierarchy-changed signal is emitted when the 8569 * anchored state of a widget changes. A widget is 8570 * “anchored” when its toplevel 8571 * ancestor is a #GtkWindow. This signal is emitted when 8572 * a widget changes from un-anchored to anchored or vice-versa. 8573 * 8574 * Params: 8575 * previousToplevel = the previous toplevel ancestor, or %NULL 8576 * if the widget was previously unanchored 8577 */ 8578 gulong addOnHierarchyChanged(void delegate(Widget, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8579 { 8580 auto wrapper = new OnHierarchyChangedDelegateWrapper(dlg); 8581 wrapper.handlerId = Signals.connectData( 8582 this, 8583 "hierarchy-changed", 8584 cast(GCallback)&callBackHierarchyChanged, 8585 cast(void*)wrapper, 8586 cast(GClosureNotify)&callBackHierarchyChangedDestroy, 8587 connectFlags); 8588 return wrapper.handlerId; 8589 } 8590 8591 extern(C) static void callBackHierarchyChanged(GtkWidget* widgetStruct, GtkWidget* previousToplevel, OnHierarchyChangedDelegateWrapper wrapper) 8592 { 8593 wrapper.dlg(ObjectG.getDObject!(Widget)(previousToplevel), wrapper.outer); 8594 } 8595 8596 extern(C) static void callBackHierarchyChangedDestroy(OnHierarchyChangedDelegateWrapper wrapper, GClosure* closure) 8597 { 8598 wrapper.remove(wrapper); 8599 } 8600 8601 protected class OnKeyPressDelegateWrapper 8602 { 8603 bool delegate(GdkEventKey*, Widget) dlg; 8604 gulong handlerId; 8605 8606 this(bool delegate(GdkEventKey*, Widget) dlg) 8607 { 8608 this.dlg = dlg; 8609 onKeyPressListeners ~= this; 8610 } 8611 8612 void remove(OnKeyPressDelegateWrapper source) 8613 { 8614 foreach(index, wrapper; onKeyPressListeners) 8615 { 8616 if (wrapper.handlerId == source.handlerId) 8617 { 8618 onKeyPressListeners[index] = null; 8619 onKeyPressListeners = std.algorithm.remove(onKeyPressListeners, index); 8620 break; 8621 } 8622 } 8623 } 8624 } 8625 OnKeyPressDelegateWrapper[] onKeyPressListeners; 8626 8627 /** 8628 * The ::key-press-event signal is emitted when a key is pressed. The signal 8629 * emission will reoccur at the key-repeat rate when the key is kept pressed. 8630 * 8631 * To receive this signal, the #GdkWindow associated to the widget needs 8632 * to enable the #GDK_KEY_PRESS_MASK mask. 8633 * 8634 * This signal will be sent to the grab widget if there is one. 8635 * 8636 * Params: 8637 * event = the #GdkEventKey which triggered this signal. 8638 * 8639 * Returns: %TRUE to stop other handlers from being invoked for the event. 8640 * %FALSE to propagate the event further. 8641 */ 8642 gulong addOnKeyPress(bool delegate(GdkEventKey*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8643 { 8644 addEvents(EventMask.KEY_PRESS_MASK); 8645 auto wrapper = new OnKeyPressDelegateWrapper(dlg); 8646 wrapper.handlerId = Signals.connectData( 8647 this, 8648 "key-press-event", 8649 cast(GCallback)&callBackKeyPress, 8650 cast(void*)wrapper, 8651 cast(GClosureNotify)&callBackKeyPressDestroy, 8652 connectFlags); 8653 return wrapper.handlerId; 8654 } 8655 8656 extern(C) static int callBackKeyPress(GtkWidget* widgetStruct, GdkEventKey* event, OnKeyPressDelegateWrapper wrapper) 8657 { 8658 return wrapper.dlg(event, wrapper.outer); 8659 } 8660 8661 extern(C) static void callBackKeyPressDestroy(OnKeyPressDelegateWrapper wrapper, GClosure* closure) 8662 { 8663 wrapper.remove(wrapper); 8664 } 8665 8666 protected class OnKeyPressEventGenericDelegateWrapper 8667 { 8668 bool delegate(Event, Widget) dlg; 8669 gulong handlerId; 8670 8671 this(bool delegate(Event, Widget) dlg) 8672 { 8673 this.dlg = dlg; 8674 onKeyPressEventGenericListeners ~= this; 8675 } 8676 8677 void remove(OnKeyPressEventGenericDelegateWrapper source) 8678 { 8679 foreach(index, wrapper; onKeyPressEventGenericListeners) 8680 { 8681 if (wrapper.handlerId == source.handlerId) 8682 { 8683 onKeyPressEventGenericListeners[index] = null; 8684 onKeyPressEventGenericListeners = std.algorithm.remove(onKeyPressEventGenericListeners, index); 8685 break; 8686 } 8687 } 8688 } 8689 } 8690 OnKeyPressEventGenericDelegateWrapper[] onKeyPressEventGenericListeners; 8691 8692 /** 8693 * The ::key-press-event signal is emitted when a key is pressed. The signal 8694 * emission will reoccur at the key-repeat rate when the key is kept pressed. 8695 * 8696 * To receive this signal, the #GdkWindow associated to the widget needs 8697 * to enable the #GDK_KEY_PRESS_MASK mask. 8698 * 8699 * This signal will be sent to the grab widget if there is one. 8700 * 8701 * Params: 8702 * event = the #GdkEventKey which triggered this signal. 8703 * 8704 * Returns: %TRUE to stop other handlers from being invoked for the event. 8705 * %FALSE to propagate the event further. 8706 */ 8707 gulong addOnKeyPress(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8708 { 8709 addEvents(EventMask.KEY_PRESS_MASK); 8710 auto wrapper = new OnKeyPressEventGenericDelegateWrapper(dlg); 8711 wrapper.handlerId = Signals.connectData( 8712 this, 8713 "key-press-event", 8714 cast(GCallback)&callBackKeyPressEventGeneric, 8715 cast(void*)wrapper, 8716 cast(GClosureNotify)&callBackKeyPressEventGenericDestroy, 8717 connectFlags); 8718 return wrapper.handlerId; 8719 } 8720 8721 extern(C) static int callBackKeyPressEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnKeyPressEventGenericDelegateWrapper wrapper) 8722 { 8723 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 8724 } 8725 8726 extern(C) static void callBackKeyPressEventGenericDestroy(OnKeyPressEventGenericDelegateWrapper wrapper, GClosure* closure) 8727 { 8728 wrapper.remove(wrapper); 8729 } 8730 8731 protected class OnKeyReleaseDelegateWrapper 8732 { 8733 bool delegate(GdkEventKey*, Widget) dlg; 8734 gulong handlerId; 8735 8736 this(bool delegate(GdkEventKey*, Widget) dlg) 8737 { 8738 this.dlg = dlg; 8739 onKeyReleaseListeners ~= this; 8740 } 8741 8742 void remove(OnKeyReleaseDelegateWrapper source) 8743 { 8744 foreach(index, wrapper; onKeyReleaseListeners) 8745 { 8746 if (wrapper.handlerId == source.handlerId) 8747 { 8748 onKeyReleaseListeners[index] = null; 8749 onKeyReleaseListeners = std.algorithm.remove(onKeyReleaseListeners, index); 8750 break; 8751 } 8752 } 8753 } 8754 } 8755 OnKeyReleaseDelegateWrapper[] onKeyReleaseListeners; 8756 8757 /** 8758 * The ::key-release-event signal is emitted when a key is released. 8759 * 8760 * To receive this signal, the #GdkWindow associated to the widget needs 8761 * to enable the #GDK_KEY_RELEASE_MASK mask. 8762 * 8763 * This signal will be sent to the grab widget if there is one. 8764 * 8765 * Params: 8766 * event = the #GdkEventKey which triggered this signal. 8767 * 8768 * Returns: %TRUE to stop other handlers from being invoked for the event. 8769 * %FALSE to propagate the event further. 8770 */ 8771 gulong addOnKeyRelease(bool delegate(GdkEventKey*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8772 { 8773 addEvents(EventMask.KEY_RELEASE_MASK); 8774 auto wrapper = new OnKeyReleaseDelegateWrapper(dlg); 8775 wrapper.handlerId = Signals.connectData( 8776 this, 8777 "key-release-event", 8778 cast(GCallback)&callBackKeyRelease, 8779 cast(void*)wrapper, 8780 cast(GClosureNotify)&callBackKeyReleaseDestroy, 8781 connectFlags); 8782 return wrapper.handlerId; 8783 } 8784 8785 extern(C) static int callBackKeyRelease(GtkWidget* widgetStruct, GdkEventKey* event, OnKeyReleaseDelegateWrapper wrapper) 8786 { 8787 return wrapper.dlg(event, wrapper.outer); 8788 } 8789 8790 extern(C) static void callBackKeyReleaseDestroy(OnKeyReleaseDelegateWrapper wrapper, GClosure* closure) 8791 { 8792 wrapper.remove(wrapper); 8793 } 8794 8795 protected class OnKeyReleaseEventGenericDelegateWrapper 8796 { 8797 bool delegate(Event, Widget) dlg; 8798 gulong handlerId; 8799 8800 this(bool delegate(Event, Widget) dlg) 8801 { 8802 this.dlg = dlg; 8803 onKeyReleaseEventGenericListeners ~= this; 8804 } 8805 8806 void remove(OnKeyReleaseEventGenericDelegateWrapper source) 8807 { 8808 foreach(index, wrapper; onKeyReleaseEventGenericListeners) 8809 { 8810 if (wrapper.handlerId == source.handlerId) 8811 { 8812 onKeyReleaseEventGenericListeners[index] = null; 8813 onKeyReleaseEventGenericListeners = std.algorithm.remove(onKeyReleaseEventGenericListeners, index); 8814 break; 8815 } 8816 } 8817 } 8818 } 8819 OnKeyReleaseEventGenericDelegateWrapper[] onKeyReleaseEventGenericListeners; 8820 8821 /** 8822 * The ::key-release-event signal is emitted when a key is released. 8823 * 8824 * To receive this signal, the #GdkWindow associated to the widget needs 8825 * to enable the #GDK_KEY_RELEASE_MASK mask. 8826 * 8827 * This signal will be sent to the grab widget if there is one. 8828 * 8829 * Params: 8830 * event = the #GdkEventKey which triggered this signal. 8831 * 8832 * Returns: %TRUE to stop other handlers from being invoked for the event. 8833 * %FALSE to propagate the event further. 8834 */ 8835 gulong addOnKeyRelease(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8836 { 8837 addEvents(EventMask.KEY_RELEASE_MASK); 8838 auto wrapper = new OnKeyReleaseEventGenericDelegateWrapper(dlg); 8839 wrapper.handlerId = Signals.connectData( 8840 this, 8841 "key-release-event", 8842 cast(GCallback)&callBackKeyReleaseEventGeneric, 8843 cast(void*)wrapper, 8844 cast(GClosureNotify)&callBackKeyReleaseEventGenericDestroy, 8845 connectFlags); 8846 return wrapper.handlerId; 8847 } 8848 8849 extern(C) static int callBackKeyReleaseEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnKeyReleaseEventGenericDelegateWrapper wrapper) 8850 { 8851 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 8852 } 8853 8854 extern(C) static void callBackKeyReleaseEventGenericDestroy(OnKeyReleaseEventGenericDelegateWrapper wrapper, GClosure* closure) 8855 { 8856 wrapper.remove(wrapper); 8857 } 8858 8859 protected class OnKeynavFailedDelegateWrapper 8860 { 8861 bool delegate(GtkDirectionType, Widget) dlg; 8862 gulong handlerId; 8863 8864 this(bool delegate(GtkDirectionType, Widget) dlg) 8865 { 8866 this.dlg = dlg; 8867 onKeynavFailedListeners ~= this; 8868 } 8869 8870 void remove(OnKeynavFailedDelegateWrapper source) 8871 { 8872 foreach(index, wrapper; onKeynavFailedListeners) 8873 { 8874 if (wrapper.handlerId == source.handlerId) 8875 { 8876 onKeynavFailedListeners[index] = null; 8877 onKeynavFailedListeners = std.algorithm.remove(onKeynavFailedListeners, index); 8878 break; 8879 } 8880 } 8881 } 8882 } 8883 OnKeynavFailedDelegateWrapper[] onKeynavFailedListeners; 8884 8885 /** 8886 * Gets emitted if keyboard navigation fails. 8887 * See gtk_widget_keynav_failed() for details. 8888 * 8889 * Params: 8890 * direction = the direction of movement 8891 * 8892 * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE 8893 * if the emitting widget should try to handle the keyboard 8894 * navigation attempt in its parent container(s). 8895 * 8896 * Since: 2.12 8897 */ 8898 gulong addOnKeynavFailed(bool delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8899 { 8900 auto wrapper = new OnKeynavFailedDelegateWrapper(dlg); 8901 wrapper.handlerId = Signals.connectData( 8902 this, 8903 "keynav-failed", 8904 cast(GCallback)&callBackKeynavFailed, 8905 cast(void*)wrapper, 8906 cast(GClosureNotify)&callBackKeynavFailedDestroy, 8907 connectFlags); 8908 return wrapper.handlerId; 8909 } 8910 8911 extern(C) static int callBackKeynavFailed(GtkWidget* widgetStruct, GtkDirectionType direction, OnKeynavFailedDelegateWrapper wrapper) 8912 { 8913 return wrapper.dlg(direction, wrapper.outer); 8914 } 8915 8916 extern(C) static void callBackKeynavFailedDestroy(OnKeynavFailedDelegateWrapper wrapper, GClosure* closure) 8917 { 8918 wrapper.remove(wrapper); 8919 } 8920 8921 protected class OnLeaveNotifyDelegateWrapper 8922 { 8923 bool delegate(GdkEventCrossing*, Widget) dlg; 8924 gulong handlerId; 8925 8926 this(bool delegate(GdkEventCrossing*, Widget) dlg) 8927 { 8928 this.dlg = dlg; 8929 onLeaveNotifyListeners ~= this; 8930 } 8931 8932 void remove(OnLeaveNotifyDelegateWrapper source) 8933 { 8934 foreach(index, wrapper; onLeaveNotifyListeners) 8935 { 8936 if (wrapper.handlerId == source.handlerId) 8937 { 8938 onLeaveNotifyListeners[index] = null; 8939 onLeaveNotifyListeners = std.algorithm.remove(onLeaveNotifyListeners, index); 8940 break; 8941 } 8942 } 8943 } 8944 } 8945 OnLeaveNotifyDelegateWrapper[] onLeaveNotifyListeners; 8946 8947 /** 8948 * The ::leave-notify-event will be emitted when the pointer leaves 8949 * the @widget's window. 8950 * 8951 * To receive this signal, the #GdkWindow associated to the widget needs 8952 * to enable the #GDK_LEAVE_NOTIFY_MASK mask. 8953 * 8954 * This signal will be sent to the grab widget if there is one. 8955 * 8956 * Params: 8957 * event = the #GdkEventCrossing which triggered 8958 * this signal. 8959 * 8960 * Returns: %TRUE to stop other handlers from being invoked for the event. 8961 * %FALSE to propagate the event further. 8962 */ 8963 gulong addOnLeaveNotify(bool delegate(GdkEventCrossing*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 8964 { 8965 addEvents(EventMask.LEAVE_NOTIFY_MASK); 8966 auto wrapper = new OnLeaveNotifyDelegateWrapper(dlg); 8967 wrapper.handlerId = Signals.connectData( 8968 this, 8969 "leave-notify-event", 8970 cast(GCallback)&callBackLeaveNotify, 8971 cast(void*)wrapper, 8972 cast(GClosureNotify)&callBackLeaveNotifyDestroy, 8973 connectFlags); 8974 return wrapper.handlerId; 8975 } 8976 8977 extern(C) static int callBackLeaveNotify(GtkWidget* widgetStruct, GdkEventCrossing* event, OnLeaveNotifyDelegateWrapper wrapper) 8978 { 8979 return wrapper.dlg(event, wrapper.outer); 8980 } 8981 8982 extern(C) static void callBackLeaveNotifyDestroy(OnLeaveNotifyDelegateWrapper wrapper, GClosure* closure) 8983 { 8984 wrapper.remove(wrapper); 8985 } 8986 8987 protected class OnLeaveNotifyEventGenericDelegateWrapper 8988 { 8989 bool delegate(Event, Widget) dlg; 8990 gulong handlerId; 8991 8992 this(bool delegate(Event, Widget) dlg) 8993 { 8994 this.dlg = dlg; 8995 onLeaveNotifyEventGenericListeners ~= this; 8996 } 8997 8998 void remove(OnLeaveNotifyEventGenericDelegateWrapper source) 8999 { 9000 foreach(index, wrapper; onLeaveNotifyEventGenericListeners) 9001 { 9002 if (wrapper.handlerId == source.handlerId) 9003 { 9004 onLeaveNotifyEventGenericListeners[index] = null; 9005 onLeaveNotifyEventGenericListeners = std.algorithm.remove(onLeaveNotifyEventGenericListeners, index); 9006 break; 9007 } 9008 } 9009 } 9010 } 9011 OnLeaveNotifyEventGenericDelegateWrapper[] onLeaveNotifyEventGenericListeners; 9012 9013 /** 9014 * The ::leave-notify-event will be emitted when the pointer leaves 9015 * the @widget's window. 9016 * 9017 * To receive this signal, the #GdkWindow associated to the widget needs 9018 * to enable the #GDK_LEAVE_NOTIFY_MASK mask. 9019 * 9020 * This signal will be sent to the grab widget if there is one. 9021 * 9022 * Params: 9023 * event = the #GdkEventCrossing which triggered 9024 * this signal. 9025 * 9026 * Returns: %TRUE to stop other handlers from being invoked for the event. 9027 * %FALSE to propagate the event further. 9028 */ 9029 gulong addOnLeaveNotify(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9030 { 9031 addEvents(EventMask.LEAVE_NOTIFY_MASK); 9032 auto wrapper = new OnLeaveNotifyEventGenericDelegateWrapper(dlg); 9033 wrapper.handlerId = Signals.connectData( 9034 this, 9035 "leave-notify-event", 9036 cast(GCallback)&callBackLeaveNotifyEventGeneric, 9037 cast(void*)wrapper, 9038 cast(GClosureNotify)&callBackLeaveNotifyEventGenericDestroy, 9039 connectFlags); 9040 return wrapper.handlerId; 9041 } 9042 9043 extern(C) static int callBackLeaveNotifyEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnLeaveNotifyEventGenericDelegateWrapper wrapper) 9044 { 9045 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 9046 } 9047 9048 extern(C) static void callBackLeaveNotifyEventGenericDestroy(OnLeaveNotifyEventGenericDelegateWrapper wrapper, GClosure* closure) 9049 { 9050 wrapper.remove(wrapper); 9051 } 9052 9053 protected class OnMapDelegateWrapper 9054 { 9055 void delegate(Widget) dlg; 9056 gulong handlerId; 9057 9058 this(void delegate(Widget) dlg) 9059 { 9060 this.dlg = dlg; 9061 onMapListeners ~= this; 9062 } 9063 9064 void remove(OnMapDelegateWrapper source) 9065 { 9066 foreach(index, wrapper; onMapListeners) 9067 { 9068 if (wrapper.handlerId == source.handlerId) 9069 { 9070 onMapListeners[index] = null; 9071 onMapListeners = std.algorithm.remove(onMapListeners, index); 9072 break; 9073 } 9074 } 9075 } 9076 } 9077 OnMapDelegateWrapper[] onMapListeners; 9078 9079 /** 9080 * The ::map signal is emitted when @widget is going to be mapped, that is 9081 * when the widget is visible (which is controlled with 9082 * gtk_widget_set_visible()) and all its parents up to the toplevel widget 9083 * are also visible. Once the map has occurred, #GtkWidget::map-event will 9084 * be emitted. 9085 * 9086 * The ::map signal can be used to determine whether a widget will be drawn, 9087 * for instance it can resume an animation that was stopped during the 9088 * emission of #GtkWidget::unmap. 9089 */ 9090 gulong addOnMap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9091 { 9092 auto wrapper = new OnMapDelegateWrapper(dlg); 9093 wrapper.handlerId = Signals.connectData( 9094 this, 9095 "map", 9096 cast(GCallback)&callBackMap, 9097 cast(void*)wrapper, 9098 cast(GClosureNotify)&callBackMapDestroy, 9099 connectFlags); 9100 return wrapper.handlerId; 9101 } 9102 9103 extern(C) static void callBackMap(GtkWidget* widgetStruct, OnMapDelegateWrapper wrapper) 9104 { 9105 wrapper.dlg(wrapper.outer); 9106 } 9107 9108 extern(C) static void callBackMapDestroy(OnMapDelegateWrapper wrapper, GClosure* closure) 9109 { 9110 wrapper.remove(wrapper); 9111 } 9112 9113 protected class OnMapEventDelegateWrapper 9114 { 9115 bool delegate(GdkEventAny*, Widget) dlg; 9116 gulong handlerId; 9117 9118 this(bool delegate(GdkEventAny*, Widget) dlg) 9119 { 9120 this.dlg = dlg; 9121 onMapEventListeners ~= this; 9122 } 9123 9124 void remove(OnMapEventDelegateWrapper source) 9125 { 9126 foreach(index, wrapper; onMapEventListeners) 9127 { 9128 if (wrapper.handlerId == source.handlerId) 9129 { 9130 onMapEventListeners[index] = null; 9131 onMapEventListeners = std.algorithm.remove(onMapEventListeners, index); 9132 break; 9133 } 9134 } 9135 } 9136 } 9137 OnMapEventDelegateWrapper[] onMapEventListeners; 9138 9139 /** 9140 * The ::map-event signal will be emitted when the @widget's window is 9141 * mapped. A window is mapped when it becomes visible on the screen. 9142 * 9143 * To receive this signal, the #GdkWindow associated to the widget needs 9144 * to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask 9145 * automatically for all new windows. 9146 * 9147 * Params: 9148 * event = the #GdkEventAny which triggered this signal. 9149 * 9150 * Returns: %TRUE to stop other handlers from being invoked for the event. 9151 * %FALSE to propagate the event further. 9152 */ 9153 gulong addOnMapEvent(bool delegate(GdkEventAny*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9154 { 9155 auto wrapper = new OnMapEventDelegateWrapper(dlg); 9156 wrapper.handlerId = Signals.connectData( 9157 this, 9158 "map-event", 9159 cast(GCallback)&callBackMapEvent, 9160 cast(void*)wrapper, 9161 cast(GClosureNotify)&callBackMapEventDestroy, 9162 connectFlags); 9163 return wrapper.handlerId; 9164 } 9165 9166 extern(C) static int callBackMapEvent(GtkWidget* widgetStruct, GdkEventAny* event, OnMapEventDelegateWrapper wrapper) 9167 { 9168 return wrapper.dlg(event, wrapper.outer); 9169 } 9170 9171 extern(C) static void callBackMapEventDestroy(OnMapEventDelegateWrapper wrapper, GClosure* closure) 9172 { 9173 wrapper.remove(wrapper); 9174 } 9175 9176 protected class OnMapEventGenericDelegateWrapper 9177 { 9178 bool delegate(Event, Widget) dlg; 9179 gulong handlerId; 9180 9181 this(bool delegate(Event, Widget) dlg) 9182 { 9183 this.dlg = dlg; 9184 onMapEventGenericListeners ~= this; 9185 } 9186 9187 void remove(OnMapEventGenericDelegateWrapper source) 9188 { 9189 foreach(index, wrapper; onMapEventGenericListeners) 9190 { 9191 if (wrapper.handlerId == source.handlerId) 9192 { 9193 onMapEventGenericListeners[index] = null; 9194 onMapEventGenericListeners = std.algorithm.remove(onMapEventGenericListeners, index); 9195 break; 9196 } 9197 } 9198 } 9199 } 9200 OnMapEventGenericDelegateWrapper[] onMapEventGenericListeners; 9201 9202 /** 9203 * The ::map-event signal will be emitted when the @widget's window is 9204 * mapped. A window is mapped when it becomes visible on the screen. 9205 * 9206 * To receive this signal, the #GdkWindow associated to the widget needs 9207 * to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask 9208 * automatically for all new windows. 9209 * 9210 * Params: 9211 * event = the #GdkEventAny which triggered this signal. 9212 * 9213 * Returns: %TRUE to stop other handlers from being invoked for the event. 9214 * %FALSE to propagate the event further. 9215 */ 9216 gulong addOnMapEvent(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9217 { 9218 auto wrapper = new OnMapEventGenericDelegateWrapper(dlg); 9219 wrapper.handlerId = Signals.connectData( 9220 this, 9221 "map-event", 9222 cast(GCallback)&callBackMapEventGeneric, 9223 cast(void*)wrapper, 9224 cast(GClosureNotify)&callBackMapEventGenericDestroy, 9225 connectFlags); 9226 return wrapper.handlerId; 9227 } 9228 9229 extern(C) static int callBackMapEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnMapEventGenericDelegateWrapper wrapper) 9230 { 9231 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 9232 } 9233 9234 extern(C) static void callBackMapEventGenericDestroy(OnMapEventGenericDelegateWrapper wrapper, GClosure* closure) 9235 { 9236 wrapper.remove(wrapper); 9237 } 9238 9239 protected class OnMnemonicActivateDelegateWrapper 9240 { 9241 bool delegate(bool, Widget) dlg; 9242 gulong handlerId; 9243 9244 this(bool delegate(bool, Widget) dlg) 9245 { 9246 this.dlg = dlg; 9247 onMnemonicActivateListeners ~= this; 9248 } 9249 9250 void remove(OnMnemonicActivateDelegateWrapper source) 9251 { 9252 foreach(index, wrapper; onMnemonicActivateListeners) 9253 { 9254 if (wrapper.handlerId == source.handlerId) 9255 { 9256 onMnemonicActivateListeners[index] = null; 9257 onMnemonicActivateListeners = std.algorithm.remove(onMnemonicActivateListeners, index); 9258 break; 9259 } 9260 } 9261 } 9262 } 9263 OnMnemonicActivateDelegateWrapper[] onMnemonicActivateListeners; 9264 9265 /** 9266 * The default handler for this signal activates @widget if @group_cycling 9267 * is %FALSE, or just makes @widget grab focus if @group_cycling is %TRUE. 9268 * 9269 * Params: 9270 * groupCycling = %TRUE if there are other widgets with the same mnemonic 9271 * 9272 * Returns: %TRUE to stop other handlers from being invoked for the event. 9273 * %FALSE to propagate the event further. 9274 */ 9275 gulong addOnMnemonicActivate(bool delegate(bool, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9276 { 9277 auto wrapper = new OnMnemonicActivateDelegateWrapper(dlg); 9278 wrapper.handlerId = Signals.connectData( 9279 this, 9280 "mnemonic-activate", 9281 cast(GCallback)&callBackMnemonicActivate, 9282 cast(void*)wrapper, 9283 cast(GClosureNotify)&callBackMnemonicActivateDestroy, 9284 connectFlags); 9285 return wrapper.handlerId; 9286 } 9287 9288 extern(C) static int callBackMnemonicActivate(GtkWidget* widgetStruct, bool groupCycling, OnMnemonicActivateDelegateWrapper wrapper) 9289 { 9290 return wrapper.dlg(groupCycling, wrapper.outer); 9291 } 9292 9293 extern(C) static void callBackMnemonicActivateDestroy(OnMnemonicActivateDelegateWrapper wrapper, GClosure* closure) 9294 { 9295 wrapper.remove(wrapper); 9296 } 9297 9298 protected class OnMotionNotifyDelegateWrapper 9299 { 9300 bool delegate(GdkEventMotion*, Widget) dlg; 9301 gulong handlerId; 9302 9303 this(bool delegate(GdkEventMotion*, Widget) dlg) 9304 { 9305 this.dlg = dlg; 9306 onMotionNotifyListeners ~= this; 9307 } 9308 9309 void remove(OnMotionNotifyDelegateWrapper source) 9310 { 9311 foreach(index, wrapper; onMotionNotifyListeners) 9312 { 9313 if (wrapper.handlerId == source.handlerId) 9314 { 9315 onMotionNotifyListeners[index] = null; 9316 onMotionNotifyListeners = std.algorithm.remove(onMotionNotifyListeners, index); 9317 break; 9318 } 9319 } 9320 } 9321 } 9322 OnMotionNotifyDelegateWrapper[] onMotionNotifyListeners; 9323 9324 /** 9325 * The ::motion-notify-event signal is emitted when the pointer moves 9326 * over the widget's #GdkWindow. 9327 * 9328 * To receive this signal, the #GdkWindow associated to the widget 9329 * needs to enable the #GDK_POINTER_MOTION_MASK mask. 9330 * 9331 * This signal will be sent to the grab widget if there is one. 9332 * 9333 * Params: 9334 * event = the #GdkEventMotion which triggered 9335 * this signal. 9336 * 9337 * Returns: %TRUE to stop other handlers from being invoked for the event. 9338 * %FALSE to propagate the event further. 9339 */ 9340 gulong addOnMotionNotify(bool delegate(GdkEventMotion*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9341 { 9342 addEvents(EventMask.POINTER_MOTION_MASK); 9343 auto wrapper = new OnMotionNotifyDelegateWrapper(dlg); 9344 wrapper.handlerId = Signals.connectData( 9345 this, 9346 "motion-notify-event", 9347 cast(GCallback)&callBackMotionNotify, 9348 cast(void*)wrapper, 9349 cast(GClosureNotify)&callBackMotionNotifyDestroy, 9350 connectFlags); 9351 return wrapper.handlerId; 9352 } 9353 9354 extern(C) static int callBackMotionNotify(GtkWidget* widgetStruct, GdkEventMotion* event, OnMotionNotifyDelegateWrapper wrapper) 9355 { 9356 return wrapper.dlg(event, wrapper.outer); 9357 } 9358 9359 extern(C) static void callBackMotionNotifyDestroy(OnMotionNotifyDelegateWrapper wrapper, GClosure* closure) 9360 { 9361 wrapper.remove(wrapper); 9362 } 9363 9364 protected class OnMotionNotifyEventGenericDelegateWrapper 9365 { 9366 bool delegate(Event, Widget) dlg; 9367 gulong handlerId; 9368 9369 this(bool delegate(Event, Widget) dlg) 9370 { 9371 this.dlg = dlg; 9372 onMotionNotifyEventGenericListeners ~= this; 9373 } 9374 9375 void remove(OnMotionNotifyEventGenericDelegateWrapper source) 9376 { 9377 foreach(index, wrapper; onMotionNotifyEventGenericListeners) 9378 { 9379 if (wrapper.handlerId == source.handlerId) 9380 { 9381 onMotionNotifyEventGenericListeners[index] = null; 9382 onMotionNotifyEventGenericListeners = std.algorithm.remove(onMotionNotifyEventGenericListeners, index); 9383 break; 9384 } 9385 } 9386 } 9387 } 9388 OnMotionNotifyEventGenericDelegateWrapper[] onMotionNotifyEventGenericListeners; 9389 9390 /** 9391 * The ::motion-notify-event signal is emitted when the pointer moves 9392 * over the widget's #GdkWindow. 9393 * 9394 * To receive this signal, the #GdkWindow associated to the widget 9395 * needs to enable the #GDK_POINTER_MOTION_MASK mask. 9396 * 9397 * This signal will be sent to the grab widget if there is one. 9398 * 9399 * Params: 9400 * event = the #GdkEventMotion which triggered 9401 * this signal. 9402 * 9403 * Returns: %TRUE to stop other handlers from being invoked for the event. 9404 * %FALSE to propagate the event further. 9405 */ 9406 gulong addOnMotionNotify(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9407 { 9408 addEvents(EventMask.POINTER_MOTION_MASK); 9409 auto wrapper = new OnMotionNotifyEventGenericDelegateWrapper(dlg); 9410 wrapper.handlerId = Signals.connectData( 9411 this, 9412 "motion-notify-event", 9413 cast(GCallback)&callBackMotionNotifyEventGeneric, 9414 cast(void*)wrapper, 9415 cast(GClosureNotify)&callBackMotionNotifyEventGenericDestroy, 9416 connectFlags); 9417 return wrapper.handlerId; 9418 } 9419 9420 extern(C) static int callBackMotionNotifyEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnMotionNotifyEventGenericDelegateWrapper wrapper) 9421 { 9422 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 9423 } 9424 9425 extern(C) static void callBackMotionNotifyEventGenericDestroy(OnMotionNotifyEventGenericDelegateWrapper wrapper, GClosure* closure) 9426 { 9427 wrapper.remove(wrapper); 9428 } 9429 9430 protected class OnMoveFocusDelegateWrapper 9431 { 9432 void delegate(GtkDirectionType, Widget) dlg; 9433 gulong handlerId; 9434 9435 this(void delegate(GtkDirectionType, Widget) dlg) 9436 { 9437 this.dlg = dlg; 9438 onMoveFocusListeners ~= this; 9439 } 9440 9441 void remove(OnMoveFocusDelegateWrapper source) 9442 { 9443 foreach(index, wrapper; onMoveFocusListeners) 9444 { 9445 if (wrapper.handlerId == source.handlerId) 9446 { 9447 onMoveFocusListeners[index] = null; 9448 onMoveFocusListeners = std.algorithm.remove(onMoveFocusListeners, index); 9449 break; 9450 } 9451 } 9452 } 9453 } 9454 OnMoveFocusDelegateWrapper[] onMoveFocusListeners; 9455 9456 /** */ 9457 gulong addOnMoveFocus(void delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9458 { 9459 auto wrapper = new OnMoveFocusDelegateWrapper(dlg); 9460 wrapper.handlerId = Signals.connectData( 9461 this, 9462 "move-focus", 9463 cast(GCallback)&callBackMoveFocus, 9464 cast(void*)wrapper, 9465 cast(GClosureNotify)&callBackMoveFocusDestroy, 9466 connectFlags); 9467 return wrapper.handlerId; 9468 } 9469 9470 extern(C) static void callBackMoveFocus(GtkWidget* widgetStruct, GtkDirectionType direction, OnMoveFocusDelegateWrapper wrapper) 9471 { 9472 wrapper.dlg(direction, wrapper.outer); 9473 } 9474 9475 extern(C) static void callBackMoveFocusDestroy(OnMoveFocusDelegateWrapper wrapper, GClosure* closure) 9476 { 9477 wrapper.remove(wrapper); 9478 } 9479 9480 protected class OnParentSetDelegateWrapper 9481 { 9482 void delegate(Widget, Widget) dlg; 9483 gulong handlerId; 9484 9485 this(void delegate(Widget, Widget) dlg) 9486 { 9487 this.dlg = dlg; 9488 onParentSetListeners ~= this; 9489 } 9490 9491 void remove(OnParentSetDelegateWrapper source) 9492 { 9493 foreach(index, wrapper; onParentSetListeners) 9494 { 9495 if (wrapper.handlerId == source.handlerId) 9496 { 9497 onParentSetListeners[index] = null; 9498 onParentSetListeners = std.algorithm.remove(onParentSetListeners, index); 9499 break; 9500 } 9501 } 9502 } 9503 } 9504 OnParentSetDelegateWrapper[] onParentSetListeners; 9505 9506 /** 9507 * The ::parent-set signal is emitted when a new parent 9508 * has been set on a widget. 9509 * 9510 * Params: 9511 * oldParent = the previous parent, or %NULL if the widget 9512 * just got its initial parent. 9513 */ 9514 gulong addOnParentSet(void delegate(Widget, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9515 { 9516 auto wrapper = new OnParentSetDelegateWrapper(dlg); 9517 wrapper.handlerId = Signals.connectData( 9518 this, 9519 "parent-set", 9520 cast(GCallback)&callBackParentSet, 9521 cast(void*)wrapper, 9522 cast(GClosureNotify)&callBackParentSetDestroy, 9523 connectFlags); 9524 return wrapper.handlerId; 9525 } 9526 9527 extern(C) static void callBackParentSet(GtkWidget* widgetStruct, GtkWidget* oldParent, OnParentSetDelegateWrapper wrapper) 9528 { 9529 wrapper.dlg(ObjectG.getDObject!(Widget)(oldParent), wrapper.outer); 9530 } 9531 9532 extern(C) static void callBackParentSetDestroy(OnParentSetDelegateWrapper wrapper, GClosure* closure) 9533 { 9534 wrapper.remove(wrapper); 9535 } 9536 9537 protected class OnPopupMenuDelegateWrapper 9538 { 9539 bool delegate(Widget) dlg; 9540 gulong handlerId; 9541 9542 this(bool delegate(Widget) dlg) 9543 { 9544 this.dlg = dlg; 9545 onPopupMenuListeners ~= this; 9546 } 9547 9548 void remove(OnPopupMenuDelegateWrapper source) 9549 { 9550 foreach(index, wrapper; onPopupMenuListeners) 9551 { 9552 if (wrapper.handlerId == source.handlerId) 9553 { 9554 onPopupMenuListeners[index] = null; 9555 onPopupMenuListeners = std.algorithm.remove(onPopupMenuListeners, index); 9556 break; 9557 } 9558 } 9559 } 9560 } 9561 OnPopupMenuDelegateWrapper[] onPopupMenuListeners; 9562 9563 /** 9564 * This signal gets emitted whenever a widget should pop up a context 9565 * menu. This usually happens through the standard key binding mechanism; 9566 * by pressing a certain key while a widget is focused, the user can cause 9567 * the widget to pop up a menu. For example, the #GtkEntry widget creates 9568 * a menu with clipboard commands. See the 9569 * [Popup Menu Migration Checklist][checklist-popup-menu] 9570 * for an example of how to use this signal. 9571 * 9572 * Returns: %TRUE if a menu was activated 9573 */ 9574 gulong addOnPopupMenu(bool delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9575 { 9576 auto wrapper = new OnPopupMenuDelegateWrapper(dlg); 9577 wrapper.handlerId = Signals.connectData( 9578 this, 9579 "popup-menu", 9580 cast(GCallback)&callBackPopupMenu, 9581 cast(void*)wrapper, 9582 cast(GClosureNotify)&callBackPopupMenuDestroy, 9583 connectFlags); 9584 return wrapper.handlerId; 9585 } 9586 9587 extern(C) static int callBackPopupMenu(GtkWidget* widgetStruct, OnPopupMenuDelegateWrapper wrapper) 9588 { 9589 return wrapper.dlg(wrapper.outer); 9590 } 9591 9592 extern(C) static void callBackPopupMenuDestroy(OnPopupMenuDelegateWrapper wrapper, GClosure* closure) 9593 { 9594 wrapper.remove(wrapper); 9595 } 9596 9597 protected class OnPropertyNotifyDelegateWrapper 9598 { 9599 bool delegate(GdkEventProperty*, Widget) dlg; 9600 gulong handlerId; 9601 9602 this(bool delegate(GdkEventProperty*, Widget) dlg) 9603 { 9604 this.dlg = dlg; 9605 onPropertyNotifyListeners ~= this; 9606 } 9607 9608 void remove(OnPropertyNotifyDelegateWrapper source) 9609 { 9610 foreach(index, wrapper; onPropertyNotifyListeners) 9611 { 9612 if (wrapper.handlerId == source.handlerId) 9613 { 9614 onPropertyNotifyListeners[index] = null; 9615 onPropertyNotifyListeners = std.algorithm.remove(onPropertyNotifyListeners, index); 9616 break; 9617 } 9618 } 9619 } 9620 } 9621 OnPropertyNotifyDelegateWrapper[] onPropertyNotifyListeners; 9622 9623 /** 9624 * The ::property-notify-event signal will be emitted when a property on 9625 * the @widget's window has been changed or deleted. 9626 * 9627 * To receive this signal, the #GdkWindow associated to the widget needs 9628 * to enable the #GDK_PROPERTY_CHANGE_MASK mask. 9629 * 9630 * Params: 9631 * event = the #GdkEventProperty which triggered 9632 * this signal. 9633 * 9634 * Returns: %TRUE to stop other handlers from being invoked for the event. 9635 * %FALSE to propagate the event further. 9636 */ 9637 gulong addOnPropertyNotify(bool delegate(GdkEventProperty*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9638 { 9639 addEvents(EventMask.PROPERTY_CHANGE_MASK); 9640 auto wrapper = new OnPropertyNotifyDelegateWrapper(dlg); 9641 wrapper.handlerId = Signals.connectData( 9642 this, 9643 "property-notify-event", 9644 cast(GCallback)&callBackPropertyNotify, 9645 cast(void*)wrapper, 9646 cast(GClosureNotify)&callBackPropertyNotifyDestroy, 9647 connectFlags); 9648 return wrapper.handlerId; 9649 } 9650 9651 extern(C) static int callBackPropertyNotify(GtkWidget* widgetStruct, GdkEventProperty* event, OnPropertyNotifyDelegateWrapper wrapper) 9652 { 9653 return wrapper.dlg(event, wrapper.outer); 9654 } 9655 9656 extern(C) static void callBackPropertyNotifyDestroy(OnPropertyNotifyDelegateWrapper wrapper, GClosure* closure) 9657 { 9658 wrapper.remove(wrapper); 9659 } 9660 9661 protected class OnPropertyNotifyEventGenericDelegateWrapper 9662 { 9663 bool delegate(Event, Widget) dlg; 9664 gulong handlerId; 9665 9666 this(bool delegate(Event, Widget) dlg) 9667 { 9668 this.dlg = dlg; 9669 onPropertyNotifyEventGenericListeners ~= this; 9670 } 9671 9672 void remove(OnPropertyNotifyEventGenericDelegateWrapper source) 9673 { 9674 foreach(index, wrapper; onPropertyNotifyEventGenericListeners) 9675 { 9676 if (wrapper.handlerId == source.handlerId) 9677 { 9678 onPropertyNotifyEventGenericListeners[index] = null; 9679 onPropertyNotifyEventGenericListeners = std.algorithm.remove(onPropertyNotifyEventGenericListeners, index); 9680 break; 9681 } 9682 } 9683 } 9684 } 9685 OnPropertyNotifyEventGenericDelegateWrapper[] onPropertyNotifyEventGenericListeners; 9686 9687 /** 9688 * The ::property-notify-event signal will be emitted when a property on 9689 * the @widget's window has been changed or deleted. 9690 * 9691 * To receive this signal, the #GdkWindow associated to the widget needs 9692 * to enable the #GDK_PROPERTY_CHANGE_MASK mask. 9693 * 9694 * Params: 9695 * event = the #GdkEventProperty which triggered 9696 * this signal. 9697 * 9698 * Returns: %TRUE to stop other handlers from being invoked for the event. 9699 * %FALSE to propagate the event further. 9700 */ 9701 gulong addOnPropertyNotify(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9702 { 9703 addEvents(EventMask.PROPERTY_CHANGE_MASK); 9704 auto wrapper = new OnPropertyNotifyEventGenericDelegateWrapper(dlg); 9705 wrapper.handlerId = Signals.connectData( 9706 this, 9707 "property-notify-event", 9708 cast(GCallback)&callBackPropertyNotifyEventGeneric, 9709 cast(void*)wrapper, 9710 cast(GClosureNotify)&callBackPropertyNotifyEventGenericDestroy, 9711 connectFlags); 9712 return wrapper.handlerId; 9713 } 9714 9715 extern(C) static int callBackPropertyNotifyEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnPropertyNotifyEventGenericDelegateWrapper wrapper) 9716 { 9717 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 9718 } 9719 9720 extern(C) static void callBackPropertyNotifyEventGenericDestroy(OnPropertyNotifyEventGenericDelegateWrapper wrapper, GClosure* closure) 9721 { 9722 wrapper.remove(wrapper); 9723 } 9724 9725 protected class OnProximityInDelegateWrapper 9726 { 9727 bool delegate(GdkEventProximity*, Widget) dlg; 9728 gulong handlerId; 9729 9730 this(bool delegate(GdkEventProximity*, Widget) dlg) 9731 { 9732 this.dlg = dlg; 9733 onProximityInListeners ~= this; 9734 } 9735 9736 void remove(OnProximityInDelegateWrapper source) 9737 { 9738 foreach(index, wrapper; onProximityInListeners) 9739 { 9740 if (wrapper.handlerId == source.handlerId) 9741 { 9742 onProximityInListeners[index] = null; 9743 onProximityInListeners = std.algorithm.remove(onProximityInListeners, index); 9744 break; 9745 } 9746 } 9747 } 9748 } 9749 OnProximityInDelegateWrapper[] onProximityInListeners; 9750 9751 /** 9752 * To receive this signal the #GdkWindow associated to the widget needs 9753 * to enable the #GDK_PROXIMITY_IN_MASK mask. 9754 * 9755 * This signal will be sent to the grab widget if there is one. 9756 * 9757 * Params: 9758 * event = the #GdkEventProximity which triggered 9759 * this signal. 9760 * 9761 * Returns: %TRUE to stop other handlers from being invoked for the event. 9762 * %FALSE to propagate the event further. 9763 */ 9764 gulong addOnProximityIn(bool delegate(GdkEventProximity*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9765 { 9766 addEvents(EventMask.PROXIMITY_IN_MASK); 9767 auto wrapper = new OnProximityInDelegateWrapper(dlg); 9768 wrapper.handlerId = Signals.connectData( 9769 this, 9770 "proximity-in-event", 9771 cast(GCallback)&callBackProximityIn, 9772 cast(void*)wrapper, 9773 cast(GClosureNotify)&callBackProximityInDestroy, 9774 connectFlags); 9775 return wrapper.handlerId; 9776 } 9777 9778 extern(C) static int callBackProximityIn(GtkWidget* widgetStruct, GdkEventProximity* event, OnProximityInDelegateWrapper wrapper) 9779 { 9780 return wrapper.dlg(event, wrapper.outer); 9781 } 9782 9783 extern(C) static void callBackProximityInDestroy(OnProximityInDelegateWrapper wrapper, GClosure* closure) 9784 { 9785 wrapper.remove(wrapper); 9786 } 9787 9788 protected class OnProximityInEventGenericDelegateWrapper 9789 { 9790 bool delegate(Event, Widget) dlg; 9791 gulong handlerId; 9792 9793 this(bool delegate(Event, Widget) dlg) 9794 { 9795 this.dlg = dlg; 9796 onProximityInEventGenericListeners ~= this; 9797 } 9798 9799 void remove(OnProximityInEventGenericDelegateWrapper source) 9800 { 9801 foreach(index, wrapper; onProximityInEventGenericListeners) 9802 { 9803 if (wrapper.handlerId == source.handlerId) 9804 { 9805 onProximityInEventGenericListeners[index] = null; 9806 onProximityInEventGenericListeners = std.algorithm.remove(onProximityInEventGenericListeners, index); 9807 break; 9808 } 9809 } 9810 } 9811 } 9812 OnProximityInEventGenericDelegateWrapper[] onProximityInEventGenericListeners; 9813 9814 /** 9815 * To receive this signal the #GdkWindow associated to the widget needs 9816 * to enable the #GDK_PROXIMITY_IN_MASK mask. 9817 * 9818 * This signal will be sent to the grab widget if there is one. 9819 * 9820 * Params: 9821 * event = the #GdkEventProximity which triggered 9822 * this signal. 9823 * 9824 * Returns: %TRUE to stop other handlers from being invoked for the event. 9825 * %FALSE to propagate the event further. 9826 */ 9827 gulong addOnProximityIn(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9828 { 9829 addEvents(EventMask.PROXIMITY_IN_MASK); 9830 auto wrapper = new OnProximityInEventGenericDelegateWrapper(dlg); 9831 wrapper.handlerId = Signals.connectData( 9832 this, 9833 "proximity-in-event", 9834 cast(GCallback)&callBackProximityInEventGeneric, 9835 cast(void*)wrapper, 9836 cast(GClosureNotify)&callBackProximityInEventGenericDestroy, 9837 connectFlags); 9838 return wrapper.handlerId; 9839 } 9840 9841 extern(C) static int callBackProximityInEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnProximityInEventGenericDelegateWrapper wrapper) 9842 { 9843 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 9844 } 9845 9846 extern(C) static void callBackProximityInEventGenericDestroy(OnProximityInEventGenericDelegateWrapper wrapper, GClosure* closure) 9847 { 9848 wrapper.remove(wrapper); 9849 } 9850 9851 protected class OnProximityOutDelegateWrapper 9852 { 9853 bool delegate(GdkEventProximity*, Widget) dlg; 9854 gulong handlerId; 9855 9856 this(bool delegate(GdkEventProximity*, Widget) dlg) 9857 { 9858 this.dlg = dlg; 9859 onProximityOutListeners ~= this; 9860 } 9861 9862 void remove(OnProximityOutDelegateWrapper source) 9863 { 9864 foreach(index, wrapper; onProximityOutListeners) 9865 { 9866 if (wrapper.handlerId == source.handlerId) 9867 { 9868 onProximityOutListeners[index] = null; 9869 onProximityOutListeners = std.algorithm.remove(onProximityOutListeners, index); 9870 break; 9871 } 9872 } 9873 } 9874 } 9875 OnProximityOutDelegateWrapper[] onProximityOutListeners; 9876 9877 /** 9878 * To receive this signal the #GdkWindow associated to the widget needs 9879 * to enable the #GDK_PROXIMITY_OUT_MASK mask. 9880 * 9881 * This signal will be sent to the grab widget if there is one. 9882 * 9883 * Params: 9884 * event = the #GdkEventProximity which triggered 9885 * this signal. 9886 * 9887 * Returns: %TRUE to stop other handlers from being invoked for the event. 9888 * %FALSE to propagate the event further. 9889 */ 9890 gulong addOnProximityOut(bool delegate(GdkEventProximity*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9891 { 9892 addEvents(EventMask.PROXIMITY_OUT_MASK); 9893 auto wrapper = new OnProximityOutDelegateWrapper(dlg); 9894 wrapper.handlerId = Signals.connectData( 9895 this, 9896 "proximity-out-event", 9897 cast(GCallback)&callBackProximityOut, 9898 cast(void*)wrapper, 9899 cast(GClosureNotify)&callBackProximityOutDestroy, 9900 connectFlags); 9901 return wrapper.handlerId; 9902 } 9903 9904 extern(C) static int callBackProximityOut(GtkWidget* widgetStruct, GdkEventProximity* event, OnProximityOutDelegateWrapper wrapper) 9905 { 9906 return wrapper.dlg(event, wrapper.outer); 9907 } 9908 9909 extern(C) static void callBackProximityOutDestroy(OnProximityOutDelegateWrapper wrapper, GClosure* closure) 9910 { 9911 wrapper.remove(wrapper); 9912 } 9913 9914 protected class OnProximityOutEventGenericDelegateWrapper 9915 { 9916 bool delegate(Event, Widget) dlg; 9917 gulong handlerId; 9918 9919 this(bool delegate(Event, Widget) dlg) 9920 { 9921 this.dlg = dlg; 9922 onProximityOutEventGenericListeners ~= this; 9923 } 9924 9925 void remove(OnProximityOutEventGenericDelegateWrapper source) 9926 { 9927 foreach(index, wrapper; onProximityOutEventGenericListeners) 9928 { 9929 if (wrapper.handlerId == source.handlerId) 9930 { 9931 onProximityOutEventGenericListeners[index] = null; 9932 onProximityOutEventGenericListeners = std.algorithm.remove(onProximityOutEventGenericListeners, index); 9933 break; 9934 } 9935 } 9936 } 9937 } 9938 OnProximityOutEventGenericDelegateWrapper[] onProximityOutEventGenericListeners; 9939 9940 /** 9941 * To receive this signal the #GdkWindow associated to the widget needs 9942 * to enable the #GDK_PROXIMITY_OUT_MASK mask. 9943 * 9944 * This signal will be sent to the grab widget if there is one. 9945 * 9946 * Params: 9947 * event = the #GdkEventProximity which triggered 9948 * this signal. 9949 * 9950 * Returns: %TRUE to stop other handlers from being invoked for the event. 9951 * %FALSE to propagate the event further. 9952 */ 9953 gulong addOnProximityOut(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 9954 { 9955 addEvents(EventMask.PROXIMITY_OUT_MASK); 9956 auto wrapper = new OnProximityOutEventGenericDelegateWrapper(dlg); 9957 wrapper.handlerId = Signals.connectData( 9958 this, 9959 "proximity-out-event", 9960 cast(GCallback)&callBackProximityOutEventGeneric, 9961 cast(void*)wrapper, 9962 cast(GClosureNotify)&callBackProximityOutEventGenericDestroy, 9963 connectFlags); 9964 return wrapper.handlerId; 9965 } 9966 9967 extern(C) static int callBackProximityOutEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnProximityOutEventGenericDelegateWrapper wrapper) 9968 { 9969 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 9970 } 9971 9972 extern(C) static void callBackProximityOutEventGenericDestroy(OnProximityOutEventGenericDelegateWrapper wrapper, GClosure* closure) 9973 { 9974 wrapper.remove(wrapper); 9975 } 9976 9977 protected class OnQueryTooltipDelegateWrapper 9978 { 9979 bool delegate(int, int, bool, Tooltip, Widget) dlg; 9980 gulong handlerId; 9981 9982 this(bool delegate(int, int, bool, Tooltip, Widget) dlg) 9983 { 9984 this.dlg = dlg; 9985 onQueryTooltipListeners ~= this; 9986 } 9987 9988 void remove(OnQueryTooltipDelegateWrapper source) 9989 { 9990 foreach(index, wrapper; onQueryTooltipListeners) 9991 { 9992 if (wrapper.handlerId == source.handlerId) 9993 { 9994 onQueryTooltipListeners[index] = null; 9995 onQueryTooltipListeners = std.algorithm.remove(onQueryTooltipListeners, index); 9996 break; 9997 } 9998 } 9999 } 10000 } 10001 OnQueryTooltipDelegateWrapper[] onQueryTooltipListeners; 10002 10003 /** 10004 * Emitted when #GtkWidget:has-tooltip is %TRUE and the hover timeout 10005 * has expired with the cursor hovering "above" @widget; or emitted when @widget got 10006 * focus in keyboard mode. 10007 * 10008 * Using the given coordinates, the signal handler should determine 10009 * whether a tooltip should be shown for @widget. If this is the case 10010 * %TRUE should be returned, %FALSE otherwise. Note that if 10011 * @keyboard_mode is %TRUE, the values of @x and @y are undefined and 10012 * should not be used. 10013 * 10014 * The signal handler is free to manipulate @tooltip with the therefore 10015 * destined function calls. 10016 * 10017 * Params: 10018 * x = the x coordinate of the cursor position where the request has 10019 * been emitted, relative to @widget's left side 10020 * y = the y coordinate of the cursor position where the request has 10021 * been emitted, relative to @widget's top 10022 * keyboardMode = %TRUE if the tooltip was triggered using the keyboard 10023 * tooltip = a #GtkTooltip 10024 * 10025 * Returns: %TRUE if @tooltip should be shown right now, %FALSE otherwise. 10026 * 10027 * Since: 2.12 10028 */ 10029 gulong addOnQueryTooltip(bool delegate(int, int, bool, Tooltip, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10030 { 10031 auto wrapper = new OnQueryTooltipDelegateWrapper(dlg); 10032 wrapper.handlerId = Signals.connectData( 10033 this, 10034 "query-tooltip", 10035 cast(GCallback)&callBackQueryTooltip, 10036 cast(void*)wrapper, 10037 cast(GClosureNotify)&callBackQueryTooltipDestroy, 10038 connectFlags); 10039 return wrapper.handlerId; 10040 } 10041 10042 extern(C) static int callBackQueryTooltip(GtkWidget* widgetStruct, int x, int y, bool keyboardMode, GtkTooltip* tooltip, OnQueryTooltipDelegateWrapper wrapper) 10043 { 10044 return wrapper.dlg(x, y, keyboardMode, ObjectG.getDObject!(Tooltip)(tooltip), wrapper.outer); 10045 } 10046 10047 extern(C) static void callBackQueryTooltipDestroy(OnQueryTooltipDelegateWrapper wrapper, GClosure* closure) 10048 { 10049 wrapper.remove(wrapper); 10050 } 10051 10052 protected class OnRealizeDelegateWrapper 10053 { 10054 void delegate(Widget) dlg; 10055 gulong handlerId; 10056 10057 this(void delegate(Widget) dlg) 10058 { 10059 this.dlg = dlg; 10060 onRealizeListeners ~= this; 10061 } 10062 10063 void remove(OnRealizeDelegateWrapper source) 10064 { 10065 foreach(index, wrapper; onRealizeListeners) 10066 { 10067 if (wrapper.handlerId == source.handlerId) 10068 { 10069 onRealizeListeners[index] = null; 10070 onRealizeListeners = std.algorithm.remove(onRealizeListeners, index); 10071 break; 10072 } 10073 } 10074 } 10075 } 10076 OnRealizeDelegateWrapper[] onRealizeListeners; 10077 10078 /** 10079 * The ::realize signal is emitted when @widget is associated with a 10080 * #GdkWindow, which means that gtk_widget_realize() has been called or the 10081 * widget has been mapped (that is, it is going to be drawn). 10082 */ 10083 gulong addOnRealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10084 { 10085 auto wrapper = new OnRealizeDelegateWrapper(dlg); 10086 wrapper.handlerId = Signals.connectData( 10087 this, 10088 "realize", 10089 cast(GCallback)&callBackRealize, 10090 cast(void*)wrapper, 10091 cast(GClosureNotify)&callBackRealizeDestroy, 10092 connectFlags); 10093 return wrapper.handlerId; 10094 } 10095 10096 extern(C) static void callBackRealize(GtkWidget* widgetStruct, OnRealizeDelegateWrapper wrapper) 10097 { 10098 wrapper.dlg(wrapper.outer); 10099 } 10100 10101 extern(C) static void callBackRealizeDestroy(OnRealizeDelegateWrapper wrapper, GClosure* closure) 10102 { 10103 wrapper.remove(wrapper); 10104 } 10105 10106 protected class OnScreenChangedDelegateWrapper 10107 { 10108 void delegate(Screen, Widget) dlg; 10109 gulong handlerId; 10110 10111 this(void delegate(Screen, Widget) dlg) 10112 { 10113 this.dlg = dlg; 10114 onScreenChangedListeners ~= this; 10115 } 10116 10117 void remove(OnScreenChangedDelegateWrapper source) 10118 { 10119 foreach(index, wrapper; onScreenChangedListeners) 10120 { 10121 if (wrapper.handlerId == source.handlerId) 10122 { 10123 onScreenChangedListeners[index] = null; 10124 onScreenChangedListeners = std.algorithm.remove(onScreenChangedListeners, index); 10125 break; 10126 } 10127 } 10128 } 10129 } 10130 OnScreenChangedDelegateWrapper[] onScreenChangedListeners; 10131 10132 /** 10133 * The ::screen-changed signal gets emitted when the 10134 * screen of a widget has changed. 10135 * 10136 * Params: 10137 * previousScreen = the previous screen, or %NULL if the 10138 * widget was not associated with a screen before 10139 */ 10140 gulong addOnScreenChanged(void delegate(Screen, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10141 { 10142 auto wrapper = new OnScreenChangedDelegateWrapper(dlg); 10143 wrapper.handlerId = Signals.connectData( 10144 this, 10145 "screen-changed", 10146 cast(GCallback)&callBackScreenChanged, 10147 cast(void*)wrapper, 10148 cast(GClosureNotify)&callBackScreenChangedDestroy, 10149 connectFlags); 10150 return wrapper.handlerId; 10151 } 10152 10153 extern(C) static void callBackScreenChanged(GtkWidget* widgetStruct, GdkScreen* previousScreen, OnScreenChangedDelegateWrapper wrapper) 10154 { 10155 wrapper.dlg(ObjectG.getDObject!(Screen)(previousScreen), wrapper.outer); 10156 } 10157 10158 extern(C) static void callBackScreenChangedDestroy(OnScreenChangedDelegateWrapper wrapper, GClosure* closure) 10159 { 10160 wrapper.remove(wrapper); 10161 } 10162 10163 protected class OnScrollDelegateWrapper 10164 { 10165 bool delegate(GdkEventScroll*, Widget) dlg; 10166 gulong handlerId; 10167 10168 this(bool delegate(GdkEventScroll*, Widget) dlg) 10169 { 10170 this.dlg = dlg; 10171 onScrollListeners ~= this; 10172 } 10173 10174 void remove(OnScrollDelegateWrapper source) 10175 { 10176 foreach(index, wrapper; onScrollListeners) 10177 { 10178 if (wrapper.handlerId == source.handlerId) 10179 { 10180 onScrollListeners[index] = null; 10181 onScrollListeners = std.algorithm.remove(onScrollListeners, index); 10182 break; 10183 } 10184 } 10185 } 10186 } 10187 OnScrollDelegateWrapper[] onScrollListeners; 10188 10189 /** 10190 * The ::scroll-event signal is emitted when a button in the 4 to 7 10191 * range is pressed. Wheel mice are usually configured to generate 10192 * button press events for buttons 4 and 5 when the wheel is turned. 10193 * 10194 * To receive this signal, the #GdkWindow associated to the widget needs 10195 * to enable the #GDK_SCROLL_MASK mask. 10196 * 10197 * This signal will be sent to the grab widget if there is one. 10198 * 10199 * Params: 10200 * event = the #GdkEventScroll which triggered 10201 * this signal. 10202 * 10203 * Returns: %TRUE to stop other handlers from being invoked for the event. 10204 * %FALSE to propagate the event further. 10205 */ 10206 gulong addOnScroll(bool delegate(GdkEventScroll*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10207 { 10208 addEvents(EventMask.SCROLL_MASK); 10209 auto wrapper = new OnScrollDelegateWrapper(dlg); 10210 wrapper.handlerId = Signals.connectData( 10211 this, 10212 "scroll-event", 10213 cast(GCallback)&callBackScroll, 10214 cast(void*)wrapper, 10215 cast(GClosureNotify)&callBackScrollDestroy, 10216 connectFlags); 10217 return wrapper.handlerId; 10218 } 10219 10220 extern(C) static int callBackScroll(GtkWidget* widgetStruct, GdkEventScroll* event, OnScrollDelegateWrapper wrapper) 10221 { 10222 return wrapper.dlg(event, wrapper.outer); 10223 } 10224 10225 extern(C) static void callBackScrollDestroy(OnScrollDelegateWrapper wrapper, GClosure* closure) 10226 { 10227 wrapper.remove(wrapper); 10228 } 10229 10230 protected class OnScrollEventGenericDelegateWrapper 10231 { 10232 bool delegate(Event, Widget) dlg; 10233 gulong handlerId; 10234 10235 this(bool delegate(Event, Widget) dlg) 10236 { 10237 this.dlg = dlg; 10238 onScrollEventGenericListeners ~= this; 10239 } 10240 10241 void remove(OnScrollEventGenericDelegateWrapper source) 10242 { 10243 foreach(index, wrapper; onScrollEventGenericListeners) 10244 { 10245 if (wrapper.handlerId == source.handlerId) 10246 { 10247 onScrollEventGenericListeners[index] = null; 10248 onScrollEventGenericListeners = std.algorithm.remove(onScrollEventGenericListeners, index); 10249 break; 10250 } 10251 } 10252 } 10253 } 10254 OnScrollEventGenericDelegateWrapper[] onScrollEventGenericListeners; 10255 10256 /** 10257 * The ::scroll-event signal is emitted when a button in the 4 to 7 10258 * range is pressed. Wheel mice are usually configured to generate 10259 * button press events for buttons 4 and 5 when the wheel is turned. 10260 * 10261 * To receive this signal, the #GdkWindow associated to the widget needs 10262 * to enable the #GDK_SCROLL_MASK mask. 10263 * 10264 * This signal will be sent to the grab widget if there is one. 10265 * 10266 * Params: 10267 * event = the #GdkEventScroll which triggered 10268 * this signal. 10269 * 10270 * Returns: %TRUE to stop other handlers from being invoked for the event. 10271 * %FALSE to propagate the event further. 10272 */ 10273 gulong addOnScroll(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10274 { 10275 addEvents(EventMask.SCROLL_MASK); 10276 auto wrapper = new OnScrollEventGenericDelegateWrapper(dlg); 10277 wrapper.handlerId = Signals.connectData( 10278 this, 10279 "scroll-event", 10280 cast(GCallback)&callBackScrollEventGeneric, 10281 cast(void*)wrapper, 10282 cast(GClosureNotify)&callBackScrollEventGenericDestroy, 10283 connectFlags); 10284 return wrapper.handlerId; 10285 } 10286 10287 extern(C) static int callBackScrollEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnScrollEventGenericDelegateWrapper wrapper) 10288 { 10289 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 10290 } 10291 10292 extern(C) static void callBackScrollEventGenericDestroy(OnScrollEventGenericDelegateWrapper wrapper, GClosure* closure) 10293 { 10294 wrapper.remove(wrapper); 10295 } 10296 10297 protected class OnSelectionClearDelegateWrapper 10298 { 10299 bool delegate(GdkEventSelection*, Widget) dlg; 10300 gulong handlerId; 10301 10302 this(bool delegate(GdkEventSelection*, Widget) dlg) 10303 { 10304 this.dlg = dlg; 10305 onSelectionClearListeners ~= this; 10306 } 10307 10308 void remove(OnSelectionClearDelegateWrapper source) 10309 { 10310 foreach(index, wrapper; onSelectionClearListeners) 10311 { 10312 if (wrapper.handlerId == source.handlerId) 10313 { 10314 onSelectionClearListeners[index] = null; 10315 onSelectionClearListeners = std.algorithm.remove(onSelectionClearListeners, index); 10316 break; 10317 } 10318 } 10319 } 10320 } 10321 OnSelectionClearDelegateWrapper[] onSelectionClearListeners; 10322 10323 /** 10324 * The ::selection-clear-event signal will be emitted when the 10325 * the @widget's window has lost ownership of a selection. 10326 * 10327 * Params: 10328 * event = the #GdkEventSelection which triggered 10329 * this signal. 10330 * 10331 * Returns: %TRUE to stop other handlers from being invoked for the event. 10332 * %FALSE to propagate the event further. 10333 */ 10334 gulong addOnSelectionClear(bool delegate(GdkEventSelection*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10335 { 10336 auto wrapper = new OnSelectionClearDelegateWrapper(dlg); 10337 wrapper.handlerId = Signals.connectData( 10338 this, 10339 "selection-clear-event", 10340 cast(GCallback)&callBackSelectionClear, 10341 cast(void*)wrapper, 10342 cast(GClosureNotify)&callBackSelectionClearDestroy, 10343 connectFlags); 10344 return wrapper.handlerId; 10345 } 10346 10347 extern(C) static int callBackSelectionClear(GtkWidget* widgetStruct, GdkEventSelection* event, OnSelectionClearDelegateWrapper wrapper) 10348 { 10349 return wrapper.dlg(event, wrapper.outer); 10350 } 10351 10352 extern(C) static void callBackSelectionClearDestroy(OnSelectionClearDelegateWrapper wrapper, GClosure* closure) 10353 { 10354 wrapper.remove(wrapper); 10355 } 10356 10357 protected class OnSelectionClearEventGenericDelegateWrapper 10358 { 10359 bool delegate(Event, Widget) dlg; 10360 gulong handlerId; 10361 10362 this(bool delegate(Event, Widget) dlg) 10363 { 10364 this.dlg = dlg; 10365 onSelectionClearEventGenericListeners ~= this; 10366 } 10367 10368 void remove(OnSelectionClearEventGenericDelegateWrapper source) 10369 { 10370 foreach(index, wrapper; onSelectionClearEventGenericListeners) 10371 { 10372 if (wrapper.handlerId == source.handlerId) 10373 { 10374 onSelectionClearEventGenericListeners[index] = null; 10375 onSelectionClearEventGenericListeners = std.algorithm.remove(onSelectionClearEventGenericListeners, index); 10376 break; 10377 } 10378 } 10379 } 10380 } 10381 OnSelectionClearEventGenericDelegateWrapper[] onSelectionClearEventGenericListeners; 10382 10383 /** 10384 * The ::selection-clear-event signal will be emitted when the 10385 * the @widget's window has lost ownership of a selection. 10386 * 10387 * Params: 10388 * event = the #GdkEventSelection which triggered 10389 * this signal. 10390 * 10391 * Returns: %TRUE to stop other handlers from being invoked for the event. 10392 * %FALSE to propagate the event further. 10393 */ 10394 gulong addOnSelectionClear(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10395 { 10396 auto wrapper = new OnSelectionClearEventGenericDelegateWrapper(dlg); 10397 wrapper.handlerId = Signals.connectData( 10398 this, 10399 "selection-clear-event", 10400 cast(GCallback)&callBackSelectionClearEventGeneric, 10401 cast(void*)wrapper, 10402 cast(GClosureNotify)&callBackSelectionClearEventGenericDestroy, 10403 connectFlags); 10404 return wrapper.handlerId; 10405 } 10406 10407 extern(C) static int callBackSelectionClearEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnSelectionClearEventGenericDelegateWrapper wrapper) 10408 { 10409 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 10410 } 10411 10412 extern(C) static void callBackSelectionClearEventGenericDestroy(OnSelectionClearEventGenericDelegateWrapper wrapper, GClosure* closure) 10413 { 10414 wrapper.remove(wrapper); 10415 } 10416 10417 protected class OnSelectionGetDelegateWrapper 10418 { 10419 void delegate(SelectionData, uint, uint, Widget) dlg; 10420 gulong handlerId; 10421 10422 this(void delegate(SelectionData, uint, uint, Widget) dlg) 10423 { 10424 this.dlg = dlg; 10425 onSelectionGetListeners ~= this; 10426 } 10427 10428 void remove(OnSelectionGetDelegateWrapper source) 10429 { 10430 foreach(index, wrapper; onSelectionGetListeners) 10431 { 10432 if (wrapper.handlerId == source.handlerId) 10433 { 10434 onSelectionGetListeners[index] = null; 10435 onSelectionGetListeners = std.algorithm.remove(onSelectionGetListeners, index); 10436 break; 10437 } 10438 } 10439 } 10440 } 10441 OnSelectionGetDelegateWrapper[] onSelectionGetListeners; 10442 10443 /** */ 10444 gulong addOnSelectionGet(void delegate(SelectionData, uint, uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10445 { 10446 auto wrapper = new OnSelectionGetDelegateWrapper(dlg); 10447 wrapper.handlerId = Signals.connectData( 10448 this, 10449 "selection-get", 10450 cast(GCallback)&callBackSelectionGet, 10451 cast(void*)wrapper, 10452 cast(GClosureNotify)&callBackSelectionGetDestroy, 10453 connectFlags); 10454 return wrapper.handlerId; 10455 } 10456 10457 extern(C) static void callBackSelectionGet(GtkWidget* widgetStruct, GtkSelectionData* data, uint info, uint time, OnSelectionGetDelegateWrapper wrapper) 10458 { 10459 wrapper.dlg(ObjectG.getDObject!(SelectionData)(data), info, time, wrapper.outer); 10460 } 10461 10462 extern(C) static void callBackSelectionGetDestroy(OnSelectionGetDelegateWrapper wrapper, GClosure* closure) 10463 { 10464 wrapper.remove(wrapper); 10465 } 10466 10467 protected class OnSelectionNotifyDelegateWrapper 10468 { 10469 bool delegate(GdkEventSelection*, Widget) dlg; 10470 gulong handlerId; 10471 10472 this(bool delegate(GdkEventSelection*, Widget) dlg) 10473 { 10474 this.dlg = dlg; 10475 onSelectionNotifyListeners ~= this; 10476 } 10477 10478 void remove(OnSelectionNotifyDelegateWrapper source) 10479 { 10480 foreach(index, wrapper; onSelectionNotifyListeners) 10481 { 10482 if (wrapper.handlerId == source.handlerId) 10483 { 10484 onSelectionNotifyListeners[index] = null; 10485 onSelectionNotifyListeners = std.algorithm.remove(onSelectionNotifyListeners, index); 10486 break; 10487 } 10488 } 10489 } 10490 } 10491 OnSelectionNotifyDelegateWrapper[] onSelectionNotifyListeners; 10492 10493 /** 10494 * Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further. 10495 */ 10496 gulong addOnSelectionNotify(bool delegate(GdkEventSelection*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10497 { 10498 auto wrapper = new OnSelectionNotifyDelegateWrapper(dlg); 10499 wrapper.handlerId = Signals.connectData( 10500 this, 10501 "selection-notify-event", 10502 cast(GCallback)&callBackSelectionNotify, 10503 cast(void*)wrapper, 10504 cast(GClosureNotify)&callBackSelectionNotifyDestroy, 10505 connectFlags); 10506 return wrapper.handlerId; 10507 } 10508 10509 extern(C) static int callBackSelectionNotify(GtkWidget* widgetStruct, GdkEventSelection* event, OnSelectionNotifyDelegateWrapper wrapper) 10510 { 10511 return wrapper.dlg(event, wrapper.outer); 10512 } 10513 10514 extern(C) static void callBackSelectionNotifyDestroy(OnSelectionNotifyDelegateWrapper wrapper, GClosure* closure) 10515 { 10516 wrapper.remove(wrapper); 10517 } 10518 10519 protected class OnSelectionNotifyEventGenericDelegateWrapper 10520 { 10521 bool delegate(Event, Widget) dlg; 10522 gulong handlerId; 10523 10524 this(bool delegate(Event, Widget) dlg) 10525 { 10526 this.dlg = dlg; 10527 onSelectionNotifyEventGenericListeners ~= this; 10528 } 10529 10530 void remove(OnSelectionNotifyEventGenericDelegateWrapper source) 10531 { 10532 foreach(index, wrapper; onSelectionNotifyEventGenericListeners) 10533 { 10534 if (wrapper.handlerId == source.handlerId) 10535 { 10536 onSelectionNotifyEventGenericListeners[index] = null; 10537 onSelectionNotifyEventGenericListeners = std.algorithm.remove(onSelectionNotifyEventGenericListeners, index); 10538 break; 10539 } 10540 } 10541 } 10542 } 10543 OnSelectionNotifyEventGenericDelegateWrapper[] onSelectionNotifyEventGenericListeners; 10544 10545 /** 10546 * Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further. 10547 */ 10548 gulong addOnSelectionNotify(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10549 { 10550 auto wrapper = new OnSelectionNotifyEventGenericDelegateWrapper(dlg); 10551 wrapper.handlerId = Signals.connectData( 10552 this, 10553 "selection-notify-event", 10554 cast(GCallback)&callBackSelectionNotifyEventGeneric, 10555 cast(void*)wrapper, 10556 cast(GClosureNotify)&callBackSelectionNotifyEventGenericDestroy, 10557 connectFlags); 10558 return wrapper.handlerId; 10559 } 10560 10561 extern(C) static int callBackSelectionNotifyEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnSelectionNotifyEventGenericDelegateWrapper wrapper) 10562 { 10563 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 10564 } 10565 10566 extern(C) static void callBackSelectionNotifyEventGenericDestroy(OnSelectionNotifyEventGenericDelegateWrapper wrapper, GClosure* closure) 10567 { 10568 wrapper.remove(wrapper); 10569 } 10570 10571 protected class OnSelectionReceivedDelegateWrapper 10572 { 10573 void delegate(SelectionData, uint, Widget) dlg; 10574 gulong handlerId; 10575 10576 this(void delegate(SelectionData, uint, Widget) dlg) 10577 { 10578 this.dlg = dlg; 10579 onSelectionReceivedListeners ~= this; 10580 } 10581 10582 void remove(OnSelectionReceivedDelegateWrapper source) 10583 { 10584 foreach(index, wrapper; onSelectionReceivedListeners) 10585 { 10586 if (wrapper.handlerId == source.handlerId) 10587 { 10588 onSelectionReceivedListeners[index] = null; 10589 onSelectionReceivedListeners = std.algorithm.remove(onSelectionReceivedListeners, index); 10590 break; 10591 } 10592 } 10593 } 10594 } 10595 OnSelectionReceivedDelegateWrapper[] onSelectionReceivedListeners; 10596 10597 /** */ 10598 gulong addOnSelectionReceived(void delegate(SelectionData, uint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10599 { 10600 auto wrapper = new OnSelectionReceivedDelegateWrapper(dlg); 10601 wrapper.handlerId = Signals.connectData( 10602 this, 10603 "selection-received", 10604 cast(GCallback)&callBackSelectionReceived, 10605 cast(void*)wrapper, 10606 cast(GClosureNotify)&callBackSelectionReceivedDestroy, 10607 connectFlags); 10608 return wrapper.handlerId; 10609 } 10610 10611 extern(C) static void callBackSelectionReceived(GtkWidget* widgetStruct, GtkSelectionData* data, uint time, OnSelectionReceivedDelegateWrapper wrapper) 10612 { 10613 wrapper.dlg(ObjectG.getDObject!(SelectionData)(data), time, wrapper.outer); 10614 } 10615 10616 extern(C) static void callBackSelectionReceivedDestroy(OnSelectionReceivedDelegateWrapper wrapper, GClosure* closure) 10617 { 10618 wrapper.remove(wrapper); 10619 } 10620 10621 protected class OnSelectionRequestDelegateWrapper 10622 { 10623 bool delegate(GdkEventSelection*, Widget) dlg; 10624 gulong handlerId; 10625 10626 this(bool delegate(GdkEventSelection*, Widget) dlg) 10627 { 10628 this.dlg = dlg; 10629 onSelectionRequestListeners ~= this; 10630 } 10631 10632 void remove(OnSelectionRequestDelegateWrapper source) 10633 { 10634 foreach(index, wrapper; onSelectionRequestListeners) 10635 { 10636 if (wrapper.handlerId == source.handlerId) 10637 { 10638 onSelectionRequestListeners[index] = null; 10639 onSelectionRequestListeners = std.algorithm.remove(onSelectionRequestListeners, index); 10640 break; 10641 } 10642 } 10643 } 10644 } 10645 OnSelectionRequestDelegateWrapper[] onSelectionRequestListeners; 10646 10647 /** 10648 * The ::selection-request-event signal will be emitted when 10649 * another client requests ownership of the selection owned by 10650 * the @widget's window. 10651 * 10652 * Params: 10653 * event = the #GdkEventSelection which triggered 10654 * this signal. 10655 * 10656 * Returns: %TRUE to stop other handlers from being invoked for the event. 10657 * %FALSE to propagate the event further. 10658 */ 10659 gulong addOnSelectionRequest(bool delegate(GdkEventSelection*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10660 { 10661 auto wrapper = new OnSelectionRequestDelegateWrapper(dlg); 10662 wrapper.handlerId = Signals.connectData( 10663 this, 10664 "selection-request-event", 10665 cast(GCallback)&callBackSelectionRequest, 10666 cast(void*)wrapper, 10667 cast(GClosureNotify)&callBackSelectionRequestDestroy, 10668 connectFlags); 10669 return wrapper.handlerId; 10670 } 10671 10672 extern(C) static int callBackSelectionRequest(GtkWidget* widgetStruct, GdkEventSelection* event, OnSelectionRequestDelegateWrapper wrapper) 10673 { 10674 return wrapper.dlg(event, wrapper.outer); 10675 } 10676 10677 extern(C) static void callBackSelectionRequestDestroy(OnSelectionRequestDelegateWrapper wrapper, GClosure* closure) 10678 { 10679 wrapper.remove(wrapper); 10680 } 10681 10682 protected class OnSelectionRequestEventGenericDelegateWrapper 10683 { 10684 bool delegate(Event, Widget) dlg; 10685 gulong handlerId; 10686 10687 this(bool delegate(Event, Widget) dlg) 10688 { 10689 this.dlg = dlg; 10690 onSelectionRequestEventGenericListeners ~= this; 10691 } 10692 10693 void remove(OnSelectionRequestEventGenericDelegateWrapper source) 10694 { 10695 foreach(index, wrapper; onSelectionRequestEventGenericListeners) 10696 { 10697 if (wrapper.handlerId == source.handlerId) 10698 { 10699 onSelectionRequestEventGenericListeners[index] = null; 10700 onSelectionRequestEventGenericListeners = std.algorithm.remove(onSelectionRequestEventGenericListeners, index); 10701 break; 10702 } 10703 } 10704 } 10705 } 10706 OnSelectionRequestEventGenericDelegateWrapper[] onSelectionRequestEventGenericListeners; 10707 10708 /** 10709 * The ::selection-request-event signal will be emitted when 10710 * another client requests ownership of the selection owned by 10711 * the @widget's window. 10712 * 10713 * Params: 10714 * event = the #GdkEventSelection which triggered 10715 * this signal. 10716 * 10717 * Returns: %TRUE to stop other handlers from being invoked for the event. 10718 * %FALSE to propagate the event further. 10719 */ 10720 gulong addOnSelectionRequest(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10721 { 10722 auto wrapper = new OnSelectionRequestEventGenericDelegateWrapper(dlg); 10723 wrapper.handlerId = Signals.connectData( 10724 this, 10725 "selection-request-event", 10726 cast(GCallback)&callBackSelectionRequestEventGeneric, 10727 cast(void*)wrapper, 10728 cast(GClosureNotify)&callBackSelectionRequestEventGenericDestroy, 10729 connectFlags); 10730 return wrapper.handlerId; 10731 } 10732 10733 extern(C) static int callBackSelectionRequestEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnSelectionRequestEventGenericDelegateWrapper wrapper) 10734 { 10735 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 10736 } 10737 10738 extern(C) static void callBackSelectionRequestEventGenericDestroy(OnSelectionRequestEventGenericDelegateWrapper wrapper, GClosure* closure) 10739 { 10740 wrapper.remove(wrapper); 10741 } 10742 10743 protected class OnShowDelegateWrapper 10744 { 10745 void delegate(Widget) dlg; 10746 gulong handlerId; 10747 10748 this(void delegate(Widget) dlg) 10749 { 10750 this.dlg = dlg; 10751 onShowListeners ~= this; 10752 } 10753 10754 void remove(OnShowDelegateWrapper source) 10755 { 10756 foreach(index, wrapper; onShowListeners) 10757 { 10758 if (wrapper.handlerId == source.handlerId) 10759 { 10760 onShowListeners[index] = null; 10761 onShowListeners = std.algorithm.remove(onShowListeners, index); 10762 break; 10763 } 10764 } 10765 } 10766 } 10767 OnShowDelegateWrapper[] onShowListeners; 10768 10769 /** 10770 * The ::show signal is emitted when @widget is shown, for example with 10771 * gtk_widget_show(). 10772 */ 10773 gulong addOnShow(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10774 { 10775 auto wrapper = new OnShowDelegateWrapper(dlg); 10776 wrapper.handlerId = Signals.connectData( 10777 this, 10778 "show", 10779 cast(GCallback)&callBackShow, 10780 cast(void*)wrapper, 10781 cast(GClosureNotify)&callBackShowDestroy, 10782 connectFlags); 10783 return wrapper.handlerId; 10784 } 10785 10786 extern(C) static void callBackShow(GtkWidget* widgetStruct, OnShowDelegateWrapper wrapper) 10787 { 10788 wrapper.dlg(wrapper.outer); 10789 } 10790 10791 extern(C) static void callBackShowDestroy(OnShowDelegateWrapper wrapper, GClosure* closure) 10792 { 10793 wrapper.remove(wrapper); 10794 } 10795 10796 protected class OnShowHelpDelegateWrapper 10797 { 10798 bool delegate(GtkWidgetHelpType, Widget) dlg; 10799 gulong handlerId; 10800 10801 this(bool delegate(GtkWidgetHelpType, Widget) dlg) 10802 { 10803 this.dlg = dlg; 10804 onShowHelpListeners ~= this; 10805 } 10806 10807 void remove(OnShowHelpDelegateWrapper source) 10808 { 10809 foreach(index, wrapper; onShowHelpListeners) 10810 { 10811 if (wrapper.handlerId == source.handlerId) 10812 { 10813 onShowHelpListeners[index] = null; 10814 onShowHelpListeners = std.algorithm.remove(onShowHelpListeners, index); 10815 break; 10816 } 10817 } 10818 } 10819 } 10820 OnShowHelpDelegateWrapper[] onShowHelpListeners; 10821 10822 /** 10823 * Returns: %TRUE to stop other handlers from being invoked for the event. 10824 * %FALSE to propagate the event further. 10825 */ 10826 gulong addOnShowHelp(bool delegate(GtkWidgetHelpType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10827 { 10828 auto wrapper = new OnShowHelpDelegateWrapper(dlg); 10829 wrapper.handlerId = Signals.connectData( 10830 this, 10831 "show-help", 10832 cast(GCallback)&callBackShowHelp, 10833 cast(void*)wrapper, 10834 cast(GClosureNotify)&callBackShowHelpDestroy, 10835 connectFlags); 10836 return wrapper.handlerId; 10837 } 10838 10839 extern(C) static int callBackShowHelp(GtkWidget* widgetStruct, GtkWidgetHelpType helpType, OnShowHelpDelegateWrapper wrapper) 10840 { 10841 return wrapper.dlg(helpType, wrapper.outer); 10842 } 10843 10844 extern(C) static void callBackShowHelpDestroy(OnShowHelpDelegateWrapper wrapper, GClosure* closure) 10845 { 10846 wrapper.remove(wrapper); 10847 } 10848 10849 protected class OnSizeAllocateDelegateWrapper 10850 { 10851 void delegate(Allocation, Widget) dlg; 10852 gulong handlerId; 10853 10854 this(void delegate(Allocation, Widget) dlg) 10855 { 10856 this.dlg = dlg; 10857 onSizeAllocateListeners ~= this; 10858 } 10859 10860 void remove(OnSizeAllocateDelegateWrapper source) 10861 { 10862 foreach(index, wrapper; onSizeAllocateListeners) 10863 { 10864 if (wrapper.handlerId == source.handlerId) 10865 { 10866 onSizeAllocateListeners[index] = null; 10867 onSizeAllocateListeners = std.algorithm.remove(onSizeAllocateListeners, index); 10868 break; 10869 } 10870 } 10871 } 10872 } 10873 OnSizeAllocateDelegateWrapper[] onSizeAllocateListeners; 10874 10875 /** */ 10876 gulong addOnSizeAllocate(void delegate(Allocation, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10877 { 10878 auto wrapper = new OnSizeAllocateDelegateWrapper(dlg); 10879 wrapper.handlerId = Signals.connectData( 10880 this, 10881 "size-allocate", 10882 cast(GCallback)&callBackSizeAllocate, 10883 cast(void*)wrapper, 10884 cast(GClosureNotify)&callBackSizeAllocateDestroy, 10885 connectFlags); 10886 return wrapper.handlerId; 10887 } 10888 10889 extern(C) static void callBackSizeAllocate(GtkWidget* widgetStruct, Allocation allocation, OnSizeAllocateDelegateWrapper wrapper) 10890 { 10891 wrapper.dlg(allocation, wrapper.outer); 10892 } 10893 10894 extern(C) static void callBackSizeAllocateDestroy(OnSizeAllocateDelegateWrapper wrapper, GClosure* closure) 10895 { 10896 wrapper.remove(wrapper); 10897 } 10898 10899 protected class OnStateChangedDelegateWrapper 10900 { 10901 void delegate(GtkStateType, Widget) dlg; 10902 gulong handlerId; 10903 10904 this(void delegate(GtkStateType, Widget) dlg) 10905 { 10906 this.dlg = dlg; 10907 onStateChangedListeners ~= this; 10908 } 10909 10910 void remove(OnStateChangedDelegateWrapper source) 10911 { 10912 foreach(index, wrapper; onStateChangedListeners) 10913 { 10914 if (wrapper.handlerId == source.handlerId) 10915 { 10916 onStateChangedListeners[index] = null; 10917 onStateChangedListeners = std.algorithm.remove(onStateChangedListeners, index); 10918 break; 10919 } 10920 } 10921 } 10922 } 10923 OnStateChangedDelegateWrapper[] onStateChangedListeners; 10924 10925 /** 10926 * The ::state-changed signal is emitted when the widget state changes. 10927 * See gtk_widget_get_state(). 10928 * 10929 * Deprecated: Use #GtkWidget::state-flags-changed instead. 10930 * 10931 * Params: 10932 * state = the previous state 10933 */ 10934 gulong addOnStateChanged(void delegate(GtkStateType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10935 { 10936 auto wrapper = new OnStateChangedDelegateWrapper(dlg); 10937 wrapper.handlerId = Signals.connectData( 10938 this, 10939 "state-changed", 10940 cast(GCallback)&callBackStateChanged, 10941 cast(void*)wrapper, 10942 cast(GClosureNotify)&callBackStateChangedDestroy, 10943 connectFlags); 10944 return wrapper.handlerId; 10945 } 10946 10947 extern(C) static void callBackStateChanged(GtkWidget* widgetStruct, GtkStateType state, OnStateChangedDelegateWrapper wrapper) 10948 { 10949 wrapper.dlg(state, wrapper.outer); 10950 } 10951 10952 extern(C) static void callBackStateChangedDestroy(OnStateChangedDelegateWrapper wrapper, GClosure* closure) 10953 { 10954 wrapper.remove(wrapper); 10955 } 10956 10957 protected class OnStateFlagsChangedDelegateWrapper 10958 { 10959 void delegate(GtkStateFlags, Widget) dlg; 10960 gulong handlerId; 10961 10962 this(void delegate(GtkStateFlags, Widget) dlg) 10963 { 10964 this.dlg = dlg; 10965 onStateFlagsChangedListeners ~= this; 10966 } 10967 10968 void remove(OnStateFlagsChangedDelegateWrapper source) 10969 { 10970 foreach(index, wrapper; onStateFlagsChangedListeners) 10971 { 10972 if (wrapper.handlerId == source.handlerId) 10973 { 10974 onStateFlagsChangedListeners[index] = null; 10975 onStateFlagsChangedListeners = std.algorithm.remove(onStateFlagsChangedListeners, index); 10976 break; 10977 } 10978 } 10979 } 10980 } 10981 OnStateFlagsChangedDelegateWrapper[] onStateFlagsChangedListeners; 10982 10983 /** 10984 * The ::state-flags-changed signal is emitted when the widget state 10985 * changes, see gtk_widget_get_state_flags(). 10986 * 10987 * Params: 10988 * flags = The previous state flags. 10989 * 10990 * Since: 3.0 10991 */ 10992 gulong addOnStateFlagsChanged(void delegate(GtkStateFlags, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 10993 { 10994 auto wrapper = new OnStateFlagsChangedDelegateWrapper(dlg); 10995 wrapper.handlerId = Signals.connectData( 10996 this, 10997 "state-flags-changed", 10998 cast(GCallback)&callBackStateFlagsChanged, 10999 cast(void*)wrapper, 11000 cast(GClosureNotify)&callBackStateFlagsChangedDestroy, 11001 connectFlags); 11002 return wrapper.handlerId; 11003 } 11004 11005 extern(C) static void callBackStateFlagsChanged(GtkWidget* widgetStruct, GtkStateFlags flags, OnStateFlagsChangedDelegateWrapper wrapper) 11006 { 11007 wrapper.dlg(flags, wrapper.outer); 11008 } 11009 11010 extern(C) static void callBackStateFlagsChangedDestroy(OnStateFlagsChangedDelegateWrapper wrapper, GClosure* closure) 11011 { 11012 wrapper.remove(wrapper); 11013 } 11014 11015 protected class OnStyleSetDelegateWrapper 11016 { 11017 void delegate(Style, Widget) dlg; 11018 gulong handlerId; 11019 11020 this(void delegate(Style, Widget) dlg) 11021 { 11022 this.dlg = dlg; 11023 onStyleSetListeners ~= this; 11024 } 11025 11026 void remove(OnStyleSetDelegateWrapper source) 11027 { 11028 foreach(index, wrapper; onStyleSetListeners) 11029 { 11030 if (wrapper.handlerId == source.handlerId) 11031 { 11032 onStyleSetListeners[index] = null; 11033 onStyleSetListeners = std.algorithm.remove(onStyleSetListeners, index); 11034 break; 11035 } 11036 } 11037 } 11038 } 11039 OnStyleSetDelegateWrapper[] onStyleSetListeners; 11040 11041 /** 11042 * The ::style-set signal is emitted when a new style has been set 11043 * on a widget. Note that style-modifying functions like 11044 * gtk_widget_modify_base() also cause this signal to be emitted. 11045 * 11046 * Note that this signal is emitted for changes to the deprecated 11047 * #GtkStyle. To track changes to the #GtkStyleContext associated 11048 * with a widget, use the #GtkWidget::style-updated signal. 11049 * 11050 * Deprecated: Use the #GtkWidget::style-updated signal 11051 * 11052 * Params: 11053 * previousStyle = the previous style, or %NULL if the widget 11054 * just got its initial style 11055 */ 11056 gulong addOnStyleSet(void delegate(Style, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11057 { 11058 auto wrapper = new OnStyleSetDelegateWrapper(dlg); 11059 wrapper.handlerId = Signals.connectData( 11060 this, 11061 "style-set", 11062 cast(GCallback)&callBackStyleSet, 11063 cast(void*)wrapper, 11064 cast(GClosureNotify)&callBackStyleSetDestroy, 11065 connectFlags); 11066 return wrapper.handlerId; 11067 } 11068 11069 extern(C) static void callBackStyleSet(GtkWidget* widgetStruct, GtkStyle* previousStyle, OnStyleSetDelegateWrapper wrapper) 11070 { 11071 wrapper.dlg(ObjectG.getDObject!(Style)(previousStyle), wrapper.outer); 11072 } 11073 11074 extern(C) static void callBackStyleSetDestroy(OnStyleSetDelegateWrapper wrapper, GClosure* closure) 11075 { 11076 wrapper.remove(wrapper); 11077 } 11078 11079 protected class OnStyleUpdatedDelegateWrapper 11080 { 11081 void delegate(Widget) dlg; 11082 gulong handlerId; 11083 11084 this(void delegate(Widget) dlg) 11085 { 11086 this.dlg = dlg; 11087 onStyleUpdatedListeners ~= this; 11088 } 11089 11090 void remove(OnStyleUpdatedDelegateWrapper source) 11091 { 11092 foreach(index, wrapper; onStyleUpdatedListeners) 11093 { 11094 if (wrapper.handlerId == source.handlerId) 11095 { 11096 onStyleUpdatedListeners[index] = null; 11097 onStyleUpdatedListeners = std.algorithm.remove(onStyleUpdatedListeners, index); 11098 break; 11099 } 11100 } 11101 } 11102 } 11103 OnStyleUpdatedDelegateWrapper[] onStyleUpdatedListeners; 11104 11105 /** 11106 * The ::style-updated signal is a convenience signal that is emitted when the 11107 * #GtkStyleContext::changed signal is emitted on the @widget's associated 11108 * #GtkStyleContext as returned by gtk_widget_get_style_context(). 11109 * 11110 * Note that style-modifying functions like gtk_widget_override_color() also 11111 * cause this signal to be emitted. 11112 * 11113 * Since: 3.0 11114 */ 11115 gulong addOnStyleUpdated(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11116 { 11117 auto wrapper = new OnStyleUpdatedDelegateWrapper(dlg); 11118 wrapper.handlerId = Signals.connectData( 11119 this, 11120 "style-updated", 11121 cast(GCallback)&callBackStyleUpdated, 11122 cast(void*)wrapper, 11123 cast(GClosureNotify)&callBackStyleUpdatedDestroy, 11124 connectFlags); 11125 return wrapper.handlerId; 11126 } 11127 11128 extern(C) static void callBackStyleUpdated(GtkWidget* widgetStruct, OnStyleUpdatedDelegateWrapper wrapper) 11129 { 11130 wrapper.dlg(wrapper.outer); 11131 } 11132 11133 extern(C) static void callBackStyleUpdatedDestroy(OnStyleUpdatedDelegateWrapper wrapper, GClosure* closure) 11134 { 11135 wrapper.remove(wrapper); 11136 } 11137 11138 protected class OnTouchDelegateWrapper 11139 { 11140 bool delegate(Event, Widget) dlg; 11141 gulong handlerId; 11142 11143 this(bool delegate(Event, Widget) dlg) 11144 { 11145 this.dlg = dlg; 11146 onTouchListeners ~= this; 11147 } 11148 11149 void remove(OnTouchDelegateWrapper source) 11150 { 11151 foreach(index, wrapper; onTouchListeners) 11152 { 11153 if (wrapper.handlerId == source.handlerId) 11154 { 11155 onTouchListeners[index] = null; 11156 onTouchListeners = std.algorithm.remove(onTouchListeners, index); 11157 break; 11158 } 11159 } 11160 } 11161 } 11162 OnTouchDelegateWrapper[] onTouchListeners; 11163 11164 /** */ 11165 gulong addOnTouch(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11166 { 11167 auto wrapper = new OnTouchDelegateWrapper(dlg); 11168 wrapper.handlerId = Signals.connectData( 11169 this, 11170 "touch-event", 11171 cast(GCallback)&callBackTouch, 11172 cast(void*)wrapper, 11173 cast(GClosureNotify)&callBackTouchDestroy, 11174 connectFlags); 11175 return wrapper.handlerId; 11176 } 11177 11178 extern(C) static int callBackTouch(GtkWidget* widgetStruct, GdkEvent* object, OnTouchDelegateWrapper wrapper) 11179 { 11180 return wrapper.dlg(ObjectG.getDObject!(Event)(object), wrapper.outer); 11181 } 11182 11183 extern(C) static void callBackTouchDestroy(OnTouchDelegateWrapper wrapper, GClosure* closure) 11184 { 11185 wrapper.remove(wrapper); 11186 } 11187 11188 protected class OnUnmapDelegateWrapper 11189 { 11190 void delegate(Widget) dlg; 11191 gulong handlerId; 11192 11193 this(void delegate(Widget) dlg) 11194 { 11195 this.dlg = dlg; 11196 onUnmapListeners ~= this; 11197 } 11198 11199 void remove(OnUnmapDelegateWrapper source) 11200 { 11201 foreach(index, wrapper; onUnmapListeners) 11202 { 11203 if (wrapper.handlerId == source.handlerId) 11204 { 11205 onUnmapListeners[index] = null; 11206 onUnmapListeners = std.algorithm.remove(onUnmapListeners, index); 11207 break; 11208 } 11209 } 11210 } 11211 } 11212 OnUnmapDelegateWrapper[] onUnmapListeners; 11213 11214 /** 11215 * The ::unmap signal is emitted when @widget is going to be unmapped, which 11216 * means that either it or any of its parents up to the toplevel widget have 11217 * been set as hidden. 11218 * 11219 * As ::unmap indicates that a widget will not be shown any longer, it can be 11220 * used to, for example, stop an animation on the widget. 11221 */ 11222 gulong addOnUnmap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11223 { 11224 auto wrapper = new OnUnmapDelegateWrapper(dlg); 11225 wrapper.handlerId = Signals.connectData( 11226 this, 11227 "unmap", 11228 cast(GCallback)&callBackUnmap, 11229 cast(void*)wrapper, 11230 cast(GClosureNotify)&callBackUnmapDestroy, 11231 connectFlags); 11232 return wrapper.handlerId; 11233 } 11234 11235 extern(C) static void callBackUnmap(GtkWidget* widgetStruct, OnUnmapDelegateWrapper wrapper) 11236 { 11237 wrapper.dlg(wrapper.outer); 11238 } 11239 11240 extern(C) static void callBackUnmapDestroy(OnUnmapDelegateWrapper wrapper, GClosure* closure) 11241 { 11242 wrapper.remove(wrapper); 11243 } 11244 11245 protected class OnUnmapEventDelegateWrapper 11246 { 11247 bool delegate(GdkEventAny*, Widget) dlg; 11248 gulong handlerId; 11249 11250 this(bool delegate(GdkEventAny*, Widget) dlg) 11251 { 11252 this.dlg = dlg; 11253 onUnmapEventListeners ~= this; 11254 } 11255 11256 void remove(OnUnmapEventDelegateWrapper source) 11257 { 11258 foreach(index, wrapper; onUnmapEventListeners) 11259 { 11260 if (wrapper.handlerId == source.handlerId) 11261 { 11262 onUnmapEventListeners[index] = null; 11263 onUnmapEventListeners = std.algorithm.remove(onUnmapEventListeners, index); 11264 break; 11265 } 11266 } 11267 } 11268 } 11269 OnUnmapEventDelegateWrapper[] onUnmapEventListeners; 11270 11271 /** 11272 * The ::unmap-event signal will be emitted when the @widget's window is 11273 * unmapped. A window is unmapped when it becomes invisible on the screen. 11274 * 11275 * To receive this signal, the #GdkWindow associated to the widget needs 11276 * to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask 11277 * automatically for all new windows. 11278 * 11279 * Params: 11280 * event = the #GdkEventAny which triggered this signal 11281 * 11282 * Returns: %TRUE to stop other handlers from being invoked for the event. 11283 * %FALSE to propagate the event further. 11284 */ 11285 gulong addOnUnmapEvent(bool delegate(GdkEventAny*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11286 { 11287 auto wrapper = new OnUnmapEventDelegateWrapper(dlg); 11288 wrapper.handlerId = Signals.connectData( 11289 this, 11290 "unmap-event", 11291 cast(GCallback)&callBackUnmapEvent, 11292 cast(void*)wrapper, 11293 cast(GClosureNotify)&callBackUnmapEventDestroy, 11294 connectFlags); 11295 return wrapper.handlerId; 11296 } 11297 11298 extern(C) static int callBackUnmapEvent(GtkWidget* widgetStruct, GdkEventAny* event, OnUnmapEventDelegateWrapper wrapper) 11299 { 11300 return wrapper.dlg(event, wrapper.outer); 11301 } 11302 11303 extern(C) static void callBackUnmapEventDestroy(OnUnmapEventDelegateWrapper wrapper, GClosure* closure) 11304 { 11305 wrapper.remove(wrapper); 11306 } 11307 11308 protected class OnUnmapEventGenericDelegateWrapper 11309 { 11310 bool delegate(Event, Widget) dlg; 11311 gulong handlerId; 11312 11313 this(bool delegate(Event, Widget) dlg) 11314 { 11315 this.dlg = dlg; 11316 onUnmapEventGenericListeners ~= this; 11317 } 11318 11319 void remove(OnUnmapEventGenericDelegateWrapper source) 11320 { 11321 foreach(index, wrapper; onUnmapEventGenericListeners) 11322 { 11323 if (wrapper.handlerId == source.handlerId) 11324 { 11325 onUnmapEventGenericListeners[index] = null; 11326 onUnmapEventGenericListeners = std.algorithm.remove(onUnmapEventGenericListeners, index); 11327 break; 11328 } 11329 } 11330 } 11331 } 11332 OnUnmapEventGenericDelegateWrapper[] onUnmapEventGenericListeners; 11333 11334 /** 11335 * The ::unmap-event signal will be emitted when the @widget's window is 11336 * unmapped. A window is unmapped when it becomes invisible on the screen. 11337 * 11338 * To receive this signal, the #GdkWindow associated to the widget needs 11339 * to enable the #GDK_STRUCTURE_MASK mask. GDK will enable this mask 11340 * automatically for all new windows. 11341 * 11342 * Params: 11343 * event = the #GdkEventAny which triggered this signal 11344 * 11345 * Returns: %TRUE to stop other handlers from being invoked for the event. 11346 * %FALSE to propagate the event further. 11347 */ 11348 gulong addOnUnmapEvent(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11349 { 11350 auto wrapper = new OnUnmapEventGenericDelegateWrapper(dlg); 11351 wrapper.handlerId = Signals.connectData( 11352 this, 11353 "unmap-event", 11354 cast(GCallback)&callBackUnmapEventGeneric, 11355 cast(void*)wrapper, 11356 cast(GClosureNotify)&callBackUnmapEventGenericDestroy, 11357 connectFlags); 11358 return wrapper.handlerId; 11359 } 11360 11361 extern(C) static int callBackUnmapEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnUnmapEventGenericDelegateWrapper wrapper) 11362 { 11363 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 11364 } 11365 11366 extern(C) static void callBackUnmapEventGenericDestroy(OnUnmapEventGenericDelegateWrapper wrapper, GClosure* closure) 11367 { 11368 wrapper.remove(wrapper); 11369 } 11370 11371 protected class OnUnrealizeDelegateWrapper 11372 { 11373 void delegate(Widget) dlg; 11374 gulong handlerId; 11375 11376 this(void delegate(Widget) dlg) 11377 { 11378 this.dlg = dlg; 11379 onUnrealizeListeners ~= this; 11380 } 11381 11382 void remove(OnUnrealizeDelegateWrapper source) 11383 { 11384 foreach(index, wrapper; onUnrealizeListeners) 11385 { 11386 if (wrapper.handlerId == source.handlerId) 11387 { 11388 onUnrealizeListeners[index] = null; 11389 onUnrealizeListeners = std.algorithm.remove(onUnrealizeListeners, index); 11390 break; 11391 } 11392 } 11393 } 11394 } 11395 OnUnrealizeDelegateWrapper[] onUnrealizeListeners; 11396 11397 /** 11398 * The ::unrealize signal is emitted when the #GdkWindow associated with 11399 * @widget is destroyed, which means that gtk_widget_unrealize() has been 11400 * called or the widget has been unmapped (that is, it is going to be 11401 * hidden). 11402 */ 11403 gulong addOnUnrealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11404 { 11405 auto wrapper = new OnUnrealizeDelegateWrapper(dlg); 11406 wrapper.handlerId = Signals.connectData( 11407 this, 11408 "unrealize", 11409 cast(GCallback)&callBackUnrealize, 11410 cast(void*)wrapper, 11411 cast(GClosureNotify)&callBackUnrealizeDestroy, 11412 connectFlags); 11413 return wrapper.handlerId; 11414 } 11415 11416 extern(C) static void callBackUnrealize(GtkWidget* widgetStruct, OnUnrealizeDelegateWrapper wrapper) 11417 { 11418 wrapper.dlg(wrapper.outer); 11419 } 11420 11421 extern(C) static void callBackUnrealizeDestroy(OnUnrealizeDelegateWrapper wrapper, GClosure* closure) 11422 { 11423 wrapper.remove(wrapper); 11424 } 11425 11426 protected class OnVisibilityNotifyDelegateWrapper 11427 { 11428 bool delegate(GdkEventVisibility*, Widget) dlg; 11429 gulong handlerId; 11430 11431 this(bool delegate(GdkEventVisibility*, Widget) dlg) 11432 { 11433 this.dlg = dlg; 11434 onVisibilityNotifyListeners ~= this; 11435 } 11436 11437 void remove(OnVisibilityNotifyDelegateWrapper source) 11438 { 11439 foreach(index, wrapper; onVisibilityNotifyListeners) 11440 { 11441 if (wrapper.handlerId == source.handlerId) 11442 { 11443 onVisibilityNotifyListeners[index] = null; 11444 onVisibilityNotifyListeners = std.algorithm.remove(onVisibilityNotifyListeners, index); 11445 break; 11446 } 11447 } 11448 } 11449 } 11450 OnVisibilityNotifyDelegateWrapper[] onVisibilityNotifyListeners; 11451 11452 /** 11453 * The ::visibility-notify-event will be emitted when the @widget's 11454 * window is obscured or unobscured. 11455 * 11456 * To receive this signal the #GdkWindow associated to the widget needs 11457 * to enable the #GDK_VISIBILITY_NOTIFY_MASK mask. 11458 * 11459 * Deprecated: Modern composited windowing systems with pervasive 11460 * transparency make it impossible to track the visibility of a window 11461 * reliably, so this signal can not be guaranteed to provide useful 11462 * information. 11463 * 11464 * Params: 11465 * event = the #GdkEventVisibility which 11466 * triggered this signal. 11467 * 11468 * Returns: %TRUE to stop other handlers from being invoked for the event. 11469 * %FALSE to propagate the event further. 11470 */ 11471 gulong addOnVisibilityNotify(bool delegate(GdkEventVisibility*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11472 { 11473 addEvents(EventMask.VISIBILITY_NOTIFY_MASK); 11474 auto wrapper = new OnVisibilityNotifyDelegateWrapper(dlg); 11475 wrapper.handlerId = Signals.connectData( 11476 this, 11477 "visibility-notify-event", 11478 cast(GCallback)&callBackVisibilityNotify, 11479 cast(void*)wrapper, 11480 cast(GClosureNotify)&callBackVisibilityNotifyDestroy, 11481 connectFlags); 11482 return wrapper.handlerId; 11483 } 11484 11485 extern(C) static int callBackVisibilityNotify(GtkWidget* widgetStruct, GdkEventVisibility* event, OnVisibilityNotifyDelegateWrapper wrapper) 11486 { 11487 return wrapper.dlg(event, wrapper.outer); 11488 } 11489 11490 extern(C) static void callBackVisibilityNotifyDestroy(OnVisibilityNotifyDelegateWrapper wrapper, GClosure* closure) 11491 { 11492 wrapper.remove(wrapper); 11493 } 11494 11495 protected class OnVisibilityNotifyEventGenericDelegateWrapper 11496 { 11497 bool delegate(Event, Widget) dlg; 11498 gulong handlerId; 11499 11500 this(bool delegate(Event, Widget) dlg) 11501 { 11502 this.dlg = dlg; 11503 onVisibilityNotifyEventGenericListeners ~= this; 11504 } 11505 11506 void remove(OnVisibilityNotifyEventGenericDelegateWrapper source) 11507 { 11508 foreach(index, wrapper; onVisibilityNotifyEventGenericListeners) 11509 { 11510 if (wrapper.handlerId == source.handlerId) 11511 { 11512 onVisibilityNotifyEventGenericListeners[index] = null; 11513 onVisibilityNotifyEventGenericListeners = std.algorithm.remove(onVisibilityNotifyEventGenericListeners, index); 11514 break; 11515 } 11516 } 11517 } 11518 } 11519 OnVisibilityNotifyEventGenericDelegateWrapper[] onVisibilityNotifyEventGenericListeners; 11520 11521 /** 11522 * The ::visibility-notify-event will be emitted when the @widget's 11523 * window is obscured or unobscured. 11524 * 11525 * To receive this signal the #GdkWindow associated to the widget needs 11526 * to enable the #GDK_VISIBILITY_NOTIFY_MASK mask. 11527 * 11528 * Deprecated: Modern composited windowing systems with pervasive 11529 * transparency make it impossible to track the visibility of a window 11530 * reliably, so this signal can not be guaranteed to provide useful 11531 * information. 11532 * 11533 * Params: 11534 * event = the #GdkEventVisibility which 11535 * triggered this signal. 11536 * 11537 * Returns: %TRUE to stop other handlers from being invoked for the event. 11538 * %FALSE to propagate the event further. 11539 */ 11540 gulong addOnVisibilityNotify(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11541 { 11542 addEvents(EventMask.VISIBILITY_NOTIFY_MASK); 11543 auto wrapper = new OnVisibilityNotifyEventGenericDelegateWrapper(dlg); 11544 wrapper.handlerId = Signals.connectData( 11545 this, 11546 "visibility-notify-event", 11547 cast(GCallback)&callBackVisibilityNotifyEventGeneric, 11548 cast(void*)wrapper, 11549 cast(GClosureNotify)&callBackVisibilityNotifyEventGenericDestroy, 11550 connectFlags); 11551 return wrapper.handlerId; 11552 } 11553 11554 extern(C) static int callBackVisibilityNotifyEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnVisibilityNotifyEventGenericDelegateWrapper wrapper) 11555 { 11556 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 11557 } 11558 11559 extern(C) static void callBackVisibilityNotifyEventGenericDestroy(OnVisibilityNotifyEventGenericDelegateWrapper wrapper, GClosure* closure) 11560 { 11561 wrapper.remove(wrapper); 11562 } 11563 11564 protected class OnWindowStateDelegateWrapper 11565 { 11566 bool delegate(GdkEventWindowState*, Widget) dlg; 11567 gulong handlerId; 11568 11569 this(bool delegate(GdkEventWindowState*, Widget) dlg) 11570 { 11571 this.dlg = dlg; 11572 onWindowStateListeners ~= this; 11573 } 11574 11575 void remove(OnWindowStateDelegateWrapper source) 11576 { 11577 foreach(index, wrapper; onWindowStateListeners) 11578 { 11579 if (wrapper.handlerId == source.handlerId) 11580 { 11581 onWindowStateListeners[index] = null; 11582 onWindowStateListeners = std.algorithm.remove(onWindowStateListeners, index); 11583 break; 11584 } 11585 } 11586 } 11587 } 11588 OnWindowStateDelegateWrapper[] onWindowStateListeners; 11589 11590 /** 11591 * The ::window-state-event will be emitted when the state of the 11592 * toplevel window associated to the @widget changes. 11593 * 11594 * To receive this signal the #GdkWindow associated to the widget 11595 * needs to enable the #GDK_STRUCTURE_MASK mask. GDK will enable 11596 * this mask automatically for all new windows. 11597 * 11598 * Params: 11599 * event = the #GdkEventWindowState which 11600 * triggered this signal. 11601 * 11602 * Returns: %TRUE to stop other handlers from being invoked for the 11603 * event. %FALSE to propagate the event further. 11604 */ 11605 gulong addOnWindowState(bool delegate(GdkEventWindowState*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11606 { 11607 auto wrapper = new OnWindowStateDelegateWrapper(dlg); 11608 wrapper.handlerId = Signals.connectData( 11609 this, 11610 "window-state-event", 11611 cast(GCallback)&callBackWindowState, 11612 cast(void*)wrapper, 11613 cast(GClosureNotify)&callBackWindowStateDestroy, 11614 connectFlags); 11615 return wrapper.handlerId; 11616 } 11617 11618 extern(C) static int callBackWindowState(GtkWidget* widgetStruct, GdkEventWindowState* event, OnWindowStateDelegateWrapper wrapper) 11619 { 11620 return wrapper.dlg(event, wrapper.outer); 11621 } 11622 11623 extern(C) static void callBackWindowStateDestroy(OnWindowStateDelegateWrapper wrapper, GClosure* closure) 11624 { 11625 wrapper.remove(wrapper); 11626 } 11627 11628 protected class OnWindowStateEventGenericDelegateWrapper 11629 { 11630 bool delegate(Event, Widget) dlg; 11631 gulong handlerId; 11632 11633 this(bool delegate(Event, Widget) dlg) 11634 { 11635 this.dlg = dlg; 11636 onWindowStateEventGenericListeners ~= this; 11637 } 11638 11639 void remove(OnWindowStateEventGenericDelegateWrapper source) 11640 { 11641 foreach(index, wrapper; onWindowStateEventGenericListeners) 11642 { 11643 if (wrapper.handlerId == source.handlerId) 11644 { 11645 onWindowStateEventGenericListeners[index] = null; 11646 onWindowStateEventGenericListeners = std.algorithm.remove(onWindowStateEventGenericListeners, index); 11647 break; 11648 } 11649 } 11650 } 11651 } 11652 OnWindowStateEventGenericDelegateWrapper[] onWindowStateEventGenericListeners; 11653 11654 /** 11655 * The ::window-state-event will be emitted when the state of the 11656 * toplevel window associated to the @widget changes. 11657 * 11658 * To receive this signal the #GdkWindow associated to the widget 11659 * needs to enable the #GDK_STRUCTURE_MASK mask. GDK will enable 11660 * this mask automatically for all new windows. 11661 * 11662 * Params: 11663 * event = the #GdkEventWindowState which 11664 * triggered this signal. 11665 * 11666 * Returns: %TRUE to stop other handlers from being invoked for the 11667 * event. %FALSE to propagate the event further. 11668 */ 11669 gulong addOnWindowState(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 11670 { 11671 auto wrapper = new OnWindowStateEventGenericDelegateWrapper(dlg); 11672 wrapper.handlerId = Signals.connectData( 11673 this, 11674 "window-state-event", 11675 cast(GCallback)&callBackWindowStateEventGeneric, 11676 cast(void*)wrapper, 11677 cast(GClosureNotify)&callBackWindowStateEventGenericDestroy, 11678 connectFlags); 11679 return wrapper.handlerId; 11680 } 11681 11682 extern(C) static int callBackWindowStateEventGeneric(GtkWidget* widgetStruct, GdkEvent* event, OnWindowStateEventGenericDelegateWrapper wrapper) 11683 { 11684 return wrapper.dlg(ObjectG.getDObject!(Event)(event), wrapper.outer); 11685 } 11686 11687 extern(C) static void callBackWindowStateEventGenericDestroy(OnWindowStateEventGenericDelegateWrapper wrapper, GClosure* closure) 11688 { 11689 wrapper.remove(wrapper); 11690 } 11691 11692 /** 11693 * This function is supposed to be called in #GtkWidget::draw 11694 * implementations for widgets that support multiple windows. 11695 * @cr must be untransformed from invoking of the draw function. 11696 * This function will return %TRUE if the contents of the given 11697 * @window are supposed to be drawn and %FALSE otherwise. Note 11698 * that when the drawing was not initiated by the windowing 11699 * system this function will return %TRUE for all windows, so 11700 * you need to draw the bottommost window first. Also, do not 11701 * use “else if” statements to check which window should be drawn. 11702 * 11703 * Params: 11704 * cr = a cairo context 11705 * window = the window to check. @window may not be an input-only 11706 * window. 11707 * 11708 * Returns: %TRUE if @window should be drawn 11709 * 11710 * Since: 3.0 11711 */ 11712 public static bool cairoShouldDrawWindow(Context cr, GdkWin window) 11713 { 11714 return gtk_cairo_should_draw_window((cr is null) ? null : cr.getContextStruct(), (window is null) ? null : window.getWindowStruct()) != 0; 11715 } 11716 11717 /** 11718 * Transforms the given cairo context @cr that from @widget-relative 11719 * coordinates to @window-relative coordinates. 11720 * If the @widget’s window is not an ancestor of @window, no 11721 * modification will be applied. 11722 * 11723 * This is the inverse to the transformation GTK applies when 11724 * preparing an expose event to be emitted with the #GtkWidget::draw 11725 * signal. It is intended to help porting multiwindow widgets from 11726 * GTK+ 2 to the rendering architecture of GTK+ 3. 11727 * 11728 * Params: 11729 * cr = the cairo context to transform 11730 * widget = the widget the context is currently centered for 11731 * window = the window to transform the context to 11732 * 11733 * Since: 3.0 11734 */ 11735 public static void cairoTransformToWindow(Context cr, Widget widget, GdkWin window) 11736 { 11737 gtk_cairo_transform_to_window((cr is null) ? null : cr.getContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), (window is null) ? null : window.getWindowStruct()); 11738 } 11739 11740 /** 11741 * Distributes @extra_space to child @sizes by bringing smaller 11742 * children up to natural size first. 11743 * 11744 * The remaining space will be added to the @minimum_size member of the 11745 * GtkRequestedSize struct. If all sizes reach their natural size then 11746 * the remaining space is returned. 11747 * 11748 * Params: 11749 * extraSpace = Extra space to redistribute among children after subtracting 11750 * minimum sizes and any child padding from the overall allocation 11751 * nRequestedSizes = Number of requests to fit into the allocation 11752 * sizes = An array of structs with a client pointer and a minimum/natural size 11753 * in the orientation of the allocation. 11754 * 11755 * Returns: The remainder of @extra_space after redistributing space 11756 * to @sizes. 11757 */ 11758 public static int distributeNaturalAllocation(int extraSpace, uint nRequestedSizes, GtkRequestedSize* sizes) 11759 { 11760 return gtk_distribute_natural_allocation(extraSpace, nRequestedSizes, sizes); 11761 } 11762 }