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 cairo.FontOption; 28 private import gdk.Clipboard; 29 private import gdk.Cursor; 30 private import gdk.Display; 31 private import gdk.FrameClock; 32 private import gio.ActionGroupIF; 33 private import gio.ListModelIF; 34 private import glib.ListG; 35 private import glib.MemorySlice; 36 private import glib.Str; 37 private import glib.Variant; 38 private import glib.c.functions; 39 private import gobject.ObjectG; 40 private import gobject.Signals; 41 private import graphene.Matrix; 42 private import graphene.Point; 43 private import graphene.Rect; 44 private import gsk.Transform; 45 private import gtk.AccessibleIF; 46 private import gtk.AccessibleT; 47 private import gtk.BuildableIF; 48 private import gtk.BuildableT; 49 private import gtk.ConstraintTargetIF; 50 private import gtk.ConstraintTargetT; 51 private import gtk.EventController; 52 private import gtk.LayoutManager; 53 private import gtk.NativeIF; 54 private import gtk.Requisition; 55 private import gtk.RootIF; 56 private import gtk.Settings; 57 private import gtk.Snapshot; 58 private import gtk.StyleContext; 59 private import gtk.Tooltip; 60 private import gtk.c.functions; 61 public import gtk.c.types; 62 private import pango.PgContext; 63 private import pango.PgFontMap; 64 private import pango.PgLayout; 65 private import std.algorithm; 66 67 68 /** 69 * The base class for all widgets. 70 * 71 * `GtkWidget` is the base class all widgets in GTK derive from. It manages the 72 * widget lifecycle, layout, states and style. 73 * 74 * ### Height-for-width Geometry Management 75 * 76 * GTK uses a height-for-width (and width-for-height) geometry management 77 * system. Height-for-width means that a widget can change how much 78 * vertical space it needs, depending on the amount of horizontal space 79 * that it is given (and similar for width-for-height). The most common 80 * example is a label that reflows to fill up the available width, wraps 81 * to fewer lines, and therefore needs less height. 82 * 83 * Height-for-width geometry management is implemented in GTK by way 84 * of two virtual methods: 85 * 86 * - [vfunc@Gtk.Widget.get_request_mode] 87 * - [vfunc@Gtk.Widget.measure] 88 * 89 * There are some important things to keep in mind when implementing 90 * height-for-width and when using it in widget implementations. 91 * 92 * If you implement a direct `GtkWidget` subclass that supports 93 * height-for-width or width-for-height geometry management for itself 94 * or its child widgets, the [vfunc@Gtk.Widget.get_request_mode] virtual 95 * function must be implemented as well and return the widget's preferred 96 * request mode. The default implementation of this virtual function 97 * returns %GTK_SIZE_REQUEST_CONSTANT_SIZE, which means that the widget will 98 * only ever get -1 passed as the for_size value to its 99 * [vfunc@Gtk.Widget.measure] implementation. 100 * 101 * The geometry management system will query a widget hierarchy in 102 * only one orientation at a time. When widgets are initially queried 103 * for their minimum sizes it is generally done in two initial passes 104 * in the [enum@Gtk.SizeRequestMode] chosen by the toplevel. 105 * 106 * For example, when queried in the normal %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH mode: 107 * 108 * First, the default minimum and natural width for each widget 109 * in the interface will be computed using [id@gtk_widget_measure] with an 110 * orientation of %GTK_ORIENTATION_HORIZONTAL and a for_size of -1. 111 * Because the preferred widths for each widget depend on the preferred 112 * widths of their children, this information propagates up the hierarchy, 113 * and finally a minimum and natural width is determined for the entire 114 * toplevel. Next, the toplevel will use the minimum width to query for the 115 * minimum height contextual to that width using [id@gtk_widget_measure] with an 116 * orientation of %GTK_ORIENTATION_VERTICAL and a for_size of the just computed 117 * width. This will also be a highly recursive operation. The minimum height 118 * for the minimum width is normally used to set the minimum size constraint 119 * on the toplevel. 120 * 121 * After the toplevel window has initially requested its size in both 122 * dimensions it can go on to allocate itself a reasonable size (or a size 123 * previously specified with [method@Gtk.Window.set_default_size]). During the 124 * recursive allocation process it’s important to note that request cycles 125 * will be recursively executed while widgets allocate their children. 126 * Each widget, once allocated a size, will go on to first share the 127 * space in one orientation among its children and then request each child's 128 * height for its target allocated width or its width for allocated height, 129 * depending. In this way a `GtkWidget` will typically be requested its size 130 * a number of times before actually being allocated a size. The size a 131 * widget is finally allocated can of course differ from the size it has 132 * requested. For this reason, `GtkWidget` caches a small number of results 133 * to avoid re-querying for the same sizes in one allocation cycle. 134 * 135 * If a widget does move content around to intelligently use up the 136 * allocated size then it must support the request in both 137 * `GtkSizeRequestMode`s even if the widget in question only 138 * trades sizes in a single orientation. 139 * 140 * For instance, a [class@Gtk.Label] that does height-for-width word wrapping 141 * will not expect to have [vfunc@Gtk.Widget.measure] with an orientation of 142 * %GTK_ORIENTATION_VERTICAL called because that call is specific to a 143 * width-for-height request. In this case the label must return the height 144 * required for its own minimum possible width. By following this rule any 145 * widget that handles height-for-width or width-for-height requests will 146 * always be allocated at least enough space to fit its own content. 147 * 148 * Here are some examples of how a %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH widget 149 * generally deals with width-for-height requests: 150 * 151 * ```c 152 * static void 153 * foo_widget_measure (GtkWidget *widget, 154 * GtkOrientation orientation, 155 * int for_size, 156 * int *minimum_size, 157 * int *natural_size, 158 * int *minimum_baseline, 159 * int *natural_baseline) 160 * { 161 * if (orientation == GTK_ORIENTATION_HORIZONTAL) 162 * { 163 * // Calculate minimum and natural width 164 * } 165 * else // VERTICAL 166 * { 167 * if (i_am_in_height_for_width_mode) 168 * { 169 * int min_width, dummy; 170 * 171 * // First, get the minimum width of our widget 172 * GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_HORIZONTAL, -1, 173 * &min_width, &dummy, &dummy, &dummy); 174 * 175 * // Now use the minimum width to retrieve the minimum and natural height to display 176 * // that width. 177 * GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_VERTICAL, min_width, 178 * minimum_size, natural_size, &dummy, &dummy); 179 * } 180 * else 181 * { 182 * // ... some widgets do both. 183 * } 184 * } 185 * } 186 * ``` 187 * 188 * Often a widget needs to get its own request during size request or 189 * allocation. For example, when computing height it may need to also 190 * compute width. Or when deciding how to use an allocation, the widget 191 * may need to know its natural size. In these cases, the widget should 192 * be careful to call its virtual methods directly, like in the code 193 * example above. 194 * 195 * It will not work to use the wrapper function [method@Gtk.Widget.measure] 196 * inside your own [vfunc@Gtk.Widget.size_allocate] implementation. 197 * These return a request adjusted by [class@Gtk.SizeGroup], the widget's 198 * align and expand flags, as well as its CSS style. 199 * 200 * If a widget used the wrappers inside its virtual method implementations, 201 * then the adjustments (such as widget margins) would be applied 202 * twice. GTK therefore does not allow this and will warn if you try 203 * to do it. 204 * 205 * Of course if you are getting the size request for another widget, such 206 * as a child widget, you must use [id@gtk_widget_measure]; otherwise, you 207 * would not properly consider widget margins, [class@Gtk.SizeGroup], and 208 * so forth. 209 * 210 * GTK also supports baseline vertical alignment of widgets. This 211 * means that widgets are positioned such that the typographical baseline of 212 * widgets in the same row are aligned. This happens if a widget supports 213 * baselines, has a vertical alignment of %GTK_ALIGN_BASELINE, and is inside 214 * a widget that supports baselines and has a natural “row” that it aligns to 215 * the baseline, or a baseline assigned to it by the grandparent. 216 * 217 * Baseline alignment support for a widget is also done by the 218 * [vfunc@Gtk.Widget.measure] virtual function. It allows you to report 219 * both a minimum and natural size. 220 * 221 * If a widget ends up baseline aligned it will be allocated all the space in 222 * the parent as if it was %GTK_ALIGN_FILL, but the selected baseline can be 223 * found via [id@gtk_widget_get_allocated_baseline]. If the baseline has a 224 * value other than -1 you need to align the widget such that the baseline 225 * appears at the position. 226 * 227 * ### GtkWidget as GtkBuildable 228 * 229 * The `GtkWidget` implementation of the `GtkBuildable` interface 230 * supports various custom elements to specify additional aspects of widgets 231 * that are not directly expressed as properties. 232 * 233 * If the widget uses a [class@Gtk.LayoutManager], `GtkWidget` supports 234 * a custom `<layout>` element, used to define layout properties: 235 * 236 * ```xml 237 * <object class="GtkGrid" id="my_grid"> 238 * <child> 239 * <object class="GtkLabel" id="label1"> 240 * <property name="label">Description</property> 241 * <layout> 242 * <property name="column">0</property> 243 * <property name="row">0</property> 244 * <property name="row-span">1</property> 245 * <property name="column-span">1</property> 246 * </layout> 247 * </object> 248 * </child> 249 * <child> 250 * <object class="GtkEntry" id="description_entry"> 251 * <layout> 252 * <property name="column">1</property> 253 * <property name="row">0</property> 254 * <property name="row-span">1</property> 255 * <property name="column-span">1</property> 256 * </layout> 257 * </object> 258 * </child> 259 * </object> 260 * ``` 261 * 262 * `GtkWidget` allows style information such as style classes to 263 * be associated with widgets, using the custom `<style>` element: 264 * 265 * ```xml 266 * <object class="GtkButton" id="button1"> 267 * <style> 268 * <class name="my-special-button-class"/> 269 * <class name="dark-button"/> 270 * </style> 271 * </object> 272 * ``` 273 * 274 * `GtkWidget` allows defining accessibility information, such as properties, 275 * relations, and states, using the custom `<accessibility>` element: 276 * 277 * ```xml 278 * <object class="GtkButton" id="button1"> 279 * <accessibility> 280 * <property name="label">Download</property> 281 * <relation name="labelled-by">label1</relation> 282 * </accessibility> 283 * </object> 284 * ``` 285 * 286 * ### Building composite widgets from template XML 287 * 288 * `GtkWidget `exposes some facilities to automate the procedure 289 * of creating composite widgets using "templates". 290 * 291 * To create composite widgets with `GtkBuilder` XML, one must associate 292 * the interface description with the widget class at class initialization 293 * time using [method@Gtk.WidgetClass.set_template]. 294 * 295 * The interface description semantics expected in composite template descriptions 296 * is slightly different from regular [class@Gtk.Builder] XML. 297 * 298 * Unlike regular interface descriptions, [method@Gtk.WidgetClass.set_template] will 299 * expect a `<template>` tag as a direct child of the toplevel `<interface>` 300 * tag. The `<template>` tag must specify the “class” attribute which must be 301 * the type name of the widget. Optionally, the “parent” attribute may be 302 * specified to specify the direct parent type of the widget type, this is 303 * ignored by `GtkBuilder` but required for UI design tools like 304 * [Glade](https://glade.gnome.org/) to introspect what kind of properties and 305 * internal children exist for a given type when the actual type does not exist. 306 * 307 * The XML which is contained inside the `<template>` tag behaves as if it were 308 * added to the `<object>` tag defining the widget itself. You may set properties 309 * on a widget by inserting `<property>` tags into the `<template>` tag, and also 310 * add `<child>` tags to add children and extend a widget in the normal way you 311 * would with `<object>` tags. 312 * 313 * Additionally, `<object>` tags can also be added before and after the initial 314 * `<template>` tag in the normal way, allowing one to define auxiliary objects 315 * which might be referenced by other widgets declared as children of the 316 * `<template>` tag. 317 * 318 * An example of a template definition: 319 * 320 * ```xml 321 * <interface> 322 * <template class="FooWidget" parent="GtkBox"> 323 * <property name="orientation">horizontal</property> 324 * <property name="spacing">4</property> 325 * <child> 326 * <object class="GtkButton" id="hello_button"> 327 * <property name="label">Hello World</property> 328 * <signal name="clicked" handler="hello_button_clicked" object="FooWidget" swapped="yes"/> 329 * </object> 330 * </child> 331 * <child> 332 * <object class="GtkButton" id="goodbye_button"> 333 * <property name="label">Goodbye World</property> 334 * </object> 335 * </child> 336 * </template> 337 * </interface> 338 * ``` 339 * 340 * Typically, you'll place the template fragment into a file that is 341 * bundled with your project, using `GResource`. In order to load the 342 * template, you need to call [method@Gtk.WidgetClass.set_template_from_resource] 343 * from the class initialization of your `GtkWidget` type: 344 * 345 * ```c 346 * static void 347 * foo_widget_class_init (FooWidgetClass *klass) 348 * { 349 * // ... 350 * 351 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 352 * "/com/example/ui/foowidget.ui"); 353 * } 354 * ``` 355 * 356 * You will also need to call [method@Gtk.Widget.init_template] from the 357 * instance initialization function: 358 * 359 * ```c 360 * static void 361 * foo_widget_init (FooWidget *self) 362 * { 363 * // ... 364 * gtk_widget_init_template (GTK_WIDGET (self)); 365 * } 366 * ``` 367 * 368 * You can access widgets defined in the template using the 369 * [id@gtk_widget_get_template_child] function, but you will typically declare 370 * a pointer in the instance private data structure of your type using the same 371 * name as the widget in the template definition, and call 372 * [method@Gtk.WidgetClass.bind_template_child_full] (or one of its wrapper macros 373 * [func@Gtk.widget_class_bind_template_child] and [func@Gtk.widget_class_bind_template_child_private]) 374 * with that name, e.g. 375 * 376 * ```c 377 * typedef struct { 378 * GtkWidget *hello_button; 379 * GtkWidget *goodbye_button; 380 * } FooWidgetPrivate; 381 * 382 * G_DEFINE_TYPE_WITH_PRIVATE (FooWidget, foo_widget, GTK_TYPE_BOX) 383 * 384 * static void 385 * foo_widget_class_init (FooWidgetClass *klass) 386 * { 387 * // ... 388 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 389 * "/com/example/ui/foowidget.ui"); 390 * gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), 391 * FooWidget, hello_button); 392 * gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), 393 * FooWidget, goodbye_button); 394 * } 395 * 396 * static void 397 * foo_widget_init (FooWidget *widget) 398 * { 399 * 400 * } 401 * ``` 402 * 403 * You can also use [method@Gtk.WidgetClass.bind_template_callback_full] (or 404 * is wrapper macro [func@Gtk.widget_class_bind_template_callback]) to connect 405 * a signal callback defined in the template with a function visible in the 406 * scope of the class, e.g. 407 * 408 * ```c 409 * // the signal handler has the instance and user data swapped 410 * // because of the swapped="yes" attribute in the template XML 411 * static void 412 * hello_button_clicked (FooWidget *self, 413 * GtkButton *button) 414 * { 415 * g_print ("Hello, world!\n"); 416 * } 417 * 418 * static void 419 * foo_widget_class_init (FooWidgetClass *klass) 420 * { 421 * // ... 422 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 423 * "/com/example/ui/foowidget.ui"); 424 * gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked); 425 * } 426 * ``` 427 */ 428 public class Widget : ObjectG, AccessibleIF, BuildableIF, ConstraintTargetIF 429 { 430 /** the main Gtk struct */ 431 protected GtkWidget* gtkWidget; 432 433 /** Get the main Gtk struct */ 434 public GtkWidget* getWidgetStruct(bool transferOwnership = false) 435 { 436 if (transferOwnership) 437 ownedRef = false; 438 return gtkWidget; 439 } 440 441 /** the main Gtk struct as a void* */ 442 protected override void* getStruct() 443 { 444 return cast(void*)gtkWidget; 445 } 446 447 /** 448 * Sets our main struct and passes it to the parent class. 449 */ 450 public this (GtkWidget* gtkWidget, bool ownedRef = false) 451 { 452 this.gtkWidget = gtkWidget; 453 super(cast(GObject*)gtkWidget, ownedRef); 454 } 455 456 // add the Accessible capabilities 457 mixin AccessibleT!(GtkWidget); 458 459 // add the Buildable capabilities 460 mixin BuildableT!(GtkWidget); 461 462 // add the ConstraintTarget capabilities 463 mixin ConstraintTargetT!(GtkWidget); 464 465 466 /** */ 467 public static GType getType() 468 { 469 return gtk_widget_get_type(); 470 } 471 472 /** 473 * Obtains the current default reading direction. 474 * 475 * See [func@Gtk.Widget.set_default_direction]. 476 * 477 * Returns: the current default direction. 478 */ 479 public static GtkTextDirection getDefaultDirection() 480 { 481 return gtk_widget_get_default_direction(); 482 } 483 484 /** 485 * Sets the default reading direction for widgets. 486 * 487 * See [method@Gtk.Widget.set_direction]. 488 * 489 * Params: 490 * dir = the new default direction. This cannot be %GTK_TEXT_DIR_NONE. 491 */ 492 public static void setDefaultDirection(GtkTextDirection dir) 493 { 494 gtk_widget_set_default_direction(dir); 495 } 496 497 /** 498 * Enable or disable an action installed with 499 * gtk_widget_class_install_action(). 500 * 501 * Params: 502 * actionName = action name, such as "clipboard.paste" 503 * enabled = whether the action is now enabled 504 */ 505 public void actionSetEnabled(string actionName, bool enabled) 506 { 507 gtk_widget_action_set_enabled(gtkWidget, Str.toStringz(actionName), enabled); 508 } 509 510 /** 511 * For widgets that can be “activated” (buttons, menu items, etc.) 512 * this function activates them. 513 * 514 * The activation will emit the signal set using 515 * gtk_widget_class_set_activate_signal() during class initialization. 516 * 517 * Activation is what happens when you press Enter on a widget during 518 * key navigation. 519 * 520 * If you wish to handle the activation keybinding yourself, it is 521 * recommended to use gtk_widget_class_add_shortcut() with an action 522 * created with gtk_signal_action_new(). 523 * 524 * If @widget isn't activatable, the function returns %FALSE. 525 * 526 * Returns: %TRUE if the widget was activatable 527 */ 528 public bool activate() 529 { 530 return gtk_widget_activate(gtkWidget) != 0; 531 } 532 533 /** 534 * Looks up the action in the action groups associated with 535 * @widget and its ancestors, and activates it. 536 * 537 * If the action is in an action group added with 538 * [method@Gtk.Widget.insert_action_group], the @name is expected 539 * to be prefixed with the prefix that was used when the group was 540 * inserted. 541 * 542 * The arguments must match the actions expected parameter type, 543 * as returned by `g_action_get_parameter_type()`. 544 * 545 * Params: 546 * name = the name of the action to activate 547 * args = parameters to use, or %NULL 548 * 549 * Returns: %TRUE if the action was activated, %FALSE if the 550 * action does not exist. 551 */ 552 public bool activateActionVariant(string name, Variant args) 553 { 554 return gtk_widget_activate_action_variant(gtkWidget, Str.toStringz(name), (args is null) ? null : args.getVariantStruct()) != 0; 555 } 556 557 /** 558 * Activates the `default.activate` action from @widget. 559 */ 560 public void activateDefault() 561 { 562 gtk_widget_activate_default(gtkWidget); 563 } 564 565 /** 566 * Adds @controller to @widget so that it will receive events. 567 * 568 * You will usually want to call this function right after 569 * creating any kind of [class@Gtk.EventController]. 570 * 571 * Params: 572 * controller = a #GtkEventController that hasn't been 573 * added to a widget yet 574 */ 575 public void addController(EventController controller) 576 { 577 gtk_widget_add_controller(gtkWidget, (controller is null) ? null : controller.getEventControllerStruct()); 578 } 579 580 /** 581 * Adds a style class to @widget. 582 * 583 * After calling this function, the widgets style will match 584 * for @css_class, according to CSS matching rules. 585 * 586 * Use [method@Gtk.Widget.remove_css_class] to remove the 587 * style again. 588 * 589 * Params: 590 * cssClass = The style class to add to @widget, without 591 * the leading '.' used for notation of style classes 592 */ 593 public void addCssClass(string cssClass) 594 { 595 gtk_widget_add_css_class(gtkWidget, Str.toStringz(cssClass)); 596 } 597 598 /** 599 * Adds a widget to the list of mnemonic labels for this widget. 600 * 601 * See [method@Gtk.Widget.list_mnemonic_labels]. Note the 602 * list of mnemonic labels for the widget is cleared when the 603 * widget is destroyed, so the caller must make sure to update 604 * its internal state at this point as well, by using a connection 605 * to the [signal@Gtk.Widget::destroy] signal or a weak notifier. 606 * 607 * Params: 608 * label = a `GtkWidget` that acts as a mnemonic label for @widget 609 */ 610 public void addMnemonicLabel(Widget label) 611 { 612 gtk_widget_add_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 613 } 614 615 /** 616 * Queues an animation frame update and adds a callback to be called 617 * before each frame. 618 * 619 * Until the tick callback is removed, it will be called frequently 620 * (usually at the frame rate of the output device or as quickly as 621 * the application can be repainted, whichever is slower). For this 622 * reason, is most suitable for handling graphics that change every 623 * frame or every few frames. The tick callback does not automatically 624 * imply a relayout or repaint. If you want a repaint or relayout, and 625 * aren’t changing widget properties that would trigger that (for example, 626 * changing the text of a #GtkLabel), then you will have to call 627 * [method@Gtk.Widget.queue_resize] or [method@Gtk.Widget.queue_draw] 628 * yourself. 629 * 630 * [method@Gdk.FrameClock.get_frame_time] should generally be used 631 * for timing continuous animations and 632 * [method@Gdk.FrameTimings.get_predicted_presentation_time] if you are 633 * trying to display isolated frames at particular times. 634 * 635 * This is a more convenient alternative to connecting directly to the 636 * [signal@Gdk.FrameClock::update] signal of `GdkFrameClock`, since you 637 * don't have to worry about when a `GdkFrameClock` is assigned to a widget. 638 * 639 * Params: 640 * callback = function to call for updating animations 641 * userData = data to pass to @callback 642 * notify = function to call to free @user_data when the callback is removed. 643 * 644 * Returns: an id for the connection of this callback. Remove the callback 645 * by passing the id returned from this function to 646 * [method@Gtk.Widget.remove_tick_callback] 647 */ 648 public uint addTickCallback(GtkTickCallback callback, void* userData, GDestroyNotify notify) 649 { 650 return gtk_widget_add_tick_callback(gtkWidget, callback, userData, notify); 651 } 652 653 /** 654 * This function is only used by `GtkWidget` subclasses, to 655 * assign a size, position and (optionally) baseline to their 656 * child widgets. 657 * 658 * In this function, the allocation and baseline may be adjusted. 659 * The given allocation will be forced to be bigger than the 660 * widget's minimum size, as well as at least 0×0 in size. 661 * 662 * For a version that does not take a transform, see 663 * [method@Gtk.Widget.size_allocate]. 664 * 665 * Params: 666 * width = New width of @widget 667 * height = New height of @widget 668 * baseline = New baseline of @widget, or -1 669 * transform = Transformation to be applied to @widget 670 */ 671 public void allocate(int width, int height, int baseline, Transform transform) 672 { 673 gtk_widget_allocate(gtkWidget, width, height, baseline, (transform is null) ? null : transform.getTransformStruct(true)); 674 } 675 676 /** 677 * Called by widgets as the user moves around the window using 678 * keyboard shortcuts. 679 * 680 * The @direction argument indicates what kind of motion is taking place (up, 681 * down, left, right, tab forward, tab backward). 682 * 683 * This function calls the [vfunc@Gtk.Widget.focus] virtual function; widgets 684 * can override the virtual function in order to implement appropriate focus 685 * behavior. 686 * 687 * The default `focus()` virtual function for a widget should return `TRUE` if 688 * moving in @direction left the focus on a focusable location inside that 689 * widget, and `FALSE` if moving in @direction moved the focus outside the 690 * widget. When returning `TRUE`, widgets normallycall [method@Gtk.Widget.grab_focus] 691 * to place the focus accordingly; when returning `FALSE`, they don’t modify 692 * the current focus location. 693 * 694 * This function is used by custom widget implementations; if you're 695 * writing an app, you’d use [method@Gtk.Widget.grab_focus] to move 696 * the focus to a particular widget. 697 * 698 * Params: 699 * direction = direction of focus movement 700 * 701 * Returns: %TRUE if focus ended up inside @widget 702 */ 703 public bool childFocus(GtkDirectionType direction) 704 { 705 return gtk_widget_child_focus(gtkWidget, direction) != 0; 706 } 707 708 /** 709 * Computes the bounds for @widget in the coordinate space of @target. 710 * 711 * FIXME: Explain what "bounds" are. 712 * 713 * If the operation is successful, %TRUE is returned. If @widget has no 714 * bounds or the bounds cannot be expressed in @target's coordinate space 715 * (for example if both widgets are in different windows), %FALSE is 716 * returned and @bounds is set to the zero rectangle. 717 * 718 * It is valid for @widget and @target to be the same widget. 719 * 720 * Params: 721 * target = the `GtkWidget` 722 * outBounds = the rectangle taking the bounds 723 * 724 * Returns: %TRUE if the bounds could be computed 725 */ 726 public bool computeBounds(Widget target, out Rect outBounds) 727 { 728 graphene_rect_t* outoutBounds = sliceNew!graphene_rect_t(); 729 730 auto __p = gtk_widget_compute_bounds(gtkWidget, (target is null) ? null : target.getWidgetStruct(), outoutBounds) != 0; 731 732 outBounds = ObjectG.getDObject!(Rect)(outoutBounds, true); 733 734 return __p; 735 } 736 737 /** 738 * Computes whether a container should give this widget 739 * extra space when possible. 740 * 741 * Containers should check this, rather than looking at 742 * [method@Gtk.Widget.get_hexpand] or [method@Gtk.Widget.get_vexpand]. 743 * 744 * This function already checks whether the widget is visible, so 745 * visibility does not need to be checked separately. Non-visible 746 * widgets are not expanded. 747 * 748 * The computed expand value uses either the expand setting explicitly 749 * set on the widget itself, or, if none has been explicitly set, 750 * the widget may expand if some of its children do. 751 * 752 * Params: 753 * orientation = expand direction 754 * 755 * Returns: whether widget tree rooted here should be expanded 756 */ 757 public bool computeExpand(GtkOrientation orientation) 758 { 759 return gtk_widget_compute_expand(gtkWidget, orientation) != 0; 760 } 761 762 /** 763 * Translates the given @point in @widget's coordinates to coordinates 764 * relative to @target’s coordinate system. 765 * 766 * In order to perform this operation, both widgets must share a 767 * common ancestor. 768 * 769 * Params: 770 * target = the `GtkWidget` to transform into 771 * point = a point in @widget's coordinate system 772 * outPoint = Set to the corresponding coordinates in 773 * @target's coordinate system 774 * 775 * Returns: %TRUE if the point could be determined, %FALSE on failure. 776 * In this case, 0 is stored in @out_point. 777 */ 778 public bool computePoint(Widget target, Point point, out Point outPoint) 779 { 780 graphene_point_t* outoutPoint = sliceNew!graphene_point_t(); 781 782 auto __p = gtk_widget_compute_point(gtkWidget, (target is null) ? null : target.getWidgetStruct(), (point is null) ? null : point.getPointStruct(), outoutPoint) != 0; 783 784 outPoint = ObjectG.getDObject!(Point)(outoutPoint, true); 785 786 return __p; 787 } 788 789 /** 790 * Computes a matrix suitable to describe a transformation from 791 * @widget's coordinate system into @target's coordinate system. 792 * 793 * Params: 794 * target = the target widget that the matrix will transform to 795 * outTransform = location to 796 * store the final transformation 797 * 798 * Returns: %TRUE if the transform could be computed, %FALSE otherwise. 799 * The transform can not be computed in certain cases, for example when 800 * @widget and @target do not share a common ancestor. In that 801 * case @out_transform gets set to the identity matrix. 802 */ 803 public bool computeTransform(Widget target, out Matrix outTransform) 804 { 805 graphene_matrix_t* outoutTransform = sliceNew!graphene_matrix_t(); 806 807 auto __p = gtk_widget_compute_transform(gtkWidget, (target is null) ? null : target.getWidgetStruct(), outoutTransform) != 0; 808 809 outTransform = ObjectG.getDObject!(Matrix)(outoutTransform, true); 810 811 return __p; 812 } 813 814 /** 815 * Tests if the point at (@x, @y) is contained in @widget. 816 * 817 * The coordinates for (@x, @y) must be in widget coordinates, so 818 * (0, 0) is assumed to be the top left of @widget's content area. 819 * 820 * Params: 821 * x = X coordinate to test, relative to @widget's origin 822 * y = Y coordinate to test, relative to @widget's origin 823 * 824 * Returns: %TRUE if @widget contains (@x, @y). 825 */ 826 public bool contains(double x, double y) 827 { 828 return gtk_widget_contains(gtkWidget, x, y) != 0; 829 } 830 831 /** 832 * Creates a new `PangoContext` with the appropriate font map, 833 * font options, font description, and base direction for drawing 834 * text for this widget. 835 * 836 * See also [method@Gtk.Widget.get_pango_context]. 837 * 838 * Returns: the new `PangoContext` 839 */ 840 public PgContext createPangoContext() 841 { 842 auto __p = gtk_widget_create_pango_context(gtkWidget); 843 844 if(__p is null) 845 { 846 return null; 847 } 848 849 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) __p, true); 850 } 851 852 /** 853 * Creates a new `PangoLayout` with the appropriate font map, 854 * font description, and base direction for drawing text for 855 * this widget. 856 * 857 * If you keep a `PangoLayout` created in this way around, 858 * you need to re-create it when the widget `PangoContext` 859 * is replaced. This can be tracked by listening to changes 860 * of the [property@Gtk.Widget:root] property on the widget. 861 * 862 * Params: 863 * text = text to set on the layout (can be %NULL) 864 * 865 * Returns: the new `PangoLayout` 866 */ 867 public PgLayout createPangoLayout(string text) 868 { 869 auto __p = gtk_widget_create_pango_layout(gtkWidget, Str.toStringz(text)); 870 871 if(__p is null) 872 { 873 return null; 874 } 875 876 return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) __p, true); 877 } 878 879 /** 880 * Checks to see if a drag movement has passed the GTK drag threshold. 881 * 882 * Params: 883 * startX = X coordinate of start of drag 884 * startY = Y coordinate of start of drag 885 * currentX = current X coordinate 886 * currentY = current Y coordinate 887 * 888 * Returns: %TRUE if the drag threshold has been passed. 889 */ 890 public bool dragCheckThreshold(int startX, int startY, int currentX, int currentY) 891 { 892 return gtk_drag_check_threshold(gtkWidget, startX, startY, currentX, currentY) != 0; 893 } 894 895 /** 896 * Notifies the user about an input-related error on this widget. 897 * 898 * If the [property@Gtk.Settings:gtk-error-bell] setting is %TRUE, 899 * it calls [method@Gdk.Surface.beep], otherwise it does nothing. 900 * 901 * Note that the effect of [method@Gdk.Surface.beep] can be configured 902 * in many ways, depending on the windowing backend and the desktop 903 * environment or window manager that is used. 904 */ 905 public void errorBell() 906 { 907 gtk_widget_error_bell(gtkWidget); 908 } 909 910 /** 911 * Returns the baseline that has currently been allocated to @widget. 912 * 913 * This function is intended to be used when implementing handlers 914 * for the `GtkWidget`Class.snapshot() function, and when allocating 915 * child widgets in `GtkWidget`Class.size_allocate(). 916 * 917 * Returns: the baseline of the @widget, or -1 if none 918 */ 919 public int getAllocatedBaseline() 920 { 921 return gtk_widget_get_allocated_baseline(gtkWidget); 922 } 923 924 /** 925 * Returns the height that has currently been allocated to @widget. 926 * 927 * Returns: the height of the @widget 928 */ 929 public int getAllocatedHeight() 930 { 931 return gtk_widget_get_allocated_height(gtkWidget); 932 } 933 934 /** 935 * Returns the width that has currently been allocated to @widget. 936 * 937 * Returns: the width of the @widget 938 */ 939 public int getAllocatedWidth() 940 { 941 return gtk_widget_get_allocated_width(gtkWidget); 942 } 943 944 /** 945 * Retrieves the widget’s allocation. 946 * 947 * Note, when implementing a layout container: a widget’s allocation 948 * will be its “adjusted” allocation, that is, the widget’s parent 949 * typically calls [method@Gtk.Widget.size_allocate] with an allocation, 950 * and that allocation is then adjusted (to handle margin 951 * and alignment for example) before assignment to the widget. 952 * [method@Gtk.Widget.get_allocation] returns the adjusted allocation that 953 * was actually assigned to the widget. The adjusted allocation is 954 * guaranteed to be completely contained within the 955 * [method@Gtk.Widget.size_allocate] allocation, however. 956 * 957 * So a layout container is guaranteed that its children stay inside 958 * the assigned bounds, but not that they have exactly the bounds the 959 * container assigned. 960 * 961 * Params: 962 * allocation = a pointer to a `GtkAllocation` to copy to 963 */ 964 public void getAllocation(out GtkAllocation allocation) 965 { 966 gtk_widget_get_allocation(gtkWidget, &allocation); 967 } 968 969 /** 970 * Gets the first ancestor of @widget with type @widget_type. 971 * 972 * For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` 973 * gets the first `GtkBox` that’s an ancestor of @widget. No 974 * reference will be added to the returned widget; it should 975 * not be unreferenced. 976 * 977 * Note that unlike [method@Gtk.Widget.is_ancestor], this function 978 * considers @widget to be an ancestor of itself. 979 * 980 * Params: 981 * widgetType = ancestor type 982 * 983 * Returns: the ancestor widget, 984 * or %NULL if not found 985 */ 986 public Widget getAncestor(GType widgetType) 987 { 988 auto __p = gtk_widget_get_ancestor(gtkWidget, widgetType); 989 990 if(__p is null) 991 { 992 return null; 993 } 994 995 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 996 } 997 998 /** 999 * Determines whether the input focus can enter @widget or any 1000 * of its children. 1001 * 1002 * See [method@Gtk.Widget.set_focusable]. 1003 * 1004 * Returns: %TRUE if the input focus can enter @widget, %FALSE otherwise 1005 */ 1006 public bool getCanFocus() 1007 { 1008 return gtk_widget_get_can_focus(gtkWidget) != 0; 1009 } 1010 1011 /** 1012 * Queries whether @widget can be the target of pointer events. 1013 * 1014 * Returns: %TRUE if @widget can receive pointer events 1015 */ 1016 public bool getCanTarget() 1017 { 1018 return gtk_widget_get_can_target(gtkWidget) != 0; 1019 } 1020 1021 /** 1022 * Gets the value set with gtk_widget_set_child_visible(). 1023 * 1024 * If you feel a need to use this function, your code probably 1025 * needs reorganization. 1026 * 1027 * This function is only useful for container implementations 1028 * and should never be called by an application. 1029 * 1030 * Returns: %TRUE if the widget is mapped with the parent. 1031 */ 1032 public bool getChildVisible() 1033 { 1034 return gtk_widget_get_child_visible(gtkWidget) != 0; 1035 } 1036 1037 /** 1038 * Gets the clipboard object for @widget. 1039 * 1040 * This is a utility function to get the clipboard object for the 1041 * `GdkDisplay` that @widget is using. 1042 * 1043 * Note that this function always works, even when @widget is not 1044 * realized yet. 1045 * 1046 * Returns: the appropriate clipboard object. 1047 */ 1048 public Clipboard getClipboard() 1049 { 1050 auto __p = gtk_widget_get_clipboard(gtkWidget); 1051 1052 if(__p is null) 1053 { 1054 return null; 1055 } 1056 1057 return ObjectG.getDObject!(Clipboard)(cast(GdkClipboard*) __p); 1058 } 1059 1060 /** 1061 * Returns the list of style classes applied to @widget. 1062 * 1063 * Returns: a %NULL-terminated list of 1064 * css classes currently applied to @widget. The returned 1065 * list can be freed using g_strfreev(). 1066 */ 1067 public string[] getCssClasses() 1068 { 1069 auto retStr = gtk_widget_get_css_classes(gtkWidget); 1070 1071 scope(exit) Str.freeStringArray(retStr); 1072 return Str.toStringArray(retStr); 1073 } 1074 1075 /** 1076 * Returns the CSS name that is used for @self. 1077 * 1078 * Returns: the CSS name 1079 */ 1080 public string getCssName() 1081 { 1082 return Str.toString(gtk_widget_get_css_name(gtkWidget)); 1083 } 1084 1085 /** 1086 * Queries the cursor set on @widget. 1087 * 1088 * See [method@Gtk.Widget.set_cursor] for details. 1089 * 1090 * Returns: the cursor 1091 * currently in use or %NULL to use the default. 1092 */ 1093 public Cursor getCursor() 1094 { 1095 auto __p = gtk_widget_get_cursor(gtkWidget); 1096 1097 if(__p is null) 1098 { 1099 return null; 1100 } 1101 1102 return ObjectG.getDObject!(Cursor)(cast(GdkCursor*) __p); 1103 } 1104 1105 /** 1106 * Gets the reading direction for a particular widget. 1107 * 1108 * See [method@Gtk.Widget.set_direction]. 1109 * 1110 * Returns: the reading direction for the widget. 1111 */ 1112 public GtkTextDirection getDirection() 1113 { 1114 return gtk_widget_get_direction(gtkWidget); 1115 } 1116 1117 /** 1118 * Get the `GdkDisplay` for the toplevel window associated with 1119 * this widget. 1120 * 1121 * This function can only be called after the widget has been 1122 * added to a widget hierarchy with a `GtkWindow` at the top. 1123 * 1124 * In general, you should only create display specific 1125 * resources when a widget has been realized, and you should 1126 * free those resources when the widget is unrealized. 1127 * 1128 * Returns: the `GdkDisplay` for the toplevel 1129 * for this widget. 1130 */ 1131 public Display getDisplay() 1132 { 1133 auto __p = gtk_widget_get_display(gtkWidget); 1134 1135 if(__p is null) 1136 { 1137 return null; 1138 } 1139 1140 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p); 1141 } 1142 1143 /** 1144 * Returns the widgets first child. 1145 * 1146 * This API is primarily meant for widget implementations. 1147 * 1148 * Returns: The widget's first child 1149 */ 1150 public Widget getFirstChild() 1151 { 1152 auto __p = gtk_widget_get_first_child(gtkWidget); 1153 1154 if(__p is null) 1155 { 1156 return null; 1157 } 1158 1159 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1160 } 1161 1162 /** 1163 * Returns the current focus child of @widget. 1164 * 1165 * Returns: The current focus 1166 * child of @widget, or %NULL in case the focus child is unset. 1167 */ 1168 public Widget getFocusChild() 1169 { 1170 auto __p = gtk_widget_get_focus_child(gtkWidget); 1171 1172 if(__p is null) 1173 { 1174 return null; 1175 } 1176 1177 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1178 } 1179 1180 /** 1181 * Returns whether the widget should grab focus when it is clicked 1182 * with the mouse. 1183 * 1184 * See [method@Gtk.Widget.set_focus_on_click]. 1185 * 1186 * Returns: %TRUE if the widget should grab focus when it is 1187 * clicked with the mouse 1188 */ 1189 public bool getFocusOnClick() 1190 { 1191 return gtk_widget_get_focus_on_click(gtkWidget) != 0; 1192 } 1193 1194 /** 1195 * Determines whether @widget can own the input focus. 1196 * 1197 * See [method@Gtk.Widget.set_focusable]. 1198 * 1199 * Returns: %TRUE if @widget can own the input focus, %FALSE otherwise 1200 */ 1201 public bool getFocusable() 1202 { 1203 return gtk_widget_get_focusable(gtkWidget) != 0; 1204 } 1205 1206 /** 1207 * Gets the font map of @widget. 1208 * 1209 * See [method@Gtk.Widget.set_font_map]. 1210 * 1211 * Returns: A `PangoFontMap`, or %NULL 1212 */ 1213 public PgFontMap getFontMap() 1214 { 1215 auto __p = gtk_widget_get_font_map(gtkWidget); 1216 1217 if(__p is null) 1218 { 1219 return null; 1220 } 1221 1222 return ObjectG.getDObject!(PgFontMap)(cast(PangoFontMap*) __p); 1223 } 1224 1225 /** 1226 * Returns the `cairo_font_options_t` used for Pango rendering. 1227 * 1228 * When not set, the defaults font options for the `GdkDisplay` 1229 * will be used. 1230 * 1231 * Returns: the `cairo_font_options_t` 1232 * or %NULL if not set 1233 */ 1234 public FontOption getFontOptions() 1235 { 1236 auto __p = gtk_widget_get_font_options(gtkWidget); 1237 1238 if(__p is null) 1239 { 1240 return null; 1241 } 1242 1243 return new FontOption(cast(cairo_font_options_t*) __p); 1244 } 1245 1246 /** 1247 * Obtains the frame clock for a widget. 1248 * 1249 * The frame clock is a global “ticker” that can be used to drive 1250 * animations and repaints. The most common reason to get the frame 1251 * clock is to call [method@Gdk.FrameClock.get_frame_time], in order 1252 * to get a time to use for animating. For example you might record 1253 * the start of the animation with an initial value from 1254 * [method@Gdk.FrameClock.get_frame_time], and then update the animation 1255 * by calling [method@Gdk.FrameClock.get_frame_time] again during each repaint. 1256 * 1257 * [method@Gdk.FrameClock.request_phase] will result in a new frame on the 1258 * clock, but won’t necessarily repaint any widgets. To repaint a 1259 * widget, you have to use [method@Gtk.Widget.queue_draw] which invalidates 1260 * the widget (thus scheduling it to receive a draw on the next 1261 * frame). gtk_widget_queue_draw() will also end up requesting a frame 1262 * on the appropriate frame clock. 1263 * 1264 * A widget’s frame clock will not change while the widget is 1265 * mapped. Reparenting a widget (which implies a temporary unmap) can 1266 * change the widget’s frame clock. 1267 * 1268 * Unrealized widgets do not have a frame clock. 1269 * 1270 * Returns: a `GdkFrameClock`, 1271 * or %NULL if widget is unrealized 1272 */ 1273 public FrameClock getFrameClock() 1274 { 1275 auto __p = gtk_widget_get_frame_clock(gtkWidget); 1276 1277 if(__p is null) 1278 { 1279 return null; 1280 } 1281 1282 return ObjectG.getDObject!(FrameClock)(cast(GdkFrameClock*) __p); 1283 } 1284 1285 /** 1286 * Gets the horizontal alignment of @widget. 1287 * 1288 * For backwards compatibility reasons this method will never return 1289 * %GTK_ALIGN_BASELINE, but instead it will convert it to 1290 * %GTK_ALIGN_FILL. Baselines are not supported for horizontal 1291 * alignment. 1292 * 1293 * Returns: the horizontal alignment of @widget 1294 */ 1295 public GtkAlign getHalign() 1296 { 1297 return gtk_widget_get_halign(gtkWidget); 1298 } 1299 1300 /** 1301 * Returns the current value of the `has-tooltip` property. 1302 * 1303 * Returns: current value of `has-tooltip` on @widget. 1304 */ 1305 public bool getHasTooltip() 1306 { 1307 return gtk_widget_get_has_tooltip(gtkWidget) != 0; 1308 } 1309 1310 /** 1311 * Returns the content height of the widget. 1312 * 1313 * This function returns the size passed to its 1314 * size-allocate implementation, which is the size you 1315 * should be using in GtkWidgetClass.snapshot(). 1316 * 1317 * For pointer events, see [method@Gtk.Widget.contains]. 1318 * 1319 * Returns: The height of @widget 1320 */ 1321 public int getHeight() 1322 { 1323 return gtk_widget_get_height(gtkWidget); 1324 } 1325 1326 /** 1327 * Gets whether the widget would like any available extra horizontal 1328 * space. 1329 * 1330 * When a user resizes a `GtkWindow`, widgets with expand=TRUE 1331 * generally receive the extra space. For example, a list or 1332 * scrollable area or document in your window would often be set to 1333 * expand. 1334 * 1335 * Containers should use [method@Gtk.Widget.compute_expand] rather 1336 * than this function, to see whether a widget, or any of its children, 1337 * has the expand flag set. If any child of a widget wants to 1338 * expand, the parent may ask to expand also. 1339 * 1340 * This function only looks at the widget’s own hexpand flag, rather 1341 * than computing whether the entire widget tree rooted at this widget 1342 * wants to expand. 1343 * 1344 * Returns: whether hexpand flag is set 1345 */ 1346 public bool getHexpand() 1347 { 1348 return gtk_widget_get_hexpand(gtkWidget) != 0; 1349 } 1350 1351 /** 1352 * Gets whether gtk_widget_set_hexpand() has been used 1353 * to explicitly set the expand flag on this widget. 1354 * 1355 * If [property@Gtk.Widget:hexpand] property is set, then it 1356 * overrides any computed expand value based on child widgets. 1357 * If `hexpand` is not set, then the expand value depends on 1358 * whether any children of the widget would like to expand. 1359 * 1360 * There are few reasons to use this function, but it’s here 1361 * for completeness and consistency. 1362 * 1363 * Returns: whether hexpand has been explicitly set 1364 */ 1365 public bool getHexpandSet() 1366 { 1367 return gtk_widget_get_hexpand_set(gtkWidget) != 0; 1368 } 1369 1370 /** 1371 * Returns the widgets last child. 1372 * 1373 * This API is primarily meant for widget implementations. 1374 * 1375 * Returns: The widget's last child 1376 */ 1377 public Widget getLastChild() 1378 { 1379 auto __p = gtk_widget_get_last_child(gtkWidget); 1380 1381 if(__p is null) 1382 { 1383 return null; 1384 } 1385 1386 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1387 } 1388 1389 /** 1390 * Retrieves the layout manager used by @widget 1391 * 1392 * See [method@Gtk.Widget.set_layout_manager]. 1393 * 1394 * Returns: a `GtkLayoutManager` 1395 */ 1396 public LayoutManager getLayoutManager() 1397 { 1398 auto __p = gtk_widget_get_layout_manager(gtkWidget); 1399 1400 if(__p is null) 1401 { 1402 return null; 1403 } 1404 1405 return ObjectG.getDObject!(LayoutManager)(cast(GtkLayoutManager*) __p); 1406 } 1407 1408 /** 1409 * Whether the widget is mapped. 1410 * 1411 * Returns: %TRUE if the widget is mapped, %FALSE otherwise. 1412 */ 1413 public bool getMapped() 1414 { 1415 return gtk_widget_get_mapped(gtkWidget) != 0; 1416 } 1417 1418 /** 1419 * Gets the bottom margin of @widget. 1420 * 1421 * Returns: The bottom margin of @widget 1422 */ 1423 public int getMarginBottom() 1424 { 1425 return gtk_widget_get_margin_bottom(gtkWidget); 1426 } 1427 1428 /** 1429 * Gets the end margin of @widget. 1430 * 1431 * Returns: The end margin of @widget 1432 */ 1433 public int getMarginEnd() 1434 { 1435 return gtk_widget_get_margin_end(gtkWidget); 1436 } 1437 1438 /** 1439 * Gets the start margin of @widget. 1440 * 1441 * Returns: The start margin of @widget 1442 */ 1443 public int getMarginStart() 1444 { 1445 return gtk_widget_get_margin_start(gtkWidget); 1446 } 1447 1448 /** 1449 * Gets the top margin of @widget. 1450 * 1451 * Returns: The top margin of @widget 1452 */ 1453 public int getMarginTop() 1454 { 1455 return gtk_widget_get_margin_top(gtkWidget); 1456 } 1457 1458 /** 1459 * Retrieves the name of a widget. 1460 * 1461 * See [method@Gtk.Widget.set_name] for the significance of widget names. 1462 * 1463 * Returns: name of the widget. This string is owned by GTK and 1464 * should not be modified or freed 1465 */ 1466 public string getName() 1467 { 1468 return Str.toString(gtk_widget_get_name(gtkWidget)); 1469 } 1470 1471 /** 1472 * Returns the `GtkNative` widget that contains @widget. 1473 * 1474 * This function will return %NULL if the widget is not 1475 * contained inside a widget tree with a native ancestor. 1476 * 1477 * `GtkNative` widgets will return themselves here. 1478 * 1479 * Returns: the `GtkNative` 1480 * widget of @widget, or %NULL 1481 */ 1482 public NativeIF getNative() 1483 { 1484 auto __p = gtk_widget_get_native(gtkWidget); 1485 1486 if(__p is null) 1487 { 1488 return null; 1489 } 1490 1491 return ObjectG.getDObject!(NativeIF)(cast(GtkNative*) __p); 1492 } 1493 1494 /** 1495 * Returns the widgets next sibling. 1496 * 1497 * This API is primarily meant for widget implementations. 1498 * 1499 * Returns: The widget's next sibling 1500 */ 1501 public Widget getNextSibling() 1502 { 1503 auto __p = gtk_widget_get_next_sibling(gtkWidget); 1504 1505 if(__p is null) 1506 { 1507 return null; 1508 } 1509 1510 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1511 } 1512 1513 /** 1514 * #Fetches the requested opacity for this widget. 1515 * 1516 * See [method@Gtk.Widget.set_opacity]. 1517 * 1518 * Returns: the requested opacity for this widget. 1519 */ 1520 public double getOpacity() 1521 { 1522 return gtk_widget_get_opacity(gtkWidget); 1523 } 1524 1525 /** 1526 * Returns the widgets overflow value. 1527 * 1528 * Returns: The widget's overflow. 1529 */ 1530 public GtkOverflow getOverflow() 1531 { 1532 return gtk_widget_get_overflow(gtkWidget); 1533 } 1534 1535 /** 1536 * Gets a `PangoContext` with the appropriate font map, font description, 1537 * and base direction for this widget. 1538 * 1539 * Unlike the context returned by [method@Gtk.Widget.create_pango_context], 1540 * this context is owned by the widget (it can be used until the screen 1541 * for the widget changes or the widget is removed from its toplevel), 1542 * and will be updated to match any changes to the widget’s attributes. 1543 * This can be tracked by listening to changes of the 1544 * [property@Gtk.Widget:root] property on the widget. 1545 * 1546 * Returns: the `PangoContext` for the widget. 1547 */ 1548 public PgContext getPangoContext() 1549 { 1550 auto __p = gtk_widget_get_pango_context(gtkWidget); 1551 1552 if(__p is null) 1553 { 1554 return null; 1555 } 1556 1557 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) __p); 1558 } 1559 1560 /** 1561 * Returns the parent widget of @widget. 1562 * 1563 * Returns: the parent widget of @widget, 1564 * or %NULL 1565 */ 1566 public Widget getParent() 1567 { 1568 auto __p = gtk_widget_get_parent(gtkWidget); 1569 1570 if(__p is null) 1571 { 1572 return null; 1573 } 1574 1575 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1576 } 1577 1578 /** 1579 * Retrieves the minimum and natural size of a widget, taking 1580 * into account the widget’s preference for height-for-width management. 1581 * 1582 * This is used to retrieve a suitable size by container widgets which do 1583 * not impose any restrictions on the child placement. It can be used 1584 * to deduce toplevel window and menu sizes as well as child widgets in 1585 * free-form containers such as `GtkFixed`. 1586 * 1587 * Handle with care. Note that the natural height of a height-for-width 1588 * widget will generally be a smaller size than the minimum height, since 1589 * the required height for the natural width is generally smaller than the 1590 * required height for the minimum width. 1591 * 1592 * Use [id@gtk_widget_measure] if you want to support baseline alignment. 1593 * 1594 * Params: 1595 * minimumSize = location for storing the minimum size, or %NULL 1596 * naturalSize = location for storing the natural size, or %NULL 1597 */ 1598 public void getPreferredSize(out Requisition minimumSize, out Requisition naturalSize) 1599 { 1600 GtkRequisition* outminimumSize = sliceNew!GtkRequisition(); 1601 GtkRequisition* outnaturalSize = sliceNew!GtkRequisition(); 1602 1603 gtk_widget_get_preferred_size(gtkWidget, outminimumSize, outnaturalSize); 1604 1605 minimumSize = ObjectG.getDObject!(Requisition)(outminimumSize, true); 1606 naturalSize = ObjectG.getDObject!(Requisition)(outnaturalSize, true); 1607 } 1608 1609 /** 1610 * Returns the widgets previous sibling. 1611 * 1612 * This API is primarily meant for widget implementations. 1613 * 1614 * Returns: The widget's previous sibling 1615 */ 1616 public Widget getPrevSibling() 1617 { 1618 auto __p = gtk_widget_get_prev_sibling(gtkWidget); 1619 1620 if(__p is null) 1621 { 1622 return null; 1623 } 1624 1625 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1626 } 1627 1628 /** 1629 * Gets the primary clipboard of @widget. 1630 * 1631 * This is a utility function to get the primary clipboard object 1632 * for the `GdkDisplay` that @widget is using. 1633 * 1634 * Note that this function always works, even when @widget is not 1635 * realized yet. 1636 * 1637 * Returns: the appropriate clipboard object. 1638 */ 1639 public Clipboard getPrimaryClipboard() 1640 { 1641 auto __p = gtk_widget_get_primary_clipboard(gtkWidget); 1642 1643 if(__p is null) 1644 { 1645 return null; 1646 } 1647 1648 return ObjectG.getDObject!(Clipboard)(cast(GdkClipboard*) __p); 1649 } 1650 1651 /** 1652 * Determines whether @widget is realized. 1653 * 1654 * Returns: %TRUE if @widget is realized, %FALSE otherwise 1655 */ 1656 public bool getRealized() 1657 { 1658 return gtk_widget_get_realized(gtkWidget) != 0; 1659 } 1660 1661 /** 1662 * Determines whether @widget is always treated as the default widget 1663 * within its toplevel when it has the focus, even if another widget 1664 * is the default. 1665 * 1666 * See [method@Gtk.Widget.set_receives_default]. 1667 * 1668 * Returns: %TRUE if @widget acts as the default widget when focused, 1669 * %FALSE otherwise 1670 */ 1671 public bool getReceivesDefault() 1672 { 1673 return gtk_widget_get_receives_default(gtkWidget) != 0; 1674 } 1675 1676 /** 1677 * Gets whether the widget prefers a height-for-width layout 1678 * or a width-for-height layout. 1679 * 1680 * Single-child widgets generally propagate the preference of 1681 * their child, more complex widgets need to request something 1682 * either in context of their children or in context of their 1683 * allocation capabilities. 1684 * 1685 * Returns: The `GtkSizeRequestMode` preferred by @widget. 1686 */ 1687 public GtkSizeRequestMode getRequestMode() 1688 { 1689 return gtk_widget_get_request_mode(gtkWidget); 1690 } 1691 1692 /** 1693 * Returns the `GtkRoot` widget of @widget. 1694 * 1695 * This function will return %NULL if the widget is not contained 1696 * inside a widget tree with a root widget. 1697 * 1698 * `GtkRoot` widgets will return themselves here. 1699 * 1700 * Returns: the root widget of @widget, 1701 * or %NULL 1702 */ 1703 public RootIF getRoot() 1704 { 1705 auto __p = gtk_widget_get_root(gtkWidget); 1706 1707 if(__p is null) 1708 { 1709 return null; 1710 } 1711 1712 return ObjectG.getDObject!(RootIF)(cast(GtkRoot*) __p); 1713 } 1714 1715 /** 1716 * Retrieves the internal scale factor that maps from window 1717 * coordinates to the actual device pixels. 1718 * 1719 * On traditional systems this is 1, on high density outputs, 1720 * it can be a higher value (typically 2). 1721 * 1722 * See [method@Gdk.Surface.get_scale_factor]. 1723 * 1724 * Returns: the scale factor for @widget 1725 */ 1726 public int getScaleFactor() 1727 { 1728 return gtk_widget_get_scale_factor(gtkWidget); 1729 } 1730 1731 /** 1732 * Returns the widget’s sensitivity. 1733 * 1734 * This function returns the value that has been set using 1735 * [method@Gtk.Widget.set_sensitive]). 1736 * 1737 * The effective sensitivity of a widget is however determined 1738 * by both its own and its parent widget’s sensitivity. 1739 * See [method@Gtk.Widget.is_sensitive]. 1740 * 1741 * Returns: %TRUE if the widget is sensitive 1742 */ 1743 public bool getSensitive() 1744 { 1745 return gtk_widget_get_sensitive(gtkWidget) != 0; 1746 } 1747 1748 /** 1749 * Gets the settings object holding the settings used for this widget. 1750 * 1751 * Note that this function can only be called when the `GtkWidget` 1752 * is attached to a toplevel, since the settings object is specific 1753 * to a particular `GdkDisplay`. If you want to monitor the widget for 1754 * changes in its settings, connect to notify::display. 1755 * 1756 * Returns: the relevant #GtkSettings object 1757 */ 1758 public Settings getSettings() 1759 { 1760 auto __p = gtk_widget_get_settings(gtkWidget); 1761 1762 if(__p is null) 1763 { 1764 return null; 1765 } 1766 1767 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) __p); 1768 } 1769 1770 /** 1771 * Returns the content width or height of the widget. 1772 * 1773 * Which dimension is returned depends on @orientation. 1774 * 1775 * This is equivalent to calling [method@Gtk.Widget.get_width] 1776 * for %GTK_ORIENTATION_HORIZONTAL or [method@Gtk.Widget.get_height] 1777 * for %GTK_ORIENTATION_VERTICAL, but can be used when 1778 * writing orientation-independent code, such as when 1779 * implementing [iface@Gtk.Orientable] widgets. 1780 * 1781 * Params: 1782 * orientation = the orientation to query 1783 * 1784 * Returns: The size of @widget in @orientation. 1785 */ 1786 public int getSize(GtkOrientation orientation) 1787 { 1788 return gtk_widget_get_size(gtkWidget, orientation); 1789 } 1790 1791 /** 1792 * Gets the size request that was explicitly set for the widget using 1793 * gtk_widget_set_size_request(). 1794 * 1795 * A value of -1 stored in @width or @height indicates that that 1796 * dimension has not been set explicitly and the natural requisition 1797 * of the widget will be used instead. See 1798 * [method@Gtk.Widget.set_size_request]. To get the size a widget will 1799 * actually request, call [method@Gtk.Widget.measure] instead of 1800 * this function. 1801 * 1802 * Params: 1803 * width = return location for width, or %NULL 1804 * height = return location for height, or %NULL 1805 */ 1806 public void getSizeRequest(out int width, out int height) 1807 { 1808 gtk_widget_get_size_request(gtkWidget, &width, &height); 1809 } 1810 1811 /** 1812 * Returns the widget state as a flag set. 1813 * 1814 * It is worth mentioning that the effective %GTK_STATE_FLAG_INSENSITIVE 1815 * state will be returned, that is, also based on parent insensitivity, 1816 * even if @widget itself is sensitive. 1817 * 1818 * Also note that if you are looking for a way to obtain the 1819 * [flags@Gtk.StateFlags] to pass to a [class@Gtk.StyleContext] 1820 * method, you should look at [method@Gtk.StyleContext.get_state]. 1821 * 1822 * Returns: The state flags for widget 1823 */ 1824 public GtkStateFlags getStateFlags() 1825 { 1826 return gtk_widget_get_state_flags(gtkWidget); 1827 } 1828 1829 /** 1830 * Returns the style context associated to @widget. 1831 * 1832 * The returned object is guaranteed to be the same 1833 * for the lifetime of @widget. 1834 * 1835 * Returns: a `GtkStyleContext`. This memory 1836 * is owned by @widget and must not be freed. 1837 */ 1838 public StyleContext getStyleContext() 1839 { 1840 auto __p = gtk_widget_get_style_context(gtkWidget); 1841 1842 if(__p is null) 1843 { 1844 return null; 1845 } 1846 1847 return ObjectG.getDObject!(StyleContext)(cast(GtkStyleContext*) __p); 1848 } 1849 1850 /** 1851 * Fetch an object build from the template XML for @widget_type in 1852 * this @widget instance. 1853 * 1854 * This will only report children which were previously declared 1855 * with [method@Gtk.WidgetClass.bind_template_child_full] or one of its 1856 * variants. 1857 * 1858 * This function is only meant to be called for code which is private 1859 * to the @widget_type which declared the child and is meant for language 1860 * bindings which cannot easily make use of the GObject structure offsets. 1861 * 1862 * Params: 1863 * widgetType = The #GType to get a template child for 1864 * name = The “id” of the child defined in the template XML 1865 * 1866 * Returns: The object built in the template XML with 1867 * the id @name 1868 */ 1869 public ObjectG getTemplateChild(GType widgetType, string name) 1870 { 1871 auto __p = gtk_widget_get_template_child(gtkWidget, widgetType, Str.toStringz(name)); 1872 1873 if(__p is null) 1874 { 1875 return null; 1876 } 1877 1878 return ObjectG.getDObject!(ObjectG)(cast(GObject*) __p); 1879 } 1880 1881 /** 1882 * Gets the contents of the tooltip for @widget. 1883 * 1884 * If the tooltip has not been set using 1885 * [method@Gtk.Widget.set_tooltip_markup], this 1886 * function returns %NULL. 1887 * 1888 * Returns: the tooltip text 1889 */ 1890 public string getTooltipMarkup() 1891 { 1892 return Str.toString(gtk_widget_get_tooltip_markup(gtkWidget)); 1893 } 1894 1895 /** 1896 * Gets the contents of the tooltip for @widget. 1897 * 1898 * If the @widget's tooltip was set using 1899 * [method@Gtk.Widget.set_tooltip_markup], 1900 * this function will return the escaped text. 1901 * 1902 * Returns: the tooltip text 1903 */ 1904 public string getTooltipText() 1905 { 1906 return Str.toString(gtk_widget_get_tooltip_text(gtkWidget)); 1907 } 1908 1909 /** 1910 * Gets the vertical alignment of @widget. 1911 * 1912 * Returns: the vertical alignment of @widget 1913 */ 1914 public GtkAlign getValign() 1915 { 1916 return gtk_widget_get_valign(gtkWidget); 1917 } 1918 1919 /** 1920 * Gets whether the widget would like any available extra vertical 1921 * space. 1922 * 1923 * See [method@Gtk.Widget.get_hexpand] for more detail. 1924 * 1925 * Returns: whether vexpand flag is set 1926 */ 1927 public bool getVexpand() 1928 { 1929 return gtk_widget_get_vexpand(gtkWidget) != 0; 1930 } 1931 1932 /** 1933 * Gets whether gtk_widget_set_vexpand() has been used to 1934 * explicitly set the expand flag on this widget. 1935 * 1936 * See [method@Gtk.Widget.get_hexpand_set] for more detail. 1937 * 1938 * Returns: whether vexpand has been explicitly set 1939 */ 1940 public bool getVexpandSet() 1941 { 1942 return gtk_widget_get_vexpand_set(gtkWidget) != 0; 1943 } 1944 1945 /** 1946 * Determines whether the widget is visible. 1947 * 1948 * If you want to take into account whether the widget’s 1949 * parent is also marked as visible, use 1950 * [method@Gtk.Widget.is_visible] instead. 1951 * 1952 * This function does not check if the widget is 1953 * obscured in any way. 1954 * 1955 * See [method@Gtk.Widget.set_visible]. 1956 * 1957 * Returns: %TRUE if the widget is visible 1958 */ 1959 public bool getVisible() 1960 { 1961 return gtk_widget_get_visible(gtkWidget) != 0; 1962 } 1963 1964 /** 1965 * Returns the content width of the widget. 1966 * 1967 * This function returns the size passed to its 1968 * size-allocate implementation, which is the size you 1969 * should be using in GtkWidgetClass.snapshot(). 1970 * 1971 * For pointer events, see [method@Gtk.Widget.contains]. 1972 * 1973 * Returns: The width of @widget 1974 */ 1975 public int getWidth() 1976 { 1977 return gtk_widget_get_width(gtkWidget); 1978 } 1979 1980 /** 1981 * Causes @widget to have the keyboard focus for the `GtkWindow` it's inside. 1982 * 1983 * If @widget is not focusable, or its ::grab_focus implementation cannot 1984 * transfer the focus to a descendant of @widget that is focusable, it will 1985 * not take focus and %FALSE will be returned. 1986 * 1987 * Calling [method@Gtk.Widget.grab_focus] on an already focused widget 1988 * is allowed, should not have an effect, and return %TRUE. 1989 * 1990 * Returns: %TRUE if focus is now inside @widget. 1991 */ 1992 public bool grabFocus() 1993 { 1994 return gtk_widget_grab_focus(gtkWidget) != 0; 1995 } 1996 1997 /** 1998 * Returns whether @css_class is currently applied to @widget. 1999 * 2000 * Params: 2001 * cssClass = A style class, without the leading '.' 2002 * used for notation of style classes 2003 * 2004 * Returns: %TRUE if @css_class is currently applied to @widget, 2005 * %FALSE otherwise. 2006 */ 2007 public bool hasCssClass(string cssClass) 2008 { 2009 return gtk_widget_has_css_class(gtkWidget, Str.toStringz(cssClass)) != 0; 2010 } 2011 2012 /** 2013 * Determines whether @widget is the current default widget 2014 * within its toplevel. 2015 * 2016 * Returns: %TRUE if @widget is the current default widget 2017 * within its toplevel, %FALSE otherwise 2018 */ 2019 public bool hasDefault() 2020 { 2021 return gtk_widget_has_default(gtkWidget) != 0; 2022 } 2023 2024 /** 2025 * Determines if the widget has the global input focus. 2026 * 2027 * See [method@Gtk.Widget.is_focus] for the difference between 2028 * having the global input focus, and only having the focus 2029 * within a toplevel. 2030 * 2031 * Returns: %TRUE if the widget has the global input focus. 2032 */ 2033 public bool hasFocus() 2034 { 2035 return gtk_widget_has_focus(gtkWidget) != 0; 2036 } 2037 2038 /** 2039 * Determines if the widget should show a visible indication that 2040 * it has the global input focus. 2041 * 2042 * This is a convenience function that takes into account whether 2043 * focus indication should currently be shown in the toplevel window 2044 * of @widget. See [method@Gtk.Window.get_focus_visible] for more 2045 * information about focus indication. 2046 * 2047 * To find out if the widget has the global input focus, use 2048 * [method@Gtk.Widget.has_focus]. 2049 * 2050 * Returns: %TRUE if the widget should display a “focus rectangle” 2051 */ 2052 public bool hasVisibleFocus() 2053 { 2054 return gtk_widget_has_visible_focus(gtkWidget) != 0; 2055 } 2056 2057 /** 2058 * Reverses the effects of gtk_widget_show(). 2059 * 2060 * This is causing the widget to be hidden (invisible to the user). 2061 */ 2062 public void hide() 2063 { 2064 gtk_widget_hide(gtkWidget); 2065 } 2066 2067 /** 2068 * Returns whether the widget is currently being destroyed. 2069 * 2070 * This information can sometimes be used to avoid doing 2071 * unnecessary work. 2072 * 2073 * Returns: %TRUE if @widget is being destroyed 2074 */ 2075 public bool inDestruction() 2076 { 2077 return gtk_widget_in_destruction(gtkWidget) != 0; 2078 } 2079 2080 /** 2081 * Creates and initializes child widgets defined in templates. 2082 * 2083 * This function must be called in the instance initializer 2084 * for any class which assigned itself a template using 2085 * [method@Gtk.WidgetClass.set_template]. 2086 * 2087 * It is important to call this function in the instance initializer 2088 * of a `GtkWidget` subclass and not in `GObject.constructed()` or 2089 * `GObject.constructor()` for two reasons: 2090 * 2091 * - derived widgets will assume that the composite widgets 2092 * defined by its parent classes have been created in their 2093 * relative instance initializers 2094 * - when calling `g_object_new()` on a widget with composite templates, 2095 * it’s important to build the composite widgets before the construct 2096 * properties are set. Properties passed to `g_object_new()` should 2097 * take precedence over properties set in the private template XML 2098 * 2099 * A good rule of thumb is to call this function as the first thing in 2100 * an instance initialization function. 2101 */ 2102 public void initTemplate() 2103 { 2104 gtk_widget_init_template(gtkWidget); 2105 } 2106 2107 /** 2108 * Inserts @group into @widget. 2109 * 2110 * Children of @widget that implement [iface@Gtk.Actionable] can 2111 * then be associated with actions in @group by setting their 2112 * “action-name” to @prefix.`action-name`. 2113 * 2114 * Note that inheritance is defined for individual actions. I.e. 2115 * even if you insert a group with prefix @prefix, actions with 2116 * the same prefix will still be inherited from the parent, unless 2117 * the group contains an action with the same name. 2118 * 2119 * If @group is %NULL, a previously inserted group for @name is 2120 * removed from @widget. 2121 * 2122 * Params: 2123 * name = the prefix for actions in @group 2124 * group = a #GActionGroup, or %NULL 2125 */ 2126 public void insertActionGroup(string name, ActionGroupIF group) 2127 { 2128 gtk_widget_insert_action_group(gtkWidget, Str.toStringz(name), (group is null) ? null : group.getActionGroupStruct()); 2129 } 2130 2131 /** 2132 * Inserts @widget into the child widget list of @parent. 2133 * 2134 * It will be placed after @previous_sibling, or at the beginning if 2135 * @previous_sibling is %NULL. 2136 * 2137 * After calling this function, `gtk_widget_get_prev_sibling(widget)` 2138 * will return @previous_sibling. 2139 * 2140 * If @parent is already set as the parent widget of @widget, this 2141 * function can also be used to reorder @widget in the child widget 2142 * list of @parent. 2143 * 2144 * This API is primarily meant for widget implementations; if you are 2145 * just using a widget, you *must* use its own API for adding children. 2146 * 2147 * Params: 2148 * parent = the parent `GtkWidget` to insert @widget into 2149 * previousSibling = the new previous sibling of @widget or %NULL 2150 */ 2151 public void insertAfter(Widget parent, Widget previousSibling) 2152 { 2153 gtk_widget_insert_after(gtkWidget, (parent is null) ? null : parent.getWidgetStruct(), (previousSibling is null) ? null : previousSibling.getWidgetStruct()); 2154 } 2155 2156 /** 2157 * Inserts @widget into the child widget list of @parent. 2158 * 2159 * It will be placed before @next_sibling, or at the end if 2160 * @next_sibling is %NULL. 2161 * 2162 * After calling this function, `gtk_widget_get_next_sibling(widget)` 2163 * will return @next_sibling. 2164 * 2165 * If @parent is already set as the parent widget of @widget, this function 2166 * can also be used to reorder @widget in the child widget list of @parent. 2167 * 2168 * This API is primarily meant for widget implementations; if you are 2169 * just using a widget, you *must* use its own API for adding children. 2170 * 2171 * Params: 2172 * parent = the parent `GtkWidget` to insert @widget into 2173 * nextSibling = the new next sibling of @widget or %NULL 2174 */ 2175 public void insertBefore(Widget parent, Widget nextSibling) 2176 { 2177 gtk_widget_insert_before(gtkWidget, (parent is null) ? null : parent.getWidgetStruct(), (nextSibling is null) ? null : nextSibling.getWidgetStruct()); 2178 } 2179 2180 /** 2181 * Determines whether @widget is somewhere inside @ancestor, 2182 * possibly with intermediate containers. 2183 * 2184 * Params: 2185 * ancestor = another `GtkWidget` 2186 * 2187 * Returns: %TRUE if @ancestor contains @widget as a child, 2188 * grandchild, great grandchild, etc. 2189 */ 2190 public bool isAncestor(Widget ancestor) 2191 { 2192 return gtk_widget_is_ancestor(gtkWidget, (ancestor is null) ? null : ancestor.getWidgetStruct()) != 0; 2193 } 2194 2195 /** 2196 * Determines whether @widget can be drawn to. 2197 * 2198 * A widget can be drawn if it is mapped and visible. 2199 * 2200 * Returns: %TRUE if @widget is drawable, %FALSE otherwise 2201 */ 2202 public bool isDrawable() 2203 { 2204 return gtk_widget_is_drawable(gtkWidget) != 0; 2205 } 2206 2207 /** 2208 * Determines if the widget is the focus widget within its 2209 * toplevel. 2210 * 2211 * This does not mean that the [property@Gtk.Widget:has-focus] 2212 * property is necessarily set; [property@Gtk,Widget:has-focus] 2213 * will only be set if the toplevel widget additionally has the 2214 * global input focus.) 2215 * 2216 * Returns: %TRUE if the widget is the focus widget. 2217 */ 2218 public bool isFocus() 2219 { 2220 return gtk_widget_is_focus(gtkWidget) != 0; 2221 } 2222 2223 /** 2224 * Returns the widget’s effective sensitivity. 2225 * 2226 * This means it is sensitive itself and also its 2227 * parent widget is sensitive. 2228 * 2229 * Returns: %TRUE if the widget is effectively sensitive 2230 */ 2231 public bool isSensitive() 2232 { 2233 return gtk_widget_is_sensitive(gtkWidget) != 0; 2234 } 2235 2236 /** 2237 * Determines whether the widget and all its parents are marked as 2238 * visible. 2239 * 2240 * This function does not check if the widget is obscured in any way. 2241 * 2242 * See also [method@Gtk.Widget.get_visible] and 2243 * [method@Gtk.Widget.set_visible]. 2244 * 2245 * Returns: %TRUE if the widget and all its parents are visible 2246 */ 2247 public bool isVisible() 2248 { 2249 return gtk_widget_is_visible(gtkWidget) != 0; 2250 } 2251 2252 /** 2253 * Emits the `::keynav-failed` signal on the widget. 2254 * 2255 * This function should be called whenever keyboard navigation 2256 * within a single widget hits a boundary. 2257 * 2258 * The return value of this function should be interpreted 2259 * in a way similar to the return value of 2260 * [method@Gtk.Widget.child_focus]. When %TRUE is returned, 2261 * stay in the widget, the failed keyboard navigation is OK 2262 * and/or there is nowhere we can/should move the focus to. 2263 * When %FALSE is returned, the caller should continue with 2264 * keyboard navigation outside the widget, e.g. by calling 2265 * [method@Gtk.Widget.child_focus] on the widget’s toplevel. 2266 * 2267 * The default [signal@Gtk.Widget::keynav-failed] handler returns 2268 * %FALSE for %GTK_DIR_TAB_FORWARD and %GTK_DIR_TAB_BACKWARD. 2269 * For the other values of #GtkDirectionType it returns %TRUE. 2270 * 2271 * Whenever the default handler returns %TRUE, it also calls 2272 * [method@Gtk.Widget.error_bell] to notify the user of the 2273 * failed keyboard navigation. 2274 * 2275 * A use case for providing an own implementation of ::keynav-failed 2276 * (either by connecting to it or by overriding it) would be a row of 2277 * [class@Gtk.Entry] widgets where the user should be able to navigate 2278 * the entire row with the cursor keys, as e.g. known from user 2279 * interfaces that require entering license keys. 2280 * 2281 * Params: 2282 * direction = direction of focus movement 2283 * 2284 * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE 2285 * if the emitting widget should try to handle the keyboard 2286 * navigation attempt in its parent container(s). 2287 */ 2288 public bool keynavFailed(GtkDirectionType direction) 2289 { 2290 return gtk_widget_keynav_failed(gtkWidget, direction) != 0; 2291 } 2292 2293 /** 2294 * Returns the widgets for which this widget is the target of a 2295 * mnemonic. 2296 * 2297 * Typically, these widgets will be labels. See, for example, 2298 * [method@Gtk.Label.set_mnemonic_widget]. 2299 * 2300 * The widgets in the list are not individually referenced. 2301 * If you want to iterate through the list and perform actions 2302 * involving callbacks that might destroy the widgets, you 2303 * must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)` 2304 * first, and then unref all the widgets afterwards. 2305 * 2306 * Returns: the list 2307 * of mnemonic labels; free this list with g_list_free() when you 2308 * are done with it. 2309 */ 2310 public ListG listMnemonicLabels() 2311 { 2312 auto __p = gtk_widget_list_mnemonic_labels(gtkWidget); 2313 2314 if(__p is null) 2315 { 2316 return null; 2317 } 2318 2319 return new ListG(cast(GList*) __p); 2320 } 2321 2322 /** 2323 * Causes a widget to be mapped if it isn’t already. 2324 * 2325 * This function is only for use in widget implementations. 2326 */ 2327 public void map() 2328 { 2329 gtk_widget_map(gtkWidget); 2330 } 2331 2332 /** 2333 * Measures @widget in the orientation @orientation and for the given @for_size. 2334 * 2335 * As an example, if @orientation is %GTK_ORIENTATION_HORIZONTAL and @for_size 2336 * is 300, this functions will compute the minimum and natural width of @widget 2337 * if it is allocated at a height of 300 pixels. 2338 * 2339 * See [GtkWidget’s geometry management section](class.Widget.html#height-for-width-geometry-management) for 2340 * a more details on implementing #GtkWidgetClass.measure(). 2341 * 2342 * Params: 2343 * orientation = the orientation to measure 2344 * forSize = Size for the opposite of @orientation, i.e. 2345 * if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is 2346 * the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL 2347 * case is analogous. This way, both height-for-width and width-for-height 2348 * requests can be implemented. If no size is known, -1 can be passed. 2349 * minimum = location to store the minimum size, or %NULL 2350 * natural = location to store the natural size, or %NULL 2351 * minimumBaseline = location to store the baseline 2352 * position for the minimum size, or %NULL 2353 * naturalBaseline = location to store the baseline 2354 * position for the natural size, or %NULL 2355 */ 2356 public void measure(GtkOrientation orientation, int forSize, out int minimum, out int natural, out int minimumBaseline, out int naturalBaseline) 2357 { 2358 gtk_widget_measure(gtkWidget, orientation, forSize, &minimum, &natural, &minimumBaseline, &naturalBaseline); 2359 } 2360 2361 /** 2362 * Emits the `GtkWidget`::mnemonic-activate signal. 2363 * 2364 * Params: 2365 * groupCycling = %TRUE if there are other widgets with the same mnemonic 2366 * 2367 * Returns: %TRUE if the signal has been handled 2368 */ 2369 public bool mnemonicActivate(bool groupCycling) 2370 { 2371 return gtk_widget_mnemonic_activate(gtkWidget, groupCycling) != 0; 2372 } 2373 2374 /** 2375 * Returns a `GListModel` to track the children of @widget. 2376 * 2377 * Calling this function will enable extra internal bookkeeping 2378 * to track children and emit signals on the returned listmodel. 2379 * It may slow down operations a lot. 2380 * 2381 * Applications should try hard to avoid calling this function 2382 * because of the slowdowns. 2383 * 2384 * Returns: a `GListModel` tracking @widget's children 2385 */ 2386 public ListModelIF observeChildren() 2387 { 2388 auto __p = gtk_widget_observe_children(gtkWidget); 2389 2390 if(__p is null) 2391 { 2392 return null; 2393 } 2394 2395 return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p, true); 2396 } 2397 2398 /** 2399 * Returns a `GListModel` to track the [class@Gtk.EventController]s 2400 * of @widget. 2401 * 2402 * Calling this function will enable extra internal bookkeeping 2403 * to track controllers and emit signals on the returned listmodel. 2404 * It may slow down operations a lot. 2405 * 2406 * Applications should try hard to avoid calling this function 2407 * because of the slowdowns. 2408 * 2409 * Returns: a `GListModel` tracking @widget's controllers 2410 */ 2411 public ListModelIF observeControllers() 2412 { 2413 auto __p = gtk_widget_observe_controllers(gtkWidget); 2414 2415 if(__p is null) 2416 { 2417 return null; 2418 } 2419 2420 return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p, true); 2421 } 2422 2423 /** 2424 * Finds the descendant of @widget closest 2425 * to the screen at the point (@x, @y). 2426 * 2427 * The point must be given in widget coordinates, so (0, 0) is assumed 2428 * to be the top left of @widget's content area. 2429 * 2430 * Usually widgets will return %NULL if the given coordinate is not 2431 * contained in @widget checked via [method@Gtk.Widget.contains]. 2432 * Otherwise they will recursively try to find a child that does 2433 * not return %NULL. Widgets are however free to customize their 2434 * picking algorithm. 2435 * 2436 * This function is used on the toplevel to determine the widget 2437 * below the mouse cursor for purposes of hover highlighting and 2438 * delivering events. 2439 * 2440 * Params: 2441 * x = X coordinate to test, relative to @widget's origin 2442 * y = Y coordinate to test, relative to @widget's origin 2443 * flags = Flags to influence what is picked 2444 * 2445 * Returns: The widget descendant at 2446 * the given coordinate or %NULL if none. 2447 */ 2448 public Widget pick(double x, double y, GtkPickFlags flags) 2449 { 2450 auto __p = gtk_widget_pick(gtkWidget, x, y, flags); 2451 2452 if(__p is null) 2453 { 2454 return null; 2455 } 2456 2457 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 2458 } 2459 2460 /** 2461 * Flags the widget for a rerun of the GtkWidgetClass::size_allocate 2462 * function. 2463 * 2464 * Use this function instead of [method@Gtk.Widget.queue_resize] 2465 * when the @widget's size request didn't change but it wants to 2466 * reposition its contents. 2467 * 2468 * An example user of this function is [method@Gtk.Widget.set_halign]. 2469 * 2470 * This function is only for use in widget implementations. 2471 */ 2472 public void queueAllocate() 2473 { 2474 gtk_widget_queue_allocate(gtkWidget); 2475 } 2476 2477 /** 2478 * Schedules this widget to be redrawn in paint phase of the 2479 * current or the next frame. 2480 * 2481 * This means @widget's GtkWidgetClass.snapshot() 2482 * implementation will be called. 2483 */ 2484 public void queueDraw() 2485 { 2486 gtk_widget_queue_draw(gtkWidget); 2487 } 2488 2489 /** 2490 * Flags a widget to have its size renegotiated. 2491 * 2492 * This should be called when a widget for some reason has a new 2493 * size request. For example, when you change the text in a 2494 * [class@Gtk.Label], the label queues a resize to ensure there’s 2495 * enough space for the new text. 2496 * 2497 * Note that you cannot call gtk_widget_queue_resize() on a widget 2498 * from inside its implementation of the GtkWidgetClass::size_allocate 2499 * virtual method. Calls to gtk_widget_queue_resize() from inside 2500 * GtkWidgetClass::size_allocate will be silently ignored. 2501 * 2502 * This function is only for use in widget implementations. 2503 */ 2504 public void queueResize() 2505 { 2506 gtk_widget_queue_resize(gtkWidget); 2507 } 2508 2509 /** 2510 * Creates the GDK resources associated with a widget. 2511 * 2512 * Normally realization happens implicitly; if you show a widget 2513 * and all its parent containers, then the widget will be realized 2514 * and mapped automatically. 2515 * 2516 * Realizing a widget requires all the widget’s parent widgets to be 2517 * realized; calling this function realizes the widget’s parents 2518 * in addition to @widget itself. If a widget is not yet inside a 2519 * toplevel window when you realize it, bad things will happen. 2520 * 2521 * This function is primarily used in widget implementations, and 2522 * isn’t very useful otherwise. Many times when you think you might 2523 * need it, a better approach is to connect to a signal that will be 2524 * called after the widget is realized automatically, such as 2525 * [signal@Gtk.Widget::realize]. 2526 */ 2527 public void realize() 2528 { 2529 gtk_widget_realize(gtkWidget); 2530 } 2531 2532 /** 2533 * Removes @controller from @widget, so that it doesn't process 2534 * events anymore. 2535 * 2536 * It should not be used again. 2537 * 2538 * Widgets will remove all event controllers automatically when they 2539 * are destroyed, there is normally no need to call this function. 2540 * 2541 * Params: 2542 * controller = a #GtkEventController 2543 */ 2544 public void removeController(EventController controller) 2545 { 2546 gtk_widget_remove_controller(gtkWidget, (controller is null) ? null : controller.getEventControllerStruct()); 2547 } 2548 2549 /** 2550 * Removes a style from @widget. 2551 * 2552 * After this, the style of @widget will stop matching for @css_class. 2553 * 2554 * Params: 2555 * cssClass = The style class to remove from @widget, without 2556 * the leading '.' used for notation of style classes 2557 */ 2558 public void removeCssClass(string cssClass) 2559 { 2560 gtk_widget_remove_css_class(gtkWidget, Str.toStringz(cssClass)); 2561 } 2562 2563 /** 2564 * Removes a widget from the list of mnemonic labels for this widget. 2565 * 2566 * See [method@Gtk.Widget.list_mnemonic_labels]. The widget must 2567 * have previously been added to the list with 2568 * [method@Gtk.Widget.add_mnemonic_label]. 2569 * 2570 * Params: 2571 * label = a `GtkWidget` that was previously set as a mnemonic 2572 * label for @widget with [method@Gtk.Widget.add_mnemonic_label] 2573 */ 2574 public void removeMnemonicLabel(Widget label) 2575 { 2576 gtk_widget_remove_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 2577 } 2578 2579 /** 2580 * Removes a tick callback previously registered with 2581 * gtk_widget_add_tick_callback(). 2582 * 2583 * Params: 2584 * id = an id returned by [method@Gtk.Widget.add_tick_callback] 2585 */ 2586 public void removeTickCallback(uint id) 2587 { 2588 gtk_widget_remove_tick_callback(gtkWidget, id); 2589 } 2590 2591 /** 2592 * Specifies whether the input focus can enter the widget 2593 * or any of its children. 2594 * 2595 * Applications should set @can_focus to %FALSE to mark a 2596 * widget as for pointer/touch use only. 2597 * 2598 * Note that having @can_focus be %TRUE is only one of the 2599 * necessary conditions for being focusable. A widget must 2600 * also be sensitive and focusable and not have an ancestor 2601 * that is marked as not can-focus in order to receive input 2602 * focus. 2603 * 2604 * See [method@Gtk.Widget.grab_focus] for actually setting 2605 * the input focus on a widget. 2606 * 2607 * Params: 2608 * canFocus = whether or not the input focus can enter 2609 * the widget or any of its children 2610 */ 2611 public void setCanFocus(bool canFocus) 2612 { 2613 gtk_widget_set_can_focus(gtkWidget, canFocus); 2614 } 2615 2616 /** 2617 * Sets whether @widget can be the target of pointer events. 2618 * 2619 * Params: 2620 * canTarget = whether this widget should be able to 2621 * receive pointer events 2622 */ 2623 public void setCanTarget(bool canTarget) 2624 { 2625 gtk_widget_set_can_target(gtkWidget, canTarget); 2626 } 2627 2628 /** 2629 * Sets whether @widget should be mapped along with its parent. 2630 * 2631 * The child visibility can be set for widget before it is added 2632 * to a container with [method@Gtk.Widget.set_parent], to avoid 2633 * mapping children unnecessary before immediately unmapping them. 2634 * However it will be reset to its default state of %TRUE when the 2635 * widget is removed from a container. 2636 * 2637 * Note that changing the child visibility of a widget does not 2638 * queue a resize on the widget. Most of the time, the size of 2639 * a widget is computed from all visible children, whether or 2640 * not they are mapped. If this is not the case, the container 2641 * can queue a resize itself. 2642 * 2643 * This function is only useful for container implementations 2644 * and should never be called by an application. 2645 * 2646 * Params: 2647 * childVisible = if %TRUE, @widget should be mapped along 2648 * with its parent. 2649 */ 2650 public void setChildVisible(bool childVisible) 2651 { 2652 gtk_widget_set_child_visible(gtkWidget, childVisible); 2653 } 2654 2655 /** 2656 * Will clear all style classes applied to @widget 2657 * and replace them with @classes. 2658 * 2659 * Params: 2660 * classes = %NULL-terminated list of style classes to apply to @widget. 2661 */ 2662 public void setCssClasses(string[] classes) 2663 { 2664 gtk_widget_set_css_classes(gtkWidget, Str.toStringzArray(classes)); 2665 } 2666 2667 /** 2668 * Sets the cursor to be shown when pointer devices point 2669 * towards @widget. 2670 * 2671 * If the @cursor is NULL, @widget will use the cursor 2672 * inherited from the parent widget. 2673 * 2674 * Params: 2675 * cursor = the new cursor or %NULL to use 2676 * the default cursor 2677 */ 2678 public void setCursor(Cursor cursor) 2679 { 2680 gtk_widget_set_cursor(gtkWidget, (cursor is null) ? null : cursor.getCursorStruct()); 2681 } 2682 2683 /** 2684 * Sets a named cursor to be shown when pointer devices point 2685 * towards @widget. 2686 * 2687 * This is a utility function that creates a cursor via 2688 * [ctor@Gdk.Cursor.new_from_name] and then sets it on @widget 2689 * with [method@Gtk.Widget.set_cursor]. See those functions for 2690 * details. 2691 * 2692 * On top of that, this function allows @name to be %NULL, which 2693 * will do the same as calling [method@Gtk.Widget.set_cursor] 2694 * with a %NULL cursor. 2695 * 2696 * Params: 2697 * name = The name of the cursor or %NULL to use 2698 * the default cursor 2699 */ 2700 public void setCursorFromName(string name) 2701 { 2702 gtk_widget_set_cursor_from_name(gtkWidget, Str.toStringz(name)); 2703 } 2704 2705 /** 2706 * Sets the reading direction on a particular widget. 2707 * 2708 * This direction controls the primary direction for widgets 2709 * containing text, and also the direction in which the children 2710 * of a container are packed. The ability to set the direction is 2711 * present in order so that correct localization into languages with 2712 * right-to-left reading directions can be done. Generally, applications 2713 * will let the default reading direction present, except for containers 2714 * where the containers are arranged in an order that is explicitly 2715 * visual rather than logical (such as buttons for text justification). 2716 * 2717 * If the direction is set to %GTK_TEXT_DIR_NONE, then the value 2718 * set by [func@Gtk.Widget.set_default_direction] will be used. 2719 * 2720 * Params: 2721 * dir = the new direction 2722 */ 2723 public void setDirection(GtkTextDirection dir) 2724 { 2725 gtk_widget_set_direction(gtkWidget, dir); 2726 } 2727 2728 /** 2729 * Set @child as the current focus child of @widget. 2730 * 2731 * The previous focus child will be unset. 2732 * 2733 * This function is only suitable for widget implementations. 2734 * If you want a certain widget to get the input focus, call 2735 * [method@Gtk.Widget.grab_focus] on it. 2736 * 2737 * Params: 2738 * child = a direct child widget of @widget or %NULL 2739 * to unset the focus child of @widget 2740 */ 2741 public void setFocusChild(Widget child) 2742 { 2743 gtk_widget_set_focus_child(gtkWidget, (child is null) ? null : child.getWidgetStruct()); 2744 } 2745 2746 /** 2747 * Sets whether the widget should grab focus when it is clicked 2748 * with the mouse. 2749 * 2750 * Making mouse clicks not grab focus is useful in places like 2751 * toolbars where you don’t want the keyboard focus removed from 2752 * the main area of the application. 2753 * 2754 * Params: 2755 * focusOnClick = whether the widget should grab focus when clicked 2756 * with the mouse 2757 */ 2758 public void setFocusOnClick(bool focusOnClick) 2759 { 2760 gtk_widget_set_focus_on_click(gtkWidget, focusOnClick); 2761 } 2762 2763 /** 2764 * Specifies whether @widget can own the input focus. 2765 * 2766 * Widget implementations should set @focusable to %TRUE in 2767 * their init() function if they want to receive keyboard input. 2768 * 2769 * Note that having @focusable be %TRUE is only one of the 2770 * necessary conditions for being focusable. A widget must 2771 * also be sensitive and can-focus and not have an ancestor 2772 * that is marked as not can-focus in order to receive input 2773 * focus. 2774 * 2775 * See [method@Gtk.Widget.grab_focus] for actually setting 2776 * the input focus on a widget. 2777 * 2778 * Params: 2779 * focusable = whether or not @widget can own the input focus 2780 */ 2781 public void setFocusable(bool focusable) 2782 { 2783 gtk_widget_set_focusable(gtkWidget, focusable); 2784 } 2785 2786 /** 2787 * Sets the font map to use for Pango rendering. 2788 * 2789 * The font map is the object that is used to look up fonts. 2790 * Setting a custom font map can be useful in special situations, 2791 * e.g. when you need to add application-specific fonts to the set 2792 * of available fonts. 2793 * 2794 * When not set, the widget will inherit the font map from its parent. 2795 * 2796 * Params: 2797 * fontMap = a `PangoFontMap`, or %NULL to unset any 2798 * previously set font map 2799 */ 2800 public void setFontMap(PgFontMap fontMap) 2801 { 2802 gtk_widget_set_font_map(gtkWidget, (fontMap is null) ? null : fontMap.getPgFontMapStruct()); 2803 } 2804 2805 /** 2806 * Sets the `cairo_font_options_t` used for Pango rendering 2807 * in this widget. 2808 * 2809 * When not set, the default font options for the `GdkDisplay` 2810 * will be used. 2811 * 2812 * Params: 2813 * options = a #cairo_font_options_t, or %NULL 2814 * to unset any previously set default font options. 2815 */ 2816 public void setFontOptions(FontOption options) 2817 { 2818 gtk_widget_set_font_options(gtkWidget, (options is null) ? null : options.getFontOptionStruct()); 2819 } 2820 2821 /** 2822 * Sets the horizontal alignment of @widget. 2823 * 2824 * Params: 2825 * align_ = the horizontal alignment 2826 */ 2827 public void setHalign(GtkAlign align_) 2828 { 2829 gtk_widget_set_halign(gtkWidget, align_); 2830 } 2831 2832 /** 2833 * Sets the `has-tooltip` property on @widget to @has_tooltip. 2834 * 2835 * Params: 2836 * hasTooltip = whether or not @widget has a tooltip. 2837 */ 2838 public void setHasTooltip(bool hasTooltip) 2839 { 2840 gtk_widget_set_has_tooltip(gtkWidget, hasTooltip); 2841 } 2842 2843 /** 2844 * Sets whether the widget would like any available extra horizontal 2845 * space. 2846 * 2847 * When a user resizes a `GtkWindow`, widgets with expand=TRUE 2848 * generally receive the extra space. For example, a list or 2849 * scrollable area or document in your window would often be set to 2850 * expand. 2851 * 2852 * Call this function to set the expand flag if you would like your 2853 * widget to become larger horizontally when the window has extra 2854 * room. 2855 * 2856 * By default, widgets automatically expand if any of their children 2857 * want to expand. (To see if a widget will automatically expand given 2858 * its current children and state, call [method@Gtk.Widget.compute_expand]. 2859 * A container can decide how the expandability of children affects the 2860 * expansion of the container by overriding the compute_expand virtual 2861 * method on `GtkWidget`.). 2862 * 2863 * Setting hexpand explicitly with this function will override the 2864 * automatic expand behavior. 2865 * 2866 * This function forces the widget to expand or not to expand, 2867 * regardless of children. The override occurs because 2868 * [method@Gtk.Widget.set_hexpand] sets the hexpand-set property (see 2869 * [method@Gtk.Widget.set_hexpand_set]) which causes the widget’s hexpand 2870 * value to be used, rather than looking at children and widget state. 2871 * 2872 * Params: 2873 * expand = whether to expand 2874 */ 2875 public void setHexpand(bool expand) 2876 { 2877 gtk_widget_set_hexpand(gtkWidget, expand); 2878 } 2879 2880 /** 2881 * Sets whether the hexpand flag will be used. 2882 * 2883 * The [property@Gtk.Widget:hexpand-set] property will be set 2884 * automatically when you call [method@Gtk.Widget.set_hexpand] 2885 * to set hexpand, so the most likely reason to use this function 2886 * would be to unset an explicit expand flag. 2887 * 2888 * If hexpand is set, then it overrides any computed 2889 * expand value based on child widgets. If hexpand is not 2890 * set, then the expand value depends on whether any 2891 * children of the widget would like to expand. 2892 * 2893 * There are few reasons to use this function, but it’s here 2894 * for completeness and consistency. 2895 * 2896 * Params: 2897 * set = value for hexpand-set property 2898 */ 2899 public void setHexpandSet(bool set) 2900 { 2901 gtk_widget_set_hexpand_set(gtkWidget, set); 2902 } 2903 2904 /** 2905 * Sets the layout manager delegate instance that 2906 * provides an implementation for measuring and 2907 * allocating the children of @widget. 2908 * 2909 * Params: 2910 * layoutManager = a `GtkLayoutManager` 2911 */ 2912 public void setLayoutManager(LayoutManager layoutManager) 2913 { 2914 gtk_widget_set_layout_manager(gtkWidget, (layoutManager is null) ? null : layoutManager.getLayoutManagerStruct()); 2915 } 2916 2917 /** 2918 * Sets the bottom margin of @widget. 2919 * 2920 * Params: 2921 * margin = the bottom margin 2922 */ 2923 public void setMarginBottom(int margin) 2924 { 2925 gtk_widget_set_margin_bottom(gtkWidget, margin); 2926 } 2927 2928 /** 2929 * Sets the end margin of @widget. 2930 * 2931 * Params: 2932 * margin = the end margin 2933 */ 2934 public void setMarginEnd(int margin) 2935 { 2936 gtk_widget_set_margin_end(gtkWidget, margin); 2937 } 2938 2939 /** 2940 * Sets the start margin of @widget. 2941 * 2942 * Params: 2943 * margin = the start margin 2944 */ 2945 public void setMarginStart(int margin) 2946 { 2947 gtk_widget_set_margin_start(gtkWidget, margin); 2948 } 2949 2950 /** 2951 * Sets the top margin of @widget. 2952 * 2953 * Params: 2954 * margin = the top margin 2955 */ 2956 public void setMarginTop(int margin) 2957 { 2958 gtk_widget_set_margin_top(gtkWidget, margin); 2959 } 2960 2961 /** 2962 * Sets a widgets name. 2963 * 2964 * Setting a name allows you to refer to the widget from a 2965 * CSS file. You can apply a style to widgets with a particular name 2966 * in the CSS file. See the documentation for the CSS syntax (on the 2967 * same page as the docs for [class@Gtk.StyleContext]. 2968 * 2969 * Note that the CSS syntax has certain special characters to delimit 2970 * and represent elements in a selector (period, #, >, *...), so using 2971 * these will make your widget impossible to match by name. Any combination 2972 * of alphanumeric symbols, dashes and underscores will suffice. 2973 * 2974 * Params: 2975 * name = name for the widget 2976 */ 2977 public void setName(string name) 2978 { 2979 gtk_widget_set_name(gtkWidget, Str.toStringz(name)); 2980 } 2981 2982 /** 2983 * Request the @widget to be rendered partially transparent. 2984 * 2985 * An opacity of 0 is fully transparent and an opacity of 1 2986 * is fully opaque. 2987 * 2988 * Opacity works on both toplevel widgets and child widgets, although 2989 * there are some limitations: For toplevel widgets, applying opacity 2990 * depends on the capabilities of the windowing system. On X11, this 2991 * has any effect only on X displays with a compositing manager, 2992 * see gdk_display_is_composited(). On Windows and Wayland it should 2993 * always work, although setting a window’s opacity after the window 2994 * has been shown may cause some flicker. 2995 * 2996 * Note that the opacity is inherited through inclusion — if you set 2997 * a toplevel to be partially translucent, all of its content will 2998 * appear translucent, since it is ultimatively rendered on that 2999 * toplevel. The opacity value itself is not inherited by child 3000 * widgets (since that would make widgets deeper in the hierarchy 3001 * progressively more translucent). As a consequence, [class@Gtk.Popover]s 3002 * and other [class@Gtk.Native] widgets with their own surface will use their 3003 * own opacity value, and thus by default appear non-translucent, 3004 * even if they are attached to a toplevel that is translucent. 3005 * 3006 * Params: 3007 * opacity = desired opacity, between 0 and 1 3008 */ 3009 public void setOpacity(double opacity) 3010 { 3011 gtk_widget_set_opacity(gtkWidget, opacity); 3012 } 3013 3014 /** 3015 * Sets how @widget treats content that is drawn outside the 3016 * widget's content area. 3017 * 3018 * See the definition of [enum@Gtk.Overflow] for details. 3019 * 3020 * This setting is provided for widget implementations and 3021 * should not be used by application code. 3022 * 3023 * The default value is %GTK_OVERFLOW_VISIBLE. 3024 * 3025 * Params: 3026 * overflow = desired overflow 3027 */ 3028 public void setOverflow(GtkOverflow overflow) 3029 { 3030 gtk_widget_set_overflow(gtkWidget, overflow); 3031 } 3032 3033 /** 3034 * Sets @parent as the parent widget of @widget. 3035 * 3036 * This takes care of details such as updating the state and style 3037 * of the child to reflect its new location and resizing the parent. 3038 * The opposite function is [method@Gtk.Widget.unparent]. 3039 * 3040 * This function is useful only when implementing subclasses of 3041 * `GtkWidget`. 3042 * 3043 * Params: 3044 * parent = parent widget 3045 */ 3046 public void setParent(Widget parent) 3047 { 3048 gtk_widget_set_parent(gtkWidget, (parent is null) ? null : parent.getWidgetStruct()); 3049 } 3050 3051 /** 3052 * Specifies whether @widget will be treated as the default 3053 * widget within its toplevel when it has the focus, even if 3054 * another widget is the default. 3055 * 3056 * Params: 3057 * receivesDefault = whether or not @widget can be a default widget. 3058 */ 3059 public void setReceivesDefault(bool receivesDefault) 3060 { 3061 gtk_widget_set_receives_default(gtkWidget, receivesDefault); 3062 } 3063 3064 /** 3065 * Sets the sensitivity of a widget. 3066 * 3067 * A widget is sensitive if the user can interact with it. 3068 * Insensitive widgets are “grayed out” and the user can’t 3069 * interact with them. Insensitive widgets are known as 3070 * “inactive”, “disabled”, or “ghosted” in some other toolkits. 3071 * 3072 * Params: 3073 * sensitive = %TRUE to make the widget sensitive 3074 */ 3075 public void setSensitive(bool sensitive) 3076 { 3077 gtk_widget_set_sensitive(gtkWidget, sensitive); 3078 } 3079 3080 /** 3081 * Sets the minimum size of a widget. 3082 * 3083 * That is, the widget’s size request will be at least @width 3084 * by @height. You can use this function to force a widget to 3085 * be larger than it normally would be. 3086 * 3087 * In most cases, [method@Gtk.Window.set_default_size] is a better 3088 * choice for toplevel windows than this function; setting the default 3089 * size will still allow users to shrink the window. Setting the size 3090 * request will force them to leave the window at least as large as 3091 * the size request. 3092 * 3093 * Note the inherent danger of setting any fixed size - themes, 3094 * translations into other languages, different fonts, and user action 3095 * can all change the appropriate size for a given widget. So, it's 3096 * basically impossible to hardcode a size that will always be 3097 * correct. 3098 * 3099 * The size request of a widget is the smallest size a widget can 3100 * accept while still functioning well and drawing itself correctly. 3101 * However in some strange cases a widget may be allocated less than 3102 * its requested size, and in many cases a widget may be allocated more 3103 * space than it requested. 3104 * 3105 * If the size request in a given direction is -1 (unset), then 3106 * the “natural” size request of the widget will be used instead. 3107 * 3108 * The size request set here does not include any margin from the 3109 * properties 3110 * [property@Gtk.Widget:margin-start], 3111 * [property@Gtk.Widget:margin-end], 3112 * [property@Gtk.Widget:margin-top], and 3113 * [property@Gtk.Widget:margin-bottom], but it does include pretty 3114 * much all other padding or border properties set by any subclass 3115 * of `GtkWidget`. 3116 * 3117 * Params: 3118 * width = width @widget should request, or -1 to unset 3119 * height = height @widget should request, or -1 to unset 3120 */ 3121 public void setSizeRequest(int width, int height) 3122 { 3123 gtk_widget_set_size_request(gtkWidget, width, height); 3124 } 3125 3126 /** 3127 * Turns on flag values in the current widget state. 3128 * 3129 * Typical widget states are insensitive, prelighted, etc. 3130 * 3131 * This function accepts the values %GTK_STATE_FLAG_DIR_LTR and 3132 * %GTK_STATE_FLAG_DIR_RTL but ignores them. If you want to set 3133 * the widget's direction, use [method@Gtk.Widget.set_direction]. 3134 * 3135 * This function is for use in widget implementations. 3136 * 3137 * Params: 3138 * flags = State flags to turn on 3139 * clear = Whether to clear state before turning on @flags 3140 */ 3141 public void setStateFlags(GtkStateFlags flags, bool clear) 3142 { 3143 gtk_widget_set_state_flags(gtkWidget, flags, clear); 3144 } 3145 3146 /** 3147 * Sets @markup as the contents of the tooltip, which is marked 3148 * up with Pango markup. 3149 * 3150 * This function will take care of setting the 3151 * [property@Gtk.Widget:has-tooltip] as a side effect, and of the 3152 * default handler for the [signal@Gtk.Widget::query-tooltip] signal. 3153 * 3154 * See also [method@Gtk.Tooltip.set_markup]. 3155 * 3156 * Params: 3157 * markup = the contents of the tooltip for @widget 3158 */ 3159 public void setTooltipMarkup(string markup) 3160 { 3161 gtk_widget_set_tooltip_markup(gtkWidget, Str.toStringz(markup)); 3162 } 3163 3164 /** 3165 * Sets @text as the contents of the tooltip. 3166 * 3167 * If @text contains any markup, it will be escaped. 3168 * 3169 * This function will take care of setting 3170 * [property@Gtk.Widget:has-tooltip] as a side effect, 3171 * and of the default handler for the 3172 * [signal@Gtk.Widget::query-tooltip] signal. 3173 * 3174 * See also [method@Gtk.Tooltip.set_text]. 3175 * 3176 * Params: 3177 * text = the contents of the tooltip for @widget 3178 */ 3179 public void setTooltipText(string text) 3180 { 3181 gtk_widget_set_tooltip_text(gtkWidget, Str.toStringz(text)); 3182 } 3183 3184 /** 3185 * Sets the vertical alignment of @widget. 3186 * 3187 * Params: 3188 * align_ = the vertical alignment 3189 */ 3190 public void setValign(GtkAlign align_) 3191 { 3192 gtk_widget_set_valign(gtkWidget, align_); 3193 } 3194 3195 /** 3196 * Sets whether the widget would like any available extra vertical 3197 * space. 3198 * 3199 * See [method@Gtk.Widget.set_hexpand] for more detail. 3200 * 3201 * Params: 3202 * expand = whether to expand 3203 */ 3204 public void setVexpand(bool expand) 3205 { 3206 gtk_widget_set_vexpand(gtkWidget, expand); 3207 } 3208 3209 /** 3210 * Sets whether the vexpand flag will be used. 3211 * 3212 * See [method@Gtk.Widget.set_hexpand_set] for more detail. 3213 * 3214 * Params: 3215 * set = value for vexpand-set property 3216 */ 3217 public void setVexpandSet(bool set) 3218 { 3219 gtk_widget_set_vexpand_set(gtkWidget, set); 3220 } 3221 3222 /** 3223 * Sets the visibility state of @widget. 3224 * 3225 * Note that setting this to %TRUE doesn’t mean the widget is 3226 * actually viewable, see [method@Gtk.Widget.get_visible]. 3227 * 3228 * This function simply calls [method@Gtk.Widget.show] or 3229 * [method@Gtk.Widget.hide] but is nicer to use when the 3230 * visibility of the widget depends on some condition. 3231 * 3232 * Params: 3233 * visible = whether the widget should be shown or not 3234 */ 3235 public void setVisible(bool visible) 3236 { 3237 gtk_widget_set_visible(gtkWidget, visible); 3238 } 3239 3240 /** 3241 * Returns whether @widget should contribute to 3242 * the measuring and allocation of its parent. 3243 * 3244 * This is %FALSE for invisible children, but also 3245 * for children that have their own surface. 3246 * 3247 * Returns: %TRUE if child should be included in 3248 * measuring and allocating 3249 */ 3250 public bool shouldLayout() 3251 { 3252 return gtk_widget_should_layout(gtkWidget) != 0; 3253 } 3254 3255 /** 3256 * Flags a widget to be displayed. 3257 * 3258 * Any widget that isn’t shown will not appear on the screen. 3259 * 3260 * Remember that you have to show the containers containing a widget, 3261 * in addition to the widget itself, before it will appear onscreen. 3262 * 3263 * When a toplevel container is shown, it is immediately realized and 3264 * mapped; other shown widgets are realized and mapped when their 3265 * toplevel container is realized and mapped. 3266 */ 3267 public void show() 3268 { 3269 gtk_widget_show(gtkWidget); 3270 } 3271 3272 /** 3273 * Allocates widget with a transformation that translates 3274 * the origin to the position in @allocation. 3275 * 3276 * This is a simple form of [method@Gtk.Widget.allocate]. 3277 * 3278 * Params: 3279 * allocation = position and size to be allocated to @widget 3280 * baseline = The baseline of the child, or -1 3281 */ 3282 public void sizeAllocate(GtkAllocation* allocation, int baseline) 3283 { 3284 gtk_widget_size_allocate(gtkWidget, allocation, baseline); 3285 } 3286 3287 /** 3288 * Snapshot the a child of @widget. 3289 * 3290 * When a widget receives a call to the snapshot function, 3291 * it must send synthetic `GtkWidget`Class.snapshot() calls 3292 * to all children. This function provides a convenient way 3293 * of doing this. A widget, when it receives a call to its 3294 * `GtkWidget`Class.snapshot() function, calls 3295 * gtk_widget_snapshot_child() once for each child, passing in 3296 * the @snapshot the widget received. 3297 * 3298 * gtk_widget_snapshot_child() takes care of translating the origin of 3299 * @snapshot, and deciding whether the child needs to be snapshot. 3300 * 3301 * This function does nothing for children that implement `GtkNative`. 3302 * 3303 * Params: 3304 * child = a child of @widget 3305 * snapshot = #GtkSnapshot as passed to the widget. In particular, no 3306 * calls to gtk_snapshot_translate() or other transform calls should 3307 * have been made. 3308 */ 3309 public void snapshotChild(Widget child, Snapshot snapshot) 3310 { 3311 gtk_widget_snapshot_child(gtkWidget, (child is null) ? null : child.getWidgetStruct(), (snapshot is null) ? null : snapshot.getGtkSnapshotStruct()); 3312 } 3313 3314 /** 3315 * Translate coordinates relative to @src_widget’s allocation 3316 * to coordinates relative to @dest_widget’s allocations. 3317 * 3318 * In order to perform this operation, both widget must share 3319 * a common ancestor. 3320 * 3321 * Params: 3322 * destWidget = a `GtkWidget` 3323 * srcX = X position relative to @src_widget 3324 * srcY = Y position relative to @src_widget 3325 * destX = location to store X position relative to @dest_widget 3326 * destY = location to store Y position relative to @dest_widget 3327 * 3328 * Returns: %FALSE if @src_widget and @dest_widget have no common 3329 * ancestor. In this case, 0 is stored in *@dest_x and *@dest_y. 3330 * Otherwise %TRUE. 3331 */ 3332 public bool translateCoordinates(Widget destWidget, double srcX, double srcY, out double destX, out double destY) 3333 { 3334 return gtk_widget_translate_coordinates(gtkWidget, (destWidget is null) ? null : destWidget.getWidgetStruct(), srcX, srcY, &destX, &destY) != 0; 3335 } 3336 3337 /** 3338 * Triggers a tooltip query on the display where the toplevel 3339 * of @widget is located. 3340 */ 3341 public void triggerTooltipQuery() 3342 { 3343 gtk_widget_trigger_tooltip_query(gtkWidget); 3344 } 3345 3346 /** 3347 * Causes a widget to be unmapped if it’s currently mapped. 3348 * 3349 * This function is only for use in widget implementations. 3350 */ 3351 public void unmap() 3352 { 3353 gtk_widget_unmap(gtkWidget); 3354 } 3355 3356 /** 3357 * Dissociate @widget from its parent. 3358 * 3359 * This function is only for use in widget implementations, 3360 * typically in dispose. 3361 */ 3362 public void unparent() 3363 { 3364 gtk_widget_unparent(gtkWidget); 3365 } 3366 3367 /** 3368 * Causes a widget to be unrealized (frees all GDK resources 3369 * associated with the widget). 3370 * 3371 * This function is only useful in widget implementations. 3372 */ 3373 public void unrealize() 3374 { 3375 gtk_widget_unrealize(gtkWidget); 3376 } 3377 3378 /** 3379 * Turns off flag values for the current widget state. 3380 * 3381 * See [method@Gtk.Widget.set_state_flags]. 3382 * 3383 * This function is for use in widget implementations. 3384 * 3385 * Params: 3386 * flags = State flags to turn off 3387 */ 3388 public void unsetStateFlags(GtkStateFlags flags) 3389 { 3390 gtk_widget_unset_state_flags(gtkWidget, flags); 3391 } 3392 3393 /** 3394 * Signals that all holders of a reference to the widget should release 3395 * the reference that they hold. 3396 * 3397 * May result in finalization of the widget if all references are released. 3398 * 3399 * This signal is not suitable for saving widget state. 3400 */ 3401 gulong addOnDestroy(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3402 { 3403 return Signals.connect(this, "destroy", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3404 } 3405 3406 /** 3407 * Emitted when the text direction of a widget changes. 3408 * 3409 * Params: 3410 * previousDirection = the previous text direction of @widget 3411 */ 3412 gulong addOnDirectionChanged(void delegate(GtkTextDirection, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3413 { 3414 return Signals.connect(this, "direction-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3415 } 3416 3417 /** 3418 * Emitted when @widget is hidden. 3419 */ 3420 gulong addOnHide(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3421 { 3422 return Signals.connect(this, "hide", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3423 } 3424 3425 /** 3426 * Emitted if keyboard navigation fails. 3427 * 3428 * See [method@Gtk.Widget.keynav_failed] for details. 3429 * 3430 * Params: 3431 * direction = the direction of movement 3432 * 3433 * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE 3434 * if the emitting widget should try to handle the keyboard 3435 * navigation attempt in its parent widget(s). 3436 */ 3437 gulong addOnKeynavFailed(bool delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3438 { 3439 return Signals.connect(this, "keynav-failed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3440 } 3441 3442 /** 3443 * Emitted when @widget is going to be mapped. 3444 * 3445 * A widget is mapped when the widget is visible (which is controlled with 3446 * [property@Gtk.Widget:visible]) and all its parents up to the toplevel widget 3447 * are also visible. 3448 * 3449 * The ::map signal can be used to determine whether a widget will be drawn, 3450 * for instance it can resume an animation that was stopped during the 3451 * emission of [signal@Gtk.Widget::unmap]. 3452 */ 3453 gulong addOnMap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3454 { 3455 return Signals.connect(this, "map", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3456 } 3457 3458 /** 3459 * Emitted when a widget is activated via a mnemonic. 3460 * 3461 * The default handler for this signal activates @widget if @group_cycling 3462 * is %FALSE, or just makes @widget grab focus if @group_cycling is %TRUE. 3463 * 3464 * Params: 3465 * groupCycling = %TRUE if there are other widgets with the same mnemonic 3466 * 3467 * Returns: %TRUE to stop other handlers from being invoked for the event. 3468 * %FALSE to propagate the event further. 3469 */ 3470 gulong addOnMnemonicActivate(bool delegate(bool, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3471 { 3472 return Signals.connect(this, "mnemonic-activate", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3473 } 3474 3475 /** 3476 * Emitted when the focus is moved. 3477 * 3478 * Params: 3479 * direction = the direction of the focus move 3480 */ 3481 gulong addOnMoveFocus(void delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3482 { 3483 return Signals.connect(this, "move-focus", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3484 } 3485 3486 /** 3487 * Emitted when the widgets tooltip is about to be shown. 3488 * 3489 * This happens when the [property@Gtk.Widget:has-tooltip] property 3490 * is %TRUE and the hover timeout has expired with the cursor hovering 3491 * "above" @widget; or emitted when @widget got focus in keyboard mode. 3492 * 3493 * Using the given coordinates, the signal handler should determine 3494 * whether a tooltip should be shown for @widget. If this is the case 3495 * %TRUE should be returned, %FALSE otherwise. Note that if 3496 * @keyboard_mode is %TRUE, the values of @x and @y are undefined and 3497 * should not be used. 3498 * 3499 * The signal handler is free to manipulate @tooltip with the therefore 3500 * destined function calls. 3501 * 3502 * Params: 3503 * x = the x coordinate of the cursor position where the request has 3504 * been emitted, relative to @widget's left side 3505 * y = the y coordinate of the cursor position where the request has 3506 * been emitted, relative to @widget's top 3507 * keyboardMode = %TRUE if the tooltip was triggered using the keyboard 3508 * tooltip = a #GtkTooltip 3509 * 3510 * Returns: %TRUE if @tooltip should be shown right now, %FALSE otherwise. 3511 */ 3512 gulong addOnQueryTooltip(bool delegate(int, int, bool, Tooltip, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3513 { 3514 return Signals.connect(this, "query-tooltip", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3515 } 3516 3517 /** 3518 * Emitted when @widget is associated with a `GdkSurface`. 3519 * 3520 * This means that [method@Gtk.Widget.realize] has been called 3521 * or the widget has been mapped (that is, it is going to be drawn). 3522 */ 3523 gulong addOnRealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3524 { 3525 return Signals.connect(this, "realize", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3526 } 3527 3528 /** 3529 * Emitted when @widget is shown. 3530 */ 3531 gulong addOnShow(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3532 { 3533 return Signals.connect(this, "show", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3534 } 3535 3536 /** 3537 * Emitted when the widget state changes. 3538 * 3539 * See [method@Gtk.Widget.get_state_flags]. 3540 * 3541 * Params: 3542 * flags = The previous state flags. 3543 */ 3544 gulong addOnStateFlagsChanged(void delegate(GtkStateFlags, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3545 { 3546 return Signals.connect(this, "state-flags-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3547 } 3548 3549 /** 3550 * Emitted when @widget is going to be unmapped. 3551 * 3552 * A widget is unmapped when either it or any of its parents up to the 3553 * toplevel widget have been set as hidden. 3554 * 3555 * As ::unmap indicates that a widget will not be shown any longer, 3556 * it can be used to, for example, stop an animation on the widget. 3557 */ 3558 gulong addOnUnmap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3559 { 3560 return Signals.connect(this, "unmap", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3561 } 3562 3563 /** 3564 * Emitted when the `GdkSurface` associated with @widget is destroyed. 3565 * 3566 * This means that [method@Gtk.Widget.unrealize] has been called 3567 * or the widget has been unmapped (that is, it is going to be hidden). 3568 */ 3569 gulong addOnUnrealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3570 { 3571 return Signals.connect(this, "unrealize", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3572 } 3573 }