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