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