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