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