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 * omit prefixes: 46 * - gtk_widget_ref 47 * omit code: 48 * - gtk_widget_destroy 49 * - gtk_widget_get_window 50 * - gtk_widget_get_allocation 51 * omit signals: 52 * imports: 53 * - glib.Str 54 * - atk.ObjectAtk 55 * - gtk.Action 56 * - gdk.Rectangle 57 * - gtk.AccelGroup 58 * - glib.ListG 59 * - gdk.Event 60 * - gdk.Window 61 * - gdk.Colormap 62 * - gdk.Visual 63 * - gtk.Style 64 * - gdk.Bitmap 65 * - gdk.Pixmap 66 * - gtk.RcStyle 67 * - gdk.Color 68 * - gdk.Pixbuf 69 * - gtk.Adjustment 70 * - gobject.ParamSpec 71 * - gdk.Region 72 * - gobject.Value 73 * - gtk.Settings 74 * - gtk.Clipboard 75 * - gdk.Display 76 * - gdk.Screen 77 * - gtkc.gdk 78 * - gdk.Cursor 79 * - pango.PgLayout 80 * - pango.PgContext 81 * - pango.PgFontDescription 82 * - gdk.Drawable 83 * - gtk.Tooltips 84 * - gobject.Type 85 * - std.conv 86 * - gtk.BuildableIF 87 * - gtk.BuildableT 88 * structWrap: 89 * - AtkObject* -> ObjectAtk 90 * - GList* -> ListG 91 * - GParamSpec* -> ParamSpec 92 * - GValue* -> Value 93 * - GdkBitmap* -> Bitmap 94 * - GdkColor* -> Color 95 * - GdkColormap* -> Colormap 96 * - GdkDisplay* -> Display 97 * - GdkEvent* -> Event 98 * - GdkPixbuf* -> Pixbuf 99 * - GdkPixmap* -> Pixmap 100 * - GdkRectangle* -> Rectangle 101 * - GdkRegion* -> Region 102 * - GdkScreen* -> Screen 103 * - GdkVisual* -> Visual 104 * - GdkWindow* -> Window 105 * - GtkAccelGroup* -> AccelGroup 106 * - GtkAction* -> Action 107 * - GtkAdjustment* -> Adjustment 108 * - GtkClipboard* -> Clipboard 109 * - GtkRcStyle* -> RcStyle 110 * - GtkSettings* -> Settings 111 * - GtkStyle* -> Style 112 * - GtkWidget* -> Widget 113 * - PangoContext* -> PgContext 114 * - PangoFontDescription* -> PgFontDescription 115 * - PangoLayout* -> PgLayout 116 * module aliases: 117 * local aliases: 118 * overrides: 119 * - unref 120 * - destroy 121 * - set 122 */ 123 124 module gtk.Widget; 125 126 public import gtkc.gtktypes; 127 128 private import gtkc.gtk; 129 private import glib.ConstructionException; 130 private import gobject.ObjectG; 131 132 private import gobject.Signals; 133 public import gtkc.gdktypes; 134 135 private import glib.Str; 136 private import atk.ObjectAtk; 137 private import gtk.Action; 138 private import gdk.Rectangle; 139 private import gtk.AccelGroup; 140 private import glib.ListG; 141 private import gdk.Event; 142 private import gdk.Window; 143 private import gdk.Colormap; 144 private import gdk.Visual; 145 private import gtk.Style; 146 private import gdk.Bitmap; 147 private import gdk.Pixmap; 148 private import gtk.RcStyle; 149 private import gdk.Color; 150 private import gdk.Pixbuf; 151 private import gtk.Adjustment; 152 private import gobject.ParamSpec; 153 private import gdk.Region; 154 private import gobject.Value; 155 private import gtk.Settings; 156 private import gtk.Clipboard; 157 private import gdk.Display; 158 private import gdk.Screen; 159 private import gtkc.gdk; 160 private import gdk.Cursor; 161 private import pango.PgLayout; 162 private import pango.PgContext; 163 private import pango.PgFontDescription; 164 private import gdk.Drawable; 165 private import gtk.Tooltips; 166 private import gobject.Type; 167 private import gtk.BuildableIF; 168 private import gtk.BuildableT; 169 170 171 version(Tango) { 172 private import tango.text.convert.Integer; 173 } else { 174 private import std.conv; 175 } 176 177 178 private import gtk.ObjectGtk; 179 180 /** 181 * Description 182 * GtkWidget is the base class all widgets in GTK+ derive from. It manages the 183 * widget lifecycle, states and style. 184 * GtkWidget introduces style 185 * properties - these are basically object properties that are stored 186 * not on the object, but in the style object associated to the widget. Style 187 * properties are set in resource files. 188 * This mechanism is used for configuring such things as the location of the 189 * scrollbar arrows through the theme, giving theme authors more control over the 190 * look of applications without the need to write a theme engine in C. 191 * Use gtk_widget_class_install_style_property() to install style properties for 192 * a widget class, gtk_widget_class_find_style_property() or 193 * gtk_widget_class_list_style_properties() to get information about existing 194 * style properties and gtk_widget_style_get_property(), gtk_widget_style_get() or 195 * gtk_widget_style_get_valist() to obtain the value of a style property. 196 * <hr> 197 * GtkWidget as GtkBuildable 198 * The GtkWidget implementation of the GtkBuildable interface supports a 199 * custom <accelerator> element, which has attributes named key, 200 * modifiers and signal and allows to specify accelerators. 201 * $(DDOC_COMMENT example) 202 * In addition to accelerators, GtkWidget also support a 203 * custom <accessible> element, which supports actions and relations. 204 * Properties on the accessible implementation of an object can be set by accessing the 205 * internal child "accessible" of a GtkWidget. 206 * $(DDOC_COMMENT example) 207 */ 208 public class Widget : ObjectGtk, BuildableIF 209 { 210 211 /** the main Gtk struct */ 212 protected GtkWidget* gtkWidget; 213 214 215 public GtkWidget* getWidgetStruct() 216 { 217 return gtkWidget; 218 } 219 220 221 /** the main Gtk struct as a void* */ 222 protected override void* getStruct() 223 { 224 return cast(void*)gtkWidget; 225 } 226 227 /** 228 * Sets our main struct and passes it to the parent class 229 */ 230 public this (GtkWidget* gtkWidget) 231 { 232 super(cast(GtkObject*)gtkWidget); 233 this.gtkWidget = gtkWidget; 234 } 235 236 protected override void setStruct(GObject* obj) 237 { 238 super.setStruct(obj); 239 gtkWidget = cast(GtkWidget*)obj; 240 } 241 242 // add the Buildable capabilities 243 mixin BuildableT!(GtkWidget); 244 245 public GtkWidgetClass* getWidgetClass() 246 { 247 return Type.getInstanceClass!(GtkWidgetClass)(this); 248 } 249 250 /** */ 251 public int getWidth() 252 { 253 int width; 254 gtk_widget_get_size_request(gtkWidget, &width, null); 255 return width; 256 } 257 258 /** */ 259 public int getHeight() 260 { 261 int height; 262 gtk_widget_get_size_request(gtkWidget, null, &height); 263 return height; 264 } 265 266 /** 267 * The widget's allocated size. 268 * Returns: the GtkAllocation for this widget 269 */ 270 public GtkAllocation getAllocation() 271 { 272 GtkAllocation allo; 273 int* pt = cast(int*)getStruct(); 274 275 version (X86_64) 276 { 277 pt += 64/4; 278 } 279 else 280 { 281 pt += 36/4; 282 } 283 284 allo.x = *pt; 285 286 pt++; 287 allo.y = *pt; 288 289 pt++; 290 allo.width = *pt; 291 292 pt++; 293 allo.height = *pt; 294 295 return allo; 296 } 297 298 /** 299 * Gets the drawable for this widget 300 * Returns: 301 * The drawable for this widget 302 * Deprecated: use getWindow(). 303 */ 304 deprecated Drawable getDrawable() 305 { 306 return getWindow(); 307 } 308 309 /** 310 * Gets the Window for this widget 311 * Returns: 312 * The window for this widget 313 */ 314 Window getWindow() 315 { 316 317 // ubyte *p = cast(ubyte*)getStruct(); 318 // 319 // for ( int i=0 ; i<120 ; i+=4 ) 320 // { 321 // printf("(%d) %X %x %x %x %x\n", i,p,*(p+0), *(p+1), *(p+2), *(p+3)); 322 // p+=4; 323 // } 324 // 325 // int* pt =cast(int*)getStruct(); 326 // 327 // printf("pt=%X strcut=%X\n", pt, getStruct()); 328 // printf("*pt=%X\n", *pt); 329 // pt+=52/4; 330 // printf("pt+52=%X strcut.window=%X\n", pt, getWidgetStruct().window); 331 // printf("*pt+52=%X\n", *pt); 332 // 333 // //return new Drawable(cast(GdkDrawable*)(getWidgetStruct().window)); 334 int* pt =cast(int*)getStruct(); 335 336 version (X86_64) 337 { 338 pt += 80/4; 339 } 340 else 341 { 342 pt += 52/4; 343 } 344 345 return new Window(cast(GdkWindow*)(*pt)); 346 } 347 348 /** 349 * Sets the cursor. 350 * Params: 351 * cursor = the new cursor 352 * Bugs: the cursor changes to the parent widget also 353 */ 354 void setCursor(Cursor cursor) 355 { 356 getWindow().setCursor(cursor); 357 } 358 359 /** 360 * Resets the cursor. 361 * don't know if this is implemented by GTK+. Seems that it's not 362 * Bugs: does nothing 363 */ 364 public void resetCursor() 365 { 366 getWindow().setCursor(null); 367 } 368 369 /** 370 * Modifies the font for this widget. 371 * This just calls modifyFont(new PgFontDescription(PgFontDescription.fromString(family ~ " " ~ size))); 372 */ 373 public void modifyFont(string family, int size) 374 { 375 if ( size < 0 ) size = -size; // hack to workaround leds bug - TO BE REMOVED 376 377 version(Tango) 378 { 379 char[10] s; 380 modifyFont( 381 PgFontDescription.fromString( 382 family ~ " " ~ tango.text.convert.Integer.itoa(s,size) 383 ) 384 ); 385 } 386 else version(D_Version2) 387 { 388 modifyFont( 389 PgFontDescription.fromString( 390 family ~ " " ~ to!(string)(size) 391 ) 392 ); 393 } 394 else 395 { 396 modifyFont( 397 PgFontDescription.fromString( 398 family ~ " " ~ std..string.toString(size) 399 ) 400 ); 401 } 402 } 403 404 405 /** 406 * Sets this widget tooltip 407 * Deprecated: Since 2.12 use setTooltipText() or setTooltipMarkup() 408 * Params: 409 * tipText = the tooltip 410 * tipPrivate = a private text 411 */ 412 void setTooltip(string tipText, string tipPrivate) 413 { 414 Tooltips tt = new Tooltips(); 415 tt.setTip(this, tipText, tipPrivate); 416 } 417 418 /** */ 419 public bool onEvent(GdkEvent* event) 420 { 421 return getWidgetClass().event(getWidgetStruct(), event) == 0 ? false : true; 422 } 423 424 /** */ 425 public bool onButtonPressEvent(GdkEventButton* event) 426 { 427 return getWidgetClass().buttonPressEvent(getWidgetStruct(), event) == 0 ? false : true; 428 } 429 430 /** */ 431 public bool onButtonReleaseEvent(GdkEventButton* event) 432 { 433 return getWidgetClass().buttonReleaseEvent(getWidgetStruct(), event) == 0 ? false : true; 434 } 435 436 /** */ 437 public bool onScrollEvent(GdkEventScroll* event) 438 { 439 return getWidgetClass().scrollEvent(getWidgetStruct(), event) == 0 ? false : true; 440 } 441 442 /** */ 443 public bool onMotionNotifyEvent(GdkEventMotion* event) 444 { 445 return getWidgetClass().motionNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 446 } 447 448 /** */ 449 public bool onDeleteEvent(GdkEventAny* event) 450 { 451 return getWidgetClass().deleteEvent(getWidgetStruct(), event) == 0 ? false : true; 452 } 453 454 /** */ 455 public bool onExposeEvent(GdkEventExpose* event) 456 { 457 return getWidgetClass().exposeEvent(getWidgetStruct(), event) == 0 ? false : true; 458 } 459 460 /** */ 461 public bool onKeyPressEvent(GdkEventKey* event) 462 { 463 return getWidgetClass().keyPressEvent(getWidgetStruct(), event) == 0 ? false : true; 464 } 465 466 /** */ 467 public bool onKeyReleaseEvent(GdkEventKey* event) 468 { 469 return getWidgetClass().keyReleaseEvent(getWidgetStruct(), event) == 0 ? false : true; 470 } 471 472 /** */ 473 public bool onEnterNotifyEvent(GdkEventCrossing* event) 474 { 475 return getWidgetClass().enterNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 476 } 477 478 /** */ 479 public bool onLeaveNotifyEvent(GdkEventCrossing* event) 480 { 481 return getWidgetClass().leaveNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 482 } 483 484 /** */ 485 public bool onConfigureEvent(GdkEventConfigure* event) 486 { 487 return getWidgetClass().configureEvent(getWidgetStruct(), event) == 0 ? false : true; 488 } 489 490 /** */ 491 public bool onFocusInEvent(GdkEventFocus* event) 492 { 493 return getWidgetClass().focusInEvent(getWidgetStruct(), event) == 0 ? false : true; 494 } 495 496 /** */ 497 public bool onFocusOutEvent(GdkEventFocus* event) 498 { 499 return getWidgetClass().focusOutEvent(getWidgetStruct(), event) == 0 ? false : true; 500 } 501 502 /** */ 503 public bool onMapEvent(GdkEventAny* event) 504 { 505 return getWidgetClass().mapEvent(getWidgetStruct(), event) == 0 ? false : true; 506 } 507 508 /** */ 509 public bool onUnmapEvent(GdkEventAny* event) 510 { 511 return getWidgetClass().unmapEvent(getWidgetStruct(), event) == 0 ? false : true; 512 } 513 514 /** */ 515 public bool onPropertyNotifyEvent(GdkEventProperty* event) 516 { 517 return getWidgetClass().propertyNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 518 } 519 520 /** */ 521 public bool onSelectionClearEvent(GdkEventSelection* event) 522 { 523 return getWidgetClass().selectionClearEvent(getWidgetStruct(), event) == 0 ? false : true; 524 } 525 526 /** */ 527 public bool onSelectionRequestEvent(GdkEventSelection* event) 528 { 529 return getWidgetClass().selectionRequestEvent(getWidgetStruct(), event) == 0 ? false : true; 530 } 531 532 /** */ 533 public bool onSelectionNotifyEvent(GdkEventSelection* event) 534 { 535 return getWidgetClass().selectionNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 536 } 537 538 /** */ 539 public bool onProximityInEvent(GdkEventProximity* event) 540 { 541 return getWidgetClass().proximityInEvent(getWidgetStruct(), event) == 0 ? false : true; 542 } 543 544 /** */ 545 public bool onProximityOutEvent(GdkEventProximity* event) 546 { 547 return getWidgetClass().proximityOutEvent(getWidgetStruct(), event) == 0 ? false : true; 548 } 549 550 /** */ 551 public bool onVisibilityNotifyEvent(GdkEventVisibility* event) 552 { 553 return getWidgetClass().visibilityNotifyEvent(getWidgetStruct(), event) == 0 ? false : true; 554 } 555 556 /** */ 557 public bool onClientEvent(GdkEventClient* event) 558 { 559 return getWidgetClass().clientEvent(getWidgetStruct(), event) == 0 ? false : true; 560 } 561 562 /** */ 563 public bool onNoExposeEvent(GdkEventAny* event) 564 { 565 return getWidgetClass().noExposeEvent(getWidgetStruct(), event) == 0 ? false : true; 566 } 567 568 /** */ 569 public bool onWindowStateEvent(GdkEventWindowState* event) 570 { 571 return getWidgetClass().windowStateEvent(getWidgetStruct(), event) == 0 ? false : true; 572 } 573 574 /** 575 * Destroys a widget. 576 * 577 * When a widget is destroyed, it will break any references it holds to 578 * other objects. 579 * If the widget is inside a container, the widget will be removed 580 * from the container. If the widget is a toplevel (derived from 581 * GtkWindow), it will be removed from the list of toplevels, and the 582 * reference GTK+ holds to it will be removed. Removing a 583 * widget from its container or the list of toplevels results in the 584 * widget being finalized, unless you've added additional references 585 * to the widget with g_object_ref(). 586 * In most cases, only toplevel widgets (windows) require explicit 587 * destruction, because when you destroy a toplevel its children will 588 * be destroyed as well. 589 */ 590 public override void destroy() 591 { 592 // void gtk_widget_destroy (GtkWidget *widget); 593 gtk_widget_destroy(gtkWidget); 594 setStruct(null); 595 } 596 597 //get the addOnDestroy from ObjectGtk 598 alias ObjectGtk.addOnDestroy addOnDestroy; 599 600 /** 601 */ 602 int[string] connectedSignals; 603 604 void delegate(Widget)[] onAccelClosuresChangedListeners; 605 /** 606 */ 607 void addOnAccelClosuresChanged(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 608 { 609 if ( !("accel-closures-changed" in connectedSignals) ) 610 { 611 Signals.connectData( 612 getStruct(), 613 "accel-closures-changed", 614 cast(GCallback)&callBackAccelClosuresChanged, 615 cast(void*)this, 616 null, 617 connectFlags); 618 connectedSignals["accel-closures-changed"] = 1; 619 } 620 onAccelClosuresChangedListeners ~= dlg; 621 } 622 extern(C) static void callBackAccelClosuresChanged(GtkWidget* widgetStruct, Widget _widget) 623 { 624 foreach ( void delegate(Widget) dlg ; _widget.onAccelClosuresChangedListeners ) 625 { 626 dlg(_widget); 627 } 628 } 629 630 bool delegate(GdkEventButton*, Widget)[] onButtonPressListeners; 631 /** 632 * The ::button-press-event signal will be emitted when a button 633 * (typically from a mouse) is pressed. 634 * To receive this signal, the GdkWindow associated to the 635 * widget needs to enable the GDK_BUTTON_PRESS_MASK mask. 636 * This signal will be sent to the grab widget if there is one. 637 */ 638 void addOnButtonPress(bool delegate(GdkEventButton*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 639 { 640 if ( !("button-press-event" in connectedSignals) ) 641 { 642 addEvents(EventMask.BUTTON_PRESS_MASK); 643 Signals.connectData( 644 getStruct(), 645 "button-press-event", 646 cast(GCallback)&callBackButtonPress, 647 cast(void*)this, 648 null, 649 connectFlags); 650 connectedSignals["button-press-event"] = 1; 651 } 652 onButtonPressListeners ~= dlg; 653 } 654 extern(C) static gboolean callBackButtonPress(GtkWidget* widgetStruct, GdkEventButton* event, Widget _widget) 655 { 656 foreach ( bool delegate(GdkEventButton*, Widget) dlg ; _widget.onButtonPressListeners ) 657 { 658 if ( dlg(event, _widget) ) 659 { 660 return 1; 661 } 662 } 663 664 return 0; 665 } 666 667 bool delegate(GdkEventButton*, Widget)[] onButtonReleaseListeners; 668 /** 669 * The ::button-release-event signal will be emitted when a button 670 * (typically from a mouse) is released. 671 * To receive this signal, the GdkWindow associated to the 672 * widget needs to enable the GDK_BUTTON_RELEASE_MASK mask. 673 * This signal will be sent to the grab widget if there is one. 674 */ 675 void addOnButtonRelease(bool delegate(GdkEventButton*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 676 { 677 if ( !("button-release-event" in connectedSignals) ) 678 { 679 addEvents(EventMask.BUTTON_PRESS_MASK); 680 addEvents(EventMask.BUTTON_RELEASE_MASK); 681 Signals.connectData( 682 getStruct(), 683 "button-release-event", 684 cast(GCallback)&callBackButtonRelease, 685 cast(void*)this, 686 null, 687 connectFlags); 688 connectedSignals["button-release-event"] = 1; 689 } 690 onButtonReleaseListeners ~= dlg; 691 } 692 extern(C) static gboolean callBackButtonRelease(GtkWidget* widgetStruct, GdkEventButton* event, Widget _widget) 693 { 694 foreach ( bool delegate(GdkEventButton*, Widget) dlg ; _widget.onButtonReleaseListeners ) 695 { 696 if ( dlg(event, _widget) ) 697 { 698 return 1; 699 } 700 } 701 702 return 0; 703 } 704 705 bool delegate(guint, Widget)[] onCanActivateAccelListeners; 706 /** 707 * Determines whether an accelerator that activates the signal 708 * identified by signal_id can currently be activated. 709 * This signal is present to allow applications and derived 710 * widgets to override the default GtkWidget handling 711 * for determining whether an accelerator can be activated. 712 */ 713 void addOnCanActivateAccel(bool delegate(guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 714 { 715 if ( !("can-activate-accel" in connectedSignals) ) 716 { 717 Signals.connectData( 718 getStruct(), 719 "can-activate-accel", 720 cast(GCallback)&callBackCanActivateAccel, 721 cast(void*)this, 722 null, 723 connectFlags); 724 connectedSignals["can-activate-accel"] = 1; 725 } 726 onCanActivateAccelListeners ~= dlg; 727 } 728 extern(C) static gboolean callBackCanActivateAccel(GtkWidget* widgetStruct, guint signalId, Widget _widget) 729 { 730 foreach ( bool delegate(guint, Widget) dlg ; _widget.onCanActivateAccelListeners ) 731 { 732 if ( dlg(signalId, _widget) ) 733 { 734 return 1; 735 } 736 } 737 738 return 0; 739 } 740 741 void delegate(ParamSpec, Widget)[] onChildNotifyListeners; 742 /** 743 * The ::child-notify signal is emitted for each 744 * child property that has 745 * changed on an object. The signal's detail holds the property name. 746 */ 747 void addOnChildNotify(void delegate(ParamSpec, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 748 { 749 if ( !("child-notify" in connectedSignals) ) 750 { 751 Signals.connectData( 752 getStruct(), 753 "child-notify", 754 cast(GCallback)&callBackChildNotify, 755 cast(void*)this, 756 null, 757 connectFlags); 758 connectedSignals["child-notify"] = 1; 759 } 760 onChildNotifyListeners ~= dlg; 761 } 762 extern(C) static void callBackChildNotify(GtkWidget* widgetStruct, GParamSpec* pspec, Widget _widget) 763 { 764 foreach ( void delegate(ParamSpec, Widget) dlg ; _widget.onChildNotifyListeners ) 765 { 766 dlg(ObjectG.getDObject!(ParamSpec)(pspec), _widget); 767 } 768 } 769 770 bool delegate(GdkEventClient*, Widget)[] onClientListeners; 771 /** 772 * The ::client-event will be emitted when the widget's window 773 * receives a message (via a ClientMessage event) from another 774 * application. 775 */ 776 void addOnClient(bool delegate(GdkEventClient*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 777 { 778 if ( !("client-event" in connectedSignals) ) 779 { 780 Signals.connectData( 781 getStruct(), 782 "client-event", 783 cast(GCallback)&callBackClient, 784 cast(void*)this, 785 null, 786 connectFlags); 787 connectedSignals["client-event"] = 1; 788 } 789 onClientListeners ~= dlg; 790 } 791 extern(C) static gboolean callBackClient(GtkWidget* widgetStruct, GdkEventClient* event, Widget _widget) 792 { 793 foreach ( bool delegate(GdkEventClient*, Widget) dlg ; _widget.onClientListeners ) 794 { 795 if ( dlg(event, _widget) ) 796 { 797 return 1; 798 } 799 } 800 801 return 0; 802 } 803 804 void delegate(Widget)[] onCompositedChangedListeners; 805 /** 806 * The ::composited-changed signal is emitted when the composited 807 * status of widgets screen changes. 808 * See gdk_screen_is_composited(). 809 */ 810 void addOnCompositedChanged(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 811 { 812 if ( !("composited-changed" in connectedSignals) ) 813 { 814 Signals.connectData( 815 getStruct(), 816 "composited-changed", 817 cast(GCallback)&callBackCompositedChanged, 818 cast(void*)this, 819 null, 820 connectFlags); 821 connectedSignals["composited-changed"] = 1; 822 } 823 onCompositedChangedListeners ~= dlg; 824 } 825 extern(C) static void callBackCompositedChanged(GtkWidget* widgetStruct, Widget _widget) 826 { 827 foreach ( void delegate(Widget) dlg ; _widget.onCompositedChangedListeners ) 828 { 829 dlg(_widget); 830 } 831 } 832 833 bool delegate(GdkEventConfigure*, Widget)[] onConfigureListeners; 834 /** 835 * The ::configure-event signal will be emitted when the size, position or 836 * stacking of the widget's window has changed. 837 * To receive this signal, the GdkWindow associated to the widget needs 838 * to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask 839 * automatically for all new windows. 840 */ 841 void addOnConfigure(bool delegate(GdkEventConfigure*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 842 { 843 if ( !("configure-event" in connectedSignals) ) 844 { 845 Signals.connectData( 846 getStruct(), 847 "configure-event", 848 cast(GCallback)&callBackConfigure, 849 cast(void*)this, 850 null, 851 connectFlags); 852 connectedSignals["configure-event"] = 1; 853 } 854 onConfigureListeners ~= dlg; 855 } 856 extern(C) static gboolean callBackConfigure(GtkWidget* widgetStruct, GdkEventConfigure* event, Widget _widget) 857 { 858 foreach ( bool delegate(GdkEventConfigure*, Widget) dlg ; _widget.onConfigureListeners ) 859 { 860 if ( dlg(event, _widget) ) 861 { 862 return 1; 863 } 864 } 865 866 return 0; 867 } 868 869 bool delegate(Event, Widget)[] onDamageListeners; 870 /** 871 * Emitted when a redirected window belonging to widget gets drawn into. 872 * The region/area members of the event shows what area of the redirected 873 * drawable was drawn into. 874 * Since 2.14 875 */ 876 void addOnDamage(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 877 { 878 if ( !("damage-event" in connectedSignals) ) 879 { 880 Signals.connectData( 881 getStruct(), 882 "damage-event", 883 cast(GCallback)&callBackDamage, 884 cast(void*)this, 885 null, 886 connectFlags); 887 connectedSignals["damage-event"] = 1; 888 } 889 onDamageListeners ~= dlg; 890 } 891 extern(C) static gboolean callBackDamage(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 892 { 893 foreach ( bool delegate(Event, Widget) dlg ; _widget.onDamageListeners ) 894 { 895 if ( dlg(ObjectG.getDObject!(Event)(event), _widget) ) 896 { 897 return 1; 898 } 899 } 900 901 return 0; 902 } 903 904 bool delegate(Event, Widget)[] onDeleteListeners; 905 /** 906 * The ::delete-event signal is emitted if a user requests that 907 * a toplevel window is closed. The default handler for this signal 908 * destroys the window. Connecting gtk_widget_hide_on_delete() to 909 * this signal will cause the window to be hidden instead, so that 910 * it can later be shown again without reconstructing it. 911 */ 912 void addOnDelete(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 913 { 914 if ( !("delete-event" in connectedSignals) ) 915 { 916 Signals.connectData( 917 getStruct(), 918 "delete-event", 919 cast(GCallback)&callBackDelete, 920 cast(void*)this, 921 null, 922 connectFlags); 923 connectedSignals["delete-event"] = 1; 924 } 925 onDeleteListeners ~= dlg; 926 } 927 extern(C) static gboolean callBackDelete(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 928 { 929 foreach ( bool delegate(Event, Widget) dlg ; _widget.onDeleteListeners ) 930 { 931 if ( dlg(ObjectG.getDObject!(Event)(event), _widget) ) 932 { 933 return 1; 934 } 935 } 936 937 return 0; 938 } 939 940 bool delegate(Event, Widget)[] onDestroyEventListeners; 941 /** 942 * The ::destroy-event signal is emitted when a GdkWindow is destroyed. 943 * You rarely get this signal, because most widgets disconnect themselves 944 * from their window before they destroy it, so no widget owns the 945 * window at destroy time. 946 * To receive this signal, the GdkWindow associated to the widget needs 947 * to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask 948 * automatically for all new windows. 949 */ 950 void addOnDestroyEvent(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 951 { 952 if ( !("destroy-event" in connectedSignals) ) 953 { 954 Signals.connectData( 955 getStruct(), 956 "destroy-event", 957 cast(GCallback)&callBackDestroyEvent, 958 cast(void*)this, 959 null, 960 connectFlags); 961 connectedSignals["destroy-event"] = 1; 962 } 963 onDestroyEventListeners ~= dlg; 964 } 965 extern(C) static gboolean callBackDestroyEvent(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 966 { 967 foreach ( bool delegate(Event, Widget) dlg ; _widget.onDestroyEventListeners ) 968 { 969 if ( dlg(ObjectG.getDObject!(Event)(event), _widget) ) 970 { 971 return 1; 972 } 973 } 974 975 return 0; 976 } 977 978 void delegate(GtkTextDirection, Widget)[] onDirectionChangedListeners; 979 /** 980 * The ::direction-changed signal is emitted when the text direction 981 * of a widget changes. 982 */ 983 void addOnDirectionChanged(void delegate(GtkTextDirection, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 984 { 985 if ( !("direction-changed" in connectedSignals) ) 986 { 987 Signals.connectData( 988 getStruct(), 989 "direction-changed", 990 cast(GCallback)&callBackDirectionChanged, 991 cast(void*)this, 992 null, 993 connectFlags); 994 connectedSignals["direction-changed"] = 1; 995 } 996 onDirectionChangedListeners ~= dlg; 997 } 998 extern(C) static void callBackDirectionChanged(GtkWidget* widgetStruct, GtkTextDirection previousDirection, Widget _widget) 999 { 1000 foreach ( void delegate(GtkTextDirection, Widget) dlg ; _widget.onDirectionChangedListeners ) 1001 { 1002 dlg(previousDirection, _widget); 1003 } 1004 } 1005 1006 void delegate(GdkDragContext*, Widget)[] onDragBeginListeners; 1007 /** 1008 * The ::drag-begin signal is emitted on the drag source when a drag is 1009 * started. A typical reason to connect to this signal is to set up a 1010 * custom drag icon with gtk_drag_source_set_icon(). 1011 * Note that some widgets set up a drag icon in the default handler of 1012 * this signal, so you may have to use g_signal_connect_after() to 1013 * override what the default handler did. 1014 */ 1015 void addOnDragBegin(void delegate(GdkDragContext*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1016 { 1017 if ( !("drag-begin" in connectedSignals) ) 1018 { 1019 Signals.connectData( 1020 getStruct(), 1021 "drag-begin", 1022 cast(GCallback)&callBackDragBegin, 1023 cast(void*)this, 1024 null, 1025 connectFlags); 1026 connectedSignals["drag-begin"] = 1; 1027 } 1028 onDragBeginListeners ~= dlg; 1029 } 1030 extern(C) static void callBackDragBegin(GtkWidget* widgetStruct, GdkDragContext* dragContext, Widget _widget) 1031 { 1032 foreach ( void delegate(GdkDragContext*, Widget) dlg ; _widget.onDragBeginListeners ) 1033 { 1034 dlg(dragContext, _widget); 1035 } 1036 } 1037 1038 void delegate(GdkDragContext*, Widget)[] onDragDataDeleteListeners; 1039 /** 1040 * The ::drag-data-delete signal is emitted on the drag source when a drag 1041 * with the action GDK_ACTION_MOVE is successfully completed. The signal 1042 * handler is responsible for deleting the data that has been dropped. What 1043 * "delete" means depends on the context of the drag operation. 1044 */ 1045 void addOnDragDataDelete(void delegate(GdkDragContext*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1046 { 1047 if ( !("drag-data-delete" in connectedSignals) ) 1048 { 1049 Signals.connectData( 1050 getStruct(), 1051 "drag-data-delete", 1052 cast(GCallback)&callBackDragDataDelete, 1053 cast(void*)this, 1054 null, 1055 connectFlags); 1056 connectedSignals["drag-data-delete"] = 1; 1057 } 1058 onDragDataDeleteListeners ~= dlg; 1059 } 1060 extern(C) static void callBackDragDataDelete(GtkWidget* widgetStruct, GdkDragContext* dragContext, Widget _widget) 1061 { 1062 foreach ( void delegate(GdkDragContext*, Widget) dlg ; _widget.onDragDataDeleteListeners ) 1063 { 1064 dlg(dragContext, _widget); 1065 } 1066 } 1067 1068 void delegate(GdkDragContext*, GtkSelectionData*, guint, guint, Widget)[] onDragDataGetListeners; 1069 /** 1070 * The ::drag-data-get signal is emitted on the drag source when the drop 1071 * site requests the data which is dragged. It is the responsibility of 1072 * the signal handler to fill data with the data in the format which 1073 * is indicated by info. See gtk_selection_data_set() and 1074 * gtk_selection_data_set_text(). 1075 */ 1076 void addOnDragDataGet(void delegate(GdkDragContext*, GtkSelectionData*, guint, guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1077 { 1078 if ( !("drag-data-get" in connectedSignals) ) 1079 { 1080 Signals.connectData( 1081 getStruct(), 1082 "drag-data-get", 1083 cast(GCallback)&callBackDragDataGet, 1084 cast(void*)this, 1085 null, 1086 connectFlags); 1087 connectedSignals["drag-data-get"] = 1; 1088 } 1089 onDragDataGetListeners ~= dlg; 1090 } 1091 extern(C) static void callBackDragDataGet(GtkWidget* widgetStruct, GdkDragContext* dragContext, GtkSelectionData* data, guint info, guint time, Widget _widget) 1092 { 1093 foreach ( void delegate(GdkDragContext*, GtkSelectionData*, guint, guint, Widget) dlg ; _widget.onDragDataGetListeners ) 1094 { 1095 dlg(dragContext, data, info, time, _widget); 1096 } 1097 } 1098 1099 void delegate(GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint, Widget)[] onDragDataReceivedListeners; 1100 /** 1101 * The ::drag-data-received signal is emitted on the drop site when the 1102 * dragged data has been received. If the data was received in order to 1103 * determine whether the drop will be accepted, the handler is expected 1104 * to call gdk_drag_status() and not finish the drag. 1105 * If the data was received in response to a "drag-drop" signal 1106 * (and this is the last target to be received), the handler for this 1107 * signal is expected to process the received data and then call 1108 * gtk_drag_finish(), setting the success parameter depending on whether 1109 * the data was processed successfully. 1110 * The handler may inspect and modify drag_context->action before calling 1111 * gtk_drag_finish(), e.g. to implement GDK_ACTION_ASK as shown in the 1112 * $(DDOC_COMMENT example) 1113 */ 1114 void addOnDragDataReceived(void delegate(GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1115 { 1116 if ( !("drag-data-received" in connectedSignals) ) 1117 { 1118 Signals.connectData( 1119 getStruct(), 1120 "drag-data-received", 1121 cast(GCallback)&callBackDragDataReceived, 1122 cast(void*)this, 1123 null, 1124 connectFlags); 1125 connectedSignals["drag-data-received"] = 1; 1126 } 1127 onDragDataReceivedListeners ~= dlg; 1128 } 1129 extern(C) static void callBackDragDataReceived(GtkWidget* widgetStruct, GdkDragContext* dragContext, gint x, gint y, GtkSelectionData* data, guint info, guint time, Widget _widget) 1130 { 1131 foreach ( void delegate(GdkDragContext*, gint, gint, GtkSelectionData*, guint, guint, Widget) dlg ; _widget.onDragDataReceivedListeners ) 1132 { 1133 dlg(dragContext, x, y, data, info, time, _widget); 1134 } 1135 } 1136 1137 bool delegate(GdkDragContext*, gint, gint, guint, Widget)[] onDragDropListeners; 1138 /** 1139 * The ::drag-drop signal is emitted on the drop site when the user drops 1140 * the data onto the widget. The signal handler must determine whether 1141 * the cursor position is in a drop zone or not. If it is not in a drop 1142 * zone, it returns FALSE and no further processing is necessary. 1143 * Otherwise, the handler returns TRUE. In this case, the handler must 1144 * ensure that gtk_drag_finish() is called to let the source know that 1145 * the drop is done. The call to gtk_drag_finish() can be done either 1146 * directly or in a "drag-data-received" handler which gets 1147 * triggered by calling gtk_drag_get_data() to receive the data for one 1148 * or more of the supported targets. 1149 */ 1150 void addOnDragDrop(bool delegate(GdkDragContext*, gint, gint, guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1151 { 1152 if ( !("drag-drop" in connectedSignals) ) 1153 { 1154 Signals.connectData( 1155 getStruct(), 1156 "drag-drop", 1157 cast(GCallback)&callBackDragDrop, 1158 cast(void*)this, 1159 null, 1160 connectFlags); 1161 connectedSignals["drag-drop"] = 1; 1162 } 1163 onDragDropListeners ~= dlg; 1164 } 1165 extern(C) static gboolean callBackDragDrop(GtkWidget* widgetStruct, GdkDragContext* dragContext, gint x, gint y, guint time, Widget _widget) 1166 { 1167 foreach ( bool delegate(GdkDragContext*, gint, gint, guint, Widget) dlg ; _widget.onDragDropListeners ) 1168 { 1169 if ( dlg(dragContext, x, y, time, _widget) ) 1170 { 1171 return 1; 1172 } 1173 } 1174 1175 return 0; 1176 } 1177 1178 void delegate(GdkDragContext*, Widget)[] onDragEndListeners; 1179 /** 1180 * The ::drag-end signal is emitted on the drag source when a drag is 1181 * finished. A typical reason to connect to this signal is to undo 1182 * things done in "drag-begin". 1183 */ 1184 void addOnDragEnd(void delegate(GdkDragContext*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1185 { 1186 if ( !("drag-end" in connectedSignals) ) 1187 { 1188 Signals.connectData( 1189 getStruct(), 1190 "drag-end", 1191 cast(GCallback)&callBackDragEnd, 1192 cast(void*)this, 1193 null, 1194 connectFlags); 1195 connectedSignals["drag-end"] = 1; 1196 } 1197 onDragEndListeners ~= dlg; 1198 } 1199 extern(C) static void callBackDragEnd(GtkWidget* widgetStruct, GdkDragContext* dragContext, Widget _widget) 1200 { 1201 foreach ( void delegate(GdkDragContext*, Widget) dlg ; _widget.onDragEndListeners ) 1202 { 1203 dlg(dragContext, _widget); 1204 } 1205 } 1206 1207 bool delegate(GdkDragContext*, GtkDragResult, Widget)[] onDragFailedListeners; 1208 /** 1209 * The ::drag-failed signal is emitted on the drag source when a drag has 1210 * failed. The signal handler may hook custom code to handle a failed DND 1211 * operation based on the type of error, it returns TRUE is the failure has 1212 * been already handled (not showing the default "drag operation failed" 1213 * animation), otherwise it returns FALSE. 1214 * Since 2.12 1215 */ 1216 void addOnDragFailed(bool delegate(GdkDragContext*, GtkDragResult, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1217 { 1218 if ( !("drag-failed" in connectedSignals) ) 1219 { 1220 Signals.connectData( 1221 getStruct(), 1222 "drag-failed", 1223 cast(GCallback)&callBackDragFailed, 1224 cast(void*)this, 1225 null, 1226 connectFlags); 1227 connectedSignals["drag-failed"] = 1; 1228 } 1229 onDragFailedListeners ~= dlg; 1230 } 1231 extern(C) static gboolean callBackDragFailed(GtkWidget* widgetStruct, GdkDragContext* dragContext, GtkDragResult result, Widget _widget) 1232 { 1233 foreach ( bool delegate(GdkDragContext*, GtkDragResult, Widget) dlg ; _widget.onDragFailedListeners ) 1234 { 1235 if ( dlg(dragContext, result, _widget) ) 1236 { 1237 return 1; 1238 } 1239 } 1240 1241 return 0; 1242 } 1243 1244 void delegate(GdkDragContext*, guint, Widget)[] onDragLeaveListeners; 1245 /** 1246 * The ::drag-leave signal is emitted on the drop site when the cursor 1247 * leaves the widget. A typical reason to connect to this signal is to 1248 * undo things done in "drag-motion", e.g. undo highlighting 1249 * with gtk_drag_unhighlight() 1250 */ 1251 void addOnDragLeave(void delegate(GdkDragContext*, guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1252 { 1253 if ( !("drag-leave" in connectedSignals) ) 1254 { 1255 Signals.connectData( 1256 getStruct(), 1257 "drag-leave", 1258 cast(GCallback)&callBackDragLeave, 1259 cast(void*)this, 1260 null, 1261 connectFlags); 1262 connectedSignals["drag-leave"] = 1; 1263 } 1264 onDragLeaveListeners ~= dlg; 1265 } 1266 extern(C) static void callBackDragLeave(GtkWidget* widgetStruct, GdkDragContext* dragContext, guint time, Widget _widget) 1267 { 1268 foreach ( void delegate(GdkDragContext*, guint, Widget) dlg ; _widget.onDragLeaveListeners ) 1269 { 1270 dlg(dragContext, time, _widget); 1271 } 1272 } 1273 1274 bool delegate(GdkDragContext*, gint, gint, guint, Widget)[] onDragMotionListeners; 1275 /** 1276 * The drag-motion signal is emitted on the drop site when the user 1277 * moves the cursor over the widget during a drag. The signal handler 1278 * must determine whether the cursor position is in a drop zone or not. 1279 * If it is not in a drop zone, it returns FALSE and no further processing 1280 * is necessary. Otherwise, the handler returns TRUE. In this case, the 1281 * handler is responsible for providing the necessary information for 1282 * displaying feedback to the user, by calling gdk_drag_status(). 1283 * If the decision whether the drop will be accepted or rejected can't be 1284 * made based solely on the cursor position and the type of the data, the 1285 * handler may inspect the dragged data by calling gtk_drag_get_data() and 1286 * defer the gdk_drag_status() call to the "drag-data-received" 1287 * handler. Note that you cannot not pass GTK_DEST_DEFAULT_DROP, 1288 * GTK_DEST_DEFAULT_MOTION or GTK_DEST_DEFAULT_ALL to gtk_drag_dest_set() 1289 * when using the drag-motion signal that way. 1290 * Also note that there is no drag-enter signal. The drag receiver has to 1291 * keep track of whether he has received any drag-motion signals since the 1292 * last "drag-leave" and if not, treat the drag-motion signal as 1293 * an "enter" signal. Upon an "enter", the handler will typically highlight 1294 * the drop site with gtk_drag_highlight(). 1295 * $(DDOC_COMMENT example) 1296 */ 1297 void addOnDragMotion(bool delegate(GdkDragContext*, gint, gint, guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1298 { 1299 if ( !("drag-motion" in connectedSignals) ) 1300 { 1301 Signals.connectData( 1302 getStruct(), 1303 "drag-motion", 1304 cast(GCallback)&callBackDragMotion, 1305 cast(void*)this, 1306 null, 1307 connectFlags); 1308 connectedSignals["drag-motion"] = 1; 1309 } 1310 onDragMotionListeners ~= dlg; 1311 } 1312 extern(C) static gboolean callBackDragMotion(GtkWidget* widgetStruct, GdkDragContext* dragContext, gint x, gint y, guint time, Widget _widget) 1313 { 1314 foreach ( bool delegate(GdkDragContext*, gint, gint, guint, Widget) dlg ; _widget.onDragMotionListeners ) 1315 { 1316 if ( dlg(dragContext, x, y, time, _widget) ) 1317 { 1318 return 1; 1319 } 1320 } 1321 1322 return 0; 1323 } 1324 1325 bool delegate(GdkEventCrossing*, Widget)[] onEnterNotifyListeners; 1326 /** 1327 * The ::enter-notify-event will be emitted when the pointer enters 1328 * the widget's window. 1329 * To receive this signal, the GdkWindow associated to the widget needs 1330 * to enable the GDK_ENTER_NOTIFY_MASK mask. 1331 * This signal will be sent to the grab widget if there is one. 1332 */ 1333 void addOnEnterNotify(bool delegate(GdkEventCrossing*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1334 { 1335 if ( !("enter-notify-event" in connectedSignals) ) 1336 { 1337 Signals.connectData( 1338 getStruct(), 1339 "enter-notify-event", 1340 cast(GCallback)&callBackEnterNotify, 1341 cast(void*)this, 1342 null, 1343 connectFlags); 1344 connectedSignals["enter-notify-event"] = 1; 1345 } 1346 onEnterNotifyListeners ~= dlg; 1347 } 1348 extern(C) static gboolean callBackEnterNotify(GtkWidget* widgetStruct, GdkEventCrossing* event, Widget _widget) 1349 { 1350 foreach ( bool delegate(GdkEventCrossing*, Widget) dlg ; _widget.onEnterNotifyListeners ) 1351 { 1352 if ( dlg(event, _widget) ) 1353 { 1354 return 1; 1355 } 1356 } 1357 1358 return 0; 1359 } 1360 1361 bool delegate(Event, Widget)[] onListeners; 1362 /** 1363 * The GTK+ main loop will emit three signals for each GDK event delivered 1364 * to a widget: one generic ::event signal, another, more specific, 1365 * signal that matches the type of event delivered (e.g. 1366 * "key-press-event") and finally a generic 1367 * "event-after" signal. 1368 */ 1369 void addOn(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1370 { 1371 if ( !("event" in connectedSignals) ) 1372 { 1373 Signals.connectData( 1374 getStruct(), 1375 "event", 1376 cast(GCallback)&callBack, 1377 cast(void*)this, 1378 null, 1379 connectFlags); 1380 connectedSignals["event"] = 1; 1381 } 1382 onListeners ~= dlg; 1383 } 1384 extern(C) static gboolean callBack(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 1385 { 1386 foreach ( bool delegate(Event, Widget) dlg ; _widget.onListeners ) 1387 { 1388 if ( dlg(ObjectG.getDObject!(Event)(event), _widget) ) 1389 { 1390 return 1; 1391 } 1392 } 1393 1394 return 0; 1395 } 1396 1397 void delegate(Event, Widget)[] onEventAfterListeners; 1398 /** 1399 * After the emission of the "event" signal and (optionally) 1400 * the second more specific signal, ::event-after will be emitted 1401 * regardless of the previous two signals handlers return values. 1402 */ 1403 void addOnEventAfter(void delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1404 { 1405 if ( !("event-after" in connectedSignals) ) 1406 { 1407 Signals.connectData( 1408 getStruct(), 1409 "event-after", 1410 cast(GCallback)&callBackEventAfter, 1411 cast(void*)this, 1412 null, 1413 connectFlags); 1414 connectedSignals["event-after"] = 1; 1415 } 1416 onEventAfterListeners ~= dlg; 1417 } 1418 extern(C) static void callBackEventAfter(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 1419 { 1420 foreach ( void delegate(Event, Widget) dlg ; _widget.onEventAfterListeners ) 1421 { 1422 dlg(ObjectG.getDObject!(Event)(event), _widget); 1423 } 1424 } 1425 1426 bool delegate(GdkEventExpose*, Widget)[] onExposeListeners; 1427 /** 1428 * The ::expose-event signal is emitted when an area of a previously 1429 * obscured GdkWindow is made visible and needs to be redrawn. 1430 * GTK_NO_WINDOW widgets will get a synthesized event from their parent 1431 * widget. 1432 * To receive this signal, the GdkWindow associated to the widget needs 1433 * to enable the GDK_EXPOSURE_MASK mask. 1434 */ 1435 void addOnExpose(bool delegate(GdkEventExpose*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1436 { 1437 if ( !("expose-event" in connectedSignals) ) 1438 { 1439 Signals.connectData( 1440 getStruct(), 1441 "expose-event", 1442 cast(GCallback)&callBackExpose, 1443 cast(void*)this, 1444 null, 1445 connectFlags); 1446 connectedSignals["expose-event"] = 1; 1447 } 1448 onExposeListeners ~= dlg; 1449 } 1450 extern(C) static gboolean callBackExpose(GtkWidget* widgetStruct, GdkEventExpose* event, Widget _widget) 1451 { 1452 foreach ( bool delegate(GdkEventExpose*, Widget) dlg ; _widget.onExposeListeners ) 1453 { 1454 if ( dlg(event, _widget) ) 1455 { 1456 return 1; 1457 } 1458 } 1459 1460 return 0; 1461 } 1462 1463 bool delegate(GtkDirectionType, Widget)[] onFocusListeners; 1464 /** 1465 */ 1466 void addOnFocus(bool delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1467 { 1468 if ( !("focus" in connectedSignals) ) 1469 { 1470 Signals.connectData( 1471 getStruct(), 1472 "focus", 1473 cast(GCallback)&callBackFocus, 1474 cast(void*)this, 1475 null, 1476 connectFlags); 1477 connectedSignals["focus"] = 1; 1478 } 1479 onFocusListeners ~= dlg; 1480 } 1481 extern(C) static gboolean callBackFocus(GtkWidget* widgetStruct, GtkDirectionType direction, Widget _widget) 1482 { 1483 foreach ( bool delegate(GtkDirectionType, Widget) dlg ; _widget.onFocusListeners ) 1484 { 1485 if ( dlg(direction, _widget) ) 1486 { 1487 return 1; 1488 } 1489 } 1490 1491 return 0; 1492 } 1493 1494 bool delegate(GdkEventFocus*, Widget)[] onFocusInListeners; 1495 /** 1496 * The ::focus-in-event signal will be emitted when the keyboard focus 1497 * enters the widget's window. 1498 * To receive this signal, the GdkWindow associated to the widget needs 1499 * to enable the GDK_FOCUS_CHANGE_MASK mask. 1500 */ 1501 void addOnFocusIn(bool delegate(GdkEventFocus*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1502 { 1503 if ( !("focus-in-event" in connectedSignals) ) 1504 { 1505 Signals.connectData( 1506 getStruct(), 1507 "focus-in-event", 1508 cast(GCallback)&callBackFocusIn, 1509 cast(void*)this, 1510 null, 1511 connectFlags); 1512 connectedSignals["focus-in-event"] = 1; 1513 } 1514 onFocusInListeners ~= dlg; 1515 } 1516 extern(C) static gboolean callBackFocusIn(GtkWidget* widgetStruct, GdkEventFocus* event, Widget _widget) 1517 { 1518 foreach ( bool delegate(GdkEventFocus*, Widget) dlg ; _widget.onFocusInListeners ) 1519 { 1520 if ( dlg(event, _widget) ) 1521 { 1522 return 1; 1523 } 1524 } 1525 1526 return 0; 1527 } 1528 1529 bool delegate(GdkEventFocus*, Widget)[] onFocusOutListeners; 1530 /** 1531 * The ::focus-out-event signal will be emitted when the keyboard focus 1532 * leaves the widget's window. 1533 * To receive this signal, the GdkWindow associated to the widget needs 1534 * to enable the GDK_FOCUS_CHANGE_MASK mask. 1535 */ 1536 void addOnFocusOut(bool delegate(GdkEventFocus*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1537 { 1538 if ( !("focus-out-event" in connectedSignals) ) 1539 { 1540 Signals.connectData( 1541 getStruct(), 1542 "focus-out-event", 1543 cast(GCallback)&callBackFocusOut, 1544 cast(void*)this, 1545 null, 1546 connectFlags); 1547 connectedSignals["focus-out-event"] = 1; 1548 } 1549 onFocusOutListeners ~= dlg; 1550 } 1551 extern(C) static gboolean callBackFocusOut(GtkWidget* widgetStruct, GdkEventFocus* event, Widget _widget) 1552 { 1553 foreach ( bool delegate(GdkEventFocus*, Widget) dlg ; _widget.onFocusOutListeners ) 1554 { 1555 if ( dlg(event, _widget) ) 1556 { 1557 return 1; 1558 } 1559 } 1560 1561 return 0; 1562 } 1563 1564 bool delegate(Event, Widget)[] onGrabBrokenListeners; 1565 /** 1566 * Emitted when a pointer or keyboard grab on a window belonging 1567 * to widget gets broken. 1568 * On X11, this happens when the grab window becomes unviewable 1569 * (i.e. it or one of its ancestors is unmapped), or if the same 1570 * application grabs the pointer or keyboard again. 1571 * Since 2.8 1572 */ 1573 void addOnGrabBroken(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1574 { 1575 if ( !("grab-broken-event" in connectedSignals) ) 1576 { 1577 Signals.connectData( 1578 getStruct(), 1579 "grab-broken-event", 1580 cast(GCallback)&callBackGrabBroken, 1581 cast(void*)this, 1582 null, 1583 connectFlags); 1584 connectedSignals["grab-broken-event"] = 1; 1585 } 1586 onGrabBrokenListeners ~= dlg; 1587 } 1588 extern(C) static gboolean callBackGrabBroken(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 1589 { 1590 foreach ( bool delegate(Event, Widget) dlg ; _widget.onGrabBrokenListeners ) 1591 { 1592 if ( dlg(ObjectG.getDObject!(Event)(event), _widget) ) 1593 { 1594 return 1; 1595 } 1596 } 1597 1598 return 0; 1599 } 1600 1601 void delegate(Widget)[] onGrabFocusListeners; 1602 /** 1603 */ 1604 void addOnGrabFocus(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1605 { 1606 if ( !("grab-focus" in connectedSignals) ) 1607 { 1608 Signals.connectData( 1609 getStruct(), 1610 "grab-focus", 1611 cast(GCallback)&callBackGrabFocus, 1612 cast(void*)this, 1613 null, 1614 connectFlags); 1615 connectedSignals["grab-focus"] = 1; 1616 } 1617 onGrabFocusListeners ~= dlg; 1618 } 1619 extern(C) static void callBackGrabFocus(GtkWidget* widgetStruct, Widget _widget) 1620 { 1621 foreach ( void delegate(Widget) dlg ; _widget.onGrabFocusListeners ) 1622 { 1623 dlg(_widget); 1624 } 1625 } 1626 1627 void delegate(gboolean, Widget)[] onGrabNotifyListeners; 1628 /** 1629 * The ::grab-notify signal is emitted when a widget becomes 1630 * shadowed by a GTK+ grab (not a pointer or keyboard grab) on 1631 * another widget, or when it becomes unshadowed due to a grab 1632 * being removed. 1633 * A widget is shadowed by a gtk_grab_add() when the topmost 1634 * grab widget in the grab stack of its window group is not 1635 * its ancestor. 1636 * FALSE if the widget becomes shadowed, TRUE 1637 * if it becomes unshadowed 1638 */ 1639 void addOnGrabNotify(void delegate(gboolean, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1640 { 1641 if ( !("grab-notify" in connectedSignals) ) 1642 { 1643 Signals.connectData( 1644 getStruct(), 1645 "grab-notify", 1646 cast(GCallback)&callBackGrabNotify, 1647 cast(void*)this, 1648 null, 1649 connectFlags); 1650 connectedSignals["grab-notify"] = 1; 1651 } 1652 onGrabNotifyListeners ~= dlg; 1653 } 1654 extern(C) static void callBackGrabNotify(GtkWidget* widgetStruct, gboolean wasGrabbed, Widget _widget) 1655 { 1656 foreach ( void delegate(gboolean, Widget) dlg ; _widget.onGrabNotifyListeners ) 1657 { 1658 dlg(wasGrabbed, _widget); 1659 } 1660 } 1661 1662 void delegate(Widget)[] onHideListeners; 1663 /** 1664 */ 1665 void addOnHide(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1666 { 1667 if ( !("hide" in connectedSignals) ) 1668 { 1669 Signals.connectData( 1670 getStruct(), 1671 "hide", 1672 cast(GCallback)&callBackHide, 1673 cast(void*)this, 1674 null, 1675 connectFlags); 1676 connectedSignals["hide"] = 1; 1677 } 1678 onHideListeners ~= dlg; 1679 } 1680 extern(C) static void callBackHide(GtkWidget* widgetStruct, Widget _widget) 1681 { 1682 foreach ( void delegate(Widget) dlg ; _widget.onHideListeners ) 1683 { 1684 dlg(_widget); 1685 } 1686 } 1687 1688 void delegate(Widget, Widget)[] onHierarchyChangedListeners; 1689 /** 1690 * The ::hierarchy-changed signal is emitted when the 1691 * anchored state of a widget changes. A widget is 1692 * anchored when its toplevel 1693 * ancestor is a GtkWindow. This signal is emitted when 1694 * a widget changes from un-anchored to anchored or vice-versa. 1695 */ 1696 void addOnHierarchyChanged(void delegate(Widget, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1697 { 1698 if ( !("hierarchy-changed" in connectedSignals) ) 1699 { 1700 Signals.connectData( 1701 getStruct(), 1702 "hierarchy-changed", 1703 cast(GCallback)&callBackHierarchyChanged, 1704 cast(void*)this, 1705 null, 1706 connectFlags); 1707 connectedSignals["hierarchy-changed"] = 1; 1708 } 1709 onHierarchyChangedListeners ~= dlg; 1710 } 1711 extern(C) static void callBackHierarchyChanged(GtkWidget* widgetStruct, GtkWidget* previousToplevel, Widget _widget) 1712 { 1713 foreach ( void delegate(Widget, Widget) dlg ; _widget.onHierarchyChangedListeners ) 1714 { 1715 dlg(ObjectG.getDObject!(Widget)(previousToplevel), _widget); 1716 } 1717 } 1718 1719 bool delegate(GdkEventKey*, Widget)[] onKeyPressListeners; 1720 /** 1721 * The ::key-press-event signal is emitted when a key is pressed. 1722 * To receive this signal, the GdkWindow associated to the widget needs 1723 * to enable the GDK_KEY_PRESS_MASK mask. 1724 * This signal will be sent to the grab widget if there is one. 1725 */ 1726 void addOnKeyPress(bool delegate(GdkEventKey*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1727 { 1728 if ( !("key-press-event" in connectedSignals) ) 1729 { 1730 Signals.connectData( 1731 getStruct(), 1732 "key-press-event", 1733 cast(GCallback)&callBackKeyPress, 1734 cast(void*)this, 1735 null, 1736 connectFlags); 1737 connectedSignals["key-press-event"] = 1; 1738 } 1739 onKeyPressListeners ~= dlg; 1740 } 1741 extern(C) static gboolean callBackKeyPress(GtkWidget* widgetStruct, GdkEventKey* event, Widget _widget) 1742 { 1743 foreach ( bool delegate(GdkEventKey*, Widget) dlg ; _widget.onKeyPressListeners ) 1744 { 1745 if ( dlg(event, _widget) ) 1746 { 1747 return 1; 1748 } 1749 } 1750 1751 return 0; 1752 } 1753 1754 bool delegate(GdkEventKey*, Widget)[] onKeyReleaseListeners; 1755 /** 1756 * The ::key-release-event signal is emitted when a key is pressed. 1757 * To receive this signal, the GdkWindow associated to the widget needs 1758 * to enable the GDK_KEY_RELEASE_MASK mask. 1759 * This signal will be sent to the grab widget if there is one. 1760 */ 1761 void addOnKeyRelease(bool delegate(GdkEventKey*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1762 { 1763 if ( !("key-release-event" in connectedSignals) ) 1764 { 1765 Signals.connectData( 1766 getStruct(), 1767 "key-release-event", 1768 cast(GCallback)&callBackKeyRelease, 1769 cast(void*)this, 1770 null, 1771 connectFlags); 1772 connectedSignals["key-release-event"] = 1; 1773 } 1774 onKeyReleaseListeners ~= dlg; 1775 } 1776 extern(C) static gboolean callBackKeyRelease(GtkWidget* widgetStruct, GdkEventKey* event, Widget _widget) 1777 { 1778 foreach ( bool delegate(GdkEventKey*, Widget) dlg ; _widget.onKeyReleaseListeners ) 1779 { 1780 if ( dlg(event, _widget) ) 1781 { 1782 return 1; 1783 } 1784 } 1785 1786 return 0; 1787 } 1788 1789 bool delegate(GtkDirectionType, Widget)[] onKeynavFailedListeners; 1790 /** 1791 * Gets emitted if keyboard navigation fails. 1792 * See gtk_widget_keynav_failed() for details. 1793 * Since 2.12 1794 */ 1795 void addOnKeynavFailed(bool delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1796 { 1797 if ( !("keynav-failed" in connectedSignals) ) 1798 { 1799 Signals.connectData( 1800 getStruct(), 1801 "keynav-failed", 1802 cast(GCallback)&callBackKeynavFailed, 1803 cast(void*)this, 1804 null, 1805 connectFlags); 1806 connectedSignals["keynav-failed"] = 1; 1807 } 1808 onKeynavFailedListeners ~= dlg; 1809 } 1810 extern(C) static gboolean callBackKeynavFailed(GtkWidget* widgetStruct, GtkDirectionType direction, Widget _widget) 1811 { 1812 foreach ( bool delegate(GtkDirectionType, Widget) dlg ; _widget.onKeynavFailedListeners ) 1813 { 1814 if ( dlg(direction, _widget) ) 1815 { 1816 return 1; 1817 } 1818 } 1819 1820 return 0; 1821 } 1822 1823 bool delegate(GdkEventCrossing*, Widget)[] onLeaveNotifyListeners; 1824 /** 1825 * The ::leave-notify-event will be emitted when the pointer leaves 1826 * the widget's window. 1827 * To receive this signal, the GdkWindow associated to the widget needs 1828 * to enable the GDK_LEAVE_NOTIFY_MASK mask. 1829 * This signal will be sent to the grab widget if there is one. 1830 */ 1831 void addOnLeaveNotify(bool delegate(GdkEventCrossing*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1832 { 1833 if ( !("leave-notify-event" in connectedSignals) ) 1834 { 1835 Signals.connectData( 1836 getStruct(), 1837 "leave-notify-event", 1838 cast(GCallback)&callBackLeaveNotify, 1839 cast(void*)this, 1840 null, 1841 connectFlags); 1842 connectedSignals["leave-notify-event"] = 1; 1843 } 1844 onLeaveNotifyListeners ~= dlg; 1845 } 1846 extern(C) static gboolean callBackLeaveNotify(GtkWidget* widgetStruct, GdkEventCrossing* event, Widget _widget) 1847 { 1848 foreach ( bool delegate(GdkEventCrossing*, Widget) dlg ; _widget.onLeaveNotifyListeners ) 1849 { 1850 if ( dlg(event, _widget) ) 1851 { 1852 return 1; 1853 } 1854 } 1855 1856 return 0; 1857 } 1858 1859 void delegate(Widget)[] onMapListeners; 1860 /** 1861 */ 1862 void addOnMap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1863 { 1864 if ( !("map" in connectedSignals) ) 1865 { 1866 Signals.connectData( 1867 getStruct(), 1868 "map", 1869 cast(GCallback)&callBackMap, 1870 cast(void*)this, 1871 null, 1872 connectFlags); 1873 connectedSignals["map"] = 1; 1874 } 1875 onMapListeners ~= dlg; 1876 } 1877 extern(C) static void callBackMap(GtkWidget* widgetStruct, Widget _widget) 1878 { 1879 foreach ( void delegate(Widget) dlg ; _widget.onMapListeners ) 1880 { 1881 dlg(_widget); 1882 } 1883 } 1884 1885 bool delegate(Event, Widget)[] onMapEventListeners; 1886 /** 1887 * The ::map-event signal will be emitted when the widget's window is 1888 * mapped. A window is mapped when it becomes visible on the screen. 1889 * To receive this signal, the GdkWindow associated to the widget needs 1890 * to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask 1891 * automatically for all new windows. 1892 */ 1893 void addOnMapEvent(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1894 { 1895 if ( !("map-event" in connectedSignals) ) 1896 { 1897 Signals.connectData( 1898 getStruct(), 1899 "map-event", 1900 cast(GCallback)&callBackMapEvent, 1901 cast(void*)this, 1902 null, 1903 connectFlags); 1904 connectedSignals["map-event"] = 1; 1905 } 1906 onMapEventListeners ~= dlg; 1907 } 1908 extern(C) static gboolean callBackMapEvent(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 1909 { 1910 foreach ( bool delegate(Event, Widget) dlg ; _widget.onMapEventListeners ) 1911 { 1912 if ( dlg(ObjectG.getDObject!(Event)(event), _widget) ) 1913 { 1914 return 1; 1915 } 1916 } 1917 1918 return 0; 1919 } 1920 1921 bool delegate(gboolean, Widget)[] onMnemonicActivateListeners; 1922 /** 1923 */ 1924 void addOnMnemonicActivate(bool delegate(gboolean, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1925 { 1926 if ( !("mnemonic-activate" in connectedSignals) ) 1927 { 1928 Signals.connectData( 1929 getStruct(), 1930 "mnemonic-activate", 1931 cast(GCallback)&callBackMnemonicActivate, 1932 cast(void*)this, 1933 null, 1934 connectFlags); 1935 connectedSignals["mnemonic-activate"] = 1; 1936 } 1937 onMnemonicActivateListeners ~= dlg; 1938 } 1939 extern(C) static gboolean callBackMnemonicActivate(GtkWidget* widgetStruct, gboolean arg1, Widget _widget) 1940 { 1941 foreach ( bool delegate(gboolean, Widget) dlg ; _widget.onMnemonicActivateListeners ) 1942 { 1943 if ( dlg(arg1, _widget) ) 1944 { 1945 return 1; 1946 } 1947 } 1948 1949 return 0; 1950 } 1951 1952 bool delegate(GdkEventMotion*, Widget)[] onMotionNotifyListeners; 1953 /** 1954 * The ::motion-notify-event signal is emitted when the pointer moves 1955 * over the widget's GdkWindow. 1956 * To receive this signal, the GdkWindow associated to the widget 1957 * needs to enable the GDK_POINTER_MOTION_MASK mask. 1958 * This signal will be sent to the grab widget if there is one. 1959 */ 1960 void addOnMotionNotify(bool delegate(GdkEventMotion*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1961 { 1962 if ( !("motion-notify-event" in connectedSignals) ) 1963 { 1964 addEvents(EventMask.POINTER_MOTION_MASK); 1965 Signals.connectData( 1966 getStruct(), 1967 "motion-notify-event", 1968 cast(GCallback)&callBackMotionNotify, 1969 cast(void*)this, 1970 null, 1971 connectFlags); 1972 connectedSignals["motion-notify-event"] = 1; 1973 } 1974 onMotionNotifyListeners ~= dlg; 1975 } 1976 extern(C) static gboolean callBackMotionNotify(GtkWidget* widgetStruct, GdkEventMotion* event, Widget _widget) 1977 { 1978 foreach ( bool delegate(GdkEventMotion*, Widget) dlg ; _widget.onMotionNotifyListeners ) 1979 { 1980 if ( dlg(event, _widget) ) 1981 { 1982 return 1; 1983 } 1984 } 1985 1986 return 0; 1987 } 1988 1989 void delegate(GtkDirectionType, Widget)[] onMoveFocusListeners; 1990 /** 1991 */ 1992 void addOnMoveFocus(void delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1993 { 1994 if ( !("move-focus" in connectedSignals) ) 1995 { 1996 Signals.connectData( 1997 getStruct(), 1998 "move-focus", 1999 cast(GCallback)&callBackMoveFocus, 2000 cast(void*)this, 2001 null, 2002 connectFlags); 2003 connectedSignals["move-focus"] = 1; 2004 } 2005 onMoveFocusListeners ~= dlg; 2006 } 2007 extern(C) static void callBackMoveFocus(GtkWidget* widgetStruct, GtkDirectionType direction, Widget _widget) 2008 { 2009 foreach ( void delegate(GtkDirectionType, Widget) dlg ; _widget.onMoveFocusListeners ) 2010 { 2011 dlg(direction, _widget); 2012 } 2013 } 2014 2015 bool delegate(GdkEventNoExpose*, Widget)[] onNoExposeListeners; 2016 /** 2017 * The ::no-expose-event will be emitted when the widget's window is 2018 * drawn as a copy of another GdkDrawable (with gdk_draw_drawable() or 2019 * gdk_window_copy_area()) which was completely unobscured. If the source 2020 * window was partially obscured GdkEventExpose events will be generated 2021 * for those areas. 2022 */ 2023 void addOnNoExpose(bool delegate(GdkEventNoExpose*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2024 { 2025 if ( !("no-expose-event" in connectedSignals) ) 2026 { 2027 Signals.connectData( 2028 getStruct(), 2029 "no-expose-event", 2030 cast(GCallback)&callBackNoExpose, 2031 cast(void*)this, 2032 null, 2033 connectFlags); 2034 connectedSignals["no-expose-event"] = 1; 2035 } 2036 onNoExposeListeners ~= dlg; 2037 } 2038 extern(C) static gboolean callBackNoExpose(GtkWidget* widgetStruct, GdkEventNoExpose* event, Widget _widget) 2039 { 2040 foreach ( bool delegate(GdkEventNoExpose*, Widget) dlg ; _widget.onNoExposeListeners ) 2041 { 2042 if ( dlg(event, _widget) ) 2043 { 2044 return 1; 2045 } 2046 } 2047 2048 return 0; 2049 } 2050 2051 void delegate(GtkObject*, Widget)[] onParentSetListeners; 2052 /** 2053 * The ::parent-set signal is emitted when a new parent 2054 * has been set on a widget. 2055 */ 2056 void addOnParentSet(void delegate(GtkObject*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2057 { 2058 if ( !("parent-set" in connectedSignals) ) 2059 { 2060 Signals.connectData( 2061 getStruct(), 2062 "parent-set", 2063 cast(GCallback)&callBackParentSet, 2064 cast(void*)this, 2065 null, 2066 connectFlags); 2067 connectedSignals["parent-set"] = 1; 2068 } 2069 onParentSetListeners ~= dlg; 2070 } 2071 extern(C) static void callBackParentSet(GtkWidget* widgetStruct, GtkObject* oldParent, Widget _widget) 2072 { 2073 foreach ( void delegate(GtkObject*, Widget) dlg ; _widget.onParentSetListeners ) 2074 { 2075 dlg(oldParent, _widget); 2076 } 2077 } 2078 2079 bool delegate(Widget)[] onPopupMenuListeners; 2080 /** 2081 * This signal gets emitted whenever a widget should pop up a context 2082 * menu. This usually happens through the standard key binding mechanism; 2083 * by pressing a certain key while a widget is focused, the user can cause 2084 * the widget to pop up a menu. For example, the GtkEntry widget creates 2085 * a menu with clipboard commands. See the section called “Implement GtkWidget::popup_menu” 2086 * for an example of how to use this signal. 2087 */ 2088 void addOnPopupMenu(bool delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2089 { 2090 if ( !("popup-menu" in connectedSignals) ) 2091 { 2092 Signals.connectData( 2093 getStruct(), 2094 "popup-menu", 2095 cast(GCallback)&callBackPopupMenu, 2096 cast(void*)this, 2097 null, 2098 connectFlags); 2099 connectedSignals["popup-menu"] = 1; 2100 } 2101 onPopupMenuListeners ~= dlg; 2102 } 2103 extern(C) static gboolean callBackPopupMenu(GtkWidget* widgetStruct, Widget _widget) 2104 { 2105 foreach ( bool delegate(Widget) dlg ; _widget.onPopupMenuListeners ) 2106 { 2107 if ( dlg(_widget) ) 2108 { 2109 return 1; 2110 } 2111 } 2112 2113 return 0; 2114 } 2115 2116 bool delegate(GdkEventProperty*, Widget)[] onPropertyNotifyListeners; 2117 /** 2118 * The ::property-notify-event signal will be emitted when a property on 2119 * the widget's window has been changed or deleted. 2120 * To receive this signal, the GdkWindow associated to the widget needs 2121 * to enable the GDK_PROPERTY_CHANGE_MASK mask. 2122 */ 2123 void addOnPropertyNotify(bool delegate(GdkEventProperty*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2124 { 2125 if ( !("property-notify-event" in connectedSignals) ) 2126 { 2127 Signals.connectData( 2128 getStruct(), 2129 "property-notify-event", 2130 cast(GCallback)&callBackPropertyNotify, 2131 cast(void*)this, 2132 null, 2133 connectFlags); 2134 connectedSignals["property-notify-event"] = 1; 2135 } 2136 onPropertyNotifyListeners ~= dlg; 2137 } 2138 extern(C) static gboolean callBackPropertyNotify(GtkWidget* widgetStruct, GdkEventProperty* event, Widget _widget) 2139 { 2140 foreach ( bool delegate(GdkEventProperty*, Widget) dlg ; _widget.onPropertyNotifyListeners ) 2141 { 2142 if ( dlg(event, _widget) ) 2143 { 2144 return 1; 2145 } 2146 } 2147 2148 return 0; 2149 } 2150 2151 bool delegate(GdkEventProximity*, Widget)[] onProximityInListeners; 2152 /** 2153 * To receive this signal the GdkWindow associated to the widget needs 2154 * to enable the GDK_PROXIMITY_IN_MASK mask. 2155 * This signal will be sent to the grab widget if there is one. 2156 */ 2157 void addOnProximityIn(bool delegate(GdkEventProximity*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2158 { 2159 if ( !("proximity-in-event" in connectedSignals) ) 2160 { 2161 Signals.connectData( 2162 getStruct(), 2163 "proximity-in-event", 2164 cast(GCallback)&callBackProximityIn, 2165 cast(void*)this, 2166 null, 2167 connectFlags); 2168 connectedSignals["proximity-in-event"] = 1; 2169 } 2170 onProximityInListeners ~= dlg; 2171 } 2172 extern(C) static gboolean callBackProximityIn(GtkWidget* widgetStruct, GdkEventProximity* event, Widget _widget) 2173 { 2174 foreach ( bool delegate(GdkEventProximity*, Widget) dlg ; _widget.onProximityInListeners ) 2175 { 2176 if ( dlg(event, _widget) ) 2177 { 2178 return 1; 2179 } 2180 } 2181 2182 return 0; 2183 } 2184 2185 bool delegate(GdkEventProximity*, Widget)[] onProximityOutListeners; 2186 /** 2187 * To receive this signal the GdkWindow associated to the widget needs 2188 * to enable the GDK_PROXIMITY_OUT_MASK mask. 2189 * This signal will be sent to the grab widget if there is one. 2190 */ 2191 void addOnProximityOut(bool delegate(GdkEventProximity*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2192 { 2193 if ( !("proximity-out-event" in connectedSignals) ) 2194 { 2195 Signals.connectData( 2196 getStruct(), 2197 "proximity-out-event", 2198 cast(GCallback)&callBackProximityOut, 2199 cast(void*)this, 2200 null, 2201 connectFlags); 2202 connectedSignals["proximity-out-event"] = 1; 2203 } 2204 onProximityOutListeners ~= dlg; 2205 } 2206 extern(C) static gboolean callBackProximityOut(GtkWidget* widgetStruct, GdkEventProximity* event, Widget _widget) 2207 { 2208 foreach ( bool delegate(GdkEventProximity*, Widget) dlg ; _widget.onProximityOutListeners ) 2209 { 2210 if ( dlg(event, _widget) ) 2211 { 2212 return 1; 2213 } 2214 } 2215 2216 return 0; 2217 } 2218 2219 bool delegate(gint, gint, gboolean, GtkTooltip*, Widget)[] onQueryTooltipListeners; 2220 /** 2221 * Emitted when "has-tooltip" is TRUE and the "gtk-tooltip-timeout" 2222 * has expired with the cursor hovering "above" widget; or emitted when widget got 2223 * focus in keyboard mode. 2224 * Using the given coordinates, the signal handler should determine 2225 * whether a tooltip should be shown for widget. If this is the case 2226 * TRUE should be returned, FALSE otherwise. Note that if 2227 * keyboard_mode is TRUE, the values of x and y are undefined and 2228 * should not be used. 2229 * The signal handler is free to manipulate tooltip with the therefore 2230 * destined function calls. 2231 * TRUE if the tooltip was trigged using the keyboard 2232 * Since 2.12 2233 */ 2234 void addOnQueryTooltip(bool delegate(gint, gint, gboolean, GtkTooltip*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2235 { 2236 if ( !("query-tooltip" in connectedSignals) ) 2237 { 2238 Signals.connectData( 2239 getStruct(), 2240 "query-tooltip", 2241 cast(GCallback)&callBackQueryTooltip, 2242 cast(void*)this, 2243 null, 2244 connectFlags); 2245 connectedSignals["query-tooltip"] = 1; 2246 } 2247 onQueryTooltipListeners ~= dlg; 2248 } 2249 extern(C) static gboolean callBackQueryTooltip(GtkWidget* widgetStruct, gint x, gint y, gboolean keyboardMode, GtkTooltip* tooltip, Widget _widget) 2250 { 2251 foreach ( bool delegate(gint, gint, gboolean, GtkTooltip*, Widget) dlg ; _widget.onQueryTooltipListeners ) 2252 { 2253 if ( dlg(x, y, keyboardMode, tooltip, _widget) ) 2254 { 2255 return 1; 2256 } 2257 } 2258 2259 return 0; 2260 } 2261 2262 void delegate(Widget)[] onRealizeListeners; 2263 /** 2264 */ 2265 void addOnRealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2266 { 2267 if ( !("realize" in connectedSignals) ) 2268 { 2269 Signals.connectData( 2270 getStruct(), 2271 "realize", 2272 cast(GCallback)&callBackRealize, 2273 cast(void*)this, 2274 null, 2275 connectFlags); 2276 connectedSignals["realize"] = 1; 2277 } 2278 onRealizeListeners ~= dlg; 2279 } 2280 extern(C) static void callBackRealize(GtkWidget* widgetStruct, Widget _widget) 2281 { 2282 foreach ( void delegate(Widget) dlg ; _widget.onRealizeListeners ) 2283 { 2284 dlg(_widget); 2285 } 2286 } 2287 2288 void delegate(Screen, Widget)[] onScreenChangedListeners; 2289 /** 2290 * The ::screen-changed signal gets emitted when the 2291 * screen of a widget has changed. 2292 */ 2293 void addOnScreenChanged(void delegate(Screen, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2294 { 2295 if ( !("screen-changed" in connectedSignals) ) 2296 { 2297 Signals.connectData( 2298 getStruct(), 2299 "screen-changed", 2300 cast(GCallback)&callBackScreenChanged, 2301 cast(void*)this, 2302 null, 2303 connectFlags); 2304 connectedSignals["screen-changed"] = 1; 2305 } 2306 onScreenChangedListeners ~= dlg; 2307 } 2308 extern(C) static void callBackScreenChanged(GtkWidget* widgetStruct, GdkScreen* previousScreen, Widget _widget) 2309 { 2310 foreach ( void delegate(Screen, Widget) dlg ; _widget.onScreenChangedListeners ) 2311 { 2312 dlg(ObjectG.getDObject!(Screen)(previousScreen), _widget); 2313 } 2314 } 2315 2316 bool delegate(GdkEventScroll*, Widget)[] onScrollListeners; 2317 /** 2318 * The ::scroll-event signal is emitted when a button in the 4 to 7 2319 * range is pressed. Wheel mice are usually configured to generate 2320 * button press events for buttons 4 and 5 when the wheel is turned. 2321 * To receive this signal, the GdkWindow associated to the widget needs 2322 * to enable the GDK_BUTTON_PRESS_MASK mask. 2323 * This signal will be sent to the grab widget if there is one. 2324 */ 2325 void addOnScroll(bool delegate(GdkEventScroll*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2326 { 2327 if ( !("scroll-event" in connectedSignals) ) 2328 { 2329 Signals.connectData( 2330 getStruct(), 2331 "scroll-event", 2332 cast(GCallback)&callBackScroll, 2333 cast(void*)this, 2334 null, 2335 connectFlags); 2336 connectedSignals["scroll-event"] = 1; 2337 } 2338 onScrollListeners ~= dlg; 2339 } 2340 extern(C) static gboolean callBackScroll(GtkWidget* widgetStruct, GdkEventScroll* event, Widget _widget) 2341 { 2342 foreach ( bool delegate(GdkEventScroll*, Widget) dlg ; _widget.onScrollListeners ) 2343 { 2344 if ( dlg(event, _widget) ) 2345 { 2346 return 1; 2347 } 2348 } 2349 2350 return 0; 2351 } 2352 2353 bool delegate(GdkEventSelection*, Widget)[] onSelectionClearListeners; 2354 /** 2355 * The ::selection-clear-event signal will be emitted when the 2356 * the widget's window has lost ownership of a selection. 2357 */ 2358 void addOnSelectionClear(bool delegate(GdkEventSelection*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2359 { 2360 if ( !("selection-clear-event" in connectedSignals) ) 2361 { 2362 Signals.connectData( 2363 getStruct(), 2364 "selection-clear-event", 2365 cast(GCallback)&callBackSelectionClear, 2366 cast(void*)this, 2367 null, 2368 connectFlags); 2369 connectedSignals["selection-clear-event"] = 1; 2370 } 2371 onSelectionClearListeners ~= dlg; 2372 } 2373 extern(C) static gboolean callBackSelectionClear(GtkWidget* widgetStruct, GdkEventSelection* event, Widget _widget) 2374 { 2375 foreach ( bool delegate(GdkEventSelection*, Widget) dlg ; _widget.onSelectionClearListeners ) 2376 { 2377 if ( dlg(event, _widget) ) 2378 { 2379 return 1; 2380 } 2381 } 2382 2383 return 0; 2384 } 2385 2386 void delegate(GtkSelectionData*, guint, guint, Widget)[] onSelectionGetListeners; 2387 /** 2388 */ 2389 void addOnSelectionGet(void delegate(GtkSelectionData*, guint, guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2390 { 2391 if ( !("selection-get" in connectedSignals) ) 2392 { 2393 Signals.connectData( 2394 getStruct(), 2395 "selection-get", 2396 cast(GCallback)&callBackSelectionGet, 2397 cast(void*)this, 2398 null, 2399 connectFlags); 2400 connectedSignals["selection-get"] = 1; 2401 } 2402 onSelectionGetListeners ~= dlg; 2403 } 2404 extern(C) static void callBackSelectionGet(GtkWidget* widgetStruct, GtkSelectionData* data, guint info, guint time, Widget _widget) 2405 { 2406 foreach ( void delegate(GtkSelectionData*, guint, guint, Widget) dlg ; _widget.onSelectionGetListeners ) 2407 { 2408 dlg(data, info, time, _widget); 2409 } 2410 } 2411 2412 bool delegate(GdkEventSelection*, Widget)[] onSelectionNotifyListeners; 2413 /** 2414 */ 2415 void addOnSelectionNotify(bool delegate(GdkEventSelection*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2416 { 2417 if ( !("selection-notify-event" in connectedSignals) ) 2418 { 2419 Signals.connectData( 2420 getStruct(), 2421 "selection-notify-event", 2422 cast(GCallback)&callBackSelectionNotify, 2423 cast(void*)this, 2424 null, 2425 connectFlags); 2426 connectedSignals["selection-notify-event"] = 1; 2427 } 2428 onSelectionNotifyListeners ~= dlg; 2429 } 2430 extern(C) static gboolean callBackSelectionNotify(GtkWidget* widgetStruct, GdkEventSelection* event, Widget _widget) 2431 { 2432 foreach ( bool delegate(GdkEventSelection*, Widget) dlg ; _widget.onSelectionNotifyListeners ) 2433 { 2434 if ( dlg(event, _widget) ) 2435 { 2436 return 1; 2437 } 2438 } 2439 2440 return 0; 2441 } 2442 2443 void delegate(GtkSelectionData*, guint, Widget)[] onSelectionReceivedListeners; 2444 /** 2445 */ 2446 void addOnSelectionReceived(void delegate(GtkSelectionData*, guint, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2447 { 2448 if ( !("selection-received" in connectedSignals) ) 2449 { 2450 Signals.connectData( 2451 getStruct(), 2452 "selection-received", 2453 cast(GCallback)&callBackSelectionReceived, 2454 cast(void*)this, 2455 null, 2456 connectFlags); 2457 connectedSignals["selection-received"] = 1; 2458 } 2459 onSelectionReceivedListeners ~= dlg; 2460 } 2461 extern(C) static void callBackSelectionReceived(GtkWidget* widgetStruct, GtkSelectionData* data, guint time, Widget _widget) 2462 { 2463 foreach ( void delegate(GtkSelectionData*, guint, Widget) dlg ; _widget.onSelectionReceivedListeners ) 2464 { 2465 dlg(data, time, _widget); 2466 } 2467 } 2468 2469 bool delegate(GdkEventSelection*, Widget)[] onSelectionRequestListeners; 2470 /** 2471 * The ::selection-request-event signal will be emitted when 2472 * another client requests ownership of the selection owned by 2473 * the widget's window. 2474 */ 2475 void addOnSelectionRequest(bool delegate(GdkEventSelection*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2476 { 2477 if ( !("selection-request-event" in connectedSignals) ) 2478 { 2479 Signals.connectData( 2480 getStruct(), 2481 "selection-request-event", 2482 cast(GCallback)&callBackSelectionRequest, 2483 cast(void*)this, 2484 null, 2485 connectFlags); 2486 connectedSignals["selection-request-event"] = 1; 2487 } 2488 onSelectionRequestListeners ~= dlg; 2489 } 2490 extern(C) static gboolean callBackSelectionRequest(GtkWidget* widgetStruct, GdkEventSelection* event, Widget _widget) 2491 { 2492 foreach ( bool delegate(GdkEventSelection*, Widget) dlg ; _widget.onSelectionRequestListeners ) 2493 { 2494 if ( dlg(event, _widget) ) 2495 { 2496 return 1; 2497 } 2498 } 2499 2500 return 0; 2501 } 2502 2503 void delegate(Widget)[] onShowListeners; 2504 /** 2505 */ 2506 void addOnShow(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2507 { 2508 if ( !("show" in connectedSignals) ) 2509 { 2510 Signals.connectData( 2511 getStruct(), 2512 "show", 2513 cast(GCallback)&callBackShow, 2514 cast(void*)this, 2515 null, 2516 connectFlags); 2517 connectedSignals["show"] = 1; 2518 } 2519 onShowListeners ~= dlg; 2520 } 2521 extern(C) static void callBackShow(GtkWidget* widgetStruct, Widget _widget) 2522 { 2523 foreach ( void delegate(Widget) dlg ; _widget.onShowListeners ) 2524 { 2525 dlg(_widget); 2526 } 2527 } 2528 2529 bool delegate(GtkWidgetHelpType, Widget)[] onShowHelpListeners; 2530 /** 2531 */ 2532 void addOnShowHelp(bool delegate(GtkWidgetHelpType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2533 { 2534 if ( !("show-help" in connectedSignals) ) 2535 { 2536 Signals.connectData( 2537 getStruct(), 2538 "show-help", 2539 cast(GCallback)&callBackShowHelp, 2540 cast(void*)this, 2541 null, 2542 connectFlags); 2543 connectedSignals["show-help"] = 1; 2544 } 2545 onShowHelpListeners ~= dlg; 2546 } 2547 extern(C) static gboolean callBackShowHelp(GtkWidget* widgetStruct, GtkWidgetHelpType helpType, Widget _widget) 2548 { 2549 foreach ( bool delegate(GtkWidgetHelpType, Widget) dlg ; _widget.onShowHelpListeners ) 2550 { 2551 if ( dlg(helpType, _widget) ) 2552 { 2553 return 1; 2554 } 2555 } 2556 2557 return 0; 2558 } 2559 2560 void delegate(GtkAllocation*, Widget)[] onSizeAllocateListeners; 2561 /** 2562 */ 2563 void addOnSizeAllocate(void delegate(GtkAllocation*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2564 { 2565 if ( !("size-allocate" in connectedSignals) ) 2566 { 2567 Signals.connectData( 2568 getStruct(), 2569 "size-allocate", 2570 cast(GCallback)&callBackSizeAllocate, 2571 cast(void*)this, 2572 null, 2573 connectFlags); 2574 connectedSignals["size-allocate"] = 1; 2575 } 2576 onSizeAllocateListeners ~= dlg; 2577 } 2578 extern(C) static void callBackSizeAllocate(GtkWidget* widgetStruct, GtkAllocation* allocation, Widget _widget) 2579 { 2580 foreach ( void delegate(GtkAllocation*, Widget) dlg ; _widget.onSizeAllocateListeners ) 2581 { 2582 dlg(allocation, _widget); 2583 } 2584 } 2585 2586 void delegate(GtkRequisition*, Widget)[] onSizeRequestListeners; 2587 /** 2588 */ 2589 void addOnSizeRequest(void delegate(GtkRequisition*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2590 { 2591 if ( !("size-request" in connectedSignals) ) 2592 { 2593 Signals.connectData( 2594 getStruct(), 2595 "size-request", 2596 cast(GCallback)&callBackSizeRequest, 2597 cast(void*)this, 2598 null, 2599 connectFlags); 2600 connectedSignals["size-request"] = 1; 2601 } 2602 onSizeRequestListeners ~= dlg; 2603 } 2604 extern(C) static void callBackSizeRequest(GtkWidget* widgetStruct, GtkRequisition* requisition, Widget _widget) 2605 { 2606 foreach ( void delegate(GtkRequisition*, Widget) dlg ; _widget.onSizeRequestListeners ) 2607 { 2608 dlg(requisition, _widget); 2609 } 2610 } 2611 2612 void delegate(GtkStateType, Widget)[] onStateChangedListeners; 2613 /** 2614 * The ::state-changed signal is emitted when the widget state changes. 2615 * See gtk_widget_get_state(). 2616 */ 2617 void addOnStateChanged(void delegate(GtkStateType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2618 { 2619 if ( !("state-changed" in connectedSignals) ) 2620 { 2621 Signals.connectData( 2622 getStruct(), 2623 "state-changed", 2624 cast(GCallback)&callBackStateChanged, 2625 cast(void*)this, 2626 null, 2627 connectFlags); 2628 connectedSignals["state-changed"] = 1; 2629 } 2630 onStateChangedListeners ~= dlg; 2631 } 2632 extern(C) static void callBackStateChanged(GtkWidget* widgetStruct, GtkStateType state, Widget _widget) 2633 { 2634 foreach ( void delegate(GtkStateType, Widget) dlg ; _widget.onStateChangedListeners ) 2635 { 2636 dlg(state, _widget); 2637 } 2638 } 2639 2640 void delegate(Style, Widget)[] onStyleSetListeners; 2641 /** 2642 * The ::style-set signal is emitted when a new style has been set 2643 * on a widget. Note that style-modifying functions like 2644 * gtk_widget_modify_base() also cause this signal to be emitted. 2645 */ 2646 void addOnStyleSet(void delegate(Style, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2647 { 2648 if ( !("style-set" in connectedSignals) ) 2649 { 2650 Signals.connectData( 2651 getStruct(), 2652 "style-set", 2653 cast(GCallback)&callBackStyleSet, 2654 cast(void*)this, 2655 null, 2656 connectFlags); 2657 connectedSignals["style-set"] = 1; 2658 } 2659 onStyleSetListeners ~= dlg; 2660 } 2661 extern(C) static void callBackStyleSet(GtkWidget* widgetStruct, GtkStyle* previousStyle, Widget _widget) 2662 { 2663 foreach ( void delegate(Style, Widget) dlg ; _widget.onStyleSetListeners ) 2664 { 2665 dlg(ObjectG.getDObject!(Style)(previousStyle), _widget); 2666 } 2667 } 2668 2669 void delegate(Widget)[] onUnmapListeners; 2670 /** 2671 */ 2672 void addOnUnmap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2673 { 2674 if ( !("unmap" in connectedSignals) ) 2675 { 2676 Signals.connectData( 2677 getStruct(), 2678 "unmap", 2679 cast(GCallback)&callBackUnmap, 2680 cast(void*)this, 2681 null, 2682 connectFlags); 2683 connectedSignals["unmap"] = 1; 2684 } 2685 onUnmapListeners ~= dlg; 2686 } 2687 extern(C) static void callBackUnmap(GtkWidget* widgetStruct, Widget _widget) 2688 { 2689 foreach ( void delegate(Widget) dlg ; _widget.onUnmapListeners ) 2690 { 2691 dlg(_widget); 2692 } 2693 } 2694 2695 bool delegate(Event, Widget)[] onUnmapEventListeners; 2696 /** 2697 * The ::unmap-event signal will be emitted when the widget's window is 2698 * unmapped. A window is unmapped when it becomes invisible on the screen. 2699 * To receive this signal, the GdkWindow associated to the widget needs 2700 * to enable the GDK_STRUCTURE_MASK mask. GDK will enable this mask 2701 * automatically for all new windows. 2702 */ 2703 void addOnUnmapEvent(bool delegate(Event, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2704 { 2705 if ( !("unmap-event" in connectedSignals) ) 2706 { 2707 Signals.connectData( 2708 getStruct(), 2709 "unmap-event", 2710 cast(GCallback)&callBackUnmapEvent, 2711 cast(void*)this, 2712 null, 2713 connectFlags); 2714 connectedSignals["unmap-event"] = 1; 2715 } 2716 onUnmapEventListeners ~= dlg; 2717 } 2718 extern(C) static gboolean callBackUnmapEvent(GtkWidget* widgetStruct, GdkEvent* event, Widget _widget) 2719 { 2720 foreach ( bool delegate(Event, Widget) dlg ; _widget.onUnmapEventListeners ) 2721 { 2722 if ( dlg(ObjectG.getDObject!(Event)(event), _widget) ) 2723 { 2724 return 1; 2725 } 2726 } 2727 2728 return 0; 2729 } 2730 2731 void delegate(Widget)[] onUnrealizeListeners; 2732 /** 2733 */ 2734 void addOnUnrealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2735 { 2736 if ( !("unrealize" in connectedSignals) ) 2737 { 2738 Signals.connectData( 2739 getStruct(), 2740 "unrealize", 2741 cast(GCallback)&callBackUnrealize, 2742 cast(void*)this, 2743 null, 2744 connectFlags); 2745 connectedSignals["unrealize"] = 1; 2746 } 2747 onUnrealizeListeners ~= dlg; 2748 } 2749 extern(C) static void callBackUnrealize(GtkWidget* widgetStruct, Widget _widget) 2750 { 2751 foreach ( void delegate(Widget) dlg ; _widget.onUnrealizeListeners ) 2752 { 2753 dlg(_widget); 2754 } 2755 } 2756 2757 bool delegate(GdkEventVisibility*, Widget)[] onVisibilityNotifyListeners; 2758 /** 2759 * The ::visibility-notify-event will be emitted when the widget's window 2760 * is obscured or unobscured. 2761 * To receive this signal the GdkWindow associated to the widget needs 2762 * to enable the GDK_VISIBILITY_NOTIFY_MASK mask. 2763 */ 2764 void addOnVisibilityNotify(bool delegate(GdkEventVisibility*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2765 { 2766 if ( !("visibility-notify-event" in connectedSignals) ) 2767 { 2768 Signals.connectData( 2769 getStruct(), 2770 "visibility-notify-event", 2771 cast(GCallback)&callBackVisibilityNotify, 2772 cast(void*)this, 2773 null, 2774 connectFlags); 2775 connectedSignals["visibility-notify-event"] = 1; 2776 } 2777 onVisibilityNotifyListeners ~= dlg; 2778 } 2779 extern(C) static gboolean callBackVisibilityNotify(GtkWidget* widgetStruct, GdkEventVisibility* event, Widget _widget) 2780 { 2781 foreach ( bool delegate(GdkEventVisibility*, Widget) dlg ; _widget.onVisibilityNotifyListeners ) 2782 { 2783 if ( dlg(event, _widget) ) 2784 { 2785 return 1; 2786 } 2787 } 2788 2789 return 0; 2790 } 2791 2792 bool delegate(GdkEventWindowState*, Widget)[] onWindowStateListeners; 2793 /** 2794 * The ::window-state-event will be emitted when the state of the 2795 * toplevel window associated to the widget changes. 2796 * To receive this signal the GdkWindow associated to the widget 2797 * needs to enable the GDK_STRUCTURE_MASK mask. GDK will enable 2798 * this mask automatically for all new windows. 2799 */ 2800 void addOnWindowState(bool delegate(GdkEventWindowState*, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2801 { 2802 if ( !("window-state-event" in connectedSignals) ) 2803 { 2804 Signals.connectData( 2805 getStruct(), 2806 "window-state-event", 2807 cast(GCallback)&callBackWindowState, 2808 cast(void*)this, 2809 null, 2810 connectFlags); 2811 connectedSignals["window-state-event"] = 1; 2812 } 2813 onWindowStateListeners ~= dlg; 2814 } 2815 extern(C) static gboolean callBackWindowState(GtkWidget* widgetStruct, GdkEventWindowState* event, Widget _widget) 2816 { 2817 foreach ( bool delegate(GdkEventWindowState*, Widget) dlg ; _widget.onWindowStateListeners ) 2818 { 2819 if ( dlg(event, _widget) ) 2820 { 2821 return 1; 2822 } 2823 } 2824 2825 return 0; 2826 } 2827 2828 2829 /** 2830 * Warning 2831 * gtk_widget_unref has been deprecated since version 2.12 and should not be used in newly-written code. Use g_object_unref() instead. 2832 * Inverse of gtk_widget_ref(). Equivalent to g_object_unref(). 2833 */ 2834 public override void unref() 2835 { 2836 // void gtk_widget_unref (GtkWidget *widget); 2837 gtk_widget_unref(gtkWidget); 2838 } 2839 2840 /** 2841 * This function sets *widget_pointer to NULL if widget_pointer != 2842 * NULL. It's intended to be used as a callback connected to the 2843 * "destroy" signal of a widget. You connect gtk_widget_destroyed() 2844 * as a signal handler, and pass the address of your widget variable 2845 * as user data. Then when the widget is destroyed, the variable will 2846 * be set to NULL. Useful for example to avoid multiple copies 2847 * of the same dialog. 2848 * Params: 2849 * widget = a GtkWidget 2850 * widgetPointer = address of a variable that contains widget. [inout][transfer none] 2851 */ 2852 public void destroyed(ref Widget widgetPointer) 2853 { 2854 // void gtk_widget_destroyed (GtkWidget *widget, GtkWidget **widget_pointer); 2855 GtkWidget* outwidgetPointer = (widgetPointer is null) ? null : widgetPointer.getWidgetStruct(); 2856 2857 gtk_widget_destroyed(gtkWidget, &outwidgetPointer); 2858 2859 widgetPointer = ObjectG.getDObject!(Widget)(outwidgetPointer); 2860 } 2861 2862 /** 2863 * This function is only for use in widget implementations. 2864 * Should be called by implementations of the remove method 2865 * on GtkContainer, to dissociate a child from the container. 2866 */ 2867 public void unparent() 2868 { 2869 // void gtk_widget_unparent (GtkWidget *widget); 2870 gtk_widget_unparent(gtkWidget); 2871 } 2872 2873 /** 2874 * Flags a widget to be displayed. Any widget that isn't shown will 2875 * not appear on the screen. If you want to show all the widgets in a 2876 * container, it's easier to call gtk_widget_show_all() on the 2877 * container, instead of individually showing the widgets. 2878 * Remember that you have to show the containers containing a widget, 2879 * in addition to the widget itself, before it will appear onscreen. 2880 * When a toplevel container is shown, it is immediately realized and 2881 * mapped; other shown widgets are realized and mapped when their 2882 * toplevel container is realized and mapped. 2883 */ 2884 public void show() 2885 { 2886 // void gtk_widget_show (GtkWidget *widget); 2887 gtk_widget_show(gtkWidget); 2888 } 2889 2890 /** 2891 * Shows a widget. If the widget is an unmapped toplevel widget 2892 * (i.e. a GtkWindow that has not yet been shown), enter the main 2893 * loop and wait for the window to actually be mapped. Be careful; 2894 * because the main loop is running, anything can happen during 2895 * this function. 2896 */ 2897 public void showNow() 2898 { 2899 // void gtk_widget_show_now (GtkWidget *widget); 2900 gtk_widget_show_now(gtkWidget); 2901 } 2902 2903 /** 2904 * Reverses the effects of gtk_widget_show(), causing the widget to be 2905 * hidden (invisible to the user). 2906 */ 2907 public void hide() 2908 { 2909 // void gtk_widget_hide (GtkWidget *widget); 2910 gtk_widget_hide(gtkWidget); 2911 } 2912 2913 /** 2914 * Recursively shows a widget, and any child widgets (if the widget is 2915 * a container). 2916 */ 2917 public void showAll() 2918 { 2919 // void gtk_widget_show_all (GtkWidget *widget); 2920 gtk_widget_show_all(gtkWidget); 2921 } 2922 2923 /** 2924 * Recursively hides a widget and any child widgets. 2925 */ 2926 public void hideAll() 2927 { 2928 // void gtk_widget_hide_all (GtkWidget *widget); 2929 gtk_widget_hide_all(gtkWidget); 2930 } 2931 2932 /** 2933 * This function is only for use in widget implementations. Causes 2934 * a widget to be mapped if it isn't already. 2935 */ 2936 public void map() 2937 { 2938 // void gtk_widget_map (GtkWidget *widget); 2939 gtk_widget_map(gtkWidget); 2940 } 2941 2942 /** 2943 * This function is only for use in widget implementations. Causes 2944 * a widget to be unmapped if it's currently mapped. 2945 */ 2946 public void unmap() 2947 { 2948 // void gtk_widget_unmap (GtkWidget *widget); 2949 gtk_widget_unmap(gtkWidget); 2950 } 2951 2952 /** 2953 * Creates the GDK (windowing system) resources associated with a 2954 * widget. For example, widget->window will be created when a widget 2955 * is realized. Normally realization happens implicitly; if you show 2956 * a widget and all its parent containers, then the widget will be 2957 * realized and mapped automatically. 2958 * Realizing a widget requires all 2959 * the widget's parent widgets to be realized; calling 2960 * gtk_widget_realize() realizes the widget's parents in addition to 2961 * widget itself. If a widget is not yet inside a toplevel window 2962 * when you realize it, bad things will happen. 2963 * This function is primarily used in widget implementations, and 2964 * isn't very useful otherwise. Many times when you think you might 2965 * need it, a better approach is to connect to a signal that will be 2966 * called after the widget is realized automatically, such as 2967 * GtkWidget::expose-event. Or simply g_signal_connect() to the 2968 * GtkWidget::realize signal. 2969 */ 2970 public void realize() 2971 { 2972 // void gtk_widget_realize (GtkWidget *widget); 2973 gtk_widget_realize(gtkWidget); 2974 } 2975 2976 /** 2977 * This function is only useful in widget implementations. 2978 * Causes a widget to be unrealized (frees all GDK resources 2979 * associated with the widget, such as widget->window). 2980 */ 2981 public void unrealize() 2982 { 2983 // void gtk_widget_unrealize (GtkWidget *widget); 2984 gtk_widget_unrealize(gtkWidget); 2985 } 2986 2987 /** 2988 * Equivalent to calling gtk_widget_queue_draw_area() for the 2989 * entire area of a widget. 2990 */ 2991 public void queueDraw() 2992 { 2993 // void gtk_widget_queue_draw (GtkWidget *widget); 2994 gtk_widget_queue_draw(gtkWidget); 2995 } 2996 2997 /** 2998 * This function is only for use in widget implementations. 2999 * Flags a widget to have its size renegotiated; should 3000 * be called when a widget for some reason has a new size request. 3001 * For example, when you change the text in a GtkLabel, GtkLabel 3002 * queues a resize to ensure there's enough space for the new text. 3003 */ 3004 public void queueResize() 3005 { 3006 // void gtk_widget_queue_resize (GtkWidget *widget); 3007 gtk_widget_queue_resize(gtkWidget); 3008 } 3009 3010 /** 3011 * This function works like gtk_widget_queue_resize(), 3012 * except that the widget is not invalidated. 3013 * Since 2.4 3014 */ 3015 public void queueResizeNoRedraw() 3016 { 3017 // void gtk_widget_queue_resize_no_redraw (GtkWidget *widget); 3018 gtk_widget_queue_resize_no_redraw(gtkWidget); 3019 } 3020 3021 /** 3022 * Warning 3023 * gtk_widget_draw is deprecated and should not be used in newly-written code. 3024 * In GTK+ 1.2, this function would immediately render the 3025 * region area of a widget, by invoking the virtual draw method of a 3026 * widget. In GTK+ 2.0, the draw method is gone, and instead 3027 * gtk_widget_draw() simply invalidates the specified region of the 3028 * widget, then updates the invalid region of the widget immediately. 3029 * Usually you don't want to update the region immediately for 3030 * performance reasons, so in general gtk_widget_queue_draw_area() is 3031 * a better choice if you want to draw a region of a widget. 3032 * Params: 3033 * area = area to draw 3034 */ 3035 public void draw(Rectangle area) 3036 { 3037 // void gtk_widget_draw (GtkWidget *widget, const GdkRectangle *area); 3038 gtk_widget_draw(gtkWidget, (area is null) ? null : area.getRectangleStruct()); 3039 } 3040 3041 /** 3042 * This function is typically used when implementing a GtkContainer 3043 * subclass. Obtains the preferred size of a widget. The container 3044 * uses this information to arrange its child widgets and decide what 3045 * size allocations to give them with gtk_widget_size_allocate(). 3046 * You can also call this function from an application, with some 3047 * caveats. Most notably, getting a size request requires the widget 3048 * to be associated with a screen, because font information may be 3049 * needed. Multihead-aware applications should keep this in mind. 3050 * Also remember that the size request is not necessarily the size 3051 * a widget will actually be allocated. 3052 * See also gtk_widget_get_child_requisition(). 3053 * Params: 3054 * requisition = a GtkRequisition to be filled in 3055 */ 3056 public void sizeRequest(out GtkRequisition requisition) 3057 { 3058 // void gtk_widget_size_request (GtkWidget *widget, GtkRequisition *requisition); 3059 gtk_widget_size_request(gtkWidget, &requisition); 3060 } 3061 3062 /** 3063 * This function is only for use in widget implementations. Obtains 3064 * widget->requisition, unless someone has forced a particular 3065 * geometry on the widget (e.g. with gtk_widget_set_size_request()), 3066 * in which case it returns that geometry instead of the widget's 3067 * requisition. 3068 * This function differs from gtk_widget_size_request() in that 3069 * it retrieves the last size request value from widget->requisition, 3070 * while gtk_widget_size_request() actually calls the "size_request" method 3071 * on widget to compute the size request and fill in widget->requisition, 3072 * and only then returns widget->requisition. 3073 * Because this function does not call the "size_request" method, it 3074 * can only be used when you know that widget->requisition is 3075 * up-to-date, that is, gtk_widget_size_request() has been called 3076 * since the last time a resize was queued. In general, only container 3077 * implementations have this information; applications should use 3078 * gtk_widget_size_request(). 3079 * Params: 3080 * requisition = a GtkRequisition to be filled in 3081 */ 3082 public void getChildRequisition(out GtkRequisition requisition) 3083 { 3084 // void gtk_widget_get_child_requisition (GtkWidget *widget, GtkRequisition *requisition); 3085 gtk_widget_get_child_requisition(gtkWidget, &requisition); 3086 } 3087 3088 /** 3089 * This function is only used by GtkContainer subclasses, to assign a size 3090 * and position to their child widgets. 3091 * Params: 3092 * allocation = position and size to be allocated to widget 3093 */ 3094 public void sizeAllocate(GtkAllocation* allocation) 3095 { 3096 // void gtk_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); 3097 gtk_widget_size_allocate(gtkWidget, allocation); 3098 } 3099 3100 /** 3101 * Installs an accelerator for this widget in accel_group that causes 3102 * accel_signal to be emitted if the accelerator is activated. 3103 * The accel_group needs to be added to the widget's toplevel via 3104 * gtk_window_add_accel_group(), and the signal must be of type G_RUN_ACTION. 3105 * Accelerators added through this function are not user changeable during 3106 * runtime. If you want to support accelerators that can be changed by the 3107 * user, use gtk_accel_map_add_entry() and gtk_widget_set_accel_path() or 3108 * gtk_menu_item_set_accel_path() instead. 3109 * Params: 3110 * accelSignal = widget signal to emit on accelerator activation 3111 * accelGroup = accel group for this widget, added to its toplevel 3112 * accelKey = GDK keyval of the accelerator 3113 * accelMods = modifier key combination of the accelerator 3114 * accelFlags = flag accelerators, e.g. GTK_ACCEL_VISIBLE 3115 */ 3116 public void addAccelerator(string accelSignal, AccelGroup accelGroup, uint accelKey, GdkModifierType accelMods, GtkAccelFlags accelFlags) 3117 { 3118 // void gtk_widget_add_accelerator (GtkWidget *widget, const gchar *accel_signal, GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods, GtkAccelFlags accel_flags); 3119 gtk_widget_add_accelerator(gtkWidget, Str.toStringz(accelSignal), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct(), accelKey, accelMods, accelFlags); 3120 } 3121 3122 /** 3123 * Removes an accelerator from widget, previously installed with 3124 * gtk_widget_add_accelerator(). 3125 * Params: 3126 * accelGroup = accel group for this widget 3127 * accelKey = GDK keyval of the accelerator 3128 * accelMods = modifier key combination of the accelerator 3129 * Returns: whether an accelerator was installed and could be removed 3130 */ 3131 public int removeAccelerator(AccelGroup accelGroup, uint accelKey, GdkModifierType accelMods) 3132 { 3133 // gboolean gtk_widget_remove_accelerator (GtkWidget *widget, GtkAccelGroup *accel_group, guint accel_key, GdkModifierType accel_mods); 3134 return gtk_widget_remove_accelerator(gtkWidget, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct(), accelKey, accelMods); 3135 } 3136 3137 /** 3138 * Given an accelerator group, accel_group, and an accelerator path, 3139 * accel_path, sets up an accelerator in accel_group so whenever the 3140 * key binding that is defined for accel_path is pressed, widget 3141 * will be activated. This removes any accelerators (for any 3142 * accelerator group) installed by previous calls to 3143 * gtk_widget_set_accel_path(). Associating accelerators with 3144 * paths allows them to be modified by the user and the modifications 3145 * to be saved for future use. (See gtk_accel_map_save().) 3146 * This function is a low level function that would most likely 3147 * be used by a menu creation system like GtkUIManager. If you 3148 * use GtkUIManager, setting up accelerator paths will be done 3149 * automatically. 3150 * Even when you you aren't using GtkUIManager, if you only want to 3151 * set up accelerators on menu items gtk_menu_item_set_accel_path() 3152 * provides a somewhat more convenient interface. 3153 * Note that accel_path string will be stored in a GQuark. Therefore, if you 3154 * pass a static string, you can save some memory by interning it first with 3155 * g_intern_static_string(). 3156 * Params: 3157 * accelPath = path used to look up the accelerator. [allow-none] 3158 * accelGroup = a GtkAccelGroup. [allow-none] 3159 */ 3160 public void setAccelPath(string accelPath, AccelGroup accelGroup) 3161 { 3162 // void gtk_widget_set_accel_path (GtkWidget *widget, const gchar *accel_path, GtkAccelGroup *accel_group); 3163 gtk_widget_set_accel_path(gtkWidget, Str.toStringz(accelPath), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 3164 } 3165 3166 /** 3167 * Lists the closures used by widget for accelerator group connections 3168 * with gtk_accel_group_connect_by_path() or gtk_accel_group_connect(). 3169 * The closures can be used to monitor accelerator changes on widget, 3170 * by connecting to the GtkAccelGroup::accel-changed signal of the 3171 * GtkAccelGroup of a closure which can be found out with 3172 * gtk_accel_group_from_accel_closure(). 3173 * Returns: a newly allocated GList of closures. [transfer container][element-type GClosure] 3174 */ 3175 public ListG listAccelClosures() 3176 { 3177 // GList* gtk_widget_list_accel_closures (GtkWidget *widget); 3178 auto p = gtk_widget_list_accel_closures(gtkWidget); 3179 3180 if(p is null) 3181 { 3182 return null; 3183 } 3184 3185 return ObjectG.getDObject!(ListG)(cast(GList*) p); 3186 } 3187 3188 /** 3189 * Determines whether an accelerator that activates the signal 3190 * identified by signal_id can currently be activated. 3191 * This is done by emitting the "can-activate-accel" 3192 * signal on widget; if the signal isn't overridden by a 3193 * handler or in a derived widget, then the default check is 3194 * that the widget must be sensitive, and the widget and all 3195 * its ancestors mapped. 3196 * Since 2.4 3197 * Params: 3198 * signalId = the ID of a signal installed on widget 3199 * Returns: TRUE if the accelerator can be activated. 3200 */ 3201 public int canActivateAccel(uint signalId) 3202 { 3203 // gboolean gtk_widget_can_activate_accel (GtkWidget *widget, guint signal_id); 3204 return gtk_widget_can_activate_accel(gtkWidget, signalId); 3205 } 3206 3207 /** 3208 * Rarely-used function. This function is used to emit 3209 * the event signals on a widget (those signals should never 3210 * be emitted without using this function to do so). 3211 * If you want to synthesize an event though, don't use this function; 3212 * instead, use gtk_main_do_event() so the event will behave as if 3213 * it were in the event queue. Don't synthesize expose events; instead, 3214 * use gdk_window_invalidate_rect() to invalidate a region of the 3215 * window. 3216 * Params: 3217 * event = a GdkEvent 3218 * Returns: return from the event signal emission (TRUE if the event was handled) 3219 */ 3220 public int event(Event event) 3221 { 3222 // gboolean gtk_widget_event (GtkWidget *widget, GdkEvent *event); 3223 return gtk_widget_event(gtkWidget, (event is null) ? null : event.getEventStruct()); 3224 } 3225 3226 /** 3227 * For widgets that can be "activated" (buttons, menu items, etc.) 3228 * this function activates them. Activation is what happens when you 3229 * press Enter on a widget during key navigation. If widget isn't 3230 * activatable, the function returns FALSE. 3231 * Returns: TRUE if the widget was activatable 3232 */ 3233 public int activate() 3234 { 3235 // gboolean gtk_widget_activate (GtkWidget *widget); 3236 return gtk_widget_activate(gtkWidget); 3237 } 3238 3239 /** 3240 * Moves a widget from one GtkContainer to another, handling reference 3241 * count issues to avoid destroying the widget. 3242 * Params: 3243 * newParent = a GtkContainer to move the widget into 3244 */ 3245 public void reparent(Widget newParent) 3246 { 3247 // void gtk_widget_reparent (GtkWidget *widget, GtkWidget *new_parent); 3248 gtk_widget_reparent(gtkWidget, (newParent is null) ? null : newParent.getWidgetStruct()); 3249 } 3250 3251 /** 3252 * Computes the intersection of a widget's area and area, storing 3253 * the intersection in intersection, and returns TRUE if there was 3254 * an intersection. intersection may be NULL if you're only 3255 * interested in whether there was an intersection. 3256 * Params: 3257 * area = a rectangle 3258 * intersection = rectangle to store intersection of widget and area 3259 * Returns: TRUE if there was an intersection 3260 */ 3261 public int intersect(Rectangle area, Rectangle intersection) 3262 { 3263 // gboolean gtk_widget_intersect (GtkWidget *widget, const GdkRectangle *area, GdkRectangle *intersection); 3264 return gtk_widget_intersect(gtkWidget, (area is null) ? null : area.getRectangleStruct(), (intersection is null) ? null : intersection.getRectangleStruct()); 3265 } 3266 3267 /** 3268 * Determines if the widget is the focus widget within its 3269 * toplevel. (This does not mean that the HAS_FOCUS flag is 3270 * necessarily set; HAS_FOCUS will only be set if the 3271 * toplevel widget additionally has the global input focus.) 3272 * Returns: TRUE if the widget is the focus widget. 3273 */ 3274 public int isFocus() 3275 { 3276 // gboolean gtk_widget_is_focus (GtkWidget *widget); 3277 return gtk_widget_is_focus(gtkWidget); 3278 } 3279 3280 /** 3281 * Causes widget to have the keyboard focus for the GtkWindow it's 3282 * inside. widget must be a focusable widget, such as a GtkEntry; 3283 * something like GtkFrame won't work. 3284 * More precisely, it must have the GTK_CAN_FOCUS flag set. Use 3285 * gtk_widget_set_can_focus() to modify that flag. 3286 * The widget also needs to be realized and mapped. This is indicated by the 3287 * related signals. Grabbing the focus immediately after creating the widget 3288 * will likely fail and cause critical warnings. 3289 */ 3290 public void grabFocus() 3291 { 3292 // void gtk_widget_grab_focus (GtkWidget *widget); 3293 gtk_widget_grab_focus(gtkWidget); 3294 } 3295 3296 /** 3297 * Causes widget to become the default widget. widget must have the 3298 * GTK_CAN_DEFAULT flag set; typically you have to set this flag 3299 * yourself by calling gtk_widget_set_can_default (widget, 3300 * TRUE). The default widget is activated when 3301 * the user presses Enter in a window. Default widgets must be 3302 * activatable, that is, gtk_widget_activate() should affect them. 3303 */ 3304 public void grabDefault() 3305 { 3306 // void gtk_widget_grab_default (GtkWidget *widget); 3307 gtk_widget_grab_default(gtkWidget); 3308 } 3309 3310 /** 3311 * Widgets can be named, which allows you to refer to them from a 3312 * gtkrc file. You can apply a style to widgets with a particular name 3313 * in the gtkrc file. See the documentation for gtkrc files (on the 3314 * same page as the docs for GtkRcStyle). 3315 * Note that widget names are separated by periods in paths (see 3316 * gtk_widget_path()), so names with embedded periods may cause confusion. 3317 * Params: 3318 * name = name for the widget 3319 */ 3320 public void setName(string name) 3321 { 3322 // void gtk_widget_set_name (GtkWidget *widget, const gchar *name); 3323 gtk_widget_set_name(gtkWidget, Str.toStringz(name)); 3324 } 3325 3326 /** 3327 * Retrieves the name of a widget. See gtk_widget_set_name() for the 3328 * significance of widget names. 3329 * Returns: name of the widget. This string is owned by GTK+ and should not be modified or freed 3330 */ 3331 public string getName() 3332 { 3333 // const gchar* gtk_widget_get_name (GtkWidget *widget); 3334 return Str.toString(gtk_widget_get_name(gtkWidget)); 3335 } 3336 3337 /** 3338 * This function is for use in widget implementations. Sets the state 3339 * of a widget (insensitive, prelighted, etc.) Usually you should set 3340 * the state using wrapper functions such as gtk_widget_set_sensitive(). 3341 * Params: 3342 * state = new state for widget 3343 */ 3344 public void setState(GtkStateType state) 3345 { 3346 // void gtk_widget_set_state (GtkWidget *widget, GtkStateType state); 3347 gtk_widget_set_state(gtkWidget, state); 3348 } 3349 3350 /** 3351 * Sets the sensitivity of a widget. A widget is sensitive if the user 3352 * can interact with it. Insensitive widgets are "grayed out" and the 3353 * user can't interact with them. Insensitive widgets are known as 3354 * "inactive", "disabled", or "ghosted" in some other toolkits. 3355 * Params: 3356 * sensitive = TRUE to make the widget sensitive 3357 */ 3358 public void setSensitive(int sensitive) 3359 { 3360 // void gtk_widget_set_sensitive (GtkWidget *widget, gboolean sensitive); 3361 gtk_widget_set_sensitive(gtkWidget, sensitive); 3362 } 3363 3364 /** 3365 * This function is useful only when implementing subclasses of 3366 * GtkContainer. 3367 * Sets the container as the parent of widget, and takes care of 3368 * some details such as updating the state and style of the child 3369 * to reflect its new location. The opposite function is 3370 * gtk_widget_unparent(). 3371 * Params: 3372 * parent = parent container 3373 */ 3374 public void setParent(Widget parent) 3375 { 3376 // void gtk_widget_set_parent (GtkWidget *widget, GtkWidget *parent); 3377 gtk_widget_set_parent(gtkWidget, (parent is null) ? null : parent.getWidgetStruct()); 3378 } 3379 3380 /** 3381 * Sets a non default parent window for widget. 3382 * Params: 3383 * parentWindow = the new parent window. 3384 */ 3385 public void setParentWindow(Window parentWindow) 3386 { 3387 // void gtk_widget_set_parent_window (GtkWidget *widget, GdkWindow *parent_window); 3388 gtk_widget_set_parent_window(gtkWidget, (parentWindow is null) ? null : parentWindow.getWindowStruct()); 3389 } 3390 3391 /** 3392 * Gets widget's parent window. 3393 * Returns: the parent window of widget. [transfer none] 3394 */ 3395 public Window getParentWindow() 3396 { 3397 // GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget); 3398 auto p = gtk_widget_get_parent_window(gtkWidget); 3399 3400 if(p is null) 3401 { 3402 return null; 3403 } 3404 3405 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 3406 } 3407 3408 /** 3409 * Warning 3410 * gtk_widget_set_uposition is deprecated and should not be used in newly-written code. 3411 * Sets the position of a widget. The funny "u" in the name comes from 3412 * the "user position" hint specified by the X Window System, and 3413 * exists for legacy reasons. This function doesn't work if a widget 3414 * is inside a container; it's only really useful on GtkWindow. 3415 * Don't use this function to center dialogs over the main application 3416 * window; most window managers will do the centering on your behalf 3417 * if you call gtk_window_set_transient_for(), and it's really not 3418 * possible to get the centering to work correctly in all cases from 3419 * application code. But if you insist, use gtk_window_set_position() 3420 * to set GTK_WIN_POS_CENTER_ON_PARENT, don't do the centering 3421 * manually. 3422 * Note that although x and y can be individually unset, the position 3423 * is not honoured unless both x and y are set. 3424 * Params: 3425 * x = x position; -1 to unset x; -2 to leave x unchanged 3426 * y = y position; -1 to unset y; -2 to leave y unchanged 3427 */ 3428 public void setUposition(int x, int y) 3429 { 3430 // void gtk_widget_set_uposition (GtkWidget *widget, gint x, gint y); 3431 gtk_widget_set_uposition(gtkWidget, x, y); 3432 } 3433 3434 /** 3435 * Warning 3436 * gtk_widget_set_usize has been deprecated since version 2.2 and should not be used in newly-written code. Use gtk_widget_set_size_request() instead. 3437 * Sets the minimum size of a widget; that is, the widget's size 3438 * request will be width by height. You can use this function to 3439 * force a widget to be either larger or smaller than it is. The 3440 * strange "usize" name dates from the early days of GTK+, and derives 3441 * from X Window System terminology. In many cases, 3442 * gtk_window_set_default_size() is a better choice for toplevel 3443 * windows than this function; setting the default size will still 3444 * allow users to shrink the window. Setting the usize will force them 3445 * to leave the window at least as large as the usize. When dealing 3446 * with window sizes, gtk_window_set_geometry_hints() can be a useful 3447 * function as well. 3448 * Note the inherent danger of setting any fixed size - themes, 3449 * translations into other languages, different fonts, and user action 3450 * can all change the appropriate size for a given widget. So, it's 3451 * basically impossible to hardcode a size that will always be 3452 * correct. 3453 * Params: 3454 * width = minimum width, or -1 to unset 3455 * height = minimum height, or -1 to unset 3456 */ 3457 public void setUsize(int width, int height) 3458 { 3459 // void gtk_widget_set_usize (GtkWidget *widget, gint width, gint height); 3460 gtk_widget_set_usize(gtkWidget, width, height); 3461 } 3462 3463 /** 3464 * Sets the event mask (see GdkEventMask) for a widget. The event 3465 * mask determines which events a widget will receive. Keep in mind 3466 * that different widgets have different default event masks, and by 3467 * changing the event mask you may disrupt a widget's functionality, 3468 * so be careful. This function must be called while a widget is 3469 * unrealized. Consider gtk_widget_add_events() for widgets that are 3470 * already realized, or if you want to preserve the existing event 3471 * mask. This function can't be used with GTK_NO_WINDOW widgets; 3472 * to get events on those widgets, place them inside a GtkEventBox 3473 * and receive events on the event box. 3474 * Params: 3475 * events = event mask 3476 */ 3477 public void setEvents(int events) 3478 { 3479 // void gtk_widget_set_events (GtkWidget *widget, gint events); 3480 gtk_widget_set_events(gtkWidget, events); 3481 } 3482 3483 /** 3484 * Adds the events in the bitfield events to the event mask for 3485 * widget. See gtk_widget_set_events() for details. 3486 * Params: 3487 * events = an event mask, see GdkEventMask 3488 */ 3489 public void addEvents(int events) 3490 { 3491 // void gtk_widget_add_events (GtkWidget *widget, gint events); 3492 gtk_widget_add_events(gtkWidget, events); 3493 } 3494 3495 /** 3496 * Sets the extension events mask to mode. See GdkExtensionMode 3497 * and gdk_input_set_extension_events(). 3498 * Params: 3499 * mode = bitfield of extension events to receive 3500 */ 3501 public void setExtensionEvents(GdkExtensionMode mode) 3502 { 3503 // void gtk_widget_set_extension_events (GtkWidget *widget, GdkExtensionMode mode); 3504 gtk_widget_set_extension_events(gtkWidget, mode); 3505 } 3506 3507 /** 3508 * Retrieves the extension events the widget will receive; see 3509 * gdk_input_set_extension_events(). 3510 * Returns: extension events for widget 3511 */ 3512 public GdkExtensionMode getExtensionEvents() 3513 { 3514 // GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget); 3515 return gtk_widget_get_extension_events(gtkWidget); 3516 } 3517 3518 /** 3519 * This function returns the topmost widget in the container hierarchy 3520 * widget is a part of. If widget has no parent widgets, it will be 3521 * returned as the topmost widget. No reference will be added to the 3522 * returned widget; it should not be unreferenced. 3523 * Note the difference in behavior vs. gtk_widget_get_ancestor(); 3524 * gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) 3525 * would return 3526 * NULL if widget wasn't inside a toplevel window, and if the 3527 * window was inside a GtkWindow-derived widget which was in turn 3528 * inside the toplevel GtkWindow. While the second case may 3529 * seem unlikely, it actually happens when a GtkPlug is embedded 3530 * inside a GtkSocket within the same application. 3531 * To reliably find the toplevel GtkWindow, use 3532 * gtk_widget_get_toplevel() and check if the TOPLEVEL flags 3533 * is set on the result. 3534 * $(DDOC_COMMENT example) 3535 * Returns: the topmost ancestor of widget, or widget itself if there's no ancestor. [transfer none] 3536 */ 3537 public Widget getToplevel() 3538 { 3539 // GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget); 3540 auto p = gtk_widget_get_toplevel(gtkWidget); 3541 3542 if(p is null) 3543 { 3544 return null; 3545 } 3546 3547 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 3548 } 3549 3550 /** 3551 * Gets the first ancestor of widget with type widget_type. For example, 3552 * gtk_widget_get_ancestor (widget, GTK_TYPE_BOX) gets 3553 * the first GtkBox that's an ancestor of widget. No reference will be 3554 * added to the returned widget; it should not be unreferenced. See note 3555 * about checking for a toplevel GtkWindow in the docs for 3556 * gtk_widget_get_toplevel(). 3557 * Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor() 3558 * considers widget to be an ancestor of itself. 3559 * Params: 3560 * widget = a GtkWidget 3561 * widgetType = ancestor type 3562 * Returns: the ancestor widget, or NULL if not found. [transfer none] 3563 */ 3564 public Widget getAncestor(GType widgetType) 3565 { 3566 // GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget, GType widget_type); 3567 auto p = gtk_widget_get_ancestor(gtkWidget, widgetType); 3568 3569 if(p is null) 3570 { 3571 return null; 3572 } 3573 3574 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 3575 } 3576 3577 /** 3578 * Gets the colormap that will be used to render widget. No reference will 3579 * be added to the returned colormap; it should not be unreferenced. 3580 * Returns: the colormap used by widget. [transfer none] 3581 */ 3582 public Colormap getColormap() 3583 { 3584 // GdkColormap* gtk_widget_get_colormap (GtkWidget *widget); 3585 auto p = gtk_widget_get_colormap(gtkWidget); 3586 3587 if(p is null) 3588 { 3589 return null; 3590 } 3591 3592 return ObjectG.getDObject!(Colormap)(cast(GdkColormap*) p); 3593 } 3594 3595 /** 3596 * Sets the colormap for the widget to the given value. Widget must not 3597 * have been previously realized. This probably should only be used 3598 * from an init() function (i.e. from the constructor 3599 * for the widget). 3600 * Params: 3601 * colormap = a colormap 3602 */ 3603 public void setColormap(Colormap colormap) 3604 { 3605 // void gtk_widget_set_colormap (GtkWidget *widget, GdkColormap *colormap); 3606 gtk_widget_set_colormap(gtkWidget, (colormap is null) ? null : colormap.getColormapStruct()); 3607 } 3608 3609 /** 3610 * Gets the visual that will be used to render widget. 3611 * Returns: the visual for widget. [transfer none] 3612 */ 3613 public Visual getVisual() 3614 { 3615 // GdkVisual* gtk_widget_get_visual (GtkWidget *widget); 3616 auto p = gtk_widget_get_visual(gtkWidget); 3617 3618 if(p is null) 3619 { 3620 return null; 3621 } 3622 3623 return ObjectG.getDObject!(Visual)(cast(GdkVisual*) p); 3624 } 3625 3626 /** 3627 * Returns the event mask for the widget (a bitfield containing flags 3628 * from the GdkEventMask enumeration). These are the events that the widget 3629 * will receive. 3630 * Returns: event mask for widget 3631 */ 3632 public int getEvents() 3633 { 3634 // gint gtk_widget_get_events (GtkWidget *widget); 3635 return gtk_widget_get_events(gtkWidget); 3636 } 3637 3638 /** 3639 * Obtains the location of the mouse pointer in widget coordinates. 3640 * Widget coordinates are a bit odd; for historical reasons, they are 3641 * defined as widget->window coordinates for widgets that are not 3642 * GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, 3643 * widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. 3644 * Params: 3645 * x = return location for the X coordinate, or NULL. [out][allow-none] 3646 * y = return location for the Y coordinate, or NULL. [out][allow-none] 3647 */ 3648 public void getPointer(out int x, out int y) 3649 { 3650 // void gtk_widget_get_pointer (GtkWidget *widget, gint *x, gint *y); 3651 gtk_widget_get_pointer(gtkWidget, &x, &y); 3652 } 3653 3654 /** 3655 * Determines whether widget is somewhere inside ancestor, possibly with 3656 * intermediate containers. 3657 * Params: 3658 * ancestor = another GtkWidget 3659 * Returns: TRUE if ancestor contains widget as a child, grandchild, great grandchild, etc. 3660 */ 3661 public int isAncestor(Widget ancestor) 3662 { 3663 // gboolean gtk_widget_is_ancestor (GtkWidget *widget, GtkWidget *ancestor); 3664 return gtk_widget_is_ancestor(gtkWidget, (ancestor is null) ? null : ancestor.getWidgetStruct()); 3665 } 3666 3667 /** 3668 * Translate coordinates relative to src_widget's allocation to coordinates 3669 * relative to dest_widget's allocations. In order to perform this 3670 * operation, both widgets must be realized, and must share a common 3671 * toplevel. 3672 * Params: 3673 * destWidget = a GtkWidget 3674 * srcX = X position relative to src_widget 3675 * srcY = Y position relative to src_widget 3676 * destX = location to store X position relative to dest_widget. [out] 3677 * destY = location to store Y position relative to dest_widget. [out] 3678 * 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. 3679 */ 3680 public int translateCoordinates(Widget destWidget, int srcX, int srcY, out int destX, out int destY) 3681 { 3682 // gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget, GtkWidget *dest_widget, gint src_x, gint src_y, gint *dest_x, gint *dest_y); 3683 return gtk_widget_translate_coordinates(gtkWidget, (destWidget is null) ? null : destWidget.getWidgetStruct(), srcX, srcY, &destX, &destY); 3684 } 3685 3686 /** 3687 * Utility function; intended to be connected to the "delete-event" 3688 * signal on a GtkWindow. The function calls gtk_widget_hide() on its 3689 * argument, then returns TRUE. If connected to ::delete-event, the 3690 * result is that clicking the close button for a window (on the 3691 * window frame, top right corner usually) will hide but not destroy 3692 * the window. By default, GTK+ destroys windows when ::delete-event 3693 * is received. 3694 * Returns: TRUE 3695 */ 3696 public int hideOnDelete() 3697 { 3698 // gboolean gtk_widget_hide_on_delete (GtkWidget *widget); 3699 return gtk_widget_hide_on_delete(gtkWidget); 3700 } 3701 3702 /** 3703 * Sets the GtkStyle for a widget (widget->style). You probably don't 3704 * want to use this function; it interacts badly with themes, because 3705 * themes work by replacing the GtkStyle. Instead, use 3706 * gtk_widget_modify_style(). 3707 * Params: 3708 * style = a GtkStyle, or NULL to remove the effect of a previous 3709 * gtk_widget_set_style() and go back to the default style. [allow-none] 3710 */ 3711 public void setStyle(Style style) 3712 { 3713 // void gtk_widget_set_style (GtkWidget *widget, GtkStyle *style); 3714 gtk_widget_set_style(gtkWidget, (style is null) ? null : style.getStyleStruct()); 3715 } 3716 3717 /** 3718 * Ensures that widget has a style (widget->style). Not a very useful 3719 * function; most of the time, if you want the style, the widget is 3720 * realized, and realized widgets are guaranteed to have a style 3721 * already. 3722 */ 3723 public void ensureStyle() 3724 { 3725 // void gtk_widget_ensure_style (GtkWidget *widget); 3726 gtk_widget_ensure_style(gtkWidget); 3727 } 3728 3729 /** 3730 * Simply an accessor function that returns widget->style. 3731 * Returns: the widget's GtkStyle. [transfer none] 3732 */ 3733 public Style getStyle() 3734 { 3735 // GtkStyle * gtk_widget_get_style (GtkWidget *widget); 3736 auto p = gtk_widget_get_style(gtkWidget); 3737 3738 if(p is null) 3739 { 3740 return null; 3741 } 3742 3743 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 3744 } 3745 3746 /** 3747 * Reset the styles of widget and all descendents, so when 3748 * they are looked up again, they get the correct values 3749 * for the currently loaded RC file settings. 3750 * This function is not useful for applications. 3751 */ 3752 public void resetRcStyles() 3753 { 3754 // void gtk_widget_reset_rc_styles (GtkWidget *widget); 3755 gtk_widget_reset_rc_styles(gtkWidget); 3756 } 3757 3758 /** 3759 * Pushes cmap onto a global stack of colormaps; the topmost 3760 * colormap on the stack will be used to create all widgets. 3761 * Remove cmap with gtk_widget_pop_colormap(). There's little 3762 * reason to use this function. 3763 * Params: 3764 * cmap = a GdkColormap 3765 */ 3766 public static void pushColormap(Colormap cmap) 3767 { 3768 // void gtk_widget_push_colormap (GdkColormap *cmap); 3769 gtk_widget_push_colormap((cmap is null) ? null : cmap.getColormapStruct()); 3770 } 3771 3772 /** 3773 * Removes a colormap pushed with gtk_widget_push_colormap(). 3774 */ 3775 public static void popColormap() 3776 { 3777 // void gtk_widget_pop_colormap (void); 3778 gtk_widget_pop_colormap(); 3779 } 3780 3781 /** 3782 * Sets the default colormap to use when creating widgets. 3783 * gtk_widget_push_colormap() is a better function to use if 3784 * you only want to affect a few widgets, rather than all widgets. 3785 * Params: 3786 * colormap = a GdkColormap 3787 */ 3788 public static void setDefaultColormap(Colormap colormap) 3789 { 3790 // void gtk_widget_set_default_colormap (GdkColormap *colormap); 3791 gtk_widget_set_default_colormap((colormap is null) ? null : colormap.getColormapStruct()); 3792 } 3793 3794 /** 3795 * Returns the default style used by all widgets initially. 3796 * Returns: the default style. This GtkStyle object is owned by GTK+ and should not be modified or freed. [transfer none] 3797 */ 3798 public static Style getDefaultStyle() 3799 { 3800 // GtkStyle* gtk_widget_get_default_style (void); 3801 auto p = gtk_widget_get_default_style(); 3802 3803 if(p is null) 3804 { 3805 return null; 3806 } 3807 3808 return ObjectG.getDObject!(Style)(cast(GtkStyle*) p); 3809 } 3810 3811 /** 3812 * Obtains the default colormap used to create widgets. 3813 * Returns: default widget colormap. [transfer none] 3814 */ 3815 public static Colormap getDefaultColormap() 3816 { 3817 // GdkColormap* gtk_widget_get_default_colormap (void); 3818 auto p = gtk_widget_get_default_colormap(); 3819 3820 if(p is null) 3821 { 3822 return null; 3823 } 3824 3825 return ObjectG.getDObject!(Colormap)(cast(GdkColormap*) p); 3826 } 3827 3828 /** 3829 * Obtains the visual of the default colormap. Not really useful; 3830 * used to be useful before gdk_colormap_get_visual() existed. 3831 * Returns: visual of the default colormap. [transfer none] 3832 */ 3833 public static Visual getDefaultVisual() 3834 { 3835 // GdkVisual* gtk_widget_get_default_visual (void); 3836 auto p = gtk_widget_get_default_visual(); 3837 3838 if(p is null) 3839 { 3840 return null; 3841 } 3842 3843 return ObjectG.getDObject!(Visual)(cast(GdkVisual*) p); 3844 } 3845 3846 /** 3847 * Sets the reading direction on a particular widget. This direction 3848 * controls the primary direction for widgets containing text, 3849 * and also the direction in which the children of a container are 3850 * packed. The ability to set the direction is present in order 3851 * so that correct localization into languages with right-to-left 3852 * reading directions can be done. Generally, applications will 3853 * let the default reading direction present, except for containers 3854 * where the containers are arranged in an order that is explicitely 3855 * visual rather than logical (such as buttons for text justification). 3856 * If the direction is set to GTK_TEXT_DIR_NONE, then the value 3857 * set by gtk_widget_set_default_direction() will be used. 3858 * Params: 3859 * dir = the new direction 3860 */ 3861 public void setDirection(GtkTextDirection dir) 3862 { 3863 // void gtk_widget_set_direction (GtkWidget *widget, GtkTextDirection dir); 3864 gtk_widget_set_direction(gtkWidget, dir); 3865 } 3866 3867 /** 3868 * Gets the reading direction for a particular widget. See 3869 * gtk_widget_set_direction(). 3870 * Returns: the reading direction for the widget. 3871 */ 3872 public GtkTextDirection getDirection() 3873 { 3874 // GtkTextDirection gtk_widget_get_direction (GtkWidget *widget); 3875 return gtk_widget_get_direction(gtkWidget); 3876 } 3877 3878 /** 3879 * Sets the default reading direction for widgets where the 3880 * direction has not been explicitly set by gtk_widget_set_direction(). 3881 * Params: 3882 * dir = the new default direction. This cannot be 3883 * GTK_TEXT_DIR_NONE. 3884 */ 3885 public static void setDefaultDirection(GtkTextDirection dir) 3886 { 3887 // void gtk_widget_set_default_direction (GtkTextDirection dir); 3888 gtk_widget_set_default_direction(dir); 3889 } 3890 3891 /** 3892 * Obtains the current default reading direction. See 3893 * gtk_widget_set_default_direction(). 3894 * Returns: the current default direction. 3895 */ 3896 public static GtkTextDirection getDefaultDirection() 3897 { 3898 // GtkTextDirection gtk_widget_get_default_direction (void); 3899 return gtk_widget_get_default_direction(); 3900 } 3901 3902 /** 3903 * Sets a shape for this widget's GDK window. This allows for 3904 * transparent windows etc., see gdk_window_shape_combine_mask() 3905 * for more information. 3906 * Params: 3907 * shapeMask = shape to be added, or NULL to remove an existing shape. [allow-none] 3908 * offsetX = X position of shape mask with respect to window 3909 * offsetY = Y position of shape mask with respect to window 3910 */ 3911 public void shapeCombineMask(Bitmap shapeMask, int offsetX, int offsetY) 3912 { 3913 // void gtk_widget_shape_combine_mask (GtkWidget *widget, GdkBitmap *shape_mask, gint offset_x, gint offset_y); 3914 gtk_widget_shape_combine_mask(gtkWidget, (shapeMask is null) ? null : shapeMask.getBitmapStruct(), offsetX, offsetY); 3915 } 3916 3917 /** 3918 * Sets an input shape for this widget's GDK window. This allows for 3919 * windows which react to mouse click in a nonrectangular region, see 3920 * gdk_window_input_shape_combine_mask() for more information. 3921 * Since 2.10 3922 * Params: 3923 * shapeMask = shape to be added, or NULL to remove an existing shape. [allow-none] 3924 * offsetX = X position of shape mask with respect to window 3925 * offsetY = Y position of shape mask with respect to window 3926 */ 3927 public void inputShapeCombineMask(Bitmap shapeMask, int offsetX, int offsetY) 3928 { 3929 // void gtk_widget_input_shape_combine_mask (GtkWidget *widget, GdkBitmap *shape_mask, gint offset_x, gint offset_y); 3930 gtk_widget_input_shape_combine_mask(gtkWidget, (shapeMask is null) ? null : shapeMask.getBitmapStruct(), offsetX, offsetY); 3931 } 3932 3933 /** 3934 * Obtains the full path to widget. The path is simply the name of a 3935 * widget and all its parents in the container hierarchy, separated by 3936 * periods. The name of a widget comes from 3937 * gtk_widget_get_name(). Paths are used to apply styles to a widget 3938 * in gtkrc configuration files. Widget names are the type of the 3939 * widget by default (e.g. "GtkButton") or can be set to an 3940 * application-specific value with gtk_widget_set_name(). By setting 3941 * the name of a widget, you allow users or theme authors to apply 3942 * styles to that specific widget in their gtkrc 3943 * file. path_reversed_p fills in the path in reverse order, 3944 * i.e. starting with widget's name instead of starting with the name 3945 * of widget's outermost ancestor. 3946 * Params: 3947 * pathLength = location to store length of the path, or NULL. [out][allow-none] 3948 * path = location to store allocated path string, or NULL. [out][allow-none] 3949 * pathReversed = location to store allocated reverse path string, or NULL. [out][allow-none] 3950 */ 3951 public void path(out uint pathLength, out string path, out string pathReversed) 3952 { 3953 // void gtk_widget_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed); 3954 char* outpath = null; 3955 char* outpathReversed = null; 3956 3957 gtk_widget_path(gtkWidget, &pathLength, &outpath, &outpathReversed); 3958 3959 path = Str.toString(outpath); 3960 pathReversed = Str.toString(outpathReversed); 3961 } 3962 3963 /** 3964 * Same as gtk_widget_path(), but always uses the name of a widget's type, 3965 * never uses a custom name set with gtk_widget_set_name(). 3966 * Params: 3967 * pathLength = location to store the length of the class path, or NULL. [out][allow-none] 3968 * path = location to store the class path as an allocated string, or NULL. [out][allow-none] 3969 * pathReversed = location to store the reverse class path as an allocated 3970 * string, or NULL. [out][allow-none] 3971 */ 3972 public void classPath(out uint pathLength, out string path, out string pathReversed) 3973 { 3974 // void gtk_widget_class_path (GtkWidget *widget, guint *path_length, gchar **path, gchar **path_reversed); 3975 char* outpath = null; 3976 char* outpathReversed = null; 3977 3978 gtk_widget_class_path(gtkWidget, &pathLength, &outpath, &outpathReversed); 3979 3980 path = Str.toString(outpath); 3981 pathReversed = Str.toString(outpathReversed); 3982 } 3983 3984 /** 3985 * Obtains the composite name of a widget. 3986 * 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. 3987 */ 3988 public string getCompositeName() 3989 { 3990 // gchar* gtk_widget_get_composite_name (GtkWidget *widget); 3991 return Str.toString(gtk_widget_get_composite_name(gtkWidget)); 3992 } 3993 3994 /** 3995 * Modifies style values on the widget. Modifications made using this 3996 * technique take precedence over style values set via an RC file, 3997 * however, they will be overriden if a style is explicitely set on 3998 * the widget using gtk_widget_set_style(). The GtkRcStyle structure 3999 * is designed so each field can either be set or unset, so it is 4000 * possible, using this function, to modify some style values and 4001 * leave the others unchanged. 4002 * Note that modifications made with this function are not cumulative 4003 * with previous calls to gtk_widget_modify_style() or with such 4004 * functions as gtk_widget_modify_fg(). If you wish to retain 4005 * previous values, you must first call gtk_widget_get_modifier_style(), 4006 * make your modifications to the returned style, then call 4007 * gtk_widget_modify_style() with that style. On the other hand, 4008 * if you first call gtk_widget_modify_style(), subsequent calls 4009 * to such functions gtk_widget_modify_fg() will have a cumulative 4010 * effect with the initial modifications. 4011 * Params: 4012 * style = the GtkRcStyle holding the style modifications 4013 */ 4014 public void modifyStyle(RcStyle style) 4015 { 4016 // void gtk_widget_modify_style (GtkWidget *widget, GtkRcStyle *style); 4017 gtk_widget_modify_style(gtkWidget, (style is null) ? null : style.getRcStyleStruct()); 4018 } 4019 4020 /** 4021 * Returns the current modifier style for the widget. (As set by 4022 * gtk_widget_modify_style().) If no style has previously set, a new 4023 * GtkRcStyle will be created with all values unset, and set as the 4024 * modifier style for the widget. If you make changes to this rc 4025 * style, you must call gtk_widget_modify_style(), passing in the 4026 * returned rc style, to make sure that your changes take effect. 4027 * Caution: passing the style back to gtk_widget_modify_style() will 4028 * normally end up destroying it, because gtk_widget_modify_style() copies 4029 * the passed-in style and sets the copy as the new modifier style, 4030 * thus dropping any reference to the old modifier style. Add a reference 4031 * to the modifier style if you want to keep it alive. 4032 * 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] 4033 */ 4034 public RcStyle getModifierStyle() 4035 { 4036 // GtkRcStyle * gtk_widget_get_modifier_style (GtkWidget *widget); 4037 auto p = gtk_widget_get_modifier_style(gtkWidget); 4038 4039 if(p is null) 4040 { 4041 return null; 4042 } 4043 4044 return ObjectG.getDObject!(RcStyle)(cast(GtkRcStyle*) p); 4045 } 4046 4047 /** 4048 * Sets the foreground color for a widget in a particular state. 4049 * All other style values are left untouched. See also 4050 * gtk_widget_modify_style(). 4051 * Params: 4052 * state = the state for which to set the foreground color 4053 * color = the color to assign (does not need to be allocated), 4054 * or NULL to undo the effect of previous calls to 4055 * of gtk_widget_modify_fg(). [allow-none] 4056 */ 4057 public void modifyFg(GtkStateType state, Color color) 4058 { 4059 // void gtk_widget_modify_fg (GtkWidget *widget, GtkStateType state, const GdkColor *color); 4060 gtk_widget_modify_fg(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4061 } 4062 4063 /** 4064 * Sets the background color for a widget in a particular state. 4065 * All other style values are left untouched. See also 4066 * gtk_widget_modify_style(). 4067 * Note that "no window" widgets (which have the GTK_NO_WINDOW flag set) 4068 * draw on their parent container's window and thus may not draw any 4069 * background themselves. This is the case for e.g. GtkLabel. To modify 4070 * the background of such widgets, you have to set the background color 4071 * on their parent; if you want to set the background of a rectangular 4072 * area around a label, try placing the label in a GtkEventBox widget 4073 * and setting the background color on that. 4074 * Params: 4075 * state = the state for which to set the background color 4076 * color = the color to assign (does not need to be allocated), 4077 * or NULL to undo the effect of previous calls to 4078 * of gtk_widget_modify_bg(). [allow-none] 4079 */ 4080 public void modifyBg(GtkStateType state, Color color) 4081 { 4082 // void gtk_widget_modify_bg (GtkWidget *widget, GtkStateType state, const GdkColor *color); 4083 gtk_widget_modify_bg(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4084 } 4085 4086 /** 4087 * Sets the text color for a widget in a particular state. All other 4088 * style values are left untouched. The text color is the foreground 4089 * color used along with the base color (see gtk_widget_modify_base()) 4090 * for widgets such as GtkEntry and GtkTextView. See also 4091 * gtk_widget_modify_style(). 4092 * Params: 4093 * state = the state for which to set the text color 4094 * color = the color to assign (does not need to be allocated), 4095 * or NULL to undo the effect of previous calls to 4096 * of gtk_widget_modify_text(). [allow-none] 4097 */ 4098 public void modifyText(GtkStateType state, Color color) 4099 { 4100 // void gtk_widget_modify_text (GtkWidget *widget, GtkStateType state, const GdkColor *color); 4101 gtk_widget_modify_text(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4102 } 4103 4104 /** 4105 * Sets the base color for a widget in a particular state. 4106 * All other style values are left untouched. The base color 4107 * is the background color used along with the text color 4108 * (see gtk_widget_modify_text()) for widgets such as GtkEntry 4109 * and GtkTextView. See also gtk_widget_modify_style(). 4110 * Note that "no window" widgets (which have the GTK_NO_WINDOW flag set) 4111 * draw on their parent container's window and thus may not draw any 4112 * background themselves. This is the case for e.g. GtkLabel. To modify 4113 * the background of such widgets, you have to set the base color on their 4114 * parent; if you want to set the background of a rectangular area around 4115 * a label, try placing the label in a GtkEventBox widget and setting 4116 * the base color on that. 4117 * Params: 4118 * state = the state for which to set the base color 4119 * color = the color to assign (does not need to be allocated), 4120 * or NULL to undo the effect of previous calls to 4121 * of gtk_widget_modify_base(). [allow-none] 4122 */ 4123 public void modifyBase(GtkStateType state, Color color) 4124 { 4125 // void gtk_widget_modify_base (GtkWidget *widget, GtkStateType state, const GdkColor *color); 4126 gtk_widget_modify_base(gtkWidget, state, (color is null) ? null : color.getColorStruct()); 4127 } 4128 4129 /** 4130 * Sets the font to use for a widget. All other style values are left 4131 * untouched. See also gtk_widget_modify_style(). 4132 * Params: 4133 * fontDesc = the font description to use, or NULL to undo 4134 * the effect of previous calls to gtk_widget_modify_font(). [allow-none] 4135 */ 4136 public void modifyFont(PgFontDescription fontDesc) 4137 { 4138 // void gtk_widget_modify_font (GtkWidget *widget, PangoFontDescription *font_desc); 4139 gtk_widget_modify_font(gtkWidget, (fontDesc is null) ? null : fontDesc.getPgFontDescriptionStruct()); 4140 } 4141 4142 /** 4143 * Sets the cursor color to use in a widget, overriding the 4144 * "cursor-color" and "secondary-cursor-color" 4145 * style properties. All other style values are left untouched. 4146 * See also gtk_widget_modify_style(). 4147 * Since 2.12 4148 * Params: 4149 * primary = the color to use for primary cursor (does not need to be 4150 * allocated), or NULL to undo the effect of previous calls to 4151 * of gtk_widget_modify_cursor(). 4152 * secondary = the color to use for secondary cursor (does not need to be 4153 * allocated), or NULL to undo the effect of previous calls to 4154 * of gtk_widget_modify_cursor(). 4155 */ 4156 public void modifyCursor(Color primary, Color secondary) 4157 { 4158 // void gtk_widget_modify_cursor (GtkWidget *widget, const GdkColor *primary, const GdkColor *secondary); 4159 gtk_widget_modify_cursor(gtkWidget, (primary is null) ? null : primary.getColorStruct(), (secondary is null) ? null : secondary.getColorStruct()); 4160 } 4161 4162 /** 4163 * Creates a new PangoContext with the appropriate font map, 4164 * font description, and base direction for drawing text for 4165 * this widget. See also gtk_widget_get_pango_context(). 4166 * Returns: the new PangoContext 4167 */ 4168 public PgContext createPangoContext() 4169 { 4170 // PangoContext * gtk_widget_create_pango_context (GtkWidget *widget); 4171 auto p = gtk_widget_create_pango_context(gtkWidget); 4172 4173 if(p is null) 4174 { 4175 return null; 4176 } 4177 4178 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p); 4179 } 4180 4181 /** 4182 * Gets a PangoContext with the appropriate font map, font description, 4183 * and base direction for this widget. Unlike the context returned 4184 * by gtk_widget_create_pango_context(), this context is owned by 4185 * the widget (it can be used until the screen for the widget changes 4186 * or the widget is removed from its toplevel), and will be updated to 4187 * match any changes to the widget's attributes. 4188 * If you create and keep a PangoLayout using this context, you must 4189 * deal with changes to the context by calling pango_layout_context_changed() 4190 * on the layout in response to the "style-set" and 4191 * "direction-changed" signals for the widget. 4192 * Returns: the PangoContext for the widget. [transfer none] 4193 */ 4194 public PgContext getPangoContext() 4195 { 4196 // PangoContext * gtk_widget_get_pango_context (GtkWidget *widget); 4197 auto p = gtk_widget_get_pango_context(gtkWidget); 4198 4199 if(p is null) 4200 { 4201 return null; 4202 } 4203 4204 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) p); 4205 } 4206 4207 /** 4208 * Creates a new PangoLayout with the appropriate font map, 4209 * font description, and base direction for drawing text for 4210 * this widget. 4211 * If you keep a PangoLayout created in this way around, in order to 4212 * notify the layout of changes to the base direction or font of this 4213 * widget, you must call pango_layout_context_changed() in response to 4214 * the "style-set" and "direction-changed" signals 4215 * for the widget. 4216 * Params: 4217 * text = text to set on the layout (can be NULL) 4218 * Returns: the new PangoLayout 4219 */ 4220 public PgLayout createPangoLayout(string text) 4221 { 4222 // PangoLayout * gtk_widget_create_pango_layout (GtkWidget *widget, const gchar *text); 4223 auto p = gtk_widget_create_pango_layout(gtkWidget, Str.toStringz(text)); 4224 4225 if(p is null) 4226 { 4227 return null; 4228 } 4229 4230 return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) p); 4231 } 4232 4233 /** 4234 * A convenience function that uses the theme engine and RC file 4235 * settings for widget to look up stock_id and render it to 4236 * a pixbuf. stock_id should be a stock icon ID such as 4237 * GTK_STOCK_OPEN or GTK_STOCK_OK. size should be a size 4238 * such as GTK_ICON_SIZE_MENU. detail should be a string that 4239 * identifies the widget or code doing the rendering, so that 4240 * theme engines can special-case rendering for that widget or code. 4241 * The pixels in the returned GdkPixbuf are shared with the rest of 4242 * the application and should not be modified. The pixbuf should be freed 4243 * after use with g_object_unref(). 4244 * Params: 4245 * stockId = a stock ID 4246 * size = (type int) a stock size. A size of (GtkIconSize)-1 means 4247 * render at the size of the source and don't scale (if there are 4248 * multiple source sizes, GTK+ picks one of the available sizes). 4249 * detail = render detail to pass to theme engine. [allow-none] 4250 * Returns: a new pixbuf, or NULL if the stock ID wasn't known 4251 */ 4252 public Pixbuf renderIcon(string stockId, GtkIconSize size, string detail) 4253 { 4254 // GdkPixbuf * gtk_widget_render_icon (GtkWidget *widget, const gchar *stock_id, GtkIconSize size, const gchar *detail); 4255 auto p = gtk_widget_render_icon(gtkWidget, Str.toStringz(stockId), size, Str.toStringz(detail)); 4256 4257 if(p is null) 4258 { 4259 return null; 4260 } 4261 4262 return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p); 4263 } 4264 4265 /** 4266 * Cancels the effect of a previous call to gtk_widget_push_composite_child(). 4267 */ 4268 public static void popCompositeChild() 4269 { 4270 // void gtk_widget_pop_composite_child (void); 4271 gtk_widget_pop_composite_child(); 4272 } 4273 4274 /** 4275 * Makes all newly-created widgets as composite children until 4276 * the corresponding gtk_widget_pop_composite_child() call. 4277 * A composite child is a child that's an implementation detail of the 4278 * container it's inside and should not be visible to people using the 4279 * container. Composite children aren't treated differently by GTK (but 4280 * see gtk_container_foreach() vs. gtk_container_forall()), but e.g. GUI 4281 * builders might want to treat them in a different way. 4282 */ 4283 public static void pushCompositeChild() 4284 { 4285 // void gtk_widget_push_composite_child (void); 4286 gtk_widget_push_composite_child(); 4287 } 4288 4289 /** 4290 * Warning 4291 * gtk_widget_queue_clear has been deprecated since version 2.2 and should not be used in newly-written code. Use gtk_widget_queue_draw() instead. 4292 * This function does the same as gtk_widget_queue_draw(). 4293 */ 4294 public void queueClear() 4295 { 4296 // void gtk_widget_queue_clear (GtkWidget *widget); 4297 gtk_widget_queue_clear(gtkWidget); 4298 } 4299 4300 /** 4301 * Warning 4302 * gtk_widget_queue_clear_area has been deprecated since version 2.2 and should not be used in newly-written code. Use gtk_widget_queue_draw_area() instead. 4303 * This function is no longer different from 4304 * gtk_widget_queue_draw_area(), though it once was. Now it just calls 4305 * gtk_widget_queue_draw_area(). Originally 4306 * gtk_widget_queue_clear_area() would force a redraw of the 4307 * background for GTK_NO_WINDOW widgets, and 4308 * gtk_widget_queue_draw_area() would not. Now both functions ensure 4309 * the background will be redrawn. 4310 * Params: 4311 * x = x coordinate of upper-left corner of rectangle to redraw 4312 * y = y coordinate of upper-left corner of rectangle to redraw 4313 * width = width of region to draw 4314 * height = height of region to draw 4315 */ 4316 public void queueClearArea(int x, int y, int width, int height) 4317 { 4318 // void gtk_widget_queue_clear_area (GtkWidget *widget, gint x, gint y, gint width, gint height); 4319 gtk_widget_queue_clear_area(gtkWidget, x, y, width, height); 4320 } 4321 4322 /** 4323 * Invalidates the rectangular area of widget defined by x, y, 4324 * width and height by calling gdk_window_invalidate_rect() on the 4325 * widget's window and all its child windows. Once the main loop 4326 * becomes idle (after the current batch of events has been processed, 4327 * roughly), the window will receive expose events for the union of 4328 * all regions that have been invalidated. 4329 * Normally you would only use this function in widget 4330 * implementations. You might also use it, or 4331 * gdk_window_invalidate_rect() directly, to schedule a redraw of a 4332 * GtkDrawingArea or some portion thereof. 4333 * Frequently you can just call gdk_window_invalidate_rect() or 4334 * gdk_window_invalidate_region() instead of this function. Those 4335 * functions will invalidate only a single window, instead of the 4336 * widget and all its children. 4337 * The advantage of adding to the invalidated region compared to 4338 * simply drawing immediately is efficiency; using an invalid region 4339 * ensures that you only have to redraw one time. 4340 * Params: 4341 * x = x coordinate of upper-left corner of rectangle to redraw 4342 * y = y coordinate of upper-left corner of rectangle to redraw 4343 * width = width of region to draw 4344 * height = height of region to draw 4345 */ 4346 public void queueDrawArea(int x, int y, int width, int height) 4347 { 4348 // void gtk_widget_queue_draw_area (GtkWidget *widget, gint x, gint y, gint width, gint height); 4349 gtk_widget_queue_draw_area(gtkWidget, x, y, width, height); 4350 } 4351 4352 /** 4353 * Recursively resets the shape on this widget and its descendants. 4354 */ 4355 public void resetShapes() 4356 { 4357 // void gtk_widget_reset_shapes (GtkWidget *widget); 4358 gtk_widget_reset_shapes(gtkWidget); 4359 } 4360 4361 /** 4362 * Sets whether the application intends to draw on the widget in 4363 * an "expose-event" handler. 4364 * This is a hint to the widget and does not affect the behavior of 4365 * the GTK+ core; many widgets ignore this flag entirely. For widgets 4366 * that do pay attention to the flag, such as GtkEventBox and GtkWindow, 4367 * the effect is to suppress default themed drawing of the widget's 4368 * background. (Children of the widget will still be drawn.) The application 4369 * is then entirely responsible for drawing the widget background. 4370 * Note that the background is still drawn when the widget is mapped. 4371 * If this is not suitable (e.g. because you want to make a transparent 4372 * Params: 4373 * appPaintable = TRUE if the application will paint on the widget 4374 */ 4375 public void setAppPaintable(int appPaintable) 4376 { 4377 // void gtk_widget_set_app_paintable (GtkWidget *widget, gboolean app_paintable); 4378 gtk_widget_set_app_paintable(gtkWidget, appPaintable); 4379 } 4380 4381 /** 4382 * Widgets are double buffered by default; you can use this function 4383 * to turn off the buffering. "Double buffered" simply means that 4384 * gdk_window_begin_paint_region() and gdk_window_end_paint() are called 4385 * automatically around expose events sent to the 4386 * widget. gdk_window_begin_paint() diverts all drawing to a widget's 4387 * window to an offscreen buffer, and gdk_window_end_paint() draws the 4388 * buffer to the screen. The result is that users see the window 4389 * update in one smooth step, and don't see individual graphics 4390 * primitives being rendered. 4391 * In very simple terms, double buffered widgets don't flicker, 4392 * so you would only use this function to turn off double buffering 4393 * if you had special needs and really knew what you were doing. 4394 * Note: if you turn off double-buffering, you have to handle 4395 * expose events, since even the clearing to the background color or 4396 * pixmap will not happen automatically (as it is done in 4397 * gdk_window_begin_paint()). 4398 * Params: 4399 * doubleBuffered = TRUE to double-buffer a widget 4400 */ 4401 public void setDoubleBuffered(int doubleBuffered) 4402 { 4403 // void gtk_widget_set_double_buffered (GtkWidget *widget, gboolean double_buffered); 4404 gtk_widget_set_double_buffered(gtkWidget, doubleBuffered); 4405 } 4406 4407 /** 4408 * Sets whether the entire widget is queued for drawing when its size 4409 * allocation changes. By default, this setting is TRUE and 4410 * the entire widget is redrawn on every size change. If your widget 4411 * leaves the upper left unchanged when made bigger, turning this 4412 * setting off will improve performance. 4413 * Note that for NO_WINDOW widgets setting this flag to FALSE turns 4414 * off all allocation on resizing: the widget will not even redraw if 4415 * its position changes; this is to allow containers that don't draw 4416 * anything to avoid excess invalidations. If you set this flag on a 4417 * NO_WINDOW widget that does draw on widget->window, 4418 * you are responsible for invalidating both the old and new allocation 4419 * of the widget when the widget is moved and responsible for invalidating 4420 * regions newly when the widget increases size. 4421 * Params: 4422 * redrawOnAllocate = if TRUE, the entire widget will be redrawn 4423 * when it is allocated to a new size. Otherwise, only the 4424 * new portion of the widget will be redrawn. 4425 */ 4426 public void setRedrawOnAllocate(int redrawOnAllocate) 4427 { 4428 // void gtk_widget_set_redraw_on_allocate (GtkWidget *widget, gboolean redraw_on_allocate); 4429 gtk_widget_set_redraw_on_allocate(gtkWidget, redrawOnAllocate); 4430 } 4431 4432 /** 4433 * Sets a widgets composite name. The widget must be 4434 * a composite child of its parent; see gtk_widget_push_composite_child(). 4435 * Params: 4436 * name = the name to set 4437 */ 4438 public void setCompositeName(string name) 4439 { 4440 // void gtk_widget_set_composite_name (GtkWidget *widget, const gchar *name); 4441 gtk_widget_set_composite_name(gtkWidget, Str.toStringz(name)); 4442 } 4443 4444 /** 4445 * For widgets that support scrolling, sets the scroll adjustments and 4446 * returns TRUE. For widgets that don't support scrolling, does 4447 * nothing and returns FALSE. Widgets that don't support scrolling 4448 * can be scrolled by placing them in a GtkViewport, which does 4449 * support scrolling. 4450 * Params: 4451 * hadjustment = an adjustment for horizontal scrolling, or NULL. [allow-none] 4452 * vadjustment = an adjustment for vertical scrolling, or NULL. [allow-none] 4453 * Returns: TRUE if the widget supports scrolling 4454 */ 4455 public int setScrollAdjustments(Adjustment hadjustment, Adjustment vadjustment) 4456 { 4457 // gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); 4458 return gtk_widget_set_scroll_adjustments(gtkWidget, (hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 4459 } 4460 4461 /** 4462 * Emits the "mnemonic-activate" signal. 4463 * The default handler for this signal activates the widget if 4464 * group_cycling is FALSE, and just grabs the focus if group_cycling 4465 * is TRUE. 4466 * Params: 4467 * groupCycling = TRUE if there are other widgets with the same mnemonic 4468 * Returns: TRUE if the signal has been handled 4469 */ 4470 public int mnemonicActivate(int groupCycling) 4471 { 4472 // gboolean gtk_widget_mnemonic_activate (GtkWidget *widget, gboolean group_cycling); 4473 return gtk_widget_mnemonic_activate(gtkWidget, groupCycling); 4474 } 4475 4476 /** 4477 * Installs a style property on a widget class. The parser for the 4478 * style property is determined by the value type of pspec. 4479 * Params: 4480 * klass = a GtkWidgetClass 4481 * pspec = the GParamSpec for the property 4482 */ 4483 public static void classInstallStyleProperty(GtkWidgetClass* klass, ParamSpec pspec) 4484 { 4485 // void gtk_widget_class_install_style_property (GtkWidgetClass *klass, GParamSpec *pspec); 4486 gtk_widget_class_install_style_property(klass, (pspec is null) ? null : pspec.getParamSpecStruct()); 4487 } 4488 4489 /** 4490 * Installs a style property on a widget class. 4491 * Params: 4492 * klass = a GtkWidgetClass 4493 * pspec = the GParamSpec for the style property 4494 * parser = the parser for the style property 4495 */ 4496 public static void classInstallStylePropertyParser(GtkWidgetClass* klass, ParamSpec pspec, GtkRcPropertyParser parser) 4497 { 4498 // void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass, GParamSpec *pspec, GtkRcPropertyParser parser); 4499 gtk_widget_class_install_style_property_parser(klass, (pspec is null) ? null : pspec.getParamSpecStruct(), parser); 4500 } 4501 4502 /** 4503 * Finds a style property of a widget class by name. 4504 * Since 2.2 4505 * Params: 4506 * klass = a GtkWidgetClass 4507 * propertyName = the name of the style property to find 4508 * Returns: the GParamSpec of the style property or NULL if class has no style property with that name. [allow-none] 4509 */ 4510 public static ParamSpec classFindStyleProperty(GtkWidgetClass* klass, string propertyName) 4511 { 4512 // GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass, const gchar *property_name); 4513 auto p = gtk_widget_class_find_style_property(klass, Str.toStringz(propertyName)); 4514 4515 if(p is null) 4516 { 4517 return null; 4518 } 4519 4520 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p); 4521 } 4522 4523 /** 4524 * Returns all style properties of a widget class. 4525 * Since 2.2 4526 * Params: 4527 * klass = a GtkWidgetClass 4528 * Returns: an newly allocated array of GParamSpec*. The array must be freed with g_free(). 4529 */ 4530 public static ParamSpec[] classListStyleProperties(GtkWidgetClass* klass) 4531 { 4532 // GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass, guint *n_properties); 4533 uint nProperties; 4534 auto p = gtk_widget_class_list_style_properties(klass, &nProperties); 4535 4536 if(p is null) 4537 { 4538 return null; 4539 } 4540 4541 ParamSpec[] arr = new ParamSpec[nProperties]; 4542 for(int i = 0; i < nProperties; i++) 4543 { 4544 arr[i] = ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p[i]); 4545 } 4546 4547 return arr; 4548 } 4549 4550 /** 4551 * Computes the intersection of a widget's area and region, returning 4552 * the intersection. The result may be empty, use gdk_region_empty() to 4553 * check. 4554 * Params: 4555 * region = a GdkRegion, in the same coordinate system as 4556 * widget->allocation. That is, relative to widget->window 4557 * for NO_WINDOW widgets; relative to the parent window 4558 * of widget->window for widgets with their own window. 4559 * 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. 4560 */ 4561 public Region regionIntersect(Region region) 4562 { 4563 // GdkRegion * gtk_widget_region_intersect (GtkWidget *widget, const GdkRegion *region); 4564 auto p = gtk_widget_region_intersect(gtkWidget, (region is null) ? null : region.getRegionStruct()); 4565 4566 if(p is null) 4567 { 4568 return null; 4569 } 4570 4571 return ObjectG.getDObject!(Region)(cast(GdkRegion*) p); 4572 } 4573 4574 /** 4575 * Very rarely-used function. This function is used to emit 4576 * an expose event signals on a widget. This function is not 4577 * normally used directly. The only time it is used is when 4578 * propagating an expose event to a child NO_WINDOW widget, and 4579 * that is normally done using gtk_container_propagate_expose(). 4580 * If you want to force an area of a window to be redrawn, 4581 * use gdk_window_invalidate_rect() or gdk_window_invalidate_region(). 4582 * To cause the redraw to be done immediately, follow that call 4583 * with a call to gdk_window_process_updates(). 4584 * Params: 4585 * event = a expose GdkEvent 4586 * Returns: return from the event signal emission (TRUE if the event was handled) 4587 */ 4588 public int sendExpose(Event event) 4589 { 4590 // gint gtk_widget_send_expose (GtkWidget *widget, GdkEvent *event); 4591 return gtk_widget_send_expose(gtkWidget, (event is null) ? null : event.getEventStruct()); 4592 } 4593 4594 /** 4595 * Sends the focus change event to widget 4596 * This function is not meant to be used by applications. The only time it 4597 * should be used is when it is necessary for a GtkWidget to assign focus 4598 * to a widget that is semantically owned by the first widget even though 4599 * it's not a direct child - for instance, a search entry in a floating 4600 * window similar to the quick search in GtkTreeView. 4601 * Since 2.22 4602 * Params: 4603 * event = a GdkEvent of type GDK_FOCUS_CHANGE 4604 * Returns: the return value from the event signal emission: TRUE if the event was handled, and FALSE otherwise 4605 */ 4606 public int sendFocusChange(Event event) 4607 { 4608 // gboolean gtk_widget_send_focus_change (GtkWidget *widget, GdkEvent *event); 4609 return gtk_widget_send_focus_change(gtkWidget, (event is null) ? null : event.getEventStruct()); 4610 } 4611 4612 /** 4613 * Gets the value of a style property of widget. 4614 * Params: 4615 * propertyName = the name of a style property 4616 * value = location to return the property value 4617 */ 4618 public void styleGetProperty(string propertyName, Value value) 4619 { 4620 // void gtk_widget_style_get_property (GtkWidget *widget, const gchar *property_name, GValue *value); 4621 gtk_widget_style_get_property(gtkWidget, Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct()); 4622 } 4623 4624 /** 4625 * Non-vararg variant of gtk_widget_style_get(). Used primarily by language 4626 * bindings. 4627 * Params: 4628 * firstPropertyName = the name of the first property to get 4629 * varArgs = a va_list of pairs of property names and 4630 * locations to return the property values, starting with the location 4631 * for first_property_name. 4632 */ 4633 public void styleGetValist(string firstPropertyName, void* varArgs) 4634 { 4635 // void gtk_widget_style_get_valist (GtkWidget *widget, const gchar *first_property_name, va_list var_args); 4636 gtk_widget_style_get_valist(gtkWidget, Str.toStringz(firstPropertyName), varArgs); 4637 } 4638 4639 /** 4640 * This function attaches the widget's GtkStyle to the widget's 4641 * GdkWindow. It is a replacement for 4642 * widget->style = gtk_style_attach (widget->style, widget->window); 4643 * and should only ever be called in a derived widget's "realize" 4644 * implementation which does not chain up to its parent class' 4645 * "realize" implementation, because one of the parent classes 4646 * (finally GtkWidget) would attach the style itself. 4647 * Since 2.20 4648 * Params: 4649 */ 4650 public void styleAttach() 4651 { 4652 // void gtk_widget_style_attach (GtkWidget *style); 4653 gtk_widget_style_attach(gtkWidget); 4654 } 4655 4656 /** 4657 * Returns the accessible object that describes the widget to an 4658 * assistive technology. 4659 * If no accessibility library is loaded (i.e. no ATK implementation library is 4660 * loaded via GTK_MODULES or via another application library, 4661 * such as libgnome), then this AtkObject instance may be a no-op. Likewise, 4662 * if no class-specific AtkObject implementation is available for the widget 4663 * instance in question, it will inherit an AtkObject implementation from the 4664 * first ancestor class for which such an implementation is defined. 4665 * The documentation of the ATK 4666 * library contains more information about accessible objects and their uses. 4667 * Returns: the AtkObject associated with widget. [transfer none] 4668 */ 4669 public ObjectAtk getAccessible() 4670 { 4671 // AtkObject* gtk_widget_get_accessible (GtkWidget *widget); 4672 auto p = gtk_widget_get_accessible(gtkWidget); 4673 4674 if(p is null) 4675 { 4676 return null; 4677 } 4678 4679 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 4680 } 4681 4682 /** 4683 * This function is used by custom widget implementations; if you're 4684 * writing an app, you'd use gtk_widget_grab_focus() to move the focus 4685 * to a particular widget, and gtk_container_set_focus_chain() to 4686 * change the focus tab order. So you may want to investigate those 4687 * functions instead. 4688 * gtk_widget_child_focus() is called by containers as the user moves 4689 * around the window using keyboard shortcuts. direction indicates 4690 * what kind of motion is taking place (up, down, left, right, tab 4691 * forward, tab backward). gtk_widget_child_focus() emits the 4692 * "focus" signal; widgets override the default handler 4693 * for this signal in order to implement appropriate focus behavior. 4694 * The default ::focus handler for a widget should return TRUE if 4695 * moving in direction left the focus on a focusable location inside 4696 * that widget, and FALSE if moving in direction moved the focus 4697 * outside the widget. If returning TRUE, widgets normally 4698 * call gtk_widget_grab_focus() to place the focus accordingly; 4699 * if returning FALSE, they don't modify the current focus location. 4700 * This function replaces gtk_container_focus() from GTK+ 1.2. 4701 * It was necessary to check that the child was visible, sensitive, 4702 * and focusable before calling gtk_container_focus(). 4703 * gtk_widget_child_focus() returns FALSE if the widget is not 4704 * currently in a focusable state, so there's no need for those checks. 4705 * Params: 4706 * direction = direction of focus movement 4707 * Returns: TRUE if focus ended up inside widget 4708 */ 4709 public int childFocus(GtkDirectionType direction) 4710 { 4711 // gboolean gtk_widget_child_focus (GtkWidget *widget, GtkDirectionType direction); 4712 return gtk_widget_child_focus(gtkWidget, direction); 4713 } 4714 4715 /** 4716 * Emits a "child-notify" signal for the 4717 * child property child_property 4718 * on widget. 4719 * This is the analogue of g_object_notify() for child properties. 4720 * Params: 4721 * childProperty = the name of a child property installed on the 4722 * class of widget's parent 4723 */ 4724 public void childNotify(string childProperty) 4725 { 4726 // void gtk_widget_child_notify (GtkWidget *widget, const gchar *child_property); 4727 gtk_widget_child_notify(gtkWidget, Str.toStringz(childProperty)); 4728 } 4729 4730 /** 4731 * Stops emission of "child-notify" signals on widget. The 4732 * signals are queued until gtk_widget_thaw_child_notify() is called 4733 * on widget. 4734 * This is the analogue of g_object_freeze_notify() for child properties. 4735 */ 4736 public void freezeChildNotify() 4737 { 4738 // void gtk_widget_freeze_child_notify (GtkWidget *widget); 4739 gtk_widget_freeze_child_notify(gtkWidget); 4740 } 4741 4742 /** 4743 * Gets the value set with gtk_widget_set_child_visible(). 4744 * If you feel a need to use this function, your code probably 4745 * needs reorganization. 4746 * This function is only useful for container implementations and 4747 * never should be called by an application. 4748 * Returns: TRUE if the widget is mapped with the parent. 4749 */ 4750 public int getChildVisible() 4751 { 4752 // gboolean gtk_widget_get_child_visible (GtkWidget *widget); 4753 return gtk_widget_get_child_visible(gtkWidget); 4754 } 4755 4756 /** 4757 * Returns the parent container of widget. 4758 * Returns: the parent container of widget, or NULL. [transfer none] 4759 */ 4760 public Widget getParent() 4761 { 4762 // GtkWidget * gtk_widget_get_parent (GtkWidget *widget); 4763 auto p = gtk_widget_get_parent(gtkWidget); 4764 4765 if(p is null) 4766 { 4767 return null; 4768 } 4769 4770 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 4771 } 4772 4773 /** 4774 * Gets the settings object holding the settings (global property 4775 * settings, RC file information, etc) used for this widget. 4776 * Note that this function can only be called when the GtkWidget 4777 * is attached to a toplevel, since the settings object is specific 4778 * to a particular GdkScreen. 4779 * Returns: the relevant GtkSettings object. [transfer none] 4780 */ 4781 public Settings getSettings() 4782 { 4783 // GtkSettings* gtk_widget_get_settings (GtkWidget *widget); 4784 auto p = gtk_widget_get_settings(gtkWidget); 4785 4786 if(p is null) 4787 { 4788 return null; 4789 } 4790 4791 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) p); 4792 } 4793 4794 /** 4795 * Returns the clipboard object for the given selection to 4796 * be used with widget. widget must have a GdkDisplay 4797 * associated with it, so must be attached to a toplevel 4798 * window. 4799 * Since 2.2 4800 * Params: 4801 * selection = a GdkAtom which identifies the clipboard 4802 * to use. GDK_SELECTION_CLIPBOARD gives the 4803 * default clipboard. Another common value 4804 * is GDK_SELECTION_PRIMARY, which gives 4805 * the primary X selection. 4806 * 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] 4807 */ 4808 public Clipboard getClipboard(GdkAtom selection) 4809 { 4810 // GtkClipboard * gtk_widget_get_clipboard (GtkWidget *widget, GdkAtom selection); 4811 auto p = gtk_widget_get_clipboard(gtkWidget, selection); 4812 4813 if(p is null) 4814 { 4815 return null; 4816 } 4817 4818 return ObjectG.getDObject!(Clipboard)(cast(GtkClipboard*) p); 4819 } 4820 4821 /** 4822 * Get the GdkDisplay for the toplevel window associated with 4823 * this widget. This function can only be called after the widget 4824 * has been added to a widget hierarchy with a GtkWindow at the top. 4825 * In general, you should only create display specific 4826 * resources when a widget has been realized, and you should 4827 * free those resources when the widget is unrealized. 4828 * Since 2.2 4829 * Returns: the GdkDisplay for the toplevel for this widget. [transfer none] 4830 */ 4831 public Display getDisplay() 4832 { 4833 // GdkDisplay * gtk_widget_get_display (GtkWidget *widget); 4834 auto p = gtk_widget_get_display(gtkWidget); 4835 4836 if(p is null) 4837 { 4838 return null; 4839 } 4840 4841 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 4842 } 4843 4844 /** 4845 * Get the root window where this widget is located. This function can 4846 * only be called after the widget has been added to a widget 4847 * hierarchy with GtkWindow at the top. 4848 * The root window is useful for such purposes as creating a popup 4849 * GdkWindow associated with the window. In general, you should only 4850 * create display specific resources when a widget has been realized, 4851 * and you should free those resources when the widget is unrealized. 4852 * Since 2.2 4853 * Returns: the GdkWindow root window for the toplevel for this widget. [transfer none] 4854 */ 4855 public Window getRootWindow() 4856 { 4857 // GdkWindow * gtk_widget_get_root_window (GtkWidget *widget); 4858 auto p = gtk_widget_get_root_window(gtkWidget); 4859 4860 if(p is null) 4861 { 4862 return null; 4863 } 4864 4865 return ObjectG.getDObject!(Window)(cast(GdkWindow*) p); 4866 } 4867 4868 /** 4869 * Get the GdkScreen from the toplevel window associated with 4870 * this widget. This function can only be called after the widget 4871 * has been added to a widget hierarchy with a GtkWindow 4872 * at the top. 4873 * In general, you should only create screen specific 4874 * resources when a widget has been realized, and you should 4875 * free those resources when the widget is unrealized. 4876 * Since 2.2 4877 * Returns: the GdkScreen for the toplevel for this widget. [transfer none] 4878 */ 4879 public Screen getScreen() 4880 { 4881 // GdkScreen * gtk_widget_get_screen (GtkWidget *widget); 4882 auto p = gtk_widget_get_screen(gtkWidget); 4883 4884 if(p is null) 4885 { 4886 return null; 4887 } 4888 4889 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 4890 } 4891 4892 /** 4893 * Checks whether there is a GdkScreen is associated with 4894 * this widget. All toplevel widgets have an associated 4895 * screen, and all widgets added into a hierarchy with a toplevel 4896 * window at the top. 4897 * Since 2.2 4898 * Returns: TRUE if there is a GdkScreen associcated with the widget. 4899 */ 4900 public int hasScreen() 4901 { 4902 // gboolean gtk_widget_has_screen (GtkWidget *widget); 4903 return gtk_widget_has_screen(gtkWidget); 4904 } 4905 4906 /** 4907 * Gets the size request that was explicitly set for the widget using 4908 * gtk_widget_set_size_request(). A value of -1 stored in width or 4909 * height indicates that that dimension has not been set explicitly 4910 * and the natural requisition of the widget will be used intead. See 4911 * gtk_widget_set_size_request(). To get the size a widget will 4912 * actually use, call gtk_widget_size_request() instead of 4913 * this function. 4914 * Params: 4915 * width = return location for width, or NULL. [out][allow-none] 4916 * height = return location for height, or NULL. [out][allow-none] 4917 */ 4918 public void getSizeRequest(out int width, out int height) 4919 { 4920 // void gtk_widget_get_size_request (GtkWidget *widget, gint *width, gint *height); 4921 gtk_widget_get_size_request(gtkWidget, &width, &height); 4922 } 4923 4924 /** 4925 * Sets whether widget should be mapped along with its when its parent 4926 * is mapped and widget has been shown with gtk_widget_show(). 4927 * The child visibility can be set for widget before it is added to 4928 * a container with gtk_widget_set_parent(), to avoid mapping 4929 * children unnecessary before immediately unmapping them. However 4930 * it will be reset to its default state of TRUE when the widget 4931 * is removed from a container. 4932 * Note that changing the child visibility of a widget does not 4933 * queue a resize on the widget. Most of the time, the size of 4934 * a widget is computed from all visible children, whether or 4935 * not they are mapped. If this is not the case, the container 4936 * can queue a resize itself. 4937 * This function is only useful for container implementations and 4938 * never should be called by an application. 4939 * Params: 4940 * isVisible = if TRUE, widget should be mapped along with its parent. 4941 */ 4942 public void setChildVisible(int isVisible) 4943 { 4944 // void gtk_widget_set_child_visible (GtkWidget *widget, gboolean is_visible); 4945 gtk_widget_set_child_visible(gtkWidget, isVisible); 4946 } 4947 4948 /** 4949 * Sets the minimum size of a widget; that is, the widget's size 4950 * request will be width by height. You can use this function to 4951 * force a widget to be either larger or smaller than it normally 4952 * would be. 4953 * In most cases, gtk_window_set_default_size() is a better choice for 4954 * toplevel windows than this function; setting the default size will 4955 * still allow users to shrink the window. Setting the size request 4956 * will force them to leave the window at least as large as the size 4957 * request. When dealing with window sizes, 4958 * gtk_window_set_geometry_hints() can be a useful function as well. 4959 * Note the inherent danger of setting any fixed size - themes, 4960 * translations into other languages, different fonts, and user action 4961 * can all change the appropriate size for a given widget. So, it's 4962 * basically impossible to hardcode a size that will always be 4963 * correct. 4964 * The size request of a widget is the smallest size a widget can 4965 * accept while still functioning well and drawing itself correctly. 4966 * However in some strange cases a widget may be allocated less than 4967 * its requested size, and in many cases a widget may be allocated more 4968 * space than it requested. 4969 * If the size request in a given direction is -1 (unset), then 4970 * the "natural" size request of the widget will be used instead. 4971 * Widgets can't actually be allocated a size less than 1 by 1, but 4972 * you can pass 0,0 to this function to mean "as small as possible." 4973 * Params: 4974 * width = width widget should request, or -1 to unset 4975 * height = height widget should request, or -1 to unset 4976 */ 4977 public void setSizeRequest(int width, int height) 4978 { 4979 // void gtk_widget_set_size_request (GtkWidget *widget, gint width, gint height); 4980 gtk_widget_set_size_request(gtkWidget, width, height); 4981 } 4982 4983 /** 4984 * Reverts the effect of a previous call to gtk_widget_freeze_child_notify(). 4985 * This causes all queued "child-notify" signals on widget to be 4986 * emitted. 4987 */ 4988 public void thawChildNotify() 4989 { 4990 // void gtk_widget_thaw_child_notify (GtkWidget *widget); 4991 gtk_widget_thaw_child_notify(gtkWidget); 4992 } 4993 4994 /** 4995 * Sets the "no-show-all" property, which determines whether 4996 * calls to gtk_widget_show_all() and gtk_widget_hide_all() will affect 4997 * this widget. 4998 * This is mostly for use in constructing widget hierarchies with externally 4999 * controlled visibility, see GtkUIManager. 5000 * Since 2.4 5001 * Params: 5002 * noShowAll = the new value for the "no-show-all" property 5003 */ 5004 public void setNoShowAll(int noShowAll) 5005 { 5006 // void gtk_widget_set_no_show_all (GtkWidget *widget, gboolean no_show_all); 5007 gtk_widget_set_no_show_all(gtkWidget, noShowAll); 5008 } 5009 5010 /** 5011 * Returns the current value of the GtkWidget:no-show-all property, 5012 * which determines whether calls to gtk_widget_show_all() and 5013 * gtk_widget_hide_all() will affect this widget. 5014 * Since 2.4 5015 * Returns: the current value of the "no-show-all" property. 5016 */ 5017 public int getNoShowAll() 5018 { 5019 // gboolean gtk_widget_get_no_show_all (GtkWidget *widget); 5020 return gtk_widget_get_no_show_all(gtkWidget); 5021 } 5022 5023 /** 5024 * Returns a newly allocated list of the widgets, normally labels, for 5025 * which this widget is a the target of a mnemonic (see for example, 5026 * gtk_label_set_mnemonic_widget()). 5027 * The widgets in the list are not individually referenced. If you 5028 * want to iterate through the list and perform actions involving 5029 * callbacks that might destroy the widgets, you 5030 * must call g_list_foreach (result, 5031 * (GFunc)g_object_ref, NULL) first, and then unref all the 5032 * widgets afterwards. 5033 * Since 2.4 5034 * Returns: the list of mnemonic labels; free this list with g_list_free() when you are done with it. [element-type GtkWidget][transfer container GtkWidget] 5035 */ 5036 public ListG listMnemonicLabels() 5037 { 5038 // GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget); 5039 auto p = gtk_widget_list_mnemonic_labels(gtkWidget); 5040 5041 if(p is null) 5042 { 5043 return null; 5044 } 5045 5046 return ObjectG.getDObject!(ListG)(cast(GList*) p); 5047 } 5048 5049 /** 5050 * Adds a widget to the list of mnemonic labels for 5051 * this widget. (See gtk_widget_list_mnemonic_labels()). Note the 5052 * list of mnemonic labels for the widget is cleared when the 5053 * widget is destroyed, so the caller must make sure to update 5054 * its internal state at this point as well, by using a connection 5055 * to the "destroy" signal or a weak notifier. 5056 * Since 2.4 5057 * Params: 5058 * label = a GtkWidget that acts as a mnemonic label for widget 5059 */ 5060 public void addMnemonicLabel(Widget label) 5061 { 5062 // void gtk_widget_add_mnemonic_label (GtkWidget *widget, GtkWidget *label); 5063 gtk_widget_add_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 5064 } 5065 5066 /** 5067 * Removes a widget from the list of mnemonic labels for 5068 * this widget. (See gtk_widget_list_mnemonic_labels()). The widget 5069 * must have previously been added to the list with 5070 * gtk_widget_add_mnemonic_label(). 5071 * Since 2.4 5072 * Params: 5073 * label = a GtkWidget that was previously set as a mnemnic label for 5074 * widget with gtk_widget_add_mnemonic_label(). 5075 */ 5076 public void removeMnemonicLabel(Widget label) 5077 { 5078 // void gtk_widget_remove_mnemonic_label (GtkWidget *widget, GtkWidget *label); 5079 gtk_widget_remove_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 5080 } 5081 5082 /** 5083 * Warning 5084 * gtk_widget_get_action has been deprecated since version 2.16 and should not be used in newly-written code. Use gtk_activatable_get_related_action() instead. 5085 * Returns the GtkAction that widget is a proxy for. 5086 * See also gtk_action_get_proxies(). 5087 * Since 2.10 5088 * Returns: the action that a widget is a proxy for, or NULL, if it is not attached to an action. 5089 */ 5090 public Action getAction() 5091 { 5092 // GtkAction * gtk_widget_get_action (GtkWidget *widget); 5093 auto p = gtk_widget_get_action(gtkWidget); 5094 5095 if(p is null) 5096 { 5097 return null; 5098 } 5099 5100 return ObjectG.getDObject!(Action)(cast(GtkAction*) p); 5101 } 5102 5103 /** 5104 * Whether widget can rely on having its alpha channel 5105 * drawn correctly. On X11 this function returns whether a 5106 * compositing manager is running for widget's screen. 5107 * Please note that the semantics of this call will change 5108 * in the future if used on a widget that has a composited 5109 * window in its hierarchy (as set by gdk_window_set_composited()). 5110 * Since 2.10 5111 * Returns: TRUE if the widget can rely on its alpha channel being drawn correctly. 5112 */ 5113 public int isComposited() 5114 { 5115 // gboolean gtk_widget_is_composited (GtkWidget *widget); 5116 return gtk_widget_is_composited(gtkWidget); 5117 } 5118 5119 /** 5120 * Notifies the user about an input-related error on this widget. 5121 * If the "gtk-error-bell" setting is TRUE, it calls 5122 * gdk_window_beep(), otherwise it does nothing. 5123 * Note that the effect of gdk_window_beep() can be configured in many 5124 * ways, depending on the windowing backend and the desktop environment 5125 * or window manager that is used. 5126 * Since 2.12 5127 */ 5128 public void errorBell() 5129 { 5130 // void gtk_widget_error_bell (GtkWidget *widget); 5131 gtk_widget_error_bell(gtkWidget); 5132 } 5133 5134 /** 5135 * This function should be called whenever keyboard navigation within 5136 * a single widget hits a boundary. The function emits the 5137 * "keynav-failed" signal on the widget and its return 5138 * value should be interpreted in a way similar to the return value of 5139 * Since 2.12 5140 * Params: 5141 * direction = direction of focus movement 5142 * 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). 5143 */ 5144 public int keynavFailed(GtkDirectionType direction) 5145 { 5146 // gboolean gtk_widget_keynav_failed (GtkWidget *widget, GtkDirectionType direction); 5147 return gtk_widget_keynav_failed(gtkWidget, direction); 5148 } 5149 5150 /** 5151 * Gets the contents of the tooltip for widget. 5152 * Since 2.12 5153 * Returns: the tooltip text, or NULL. You should free the returned string with g_free() when done. 5154 */ 5155 public string getTooltipMarkup() 5156 { 5157 // gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget); 5158 return Str.toString(gtk_widget_get_tooltip_markup(gtkWidget)); 5159 } 5160 5161 /** 5162 * Sets markup as the contents of the tooltip, which is marked up with 5163 * the Pango text markup language. 5164 * This function will take care of setting GtkWidget:has-tooltip to TRUE 5165 * and of the default handler for the GtkWidget::query-tooltip signal. 5166 * See also the GtkWidget:tooltip-markup property and 5167 * gtk_tooltip_set_markup(). 5168 * Since 2.12 5169 * Params: 5170 * markup = the contents of the tooltip for widget, or NULL. [allow-none] 5171 */ 5172 public void setTooltipMarkup(string markup) 5173 { 5174 // void gtk_widget_set_tooltip_markup (GtkWidget *widget, const gchar *markup); 5175 gtk_widget_set_tooltip_markup(gtkWidget, Str.toStringz(markup)); 5176 } 5177 5178 /** 5179 * Gets the contents of the tooltip for widget. 5180 * Since 2.12 5181 * Returns: the tooltip text, or NULL. You should free the returned string with g_free() when done. 5182 */ 5183 public string getTooltipText() 5184 { 5185 // gchar * gtk_widget_get_tooltip_text (GtkWidget *widget); 5186 return Str.toString(gtk_widget_get_tooltip_text(gtkWidget)); 5187 } 5188 5189 /** 5190 * Sets text as the contents of the tooltip. This function will take 5191 * care of setting GtkWidget:has-tooltip to TRUE and of the default 5192 * handler for the GtkWidget::query-tooltip signal. 5193 * See also the GtkWidget:tooltip-text property and gtk_tooltip_set_text(). 5194 * Since 2.12 5195 * Params: 5196 * text = the contents of the tooltip for widget 5197 */ 5198 public void setTooltipText(string text) 5199 { 5200 // void gtk_widget_set_tooltip_text (GtkWidget *widget, const gchar *text); 5201 gtk_widget_set_tooltip_text(gtkWidget, Str.toStringz(text)); 5202 } 5203 5204 /** 5205 * Returns the GtkWindow of the current tooltip. This can be the 5206 * GtkWindow created by default, or the custom tooltip window set 5207 * using gtk_widget_set_tooltip_window(). 5208 * Since 2.12 5209 * Returns: The GtkWindow of the current tooltip. [transfer none] 5210 */ 5211 public GtkWindow* getTooltipWindow() 5212 { 5213 // GtkWindow * gtk_widget_get_tooltip_window (GtkWidget *widget); 5214 return gtk_widget_get_tooltip_window(gtkWidget); 5215 } 5216 5217 /** 5218 * Replaces the default, usually yellow, window used for displaying 5219 * tooltips with custom_window. GTK+ will take care of showing and 5220 * hiding custom_window at the right moment, to behave likewise as 5221 * the default tooltip window. If custom_window is NULL, the default 5222 * tooltip window will be used. 5223 * If the custom window should have the default theming it needs to 5224 * have the name "gtk-tooltip", see gtk_widget_set_name(). 5225 * Since 2.12 5226 * Params: 5227 * customWindow = a GtkWindow, or NULL. [allow-none] 5228 */ 5229 public void setTooltipWindow(GtkWindow* customWindow) 5230 { 5231 // void gtk_widget_set_tooltip_window (GtkWidget *widget, GtkWindow *custom_window); 5232 gtk_widget_set_tooltip_window(gtkWidget, customWindow); 5233 } 5234 5235 /** 5236 * Returns the current value of the has-tooltip property. See 5237 * GtkWidget:has-tooltip for more information. 5238 * Since 2.12 5239 * Returns: current value of has-tooltip on widget. 5240 */ 5241 public int getHasTooltip() 5242 { 5243 // gboolean gtk_widget_get_has_tooltip (GtkWidget *widget); 5244 return gtk_widget_get_has_tooltip(gtkWidget); 5245 } 5246 5247 /** 5248 * Sets the has-tooltip property on widget to has_tooltip. See 5249 * GtkWidget:has-tooltip for more information. 5250 * Since 2.12 5251 * Params: 5252 * hasTooltip = whether or not widget has a tooltip. 5253 */ 5254 public void setHasTooltip(int hasTooltip) 5255 { 5256 // void gtk_widget_set_has_tooltip (GtkWidget *widget, gboolean has_tooltip); 5257 gtk_widget_set_has_tooltip(gtkWidget, hasTooltip); 5258 } 5259 5260 /** 5261 * Triggers a tooltip query on the display where the toplevel of widget 5262 * is located. See gtk_tooltip_trigger_tooltip_query() for more 5263 * information. 5264 * Since 2.12 5265 */ 5266 public void triggerTooltipQuery() 5267 { 5268 // void gtk_widget_trigger_tooltip_query (GtkWidget *widget); 5269 gtk_widget_trigger_tooltip_query(gtkWidget); 5270 } 5271 5272 /** 5273 * Create a GdkPixmap of the contents of the widget and its children. 5274 * Works even if the widget is obscured. The depth and visual of the 5275 * resulting pixmap is dependent on the widget being snapshot and likely 5276 * differs from those of a target widget displaying the pixmap. 5277 * The function gdk_pixbuf_get_from_drawable() can be used to convert 5278 * the pixmap to a visual independant representation. 5279 * The snapshot area used by this function is the widget's allocation plus 5280 * any extra space occupied by additional windows belonging to this widget 5281 * (such as the arrows of a spin button). 5282 * Thus, the resulting snapshot pixmap is possibly larger than the allocation. 5283 * If clip_rect is non-NULL, the resulting pixmap is shrunken to 5284 * match the specified clip_rect. The (x,y) coordinates of clip_rect are 5285 * interpreted widget relative. If width or height of clip_rect are 0 or 5286 * negative, the width or height of the resulting pixmap will be shrunken 5287 * by the respective amount. 5288 * For instance a clip_rect { +5, +5, -10, -10 } will 5289 * chop off 5 pixels at each side of the snapshot pixmap. 5290 * If non-NULL, clip_rect will contain the exact widget-relative snapshot 5291 * coordinates upon return. A clip_rect of { -1, -1, 0, 0 } 5292 * can be used to preserve the auto-grown snapshot area and use clip_rect 5293 * as a pure output parameter. 5294 * The returned pixmap can be NULL, if the resulting clip_area was empty. 5295 * Since 2.14 5296 * Params: 5297 * clipRect = a GdkRectangle or NULL. [allow-none] 5298 * Returns: GdkPixmap snapshot of the widget 5299 */ 5300 public Pixmap getSnapshot(Rectangle clipRect) 5301 { 5302 // GdkPixmap * gtk_widget_get_snapshot (GtkWidget *widget, GdkRectangle *clip_rect); 5303 auto p = gtk_widget_get_snapshot(gtkWidget, (clipRect is null) ? null : clipRect.getRectangleStruct()); 5304 5305 if(p is null) 5306 { 5307 return null; 5308 } 5309 5310 return ObjectG.getDObject!(Pixmap)(cast(GdkPixmap*) p); 5311 } 5312 5313 /** 5314 * Sets the widget's allocation. This should not be used 5315 * directly, but from within a widget's size_allocate method. 5316 * Since 2.18 5317 * Params: 5318 * allocation = a pointer to a GtkAllocation to copy from 5319 */ 5320 public void setAllocation(ref GtkAllocation allocation) 5321 { 5322 // void gtk_widget_set_allocation (GtkWidget *widget, const GtkAllocation *allocation); 5323 gtk_widget_set_allocation(gtkWidget, &allocation); 5324 } 5325 5326 /** 5327 * Determines whether the application intends to draw on the widget in 5328 * an "expose-event" handler. 5329 * See gtk_widget_set_app_paintable() 5330 * Since 2.18 5331 * Returns: TRUE if the widget is app paintable 5332 */ 5333 public int getAppPaintable() 5334 { 5335 // gboolean gtk_widget_get_app_paintable (GtkWidget *widget); 5336 return gtk_widget_get_app_paintable(gtkWidget); 5337 } 5338 5339 /** 5340 * Determines whether widget can be a default widget. See 5341 * gtk_widget_set_can_default(). 5342 * Since 2.18 5343 * Returns: TRUE if widget can be a default widget, FALSE otherwise 5344 */ 5345 public int getCanDefault() 5346 { 5347 // gboolean gtk_widget_get_can_default (GtkWidget *widget); 5348 return gtk_widget_get_can_default(gtkWidget); 5349 } 5350 5351 /** 5352 * Specifies whether widget can be a default widget. See 5353 * gtk_widget_grab_default() for details about the meaning of 5354 * "default". 5355 * Since 2.18 5356 * Params: 5357 * canDefault = whether or not widget can be a default widget. 5358 */ 5359 public void setCanDefault(int canDefault) 5360 { 5361 // void gtk_widget_set_can_default (GtkWidget *widget, gboolean can_default); 5362 gtk_widget_set_can_default(gtkWidget, canDefault); 5363 } 5364 5365 /** 5366 * Determines whether widget can own the input focus. See 5367 * gtk_widget_set_can_focus(). 5368 * Since 2.18 5369 * Returns: TRUE if widget can own the input focus, FALSE otherwise 5370 */ 5371 public int getCanFocus() 5372 { 5373 // gboolean gtk_widget_get_can_focus (GtkWidget *widget); 5374 return gtk_widget_get_can_focus(gtkWidget); 5375 } 5376 5377 /** 5378 * Specifies whether widget can own the input focus. See 5379 * gtk_widget_grab_focus() for actually setting the input focus on a 5380 * widget. 5381 * Since 2.18 5382 * Params: 5383 * canFocus = whether or not widget can own the input focus. 5384 */ 5385 public void setCanFocus(int canFocus) 5386 { 5387 // void gtk_widget_set_can_focus (GtkWidget *widget, gboolean can_focus); 5388 gtk_widget_set_can_focus(gtkWidget, canFocus); 5389 } 5390 5391 /** 5392 * Determines whether the widget is double buffered. 5393 * See gtk_widget_set_double_buffered() 5394 * Since 2.18 5395 * Returns: TRUE if the widget is double buffered 5396 */ 5397 public int getDoubleBuffered() 5398 { 5399 // gboolean gtk_widget_get_double_buffered (GtkWidget *widget); 5400 return gtk_widget_get_double_buffered(gtkWidget); 5401 } 5402 5403 /** 5404 * Determines whether widget has a GdkWindow of its own. See 5405 * gtk_widget_set_has_window(). 5406 * Since 2.18 5407 * Returns: TRUE if widget has a window, FALSE otherwise 5408 */ 5409 public int getHasWindow() 5410 { 5411 // gboolean gtk_widget_get_has_window (GtkWidget *widget); 5412 return gtk_widget_get_has_window(gtkWidget); 5413 } 5414 5415 /** 5416 * Specifies whether widget has a GdkWindow of its own. Note that 5417 * all realized widgets have a non-NULL "window" pointer 5418 * (gtk_widget_get_window() never returns a NULL window when a widget 5419 * is realized), but for many of them it's actually the GdkWindow of 5420 * one of its parent widgets. Widgets that do not create a window for 5421 * themselves in GtkWidget::realize() must announce this by 5422 * calling this function with has_window = FALSE. 5423 * This function should only be called by widget implementations, 5424 * and they should call it in their init() function. 5425 * Since 2.18 5426 * Params: 5427 * hasWindow = whether or not widget has a window. 5428 */ 5429 public void setHasWindow(int hasWindow) 5430 { 5431 // void gtk_widget_set_has_window (GtkWidget *widget, gboolean has_window); 5432 gtk_widget_set_has_window(gtkWidget, hasWindow); 5433 } 5434 5435 /** 5436 * Returns the widget's sensitivity (in the sense of returning 5437 * the value that has been set using gtk_widget_set_sensitive()). 5438 * The effective sensitivity of a widget is however determined by both its 5439 * own and its parent widget's sensitivity. See gtk_widget_is_sensitive(). 5440 * Since 2.18 5441 * Returns: TRUE if the widget is sensitive 5442 */ 5443 public int getSensitive() 5444 { 5445 // gboolean gtk_widget_get_sensitive (GtkWidget *widget); 5446 return gtk_widget_get_sensitive(gtkWidget); 5447 } 5448 5449 /** 5450 * Returns the widget's effective sensitivity, which means 5451 * it is sensitive itself and also its parent widget is sensntive 5452 * Since 2.18 5453 * Returns: TRUE if the widget is effectively sensitive 5454 */ 5455 public int isSensitive() 5456 { 5457 // gboolean gtk_widget_is_sensitive (GtkWidget *widget); 5458 return gtk_widget_is_sensitive(gtkWidget); 5459 } 5460 5461 /** 5462 * Returns the widget's state. See gtk_widget_set_state(). 5463 * Since 2.18 5464 * Returns: the state of widget. 5465 */ 5466 public GtkStateType getState() 5467 { 5468 // GtkStateType gtk_widget_get_state (GtkWidget *widget); 5469 return gtk_widget_get_state(gtkWidget); 5470 } 5471 5472 /** 5473 * Determines whether the widget is visible. Note that this doesn't 5474 * take into account whether the widget's parent is also visible 5475 * or the widget is obscured in any way. 5476 * See gtk_widget_set_visible(). 5477 * Since 2.18 5478 * Returns: TRUE if the widget is visible 5479 */ 5480 public int getVisible() 5481 { 5482 // gboolean gtk_widget_get_visible (GtkWidget *widget); 5483 return gtk_widget_get_visible(gtkWidget); 5484 } 5485 5486 /** 5487 * Sets the visibility state of widget. Note that setting this to 5488 * TRUE doesn't mean the widget is actually viewable, see 5489 * gtk_widget_get_visible(). 5490 * This function simply calls gtk_widget_show() or gtk_widget_hide() 5491 * but is nicer to use when the visibility of the widget depends on 5492 * some condition. 5493 * Since 2.18 5494 * Params: 5495 * visible = whether the widget should be shown or not 5496 */ 5497 public void setVisible(int visible) 5498 { 5499 // void gtk_widget_set_visible (GtkWidget *widget, gboolean visible); 5500 gtk_widget_set_visible(gtkWidget, visible); 5501 } 5502 5503 /** 5504 * Determines whether widget is the current default widget within its 5505 * toplevel. See gtk_widget_set_can_default(). 5506 * Since 2.18 5507 * Returns: TRUE if widget is the current default widget within its toplevel, FALSE otherwise 5508 */ 5509 public int hasDefault() 5510 { 5511 // gboolean gtk_widget_has_default (GtkWidget *widget); 5512 return gtk_widget_has_default(gtkWidget); 5513 } 5514 5515 /** 5516 * Determines if the widget has the global input focus. See 5517 * gtk_widget_is_focus() for the difference between having the global 5518 * input focus, and only having the focus within a toplevel. 5519 * Since 2.18 5520 * Returns: TRUE if the widget has the global input focus. 5521 */ 5522 public int hasFocus() 5523 { 5524 // gboolean gtk_widget_has_focus (GtkWidget *widget); 5525 return gtk_widget_has_focus(gtkWidget); 5526 } 5527 5528 /** 5529 * Determines whether the widget is currently grabbing events, so it 5530 * is the only widget receiving input events (keyboard and mouse). 5531 * See also gtk_grab_add(). 5532 * Since 2.18 5533 * Returns: TRUE if the widget is in the grab_widgets stack 5534 */ 5535 public int hasGrab() 5536 { 5537 // gboolean gtk_widget_has_grab (GtkWidget *widget); 5538 return gtk_widget_has_grab(gtkWidget); 5539 } 5540 5541 /** 5542 * Determines if the widget style has been looked up through the rc mechanism. 5543 * Since 2.20 5544 * Returns: TRUE if the widget has been looked up through the rc mechanism, FALSE otherwise. 5545 */ 5546 public int hasRcStyle() 5547 { 5548 // gboolean gtk_widget_has_rc_style (GtkWidget *widget); 5549 return gtk_widget_has_rc_style(gtkWidget); 5550 } 5551 5552 /** 5553 * Determines whether widget can be drawn to. A widget can be drawn 5554 * to if it is mapped and visible. 5555 * Since 2.18 5556 * Returns: TRUE if widget is drawable, FALSE otherwise 5557 */ 5558 public int isDrawable() 5559 { 5560 // gboolean gtk_widget_is_drawable (GtkWidget *widget); 5561 return gtk_widget_is_drawable(gtkWidget); 5562 } 5563 5564 /** 5565 * Determines whether widget is a toplevel widget. Currently only 5566 * GtkWindow and GtkInvisible are toplevel widgets. Toplevel 5567 * widgets have no parent widget. 5568 * Since 2.18 5569 * Returns: TRUE if widget is a toplevel, FALSE otherwise 5570 */ 5571 public int isToplevel() 5572 { 5573 // gboolean gtk_widget_is_toplevel (GtkWidget *widget); 5574 return gtk_widget_is_toplevel(gtkWidget); 5575 } 5576 5577 /** 5578 * Sets a widget's window. This function should only be used in a 5579 * widget's GtkWidget::realize() implementation. The window passed is 5580 * usually either new window created with gdk_window_new(), or the 5581 * window of its parent widget as returned by 5582 * gtk_widget_get_parent_window(). 5583 * Widgets must indicate whether they will create their own GdkWindow 5584 * by calling gtk_widget_set_has_window(). This is usually done in the 5585 * widget's init() function. 5586 * Since 2.18 5587 * Params: 5588 * window = a GdkWindow 5589 */ 5590 public void setWindow(Window window) 5591 { 5592 // void gtk_widget_set_window (GtkWidget *widget, GdkWindow *window); 5593 gtk_widget_set_window(gtkWidget, (window is null) ? null : window.getWindowStruct()); 5594 } 5595 5596 /** 5597 * Specifies whether widget will be treated as the default widget 5598 * within its toplevel when it has the focus, even if another widget 5599 * is the default. 5600 * See gtk_widget_grab_default() for details about the meaning of 5601 * "default". 5602 * Since 2.18 5603 * Params: 5604 * receivesDefault = whether or not widget can be a default widget. 5605 */ 5606 public void setReceivesDefault(int receivesDefault) 5607 { 5608 // void gtk_widget_set_receives_default (GtkWidget *widget, gboolean receives_default); 5609 gtk_widget_set_receives_default(gtkWidget, receivesDefault); 5610 } 5611 5612 /** 5613 * Determines whether widget is alyways treated as default widget 5614 * withing its toplevel when it has the focus, even if another widget 5615 * is the default. 5616 * See gtk_widget_set_receives_default(). 5617 * Since 2.18 5618 * Returns: TRUE if widget acts as default widget when focussed, FALSE otherwise 5619 */ 5620 public int getReceivesDefault() 5621 { 5622 // gboolean gtk_widget_get_receives_default (GtkWidget *widget); 5623 return gtk_widget_get_receives_default(gtkWidget); 5624 } 5625 5626 /** 5627 * Marks the widget as being realized. 5628 * This function should only ever be called in a derived widget's 5629 * "realize" or "unrealize" implementation. 5630 * Since 2.20 5631 * Params: 5632 * realized = TRUE to mark the widget as realized 5633 */ 5634 public void setRealized(int realized) 5635 { 5636 // void gtk_widget_set_realized (GtkWidget *widget, gboolean realized); 5637 gtk_widget_set_realized(gtkWidget, realized); 5638 } 5639 5640 /** 5641 * Determines whether widget is realized. 5642 * Since 2.20 5643 * Returns: TRUE if widget is realized, FALSE otherwise 5644 */ 5645 public int getRealized() 5646 { 5647 // gboolean gtk_widget_get_realized (GtkWidget *widget); 5648 return gtk_widget_get_realized(gtkWidget); 5649 } 5650 5651 /** 5652 * Marks the widget as being realized. 5653 * This function should only ever be called in a derived widget's 5654 * "map" or "unmap" implementation. 5655 * Since 2.20 5656 * Params: 5657 * mapped = TRUE to mark the widget as mapped 5658 */ 5659 public void setMapped(int mapped) 5660 { 5661 // void gtk_widget_set_mapped (GtkWidget *widget, gboolean mapped); 5662 gtk_widget_set_mapped(gtkWidget, mapped); 5663 } 5664 5665 /** 5666 * Whether the widget is mapped. 5667 * Since 2.20 5668 * Returns: TRUE if the widget is mapped, FALSE otherwise. 5669 */ 5670 public int getMapped() 5671 { 5672 // gboolean gtk_widget_get_mapped (GtkWidget *widget); 5673 return gtk_widget_get_mapped(gtkWidget); 5674 } 5675 5676 /** 5677 * Retrieves the widget's requisition. 5678 * This function should only be used by widget implementations in 5679 * order to figure whether the widget's requisition has actually 5680 * changed after some internal state change (so that they can call 5681 * gtk_widget_queue_resize() instead of gtk_widget_queue_draw()). 5682 * Normally, gtk_widget_size_request() should be used. 5683 * Since 2.20 5684 * Params: 5685 * requisition = a pointer to a GtkRequisition to copy to. [out] 5686 */ 5687 public void getRequisition(out GtkRequisition requisition) 5688 { 5689 // void gtk_widget_get_requisition (GtkWidget *widget, GtkRequisition *requisition); 5690 gtk_widget_get_requisition(gtkWidget, &requisition); 5691 } 5692 5693 /** 5694 * Copies a GtkRequisition. 5695 * Params: 5696 * requisition = a GtkRequisition 5697 * Returns: a copy of requisition 5698 */ 5699 public static GtkRequisition* requisitionCopy(GtkRequisition* requisition) 5700 { 5701 // GtkRequisition * gtk_requisition_copy (const GtkRequisition *requisition); 5702 return gtk_requisition_copy(requisition); 5703 } 5704 5705 /** 5706 * Frees a GtkRequisition. 5707 * Params: 5708 * requisition = a GtkRequisition 5709 */ 5710 public static void requisitionFree(GtkRequisition* requisition) 5711 { 5712 // void gtk_requisition_free (GtkRequisition *requisition); 5713 gtk_requisition_free(requisition); 5714 } 5715 }