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