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