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