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