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