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