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