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