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