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