1 2@c %start of fragment 3 4@deftp Class <gtk-widget> 5Derives from @code{<atk-implementor-iface>}, @code{<gtk-buildable>}, 6@code{<gtk-object>}. 7 8This class defines the following slots: 9 10@table @code 11@item name 12The name of the widget 13 14@item parent 15The parent widget of this widget. Must be a Container widget 16 17@item width-request 18Override for width request of the widget, or -1 if natural request should be 19used 20 21@item height-request 22Override for height request of the widget, or -1 if natural request should be 23used 24 25@item visible 26Whether the widget is visible 27 28@item sensitive 29Whether the widget responds to input 30 31@item app-paintable 32Whether the application will paint directly on the widget 33 34@item can-focus 35Whether the widget can accept the input focus 36 37@item has-focus 38Whether the widget has the input focus 39 40@item is-focus 41Whether the widget is the focus widget within the toplevel 42 43@item can-default 44Whether the widget can be the default widget 45 46@item has-default 47Whether the widget is the default widget 48 49@item receives-default 50If TRUE, the widget will receive the default action when it is focused 51 52@item composite-child 53Whether the widget is part of a composite widget 54 55@item style 56The style of the widget, which contains information about how it will look 57(colors etc) 58 59@item events 60The event mask that decides what kind of GdkEvents this widget gets 61 62@item extension-events 63The mask that decides what kind of extension events this widget gets 64 65@item no-show-all 66Whether gtk_widget_show_all() should not affect this widget 67 68@item has-tooltip 69Whether this widget has a tooltip 70 71@item tooltip-markup 72The contents of the tooltip for this widget 73 74@item tooltip-text 75The contents of the tooltip for this widget 76 77@end table 78 79@end deftp 80 81@defop Signal <gtk-widget> composited-changed 82@end defop 83 84@defop Signal <gtk-widget> show 85@end defop 86 87@defop Signal <gtk-widget> hide 88@end defop 89 90@defop Signal <gtk-widget> map 91@end defop 92 93@defop Signal <gtk-widget> unmap 94@end defop 95 96@defop Signal <gtk-widget> realize 97@end defop 98 99@defop Signal <gtk-widget> unrealize 100@end defop 101 102@defop Signal <gtk-widget> size-request (arg0@tie{}@code{<gtk-requisition>}) 103@end defop 104 105@defop Signal <gtk-widget> size-allocate (arg0@tie{}@code{<gdk-rectangle>}) 106@end defop 107 108@defop Signal <gtk-widget> state-changed (arg0@tie{}@code{<gtk-state-type>}) 109@end defop 110 111@defop Signal <gtk-widget> parent-set (arg0@tie{}@code{<gtk-widget>}) 112The parent-set signal is emitted when a new parent has been set on a widget. 113 114@end defop 115 116@defop Signal <gtk-widget> hierarchy-changed (arg0@tie{}@code{<gtk-widget>}) 117Emitted when there is a chance in the hierarchy to which a widget belong. More 118precisely, a widget is @dfn{anchored} when its toplevel ancestor is a 119@code{<gtk-window>}. This signal is emitted when a widget changes from 120un-anchored to anchored or vice-versa. 121 122@end defop 123 124@defop Signal <gtk-widget> style-set (arg0@tie{}@code{<gtk-style>}) 125The style-set signal is emitted when a new style has been set on a widget. Note 126that style-modifying functions like @code{gtk-widget-modify-base} also cause 127this signal to be emitted. 128 129@end defop 130 131@defop Signal <gtk-widget> direction-changed (arg0@tie{}@code{<gtk-text-direction>}) 132@end defop 133 134@defop Signal <gtk-widget> grab-notify (arg0@tie{}@code{<gboolean>}) 135The ::grab-notify signal is emitted when a widget becomes shadowed by a GTK+ 136grab (not a pointer or keyboard grab) on another widget, or when it becomes 137unshadowed due to a grab being removed. 138 139A widget is shadowed by a @code{gtk-grab-add} when the topmost grab widget in 140the grab stack of its window group is not its ancestor. 141 142@end defop 143 144@defop Signal <gtk-widget> child-notify (arg0@tie{}@code{<gparam>}) 145The ::child-notify signal is emitted for each child property that has changed on 146an object. The signal's detail holds the property name. 147 148@end defop 149 150@defop Signal <gtk-widget> mnemonic-activate (arg0@tie{}@code{<gboolean>}) @result{}@tie{}@code{<gboolean>} 151@end defop 152 153@defop Signal <gtk-widget> grab-focus 154@end defop 155 156@defop Signal <gtk-widget> focus (arg0@tie{}@code{<gtk-direction-type>}) @result{}@tie{}@code{<gboolean>} 157@end defop 158 159@defop Signal <gtk-widget> move-focus (arg0@tie{}@code{<gtk-direction-type>}) 160undocumented 161@end defop 162 163@defop Signal <gtk-widget> event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 164@end defop 165 166@defop Signal <gtk-widget> event-after (arg0@tie{}@code{<gdk-event>}) 167@end defop 168 169@defop Signal <gtk-widget> button-press-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 170@end defop 171 172@defop Signal <gtk-widget> button-release-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 173@end defop 174 175@defop Signal <gtk-widget> scroll-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 176@end defop 177 178@defop Signal <gtk-widget> motion-notify-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 179@end defop 180 181@defop Signal <gtk-widget> keynav-failed (arg0@tie{}@code{<gtk-direction-type>}) @result{}@tie{}@code{<gboolean>} 182undocumented 183@end defop 184 185@defop Signal <gtk-widget> delete-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 186The ::delete-event signal is emitted if a user requests that a toplevel window 187is closed. The default handler for this signal destroys the window. Connecting 188@code{gtk-widget-hide-on-delete} to this signal will cause the window to be 189hidden instead, so that it can later be shown again without reconstructing it. 190 191@end defop 192 193@defop Signal <gtk-widget> destroy-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 194The ::destroy-event signal is emitted when a @code{<gdk-window>} is destroyed. 195You rarely get this signal, because most widgets disconnect themselves from 196their window before they destroy it, so no widget owns the window at destroy 197time. 198 199@end defop 200 201@defop Signal <gtk-widget> expose-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 202@end defop 203 204@defop Signal <gtk-widget> key-press-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 205@end defop 206 207@defop Signal <gtk-widget> key-release-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 208@end defop 209 210@defop Signal <gtk-widget> enter-notify-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 211@end defop 212 213@defop Signal <gtk-widget> leave-notify-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 214@end defop 215 216@defop Signal <gtk-widget> configure-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 217@end defop 218 219@defop Signal <gtk-widget> focus-in-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 220@end defop 221 222@defop Signal <gtk-widget> focus-out-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 223@end defop 224 225@defop Signal <gtk-widget> map-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 226@end defop 227 228@defop Signal <gtk-widget> unmap-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 229@end defop 230 231@defop Signal <gtk-widget> property-notify-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 232@end defop 233 234@defop Signal <gtk-widget> selection-clear-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 235@end defop 236 237@defop Signal <gtk-widget> selection-request-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 238@end defop 239 240@defop Signal <gtk-widget> selection-notify-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 241@end defop 242 243@defop Signal <gtk-widget> selection-received (arg0@tie{}@code{<gtk-selection-data>}) (arg1@tie{}@code{<guint>}) 244@end defop 245 246@defop Signal <gtk-widget> selection-get (arg0@tie{}@code{<gtk-selection-data>}) (arg1@tie{}@code{<guint>}) (arg2@tie{}@code{<guint>}) 247@end defop 248 249@defop Signal <gtk-widget> proximity-in-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 250@end defop 251 252@defop Signal <gtk-widget> proximity-out-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 253@end defop 254 255@defop Signal <gtk-widget> drag-leave (arg0@tie{}@code{<gdk-drag-context>}) (arg1@tie{}@code{<guint>}) 256The ::drag-leave signal is emitted on the drop site when the cursor leaves the 257widget. A typical reason to connect to this signal is to undo things done in 258::drag-motion, e.g. undo highlighting with @code{gtk-drag-unhighlight} 259 260@end defop 261 262@defop Signal <gtk-widget> drag-begin (arg0@tie{}@code{<gdk-drag-context>}) 263The ::drag-begin signal is emitted on the drag source when a drag is started. A 264typical reason to connect to this signal is to set up a custom drag icon with 265@code{gtk-drag-source-set-icon}. 266 267@end defop 268 269@defop Signal <gtk-widget> drag-end (arg0@tie{}@code{<gdk-drag-context>}) 270The ::drag-end signal is emitted on the drag source when a drag is finished. A 271typical reason to connect to this signal is to undo things done in ::drag-begin. 272 273@end defop 274 275@defop Signal <gtk-widget> drag-data-delete (arg0@tie{}@code{<gdk-drag-context>}) 276The ::drag-data-delete signal is emitted on the drag source when a drag with the 277action @samp{GDK_ACTION_MOVE} is successfully completed. The signal handler is 278responsible for deleting the data that has been dropped. What "delete" means, 279depends on the context of the drag operation. 280 281@end defop 282 283@defop Signal <gtk-widget> drag-failed (arg0@tie{}@code{<gdk-drag-context>}) (arg1@tie{}@code{<gtk-drag-result>}) @result{}@tie{}@code{<gboolean>} 284undocumented 285@end defop 286 287@defop Signal <gtk-widget> drag-motion (arg0@tie{}@code{<gdk-drag-context>}) (arg1@tie{}@code{<gint>}) (arg2@tie{}@code{<gint>}) (arg3@tie{}@code{<guint>}) @result{}@tie{}@code{<gboolean>} 288The ::drag-motion signal is emitted on the drop site when the user moves the 289cursor over the widget during a drag. The signal handler must determine whether 290the cursor position is in a drop zone or not. If it is not in a drop zone, it 291returns @samp{@code{#f}} and no further processing is necessary. Otherwise, the 292handler returns @samp{@code{#t}}. In this case, the handler is responsible for 293providing the necessary information for displaying feedback to the user, by 294calling @code{gdk-drag-status}. If the decision whether the drop will be 295accepted or rejected can't be made based solely on the cursor position and the 296type of the data, the handler may inspect the dragged data by calling 297@code{gtk-drag-get-data} and defer the @code{gdk-drag-status} call to the 298::drag-data-received handler. 299 300Note that there is no ::drag-enter signal. The drag receiver has to keep track 301of whether he has received any ::drag-motion signals since the last ::drag-leave 302and if not, treat the ::drag-motion signal as an "enter" signal. Upon an 303"enter", the handler will typically highlight the drop site with 304@code{gtk-drag-highlight}. 305 306@example 307 308static void 309drag_motion (GtkWidget *widget, 310 GdkDragContext *context, 311 gint x, 312 gint y, 313 guint time) 314@{ 315 GdkAtom target; 316 317 PrivateData *private_data = GET_PRIVATE_DATA (widget); 318 319 if (!private_data->drag_highlight) 320 @{ 321 private_data->drag_highlight = 1; 322 gtk_drag_highlight (widget); 323 @} 324 325 target = gtk_drag_dest_find_target (widget, context, NULL); 326 if (target == GDK_NONE) 327 gdk_drag_status (context, 0, time); 328 else 329 @{ 330 private_data->pending_status = context->suggested_action; 331 gtk_drag_get_data (widget, context, target, time); 332 @} 333 334 return TRUE; 335@} 336 337static void 338drag_data_received (GtkWidget *widget, 339 GdkDragContext *context, 340 gint x, 341 gint y, 342 GtkSelectionData *selection_data, 343 guint info, 344 guint time) 345@{ 346 PrivateData *private_data = GET_PRIVATE_DATA (widget); 347 348 if (private_data->suggested_action) 349 @{ 350 private_data->suggested_action = 0; 351 352 /* We are getting this data due to a request in drag_motion, 353 * rather than due to a request in drag_drop, so we are just 354 * supposed to call gdk_drag_status(), not actually paste in 355 * the data. 356 */ 357 str = gtk_selection_data_get_text (selection_data); 358 if (!data_is_acceptable (str)) 359 gdk_drag_status (context, 0, time); 360 else 361 gdk_drag_status (context, private_data->suggested_action, time); 362 @} 363 else 364 @{ 365 /* accept the drop */ 366 @} 367@} 368@end example 369 370@end defop 371 372@defop Signal <gtk-widget> drag-drop (arg0@tie{}@code{<gdk-drag-context>}) (arg1@tie{}@code{<gint>}) (arg2@tie{}@code{<gint>}) (arg3@tie{}@code{<guint>}) @result{}@tie{}@code{<gboolean>} 373The ::drag-drop signal is emitted on the drop site when the user drops the data 374onto the widget. The signal handler must determine whether the cursor position 375is in a drop zone or not. If it is not in a drop zone, it returns 376@samp{@code{#f}} and no further processing is necessary. Otherwise, the handler 377returns @samp{@code{#t}}. In this case, the handler must ensure that 378@code{gtk-drag-finish} is called to let the source know that the drop is done. 379The call to @code{gtk-drag-finish} can be done either directly or in a 380::drag-data-received handler which gets triggered by calling 381@code{gtk-drop-get-data} to receive the data for one or more of the supported 382targets. 383 384@end defop 385 386@defop Signal <gtk-widget> drag-data-get (arg0@tie{}@code{<gdk-drag-context>}) (arg1@tie{}@code{<gtk-selection-data>}) (arg2@tie{}@code{<guint>}) (arg3@tie{}@code{<guint>}) 387The ::drag-data-get signal is emitted on the drag source when the drop site 388requests the data which is dragged. It is the responsibility of the signal 389handler to fill @var{data} with the data in the format which is indicated by 390@var{info}. See @code{gtk-selection-data-set} and 391@code{gtk-selection-data-set-text}. 392 393@end defop 394 395@defop Signal <gtk-widget> drag-data-received (arg0@tie{}@code{<gdk-drag-context>}) (arg1@tie{}@code{<gint>}) (arg2@tie{}@code{<gint>}) (arg3@tie{}@code{<gtk-selection-data>}) (arg4@tie{}@code{<guint>}) (arg5@tie{}@code{<guint>}) 396The ::drag-data-received signal is emitted on the drop site when the dragged 397data has been received. If the data was received in order to determine whether 398the drop will be accepted, the handler is expected to call 399@code{gdk-drag-status} and @emph{not} finish the drag. If the data was received 400in response to a ::drag-drop signal (and this is the last target to be 401received), the handler for this signal is expected to process the received data 402and then call @code{gtk-drag-finish}, setting the @var{success} parameter 403depending on whether the data was processed successfully. 404 405The handler may inspect and modify @var{drag-context->action} before calling 406@code{gtk-drag-finish}, e.g. to implement @samp{GDK_ACTION_ASK} as shown in the 407following example: 408 409@example 410 411void 412drag_data_received (GtkWidget *widget, 413 GdkDragContext *drag_context, 414 gint x, 415 gint y, 416 GtkSelectionData *data, 417 guint info, 418 guint time) 419@{ 420 if ((data->length >= 0) && (data->format == 8)) 421 @{ 422 if (drag_context->action == GDK_ACTION_ASK) 423 @{ 424 GtkWidget *dialog; 425 gint response; 426 427 dialog = gtk_message_dialog_new (NULL, 428 GTK_DIALOG_MODAL | 429 GTK_DIALOG_DESTROY_WITH_PARENT, 430 GTK_MESSAGE_INFO, 431 GTK_BUTTONS_YES_NO, 432 "Move the data ?\n"); 433 response = gtk_dialog_run (GTK_DIALOG (dialog)); 434 gtk_widget_destroy (dialog); 435 436 if (response == GTK_RESPONSE_YES) 437 drag_context->action = GDK_ACTION_MOVE; 438 else 439 drag_context->action = GDK_ACTION_COPY; 440 @} 441 442 gtk_drag_finish (drag_context, TRUE, FALSE, time); 443 return; 444 @} 445 446 gtk_drag_finish (drag_context, FALSE, FALSE, time); 447 @} 448@end example 449 450@end defop 451 452@defop Signal <gtk-widget> visibility-notify-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 453@end defop 454 455@defop Signal <gtk-widget> client-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 456@end defop 457 458@defop Signal <gtk-widget> no-expose-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 459@end defop 460 461@defop Signal <gtk-widget> window-state-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 462@end defop 463 464@defop Signal <gtk-widget> grab-broken-event (arg0@tie{}@code{<gdk-event>}) @result{}@tie{}@code{<gboolean>} 465Emitted when a pointer or keyboard grab on a window belonging to @var{widget} 466gets broken. 467 468On X11, this happens when the grab window becomes unviewable (i.e. it or one of 469its ancestors is unmapped), or if the same application grabs the pointer or 470keyboard again. 471 472Since 2.8 473 474@end defop 475 476@defop Signal <gtk-widget> query-tooltip (arg0@tie{}@code{<gint>}) (arg1@tie{}@code{<gint>}) (arg2@tie{}@code{<gboolean>}) (arg3@tie{}@code{<gtk-tooltip>}) @result{}@tie{}@code{<gboolean>} 477undocumented 478@end defop 479 480@defop Signal <gtk-widget> popup-menu @result{}@tie{}@code{<gboolean>} 481This signal gets emitted whenever a widget should pop up a context-sensitive 482menu. This usually happens through the standard key binding mechanism; by 483pressing a certain key while a widget is focused, the user can cause the widget 484to pop up a menu. For example, the @code{<gtk-entry>} widget creates a menu with 485clipboard commands. See @emph{(the missing figure, checklist-popup-menu} for an 486example of how to use this signal. 487 488@end defop 489 490@defop Signal <gtk-widget> show-help (arg0@tie{}@code{<gtk-widget-help-type>}) @result{}@tie{}@code{<gboolean>} 491@end defop 492 493@defop Signal <gtk-widget> accel-closures-changed 494@end defop 495 496@defop Signal <gtk-widget> screen-changed (arg0@tie{}@code{<gdk-screen>}) 497@end defop 498 499@defop Signal <gtk-widget> can-activate-accel (arg0@tie{}@code{<guint>}) @result{}@tie{}@code{<gboolean>} 500Determines whether an accelerator that activates the signal identified by 501@var{signal-id} can currently be activated. This signal is present to allow 502applications and derived widgets to override the default @code{<gtk-widget>} 503handling for determining whether an accelerator can be activated. 504 505@end defop 506 507@deftp Class <gtk-requisition> 508Derives from @code{<gboxed>}. 509 510This class defines no direct slots. 511 512@end deftp 513 514@deftp Class <gtk-selection-data> 515Derives from @code{<gboxed>}. 516 517This class defines no direct slots. 518 519@end deftp 520 521@deffn Function gtk-widget-destroy (self@tie{}@code{<gtk-widget>}) 522@deffnx Method destroy 523Destroys a widget. Equivalent to @code{gtk-object-destroy}, except that you 524don't have to cast the widget to @code{<gtk-object>}. When a widget is 525destroyed, it will break any references it holds to other objects. If the widget 526is inside a container, the widget will be removed from the container. If the 527widget is a toplevel (derived from @code{<gtk-window>}), it will be removed from 528the list of toplevels, and the reference GTK+ holds to it will be removed. 529Removing a widget from its container or the list of toplevels results in the 530widget being finalized, unless you've added additional references to the widget 531with @code{g-object-ref}. 532 533In most cases, only toplevel widgets (windows) require explicit destruction, 534because when you destroy a toplevel its children will be destroyed as well. 535 536@table @var 537@item widget 538a @code{<gtk-widget>} 539 540@end table 541 542@end deffn 543 544@deffn Function gtk-widget-unparent (self@tie{}@code{<gtk-widget>}) 545@deffnx Method unparent 546This function is only for use in widget implementations. Should be called by 547implementations of the remove method on @code{<gtk-container>}, to dissociate a 548child from the container. 549 550@table @var 551@item widget 552a @code{<gtk-widget>} 553 554@end table 555 556@end deffn 557 558@deffn Function gtk-widget-show (self@tie{}@code{<gtk-widget>}) 559@deffnx Method show 560Flags a widget to be displayed. Any widget that isn't shown will not appear on 561the screen. If you want to show all the widgets in a container, it's easier to 562call @code{gtk-widget-show-all} on the container, instead of individually 563showing the widgets. 564 565Remember that you have to show the containers containing a widget, in addition 566to the widget itself, before it will appear onscreen. 567 568When a toplevel container is shown, it is immediately realized and mapped; other 569shown widgets are realized and mapped when their toplevel container is realized 570and mapped. 571 572@table @var 573@item widget 574a @code{<gtk-widget>} 575 576@end table 577 578@end deffn 579 580@deffn Function gtk-widget-show-now (self@tie{}@code{<gtk-widget>}) 581@deffnx Method show-now 582Shows a widget. If the widget is an unmapped toplevel widget (i.e. a 583@code{<gtk-window>} that has not yet been shown), enter the main loop and wait 584for the window to actually be mapped. Be careful; because the main loop is 585running, anything can happen during this function. 586 587@table @var 588@item widget 589a @code{<gtk-widget>} 590 591@end table 592 593@end deffn 594 595@deffn Function gtk-widget-hide (self@tie{}@code{<gtk-widget>}) 596@deffnx Method hide 597Reverses the effects of @code{gtk-widget-show}, causing the widget to be hidden 598(invisible to the user). 599 600@table @var 601@item widget 602a @code{<gtk-widget>} 603 604@end table 605 606@end deffn 607 608@deffn Function gtk-widget-show-all (self@tie{}@code{<gtk-widget>}) 609@deffnx Method show-all 610Recursively shows a widget, and any child widgets (if the widget is a 611container). 612 613@table @var 614@item widget 615a @code{<gtk-widget>} 616 617@end table 618 619@end deffn 620 621@deffn Function gtk-widget-hide-all (self@tie{}@code{<gtk-widget>}) 622@deffnx Method hide-all 623Recursively hides a widget and any child widgets. 624 625@table @var 626@item widget 627a @code{<gtk-widget>} 628 629@end table 630 631@end deffn 632 633@deffn Function gtk-widget-map (self@tie{}@code{<gtk-widget>}) 634@deffnx Method map 635This function is only for use in widget implementations. Causes a widget to be 636mapped if it isn't already. 637 638@table @var 639@item widget 640a @code{<gtk-widget>} 641 642@end table 643 644@end deffn 645 646@deffn Function gtk-widget-unmap (self@tie{}@code{<gtk-widget>}) 647@deffnx Method unmap 648This function is only for use in widget implementations. Causes a widget to be 649unmapped if it's currently mapped. 650 651@table @var 652@item widget 653a @code{<gtk-widget>} 654 655@end table 656 657@end deffn 658 659@deffn Function gtk-widget-realize (self@tie{}@code{<gtk-widget>}) 660@deffnx Method realize 661Creates the GDK (windowing system) resources associated with a widget. For 662example, @var{widget->window} will be created when a widget is realized. 663Normally realization happens implicitly; if you show a widget and all its parent 664containers, then the widget will be realized and mapped automatically. 665 666Realizing a widget requires all the widget's parent widgets to be realized; 667calling @code{gtk-widget-realize} realizes the widget's parents in addition to 668@var{widget} itself. If a widget is not yet inside a toplevel window when you 669realize it, bad things will happen. 670 671This function is primarily used in widget implementations, and isn't very useful 672otherwise. Many times when you think you might need it, a better approach is to 673connect to a signal that will be called after the widget is realized 674automatically, such as "expose_event". Or simply @code{g-signal-connect-after} 675to the "realize" signal. 676 677@table @var 678@item widget 679a @code{<gtk-widget>} 680 681@end table 682 683@end deffn 684 685@deffn Function gtk-widget-unrealize (self@tie{}@code{<gtk-widget>}) 686@deffnx Method unrealize 687This function is only useful in widget implementations. Causes a widget to be 688unrealized (frees all GDK resources associated with the widget, such as 689@var{widget->window}). 690 691@table @var 692@item widget 693a @code{<gtk-widget>} 694 695@end table 696 697@end deffn 698 699@deffn Function gtk-widget-queue-draw (self@tie{}@code{<gtk-widget>}) 700@deffnx Method queue-draw 701Equivalent to calling @code{gtk-widget-queue-draw-area} for the entire area of a 702widget. 703 704@table @var 705@item widget 706a @code{<gtk-widget>} 707 708@end table 709 710@end deffn 711 712@deffn Function gtk-widget-queue-resize (self@tie{}@code{<gtk-widget>}) 713@deffnx Method queue-resize 714This function is only for use in widget implementations. Flags a widget to have 715its size renegotiated; should be called when a widget for some reason has a new 716size request. For example, when you change the text in a @code{<gtk-label>}, 717@code{<gtk-label>} queues a resize to ensure there's enough space for the new 718text. 719 720@table @var 721@item widget 722a @code{<gtk-widget>} 723 724@end table 725 726@end deffn 727 728@deffn Function gtk-widget-queue-resize-no-redraw (self@tie{}@code{<gtk-widget>}) 729@deffnx Method queue-resize-no-redraw 730This function works like @code{gtk-widget-queue-resize}, except that the widget 731is not invalidated. 732 733@table @var 734@item widget 735a @code{<gtk-widget>} 736 737@end table 738 739Since 2.4 740 741@end deffn 742 743@deffn Function gtk-widget-size-request (self@tie{}@code{<gtk-widget>}) (requisition@tie{}@code{<gtk-requisition>}) 744@deffnx Method size-request 745This function is typically used when implementing a @code{<gtk-container>} 746subclass. Obtains the preferred size of a widget. The container uses this 747information to arrange its child widgets and decide what size allocations to 748give them with @code{gtk-widget-size-allocate}. 749 750You can also call this function from an application, with some caveats. Most 751notably, getting a size request requires the widget to be associated with a 752screen, because font information may be needed. Multihead-aware applications 753should keep this in mind. 754 755Also remember that the size request is not necessarily the size a widget will 756actually be allocated. 757 758See also @code{gtk-widget-get-child-requisition}. 759 760@table @var 761@item widget 762a @code{<gtk-widget>} 763 764@item requisition 765a @code{<gtk-requisition>} to be filled in 766 767@end table 768 769@end deffn 770 771@deffn Function gtk-widget-get-child-requisition (self@tie{}@code{<gtk-widget>}) (requisition@tie{}@code{<gtk-requisition>}) 772@deffnx Method get-child-requisition 773This function is only for use in widget implementations. Obtains 774@var{widget->requisition}, unless someone has forced a particular geometry on 775the widget (e.g. with @code{gtk-widget-set-usize}), in which case it returns 776that geometry instead of the widget's requisition. 777 778This function differs from @code{gtk-widget-size-request} in that it retrieves 779the last size request value from @var{widget->requisition}, while 780@code{gtk-widget-size-request} actually calls the "size_request" method on 781@var{widget} to compute the size request and fill in @var{widget->requisition}, 782and only then returns @var{widget->requisition}. 783 784Because this function does not call the "size_request" method, it can only be 785used when you know that @var{widget->requisition} is up-to-date, that is, 786@code{gtk-widget-size-request} has been called since the last time a resize was 787queued. In general, only container implementations have this information; 788applications should use @code{gtk-widget-size-request}. 789 790@table @var 791@item widget 792a @code{<gtk-widget>} 793 794@item requisition 795a @code{<gtk-requisition>} to be filled in 796 797@end table 798 799@end deffn 800 801@deffn Function gtk-widget-size-allocate (self@tie{}@code{<gtk-widget>}) (allocation@tie{}@code{<gdk-rectangle>}) 802@deffnx Method size-allocate 803This function is only used by @code{<gtk-container>} subclasses, to assign a 804size and position to their child widgets. 805 806@table @var 807@item widget 808a @code{<gtk-widget>} 809 810@item allocation 811position and size to be allocated to @var{widget} 812 813@end table 814 815@end deffn 816 817@deffn Function gtk-widget-add-accelerator (self@tie{}@code{<gtk-widget>}) (accel_signal@tie{}@code{mchars}) (accel_group@tie{}@code{<gtk-accel-group>}) (accel_key@tie{}@code{unsigned-int}) (accel_mods@tie{}@code{<gdk-modifier-type>}) (accel_flags@tie{}@code{<gtk-accel-flags>}) 818@deffnx Method add-accelerator 819Installs an accelerator for this @var{widget} in @var{accel-group} that causes 820@var{accel-signal} to be emitted if the accelerator is activated. The 821@var{accel-group} needs to be added to the widget's toplevel via 822@code{gtk-window-add-accel-group}, and the signal must be of type 823@samp{G_RUN_ACTION}. Accelerators added through this function are not user 824changeable during runtime. If you want to support accelerators that can be 825changed by the user, use @code{gtk-accel-map-add-entry} and 826@code{gtk-widget-set-accel-path} or @code{gtk-menu-item-set-accel-path} instead. 827 828@table @var 829@item widget 830widget to install an accelerator on 831 832@item accel-signal 833widget signal to emit on accelerator activation 834 835@item accel-group 836accel group for this widget, added to its toplevel 837 838@item accel-key 839GDK keyval of the accelerator 840 841@item accel-mods 842modifier key combination of the accelerator 843 844@item accel-flags 845flag accelerators, e.g. @samp{GTK_ACCEL_VISIBLE} 846 847@end table 848 849@end deffn 850 851@deffn Function gtk-widget-remove-accelerator (self@tie{}@code{<gtk-widget>}) (accel_group@tie{}@code{<gtk-accel-group>}) (accel_key@tie{}@code{unsigned-int}) (accel_mods@tie{}@code{<gdk-modifier-type>}) @result{}@tie{} (ret@tie{}@code{bool}) 852@deffnx Method remove-accelerator 853Removes an accelerator from @var{widget}, previously installed with 854@code{gtk-widget-add-accelerator}. 855 856@table @var 857@item widget 858widget to install an accelerator on 859 860@item accel-group 861accel group for this widget 862 863@item accel-key 864GDK keyval of the accelerator 865 866@item accel-mods 867modifier key combination of the accelerator 868 869@item ret 870whether an accelerator was installed and could be removed 871 872@end table 873 874@end deffn 875 876@deffn Function gtk-widget-set-accel-path (self@tie{}@code{<gtk-widget>}) (accel_path@tie{}@code{mchars}) (accel_group@tie{}@code{<gtk-accel-group>}) 877@deffnx Method set-accel-path 878Given an accelerator group, @var{accel-group}, and an accelerator path, 879@var{accel-path}, sets up an accelerator in @var{accel-group} so whenever the 880key binding that is defined for @var{accel-path} is pressed, @var{widget} will 881be activated. This removes any accelerators (for any accelerator group) 882installed by previous calls to @code{gtk-widget-set-accel-path}. Associating 883accelerators with paths allows them to be modified by the user and the 884modifications to be saved for future use. (See @code{gtk-accel-map-save}.) 885 886This function is a low level function that would most likely be used by a menu 887creation system like @code{<gtk-item-factory>}. If you use 888@code{<gtk-item-factory>}, setting up accelerator paths will be done 889automatically. 890 891Even when you you aren't using @code{<gtk-item-factory>}, if you only want to 892set up accelerators on menu items @code{gtk-menu-item-set-accel-path} provides a 893somewhat more convenient interface. 894 895@table @var 896@item widget 897a @code{<gtk-widget>} 898 899@item accel-path 900path used to look up the accelerator 901 902@item accel-group 903a @code{<gtk-accel-group>}. 904 905@end table 906 907@end deffn 908 909@deffn Function gtk-widget-list-accel-closures (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{glist-of}) 910@deffnx Method list-accel-closures 911Lists the closures used by @var{widget} for accelerator group connections with 912@code{gtk-accel-group-connect-by-path} or @code{gtk-accel-group-connect}. The 913closures can be used to monitor accelerator changes on @var{widget}, by 914connecting to the ::accel_changed signal of the @code{<gtk-accel-group>} of a 915closure which can be found out with @code{gtk-accel-group-from-accel-closure}. 916 917@table @var 918@item widget 919widget to list accelerator closures for 920 921@item ret 922a newly allocated @code{<g-list>} of closures 923 924@end table 925 926@end deffn 927 928@deffn Function gtk-widget-can-activate-accel (self@tie{}@code{<gtk-widget>}) (signal_id@tie{}@code{unsigned-int}) @result{}@tie{} (ret@tie{}@code{bool}) 929@deffnx Method can-activate-accel 930Determines whether an accelerator that activates the signal identified by 931@var{signal-id} can currently be activated. This is done by emitting the 932GtkWidget::can-activate-accel signal on @var{widget}; if the signal isn't 933overridden by a handler or in a derived widget, then the default check is that 934the widget must be sensitive, and the widget and all its ancestors mapped. 935 936@table @var 937@item widget 938a @code{<gtk-widget>} 939 940@item signal-id 941the ID of a signal installed on @var{widget} 942 943@item ret 944@samp{@code{#t}} if the accelerator can be activated. 945 946@end table 947 948Since 2.4 949 950@end deffn 951 952@deffn Function gtk-widget-event (self@tie{}@code{<gtk-widget>}) (event@tie{}@code{<gdk-event>}) @result{}@tie{} (ret@tie{}@code{bool}) 953@deffnx Method event 954Rarely-used function. This function is used to emit the event signals on a 955widget (those signals should never be emitted without using this function to do 956so). If you want to synthesize an event though, don't use this function; 957instead, use @code{gtk-main-do-event} so the event will behave as if it were in 958the event queue. Don't synthesize expose events; instead, use 959@code{gdk-window-invalidate-rect} to invalidate a region of the window. 960 961@table @var 962@item widget 963a @code{<gtk-widget>} 964 965@item event 966a @code{<gdk-event>} 967 968@item ret 969return from the event signal emission (@samp{@code{#t}} if the event was 970handled) 971 972@end table 973 974@end deffn 975 976@deffn Function gtk-widget-activate (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 977@deffnx Method activate 978For widgets that can be "activated" (buttons, menu items, etc.) this function 979activates them. Activation is what happens when you press Enter on a widget 980during key navigation. If @var{widget} isn't activatable, the function returns 981@samp{@code{#f}}. 982 983@table @var 984@item widget 985a @code{<gtk-widget>} that's activatable 986 987@item ret 988@samp{@code{#t}} if the widget was activatable 989 990@end table 991 992@end deffn 993 994@deffn Function gtk-widget-reparent (self@tie{}@code{<gtk-widget>}) (new_parent@tie{}@code{<gtk-widget>}) 995@deffnx Method reparent 996Moves a widget from one @code{<gtk-container>} to another, handling reference 997count issues to avoid destroying the widget. 998 999@table @var 1000@item widget 1001a @code{<gtk-widget>} 1002 1003@item new-parent 1004a @code{<gtk-container>} to move the widget into 1005 1006@end table 1007 1008@end deffn 1009 1010@deffn Function gtk-widget-is-focus (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 1011@deffnx Method is-focus 1012Determines if the widget is the focus widget within its toplevel. (This does not 1013mean that the @samp{HAS_FOCUS} flag is necessarily set; @samp{HAS_FOCUS} will 1014only be set if the toplevel widget additionally has the global input focus.) 1015 1016@table @var 1017@item widget 1018a @code{<gtk-widget>} 1019 1020@item ret 1021@samp{@code{#t}} if the widget is the focus widget. 1022 1023@end table 1024 1025@end deffn 1026 1027@deffn Function gtk-widget-grab-focus (self@tie{}@code{<gtk-widget>}) 1028@deffnx Method grab-focus 1029Causes @var{widget} to have the keyboard focus for the @code{<gtk-window>} it's 1030inside. @var{widget} must be a focusable widget, such as a @code{<gtk-entry>}; 1031something like @code{<gtk-frame>} won't work. (More precisely, it must have the 1032@samp{GTK_CAN_FOCUS} flag set.) 1033 1034@table @var 1035@item widget 1036a @code{<gtk-widget>} 1037 1038@end table 1039 1040@end deffn 1041 1042@deffn Function gtk-widget-grab-default (self@tie{}@code{<gtk-widget>}) 1043@deffnx Method grab-default 1044Causes @var{widget} to become the default widget. @var{widget} must have the 1045@samp{GTK_CAN_DEFAULT} flag set; typically you have to set this flag yourself by 1046calling @samp{GTK_WIDGET_SET_FLAGS (@var{widget}, GTK_CAN_DEFAULT)}. The default 1047widget is activated when the user presses Enter in a window. Default widgets 1048must be activatable, that is, @code{gtk-widget-activate} should affect them. 1049 1050@table @var 1051@item widget 1052a @code{<gtk-widget>} 1053 1054@end table 1055 1056@end deffn 1057 1058@deffn Function gtk-widget-set-name (self@tie{}@code{<gtk-widget>}) (name@tie{}@code{mchars}) 1059@deffnx Method set-name 1060Widgets can be named, which allows you to refer to them from a gtkrc file. You 1061can apply a style to widgets with a particular name in the gtkrc file. See the 1062documentation for gtkrc files (on the same page as the docs for 1063@code{<gtk-rc-style>}). 1064 1065Note that widget names are separated by periods in paths (see 1066@code{gtk-widget-path}), so names with embedded periods may cause confusion. 1067 1068@table @var 1069@item widget 1070a @code{<gtk-widget>} 1071 1072@item name 1073name for the widget 1074 1075@end table 1076 1077@end deffn 1078 1079@deffn Function gtk-widget-get-name (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{mchars}) 1080@deffnx Method get-name 1081Retrieves the name of a widget. See @code{gtk-widget-set-name} for the 1082significance of widget names. 1083 1084@table @var 1085@item widget 1086a @code{<gtk-widget>} 1087 1088@item ret 1089name of the widget. This string is owned by GTK+ and should not be modified or 1090freed 1091 1092@end table 1093 1094@end deffn 1095 1096@deffn Function gtk-widget-set-state (self@tie{}@code{<gtk-widget>}) (state@tie{}@code{<gtk-state-type>}) 1097@deffnx Method set-state 1098This function is for use in widget implementations. Sets the state of a widget 1099(insensitive, prelighted, etc.) Usually you should set the state using wrapper 1100functions such as @code{gtk-widget-set-sensitive}. 1101 1102@table @var 1103@item widget 1104a @code{<gtk-widget>} 1105 1106@item state 1107new state for @var{widget} 1108 1109@end table 1110 1111@end deffn 1112 1113@deffn Function gtk-widget-set-sensitive (self@tie{}@code{<gtk-widget>}) (sensitive@tie{}@code{bool}) 1114@deffnx Method set-sensitive 1115Sets the sensitivity of a widget. A widget is sensitive if the user can interact 1116with it. Insensitive widgets are "grayed out" and the user can't interact with 1117them. Insensitive widgets are known as "inactive", "disabled", or "ghosted" in 1118some other toolkits. 1119 1120@table @var 1121@item widget 1122a @code{<gtk-widget>} 1123 1124@item sensitive 1125@samp{@code{#t}} to make the widget sensitive 1126 1127@end table 1128 1129@end deffn 1130 1131@deffn Function gtk-widget-set-parent (self@tie{}@code{<gtk-widget>}) (parent@tie{}@code{<gtk-widget>}) 1132@deffnx Method set-parent 1133This function is useful only when implementing subclasses of 1134@code{<gtk-container>}. Sets the container as the parent of @var{widget}, and 1135takes care of some details such as updating the state and style of the child to 1136reflect its new location. The opposite function is @code{gtk-widget-unparent}. 1137 1138@table @var 1139@item widget 1140a @code{<gtk-widget>} 1141 1142@item parent 1143parent container 1144 1145@end table 1146 1147@end deffn 1148 1149@deffn Function gtk-widget-set-parent-window (self@tie{}@code{<gtk-widget>}) (parent_window@tie{}@code{<gdk-window>}) 1150@deffnx Method set-parent-window 1151Sets a non default parent window for @var{widget}. 1152 1153@table @var 1154@item widget 1155a @code{<gtk-widget>}. 1156 1157@item parent-window 1158the new parent window. 1159 1160@end table 1161 1162@end deffn 1163 1164@deffn Function gtk-widget-get-parent-window (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gdk-window>}) 1165@deffnx Method get-parent-window 1166Gets @var{widget}'s parent window. 1167 1168@table @var 1169@item widget 1170a @code{<gtk-widget>}. 1171 1172@item ret 1173the parent window of @var{widget}. 1174 1175@end table 1176 1177@end deffn 1178 1179@deffn Function gtk-widget-set-events (self@tie{}@code{<gtk-widget>}) (events@tie{}@code{<gdk-event-mask>}) 1180@deffnx Method set-events 1181Sets the event mask (see @code{<gdk-event-mask>}) for a widget. The event mask 1182determines which events a widget will receive. Keep in mind that different 1183widgets have different default event masks, and by changing the event mask you 1184may disrupt a widget's functionality, so be careful. This function must be 1185called while a widget is unrealized. Consider @code{gtk-widget-add-events} for 1186widgets that are already realized, or if you want to preserve the existing event 1187mask. This function can't be used with @code{<gtk-no-window>} widgets; to get 1188events on those widgets, place them inside a @code{<gtk-event-box>} and receive 1189events on the event box. 1190 1191@table @var 1192@item widget 1193a @code{<gtk-widget>} 1194 1195@item events 1196event mask 1197 1198@end table 1199 1200@end deffn 1201 1202@deffn Function gtk-widget-add-events (self@tie{}@code{<gtk-widget>}) (events@tie{}@code{<gdk-event-mask>}) 1203@deffnx Method add-events 1204Adds the events in the bitfield @var{events} to the event mask for @var{widget}. 1205See @code{gtk-widget-set-events} for details. 1206 1207@table @var 1208@item widget 1209a @code{<gtk-widget>} 1210 1211@item events 1212an event mask, see @code{<gdk-event-mask>} 1213 1214@end table 1215 1216@end deffn 1217 1218@deffn Function gtk-widget-set-extension-events (self@tie{}@code{<gtk-widget>}) (mode@tie{}@code{<gdk-extension-mode>}) 1219@deffnx Method set-extension-events 1220Sets the extension events mask to @var{mode}. See @code{<gdk-extension-mode>} 1221and @code{gdk-input-set-extension-events}. 1222 1223@table @var 1224@item widget 1225a @code{<gtk-widget>} 1226 1227@item mode 1228bitfield of extension events to receive 1229 1230@end table 1231 1232@end deffn 1233 1234@deffn Function gtk-widget-get-extension-events (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gdk-extension-mode>}) 1235@deffnx Method get-extension-events 1236Retrieves the extension events the widget will receive; see 1237@code{gdk-input-set-extension-events}. 1238 1239@table @var 1240@item widget 1241a @code{<gtk-widget>} 1242 1243@item ret 1244extension events for @var{widget} 1245 1246@end table 1247 1248@end deffn 1249 1250@deffn Function gtk-widget-get-toplevel (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 1251@deffnx Method get-toplevel 1252This function returns the topmost widget in the container hierarchy @var{widget} 1253is a part of. If @var{widget} has no parent widgets, it will be returned as the 1254topmost widget. No reference will be added to the returned widget; it should not 1255be unreferenced. 1256 1257Note the difference in behavior vs. @code{gtk-widget-get-ancestor}; 1258@samp{gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)} would return 1259@samp{@code{#f}} if @var{widget} wasn't inside a toplevel window, and if the 1260window was inside a @code{<gtk-window-derived>} widget which was in turn inside 1261the toplevel @code{<gtk-window>}. While the second case may seem unlikely, it 1262actually happens when a @code{<gtk-plug>} is embedded inside a 1263@code{<gtk-socket>} within the same application. 1264 1265To reliably find the toplevel @code{<gtk-window>}, use 1266@code{gtk-widget-get-toplevel} and check if the @samp{TOPLEVEL} flags is set on 1267the result. 1268 1269@example 1270 1271 GtkWidget *toplevel = gtk_widget_get_toplevel (widget); 1272 if (GTK_WIDGET_TOPLEVEL (toplevel)) 1273 @{ 1274 [ Perform action on toplevel. ] 1275 @} 1276@end example 1277 1278@table @var 1279@item widget 1280a @code{<gtk-widget>} 1281 1282@item ret 1283the topmost ancestor of @var{widget}, or @var{widget} itself if there's no 1284ancestor. 1285 1286@end table 1287 1288@end deffn 1289 1290@deffn Function gtk-widget-get-ancestor (self@tie{}@code{<gtk-widget>}) (widget_type@tie{}@code{<gtype>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 1291@deffnx Method get-ancestor 1292Gets the first ancestor of @var{widget} with type @var{widget-type}. For 1293example, @samp{gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)} gets the first 1294@code{<gtk-box>} that's an ancestor of @var{widget}. No reference will be added 1295to the returned widget; it should not be unreferenced. See note about checking 1296for a toplevel @code{<gtk-window>} in the docs for 1297@code{gtk-widget-get-toplevel}. 1298 1299Note that unlike @code{gtk-widget-is-ancestor}, @code{gtk-widget-get-ancestor} 1300considers @var{widget} to be an ancestor of itself. 1301 1302@table @var 1303@item widget 1304a @code{<gtk-widget>} 1305 1306@item widget-type 1307ancestor type 1308 1309@item ret 1310the ancestor widget, or @samp{@code{#f}} if not found 1311 1312@end table 1313 1314@end deffn 1315 1316@deffn Function gtk-widget-get-colormap (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gdk-colormap>}) 1317@deffnx Method get-colormap 1318Gets the colormap that will be used to render @var{widget}. No reference will be 1319added to the returned colormap; it should not be unreferenced. 1320 1321@table @var 1322@item widget 1323a @code{<gtk-widget>} 1324 1325@item ret 1326the colormap used by @var{widget} 1327 1328@end table 1329 1330@end deffn 1331 1332@deffn Function gtk-widget-set-colormap (self@tie{}@code{<gtk-widget>}) (colormap@tie{}@code{<gdk-colormap>}) 1333@deffnx Method set-colormap 1334Sets the colormap for the widget to the given value. Widget must not have been 1335previously realized. This probably should only be used from an 1336@code{@code{init}} function (i.e. from the constructor for the widget). 1337 1338@table @var 1339@item widget 1340a @code{<gtk-widget>} 1341 1342@item colormap 1343a colormap 1344 1345@end table 1346 1347@end deffn 1348 1349@deffn Function gtk-widget-get-visual (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gdk-visual>}) 1350@deffnx Method get-visual 1351Gets the visual that will be used to render @var{widget}. 1352 1353@table @var 1354@item widget 1355a @code{<gtk-widget>} 1356 1357@item ret 1358the visual for @var{widget} 1359 1360@end table 1361 1362@end deffn 1363 1364@deffn Function gtk-widget-get-events (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{int}) 1365@deffnx Method get-events 1366Returns the event mask for the widget (a bitfield containing flags from the 1367@code{<gdk-event-mask>} enumeration). These are the events that the widget will 1368receive. 1369 1370@table @var 1371@item widget 1372a @code{<gtk-widget>} 1373 1374@item ret 1375event mask for @var{widget} 1376 1377@end table 1378 1379@end deffn 1380 1381@deffn Function gtk-widget-get-pointer (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (x@tie{}@code{int}) (y@tie{}@code{int}) 1382@deffnx Method get-pointer 1383Obtains the location of the mouse pointer in widget coordinates. Widget 1384coordinates are a bit odd; for historical reasons, they are defined as 1385@var{widget->window} coordinates for widgets that are not @code{<gtk-no-window>} 1386widgets, and are relative to @var{widget->allocation.x}, 1387@var{widget->allocation.y} for widgets that are @code{<gtk-no-window>} widgets. 1388 1389@table @var 1390@item widget 1391a @code{<gtk-widget>} 1392 1393@item x 1394return location for the X coordinate, or @samp{@code{#f}} 1395 1396@item y 1397return location for the Y coordinate, or @samp{@code{#f}} 1398 1399@end table 1400 1401@end deffn 1402 1403@deffn Function gtk-widget-is-ancestor (self@tie{}@code{<gtk-widget>}) (ancestor@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 1404@deffnx Method is-ancestor 1405Determines whether @var{widget} is somewhere inside @var{ancestor}, possibly 1406with intermediate containers. 1407 1408@table @var 1409@item widget 1410a @code{<gtk-widget>} 1411 1412@item ancestor 1413another @code{<gtk-widget>} 1414 1415@item ret 1416@samp{@code{#t}} if @var{ancestor} contains @var{widget} as a child, grandchild, 1417great grandchild, etc. 1418 1419@end table 1420 1421@end deffn 1422 1423@deffn Function gtk-widget-translate-coordinates (self@tie{}@code{<gtk-widget>}) (dest_widget@tie{}@code{<gtk-widget>}) (src_x@tie{}@code{int}) (src_y@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool}) (dest_x@tie{}@code{int}) (dest_y@tie{}@code{int}) 1424@deffnx Method translate-coordinates 1425Translate coordinates relative to @var{src-widget}'s allocation to coordinates 1426relative to @var{dest-widget}'s allocations. In order to perform this operation, 1427both widgets must be realized, and must share a common toplevel. 1428 1429@table @var 1430@item src-widget 1431a @code{<gtk-widget>} 1432 1433@item dest-widget 1434a @code{<gtk-widget>} 1435 1436@item src-x 1437X position relative to @var{src-widget} 1438 1439@item src-y 1440Y position relative to @var{src-widget} 1441 1442@item dest-x 1443location to store X position relative to @var{dest-widget} 1444 1445@item dest-y 1446location to store Y position relative to @var{dest-widget} 1447 1448@item ret 1449@samp{@code{#f}} if either widget was not realized, or there was no common 1450ancestor. In this case, nothing is stored in *@var{dest-x} and *@var{dest-y}. 1451Otherwise @samp{@code{#t}}. 1452 1453@end table 1454 1455@end deffn 1456 1457@deffn Function gtk-widget-hide-on-delete (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 1458@deffnx Method hide-on-delete 1459Utility function; intended to be connected to the "delete_event" signal on a 1460@code{<gtk-window>}. The function calls @code{gtk-widget-hide} on its argument, 1461then returns @samp{@code{#t}}. If connected to "delete_event", the result is 1462that clicking the close button for a window (on the window frame, top right 1463corner usually) will hide but not destroy the window. By default, GTK+ destroys 1464windows when "delete_event" is received. 1465 1466@table @var 1467@item widget 1468a @code{<gtk-widget>} 1469 1470@item ret 1471@samp{@code{#t}} 1472 1473@end table 1474 1475@end deffn 1476 1477@deffn Function gtk-widget-set-style (self@tie{}@code{<gtk-widget>}) (style@tie{}@code{<gtk-style>}) 1478@deffnx Method set-style 1479Sets the @code{<gtk-style>} for a widget (@var{widget->style}). You probably 1480don't want to use this function; it interacts badly with themes, because themes 1481work by replacing the @code{<gtk-style>}. Instead, use 1482@code{gtk-widget-modify-style}. 1483 1484@table @var 1485@item widget 1486a @code{<gtk-widget>} 1487 1488@item style 1489a @code{<gtk-style>}, or @samp{@code{#f}} to remove the effect of a previous 1490@code{gtk-widget-set-style} and go back to the default style 1491 1492@end table 1493 1494@end deffn 1495 1496@deffn Function gtk-widget-ensure-style (self@tie{}@code{<gtk-widget>}) 1497@deffnx Method ensure-style 1498Ensures that @var{widget} has a style (@var{widget->style}). Not a very useful 1499function; most of the time, if you want the style, the widget is realized, and 1500realized widgets are guaranteed to have a style already. 1501 1502@table @var 1503@item widget 1504a @code{<gtk-widget>} 1505 1506@end table 1507 1508@end deffn 1509 1510@deffn Function gtk-widget-get-style (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gtk-style>}) 1511@deffnx Method get-style 1512Simply an accessor function that returns @var{widget->style}. 1513 1514@table @var 1515@item widget 1516a @code{<gtk-widget>} 1517 1518@item ret 1519the widget's @code{<gtk-style>} 1520 1521@end table 1522 1523@end deffn 1524 1525@deffn Function gtk-widget-reset-rc-styles (self@tie{}@code{<gtk-widget>}) 1526@deffnx Method reset-rc-styles 1527Reset the styles of @var{widget} and all descendents, so when they are looked up 1528again, they get the correct values for the currently loaded RC file settings. 1529 1530This function is not useful for applications. 1531 1532@table @var 1533@item widget 1534a @code{<gtk-widget>}. 1535 1536@end table 1537 1538@end deffn 1539 1540@deffn Function gtk-widget-push-colormap (cmap@tie{}@code{<gdk-colormap>}) 1541Pushes @var{cmap} onto a global stack of colormaps; the topmost colormap on the 1542stack will be used to create all widgets. Remove @var{cmap} with 1543@code{gtk-widget-pop-colormap}. There's little reason to use this function. 1544 1545@table @var 1546@item cmap 1547a @code{<gdk-colormap>} 1548 1549@end table 1550 1551@end deffn 1552 1553@deffn Function gtk-widget-pop-colormap 1554Removes a colormap pushed with @code{gtk-widget-push-colormap}. 1555 1556@end deffn 1557 1558@deffn Function gtk-widget-set-default-colormap (colormap@tie{}@code{<gdk-colormap>}) 1559Sets the default colormap to use when creating widgets. 1560@code{gtk-widget-push-colormap} is a better function to use if you only want to 1561affect a few widgets, rather than all widgets. 1562 1563@table @var 1564@item colormap 1565a @code{<gdk-colormap>} 1566 1567@end table 1568 1569@end deffn 1570 1571@deffn Function gtk-widget-get-default-style @result{}@tie{} (ret@tie{}@code{<gtk-style>}) 1572Returns the default style used by all widgets initially. 1573 1574@table @var 1575@item ret 1576the default style. This @code{<gtk-style>} object is owned by GTK+ and should 1577not be modified or freed. 1578 1579@end table 1580 1581@end deffn 1582 1583@deffn Function gtk-widget-get-default-colormap @result{}@tie{} (ret@tie{}@code{<gdk-colormap>}) 1584Obtains the default colormap used to create widgets. 1585 1586@table @var 1587@item ret 1588default widget colormap 1589 1590@end table 1591 1592@end deffn 1593 1594@deffn Function gtk-widget-get-default-visual @result{}@tie{} (ret@tie{}@code{<gdk-visual>}) 1595Obtains the visual of the default colormap. Not really useful; used to be useful 1596before @code{gdk-colormap-get-visual} existed. 1597 1598@table @var 1599@item ret 1600visual of the default colormap 1601 1602@end table 1603 1604@end deffn 1605 1606@deffn Function gtk-widget-set-direction (self@tie{}@code{<gtk-widget>}) (dir@tie{}@code{<gtk-text-direction>}) 1607@deffnx Method set-direction 1608Sets the reading direction on a particular widget. This direction controls the 1609primary direction for widgets containing text, and also the direction in which 1610the children of a container are packed. The ability to set the direction is 1611present in order so that correct localization into languages with right-to-left 1612reading directions can be done. Generally, applications will let the default 1613reading direction present, except for containers where the containers are 1614arranged in an order that is explicitely visual rather than logical (such as 1615buttons for text justification). 1616 1617If the direction is set to @samp{GTK_TEXT_DIR_NONE}, then the value set by 1618@code{gtk-widget-set-default-direction} will be used. 1619 1620@table @var 1621@item widget 1622a @code{<gtk-widget>} 1623 1624@item dir 1625the new direction 1626 1627@end table 1628 1629@end deffn 1630 1631@deffn Function gtk-widget-get-direction (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-direction>}) 1632@deffnx Method get-direction 1633Gets the reading direction for a particular widget. See 1634@code{gtk-widget-set-direction}. 1635 1636@table @var 1637@item widget 1638a @code{<gtk-widget>} 1639 1640@item ret 1641the reading direction for the widget. 1642 1643@end table 1644 1645@end deffn 1646 1647@deffn Function gtk-widget-set-default-direction (dir@tie{}@code{<gtk-text-direction>}) 1648Sets the default reading direction for widgets where the direction has not been 1649explicitly set by @code{gtk-widget-set-direction}. 1650 1651@table @var 1652@item dir 1653the new default direction. This cannot be @samp{GTK_TEXT_DIR_NONE}. 1654 1655@end table 1656 1657@end deffn 1658 1659@deffn Function gtk-widget-get-default-direction @result{}@tie{} (ret@tie{}@code{<gtk-text-direction>}) 1660Obtains the current default reading direction. See 1661@code{gtk-widget-set-default-direction}. 1662 1663@table @var 1664@item ret 1665the current default direction. 1666 1667@end table 1668 1669@end deffn 1670 1671@deffn Function gtk-widget-shape-combine-mask (self@tie{}@code{<gtk-widget>}) (shape_mask@tie{}@code{<gdk-drawable>}) (offset_x@tie{}@code{int}) (offset_y@tie{}@code{int}) 1672@deffnx Method shape-combine-mask 1673Sets a shape for this widget's GDK window. This allows for transparent windows 1674etc., see @code{gdk-window-shape-combine-mask} for more information. 1675 1676@table @var 1677@item widget 1678a @code{<gtk-widget>}. 1679 1680@item shape-mask 1681shape to be added, or @samp{@code{#f}} to remove an existing shape. 1682 1683@item offset-x 1684X position of shape mask with respect to @var{window}. 1685 1686@item offset-y 1687Y position of shape mask with respect to @var{window}. 1688 1689@end table 1690 1691@end deffn 1692 1693@deffn Function gtk-widget-input-shape-combine-mask (self@tie{}@code{<gtk-widget>}) (shape_mask@tie{}@code{<gdk-drawable>}) (offset_x@tie{}@code{int}) (offset_y@tie{}@code{int}) 1694@deffnx Method input-shape-combine-mask 1695Sets an input shape for this widget's GDK window. This allows for windows which 1696react to mouse click in a nonrectangular region, see 1697@code{gdk-window-input-shape-combine-mask} for more information. 1698 1699@table @var 1700@item widget 1701a @code{<gtk-widget>}. 1702 1703@item shape-mask 1704shape to be added, or @samp{@code{#f}} to remove an existing shape. 1705 1706@item offset-x 1707X position of shape mask with respect to @var{window}. 1708 1709@item offset-y 1710Y position of shape mask with respect to @var{window}. 1711 1712@end table 1713 1714Since 2.10 1715 1716@end deffn 1717 1718@deffn Function gtk-widget-path (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (path_length@tie{}@code{unsigned-int}) (path@tie{}@code{mchars}) (path_reversed@tie{}@code{mchars}) 1719@deffnx Method path 1720Obtains the full path to @var{widget}. The path is simply the name of a widget 1721and all its parents in the container hierarchy, separated by periods. The name 1722of a widget comes from @code{gtk-widget-get-name}. Paths are used to apply 1723styles to a widget in gtkrc configuration files. Widget names are the type of 1724the widget by default (e.g. "GtkButton") or can be set to an 1725application-specific value with @code{gtk-widget-set-name}. By setting the name 1726of a widget, you allow users or theme authors to apply styles to that specific 1727widget in their gtkrc file. @var{path-reversed-p} fills in the path in reverse 1728order, i.e. starting with @var{widget}'s name instead of starting with the name 1729of @var{widget}'s outermost ancestor. 1730 1731@table @var 1732@item widget 1733a @code{<gtk-widget>} 1734 1735@item path-length 1736location to store length of the path, or @samp{@code{#f}} 1737 1738@item path 1739location to store allocated path string, or @samp{@code{#f}} 1740 1741@item path-reversed 1742location to store allocated reverse path string, or @samp{@code{#f}} 1743 1744@end table 1745 1746@end deffn 1747 1748@deffn Function gtk-widget-class-path (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (path_length@tie{}@code{unsigned-int}) (path@tie{}@code{mchars}) (path_reversed@tie{}@code{mchars}) 1749@deffnx Method class-path 1750Same as @code{gtk-widget-path}, but always uses the name of a widget's type, 1751never uses a custom name set with @code{gtk-widget-set-name}. 1752 1753@table @var 1754@item widget 1755a @code{<gtk-widget>} 1756 1757@item path-length 1758location to store the length of the class path, or @samp{@code{#f}} 1759 1760@item path 1761location to store the class path as an allocated string, or @samp{@code{#f}} 1762 1763@item path-reversed 1764location to store the reverse class path as an allocated string, or 1765@samp{@code{#f}} 1766 1767@end table 1768 1769@end deffn 1770 1771@deffn Function gtk-widget-get-composite-name (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{mchars}) 1772@deffnx Method get-composite-name 1773Obtains the composite name of a widget. 1774 1775@table @var 1776@item widget 1777a @code{<gtk-widget>}. 1778 1779@item ret 1780the composite name of @var{widget}, or @samp{@code{#f}} if @var{widget} is not a 1781composite child. The string should not be freed when it is no longer needed. 1782 1783@end table 1784 1785@end deffn 1786 1787@deffn Function gtk-widget-modify-style (self@tie{}@code{<gtk-widget>}) (style@tie{}@code{<gtk-rc-style>}) 1788@deffnx Method modify-style 1789Modifies style values on the widget. Modifications made using this technique 1790take precedence over style values set via an RC file, however, they will be 1791overriden if a style is explicitely set on the widget using 1792@code{gtk-widget-set-style}. The @code{<gtk-rc-style>} structure is designed so 1793each field can either be set or unset, so it is possible, using this function, 1794to modify some style values and leave the others unchanged. 1795 1796Note that modifications made with this function are not cumulative with previous 1797calls to @code{gtk-widget-modify-style} or with such functions as 1798@code{gtk-widget-modify-fg}. If you wish to retain previous values, you must 1799first call @code{gtk-widget-get-modifier-style}, make your modifications to the 1800returned style, then call @code{gtk-widget-modify-style} with that style. On the 1801other hand, if you first call @code{gtk-widget-modify-style}, subsequent calls 1802to such functions @code{gtk-widget-modify-fg} will have a cumulative effect with 1803the initial modifications. 1804 1805@table @var 1806@item widget 1807a @code{<gtk-widget>} 1808 1809@item style 1810the @code{<gtk-rc-style>} holding the style modifications 1811 1812@end table 1813 1814@end deffn 1815 1816@deffn Function gtk-widget-get-modifier-style (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gtk-rc-style>}) 1817@deffnx Method get-modifier-style 1818Returns the current modifier style for the widget. (As set by 1819@code{gtk-widget-modify-style}.) If no style has previously set, a new 1820@code{<gtk-rc-style>} will be created with all values unset, and set as the 1821modifier style for the widget. If you make changes to this rc style, you must 1822call @code{gtk-widget-modify-style}, passing in the returned rc style, to make 1823sure that your changes take effect. 1824 1825Caution: passing the style back to @code{gtk-widget-modify-style} will normally 1826end up destroying it, because @code{gtk-widget-modify-style} copies the 1827passed-in style and sets the copy as the new modifier style, thus dropping any 1828reference to the old modifier style. Add a reference to the modifier style if 1829you want to keep it alive. 1830 1831@table @var 1832@item widget 1833a @code{<gtk-widget>} 1834 1835@item ret 1836the modifier style for the widget. This rc style is owned by the widget. If you 1837want to keep a pointer to value this around, you must add a refcount using 1838@code{g-object-ref}. 1839 1840@end table 1841 1842@end deffn 1843 1844@deffn Function gtk-widget-modify-fg (self@tie{}@code{<gtk-widget>}) (state@tie{}@code{<gtk-state-type>}) (color@tie{}@code{<gdk-color>}) 1845@deffnx Method modify-fg 1846Sets the foreground color for a widget in a particular state. All other style 1847values are left untouched. See also @code{gtk-widget-modify-style}. 1848 1849@table @var 1850@item widget 1851a @code{<gtk-widget>}. 1852 1853@item state 1854the state for which to set the foreground color. 1855 1856@item color 1857the color to assign (does not need to be allocated), or @samp{@code{#f}} to undo 1858the effect of previous calls to of @code{gtk-widget-modify-fg}. 1859 1860@end table 1861 1862@end deffn 1863 1864@deffn Function gtk-widget-modify-bg (self@tie{}@code{<gtk-widget>}) (state@tie{}@code{<gtk-state-type>}) (color@tie{}@code{<gdk-color>}) 1865@deffnx Method modify-bg 1866Sets the background color for a widget in a particular state. All other style 1867values are left untouched. See also @code{gtk-widget-modify-style}. 1868 1869Note that "no window" widgets (which have the @samp{GTK_NO_WINDOW} flag set) 1870draw on their parent container's window and thus may not draw any background 1871themselves. This is the case for e.g. @code{<gtk-label>}. To modify the 1872background of such widgets, you have to set the background color on their 1873parent; if you want to set the background of a rectangular area around a label, 1874try placing the label in a @code{<gtk-event-box>} widget and setting the 1875background color on that. 1876 1877@table @var 1878@item widget 1879a @code{<gtk-widget>}. 1880 1881@item state 1882the state for which to set the background color. 1883 1884@item color 1885the color to assign (does not need to be allocated), or @samp{@code{#f}} to undo 1886the effect of previous calls to of @code{gtk-widget-modify-bg}. 1887 1888@end table 1889 1890@end deffn 1891 1892@deffn Function gtk-widget-modify-text (self@tie{}@code{<gtk-widget>}) (state@tie{}@code{<gtk-state-type>}) (color@tie{}@code{<gdk-color>}) 1893@deffnx Method modify-text 1894Sets the text color for a widget in a particular state. All other style values 1895are left untouched. The text color is the foreground color used along with the 1896base color (see @code{gtk-widget-modify-base}) for widgets such as 1897@code{<gtk-entry>} and @code{<gtk-text-view>}. See also 1898@code{gtk-widget-modify-style}. 1899 1900@table @var 1901@item widget 1902a @code{<gtk-widget>}. 1903 1904@item state 1905the state for which to set the text color. 1906 1907@item color 1908the color to assign (does not need to be allocated), or @samp{@code{#f}} to undo 1909the effect of previous calls to of @code{gtk-widget-modify-text}. 1910 1911@end table 1912 1913@end deffn 1914 1915@deffn Function gtk-widget-modify-base (self@tie{}@code{<gtk-widget>}) (state@tie{}@code{<gtk-state-type>}) (color@tie{}@code{<gdk-color>}) 1916@deffnx Method modify-base 1917Sets the base color for a widget in a particular state. All other style values 1918are left untouched. The base color is the background color used along with the 1919text color (see @code{gtk-widget-modify-text}) for widgets such as 1920@code{<gtk-entry>} and @code{<gtk-text-view>}. See also 1921@code{gtk-widget-modify-style}. 1922 1923Note that "no window" widgets (which have the @samp{GTK_NO_WINDOW} flag set) 1924draw on their parent container's window and thus may not draw any background 1925themselves. This is the case for e.g. @code{<gtk-label>}. To modify the 1926background of such widgets, you have to set the base color on their parent; if 1927you want to set the background of a rectangular area around a label, try placing 1928the label in a @code{<gtk-event-box>} widget and setting the base color on that. 1929 1930@table @var 1931@item widget 1932a @code{<gtk-widget>}. 1933 1934@item state 1935the state for which to set the base color. 1936 1937@item color 1938the color to assign (does not need to be allocated), or @samp{@code{#f}} to undo 1939the effect of previous calls to of @code{gtk-widget-modify-base}. 1940 1941@end table 1942 1943@end deffn 1944 1945@deffn Function gtk-widget-modify-font (self@tie{}@code{<gtk-widget>}) (font_desc@tie{}@code{<pango-font-description>}) 1946@deffnx Method modify-font 1947Sets the font to use for a widget. All other style values are left untouched. 1948See also @code{gtk-widget-modify-style}. 1949 1950@table @var 1951@item widget 1952a @code{<gtk-widget>} 1953 1954@item font-desc 1955the font description to use, or @samp{@code{#f}} to undo the effect of previous 1956calls to @code{gtk-widget-modify-font}. 1957 1958@end table 1959 1960@end deffn 1961 1962@deffn Function gtk-widget-create-pango-context (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<pango-context>}) 1963@deffnx Method create-pango-context 1964Creates a new @code{<pango-context>} with the appropriate font map, font 1965description, and base direction for drawing text for this widget. See also 1966@code{gtk-widget-get-pango-context}. 1967 1968@table @var 1969@item widget 1970a @code{<gtk-widget>} 1971 1972@item ret 1973the new @code{<pango-context>} 1974 1975@end table 1976 1977@end deffn 1978 1979@deffn Function gtk-widget-get-pango-context (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<pango-context>}) 1980@deffnx Method get-pango-context 1981Gets a @code{<pango-context>} with the appropriate font map, font description, 1982and base direction for this widget. Unlike the context returned by 1983@code{gtk-widget-create-pango-context}, this context is owned by the widget (it 1984can be used until the screen for the widget changes or the widget is removed 1985from its toplevel), and will be updated to match any changes to the widget's 1986attributes. 1987 1988If you create and keep a @code{<pango-layout>} using this context, you must deal 1989with changes to the context by calling @code{pango-layout-context-changed} on 1990the layout in response to the ::style-set and ::direction-changed signals for 1991the widget. 1992 1993@table @var 1994@item widget 1995a @code{<gtk-widget>} 1996 1997@item ret 1998the @code{<pango-context>} for the widget. 1999 2000@end table 2001 2002@end deffn 2003 2004@deffn Function gtk-widget-create-pango-layout (self@tie{}@code{<gtk-widget>}) (text@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{<pango-layout>}) 2005@deffnx Method create-pango-layout 2006Creates a new @code{<pango-layout>} with the appropriate font map, font 2007description, and base direction for drawing text for this widget. 2008 2009If you keep a @code{<pango-layout>} created in this way around, in order to 2010notify the layout of changes to the base direction or font of this widget, you 2011must call @code{pango-layout-context-changed} in response to the ::style-set and 2012::direction-changed signals for the widget. 2013 2014@table @var 2015@item widget 2016a @code{<gtk-widget>} 2017 2018@item text 2019text to set on the layout (can be @samp{@code{#f}}) 2020 2021@item ret 2022the new @code{<pango-layout>} 2023 2024@end table 2025 2026@end deffn 2027 2028@deffn Function gtk-widget-render-icon (self@tie{}@code{<gtk-widget>}) (stock_id@tie{}@code{mchars}) (size@tie{}@code{<gtk-icon-size>}) (detail@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>}) 2029@deffnx Method render-icon 2030A convenience function that uses the theme engine and RC file settings for 2031@var{widget} to look up @var{stock-id} and render it to a pixbuf. @var{stock-id} 2032should be a stock icon ID such as @code{<gtk-stock-open>} or 2033@code{<gtk-stock-ok>}. @var{size} should be a size such as 2034@code{<gtk-icon-size-menu>}. @var{detail} should be a string that identifies the 2035widget or code doing the rendering, so that theme engines can special-case 2036rendering for that widget or code. 2037 2038The pixels in the returned @code{<gdk-pixbuf>} are shared with the rest of the 2039application and should not be modified. The pixbuf should be freed after use 2040with @code{g-object-unref}. 2041 2042@table @var 2043@item widget 2044a @code{<gtk-widget>} 2045 2046@item stock-id 2047a stock ID 2048 2049@item size 2050a stock size. A size of (GtkIconSize)-1 means render at the size of the source 2051and don't scale (if there are multiple source sizes, GTK+ picks one of the 2052available sizes). 2053 2054@item detail 2055render detail to pass to theme engine 2056 2057@item ret 2058a new pixbuf, or @samp{@code{#f}} if the stock ID wasn't known 2059 2060@end table 2061 2062@end deffn 2063 2064@deffn Function gtk-widget-pop-composite-child 2065Cancels the effect of a previous call to @code{gtk-widget-push-composite-child}. 2066 2067@end deffn 2068 2069@deffn Function gtk-widget-push-composite-child 2070Makes all newly-created widgets as composite children until the corresponding 2071@code{gtk-widget-pop-composite-child} call. 2072 2073A composite child is a child that's an implementation detail of the container 2074it's inside and should not be visible to people using the container. Composite 2075children aren't treated differently by GTK (but see @code{gtk-container-foreach} 2076vs. @code{gtk-container-forall}), but e.g. GUI builders might want to treat them 2077in a different way. 2078 2079Here is a simple example: 2080 2081@example 2082 2083 gtk_widget_push_composite_child (); 2084 scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment); 2085 gtk_widget_set_composite_name (scrolled_window->hscrollbar, "hscrollbar"); 2086 gtk_widget_pop_composite_child (); 2087 gtk_widget_set_parent (scrolled_window->hscrollbar, 2088 GTK_WIDGET (scrolled_window)); 2089 g_object_ref (scrolled_window->hscrollbar); 2090@end example 2091 2092@end deffn 2093 2094@deffn Function gtk-widget-queue-draw-area (self@tie{}@code{<gtk-widget>}) (x@tie{}@code{int}) (y@tie{}@code{int}) (width@tie{}@code{int}) (height@tie{}@code{int}) 2095@deffnx Method queue-draw-area 2096Invalidates the rectangular area of @var{widget} defined by @var{x}, @var{y}, 2097@var{width} and @var{height} by calling @code{gdk-window-invalidate-rect} on the 2098widget's window and all its child windows. Once the main loop becomes idle 2099(after the current batch of events has been processed, roughly), the window will 2100receive expose events for the union of all regions that have been invalidated. 2101 2102Normally you would only use this function in widget implementations. You might 2103also use it, or @code{gdk-window-invalidate-rect} directly, to schedule a redraw 2104of a @code{<gtk-drawing-area>} or some portion thereof. 2105 2106Frequently you can just call @code{gdk-window-invalidate-rect} or 2107@code{gdk-window-invalidate-region} instead of this function. Those functions 2108will invalidate only a single window, instead of the widget and all its 2109children. 2110 2111The advantage of adding to the invalidated region compared to simply drawing 2112immediately is efficiency; using an invalid region ensures that you only have to 2113redraw one time. 2114 2115@table @var 2116@item widget 2117a @code{<gtk-widget>} 2118 2119@item x 2120x coordinate of upper-left corner of rectangle to redraw 2121 2122@item y 2123y coordinate of upper-left corner of rectangle to redraw 2124 2125@item width 2126width of region to draw 2127 2128@item height 2129height of region to draw 2130 2131@end table 2132 2133@end deffn 2134 2135@deffn Function gtk-widget-reset-shapes (self@tie{}@code{<gtk-widget>}) 2136@deffnx Method reset-shapes 2137Recursively resets the shape on this widget and its descendants. 2138 2139@table @var 2140@item widget 2141a @code{<gtk-widget>}. 2142 2143@end table 2144 2145@end deffn 2146 2147@deffn Function gtk-widget-set-app-paintable (self@tie{}@code{<gtk-widget>}) (app_paintable@tie{}@code{bool}) 2148@deffnx Method set-app-paintable 2149Sets whether the application intends to draw on the widget in an ::expose-event 2150handler. 2151 2152This is a hint to the widget and does not affect the behavior of the GTK+ core; 2153many widgets ignore this flag entirely. For widgets that do pay attention to the 2154flag, such as @code{<gtk-event-box>} and @code{<gtk-window>}, the effect is to 2155suppress default themed drawing of the widget's background. (Children of the 2156widget will still be drawn.) The application is then entirely responsible for 2157drawing the widget background. 2158 2159Note that the background is still drawn when the widget is mapped. If this is 2160not suitable (e.g. because you want to make a transparent window using an RGBA 2161visual), you can work around this by doing: 2162 2163@example 2164 2165 gtk_widget_realize (window); 2166 gdk_window_set_back_pixmap (window->window, NULL, FALSE); 2167 gtk_widget_show (window); 2168@end example 2169 2170@table @var 2171@item widget 2172a @code{<gtk-widget>} 2173 2174@item app-paintable 2175@samp{@code{#t}} if the application will paint on the widget 2176 2177@end table 2178 2179@end deffn 2180 2181@deffn Function gtk-widget-set-double-buffered (self@tie{}@code{<gtk-widget>}) (double_buffered@tie{}@code{bool}) 2182@deffnx Method set-double-buffered 2183Widgets are double buffered by default; you can use this function to turn off 2184the buffering. "Double buffered" simply means that 2185@code{gdk-window-begin-paint-region} and @code{gdk-window-end-paint} are called 2186automatically around expose events sent to the widget. 2187@code{gdk-window-begin-paint} diverts all drawing to a widget's window to an 2188offscreen buffer, and @code{gdk-window-end-paint} draws the buffer to the 2189screen. The result is that users see the window update in one smooth step, and 2190don't see individual graphics primitives being rendered. 2191 2192In very simple terms, double buffered widgets don't flicker, so you would only 2193use this function to turn off double buffering if you had special needs and 2194really knew what you were doing. 2195 2196Note: if you turn off double-buffering, you have to handle expose events, since 2197even the clearing to the background color or pixmap will not happen 2198automatically (as it is done in @code{gdk-window-begin-paint}). 2199 2200@table @var 2201@item widget 2202a @code{<gtk-widget>} 2203 2204@item double-buffered 2205@samp{@code{#t}} to double-buffer a widget 2206 2207@end table 2208 2209@end deffn 2210 2211@deffn Function gtk-widget-set-redraw-on-allocate (self@tie{}@code{<gtk-widget>}) (redraw_on_allocate@tie{}@code{bool}) 2212@deffnx Method set-redraw-on-allocate 2213Sets whether the entire widget is queued for drawing when its size allocation 2214changes. By default, this setting is @samp{@code{#t}} and the entire widget is 2215redrawn on every size change. If your widget leaves the upper left unchanged 2216when made bigger, turning this setting on will improve performance. 2217 2218Note that for @samp{NO_WINDOW} widgets setting this flag to @samp{@code{#f}} 2219turns off all allocation on resizing: the widget will not even redraw if its 2220position changes; this is to allow containers that don't draw anything to avoid 2221excess invalidations. If you set this flag on a @samp{NO_WINDOW} widget that 2222@emph{does} draw on @var{widget->window}, you are responsible for invalidating 2223both the old and new allocation of the widget when the widget is moved and 2224responsible for invalidating regions newly when the widget increases size. 2225 2226@table @var 2227@item widget 2228a @code{<gtk-widget>} 2229 2230@item redraw-on-allocate 2231if @samp{@code{#t}}, the entire widget will be redrawn when it is allocated to a 2232new size. Otherwise, only the new portion of the widget will be redrawn. 2233 2234@end table 2235 2236@end deffn 2237 2238@deffn Function gtk-widget-set-composite-name (self@tie{}@code{<gtk-widget>}) (name@tie{}@code{mchars}) 2239@deffnx Method set-composite-name 2240Sets a widgets composite name. The widget must be a composite child of its 2241parent; see @code{gtk-widget-push-composite-child}. 2242 2243@table @var 2244@item widget 2245a @code{<gtk-widget>}. 2246 2247@item name 2248the name to set. 2249 2250@end table 2251 2252@end deffn 2253 2254@deffn Function gtk-widget-set-scroll-adjustments (self@tie{}@code{<gtk-widget>}) (hadjustment@tie{}@code{<gtk-adjustment>}) (vadjustment@tie{}@code{<gtk-adjustment>}) @result{}@tie{} (ret@tie{}@code{bool}) 2255@deffnx Method set-scroll-adjustments 2256For widgets that support scrolling, sets the scroll adjustments and returns 2257@samp{@code{#t}}. For widgets that don't support scrolling, does nothing and 2258returns @samp{@code{#f}}. Widgets that don't support scrolling can be scrolled 2259by placing them in a @code{<gtk-viewport>}, which does support scrolling. 2260 2261@table @var 2262@item widget 2263a @code{<gtk-widget>} 2264 2265@item hadjustment 2266an adjustment for horizontal scrolling, or @samp{@code{#f}} 2267 2268@item vadjustment 2269an adjustment for vertical scrolling, or @samp{@code{#f}} 2270 2271@item ret 2272@samp{@code{#t}} if the widget supports scrolling 2273 2274@end table 2275 2276@end deffn 2277 2278@deffn Function gtk-widget-mnemonic-activate (self@tie{}@code{<gtk-widget>}) (group_cycling@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool}) 2279@deffnx Method mnemonic-activate 2280@table @var 2281@item widget 2282 2283 2284@item group-cycling 2285 2286 2287@item ret 2288 2289 2290@end table 2291 2292@end deffn 2293 2294@deffn Function gtk-widget-region-intersect (self@tie{}@code{<gtk-widget>}) (region@tie{}@code{<gdk-region>}) @result{}@tie{} (ret@tie{}@code{<gdk-region>}) 2295@deffnx Method region-intersect 2296Computes the intersection of a @var{widget}'s area and @var{region}, returning 2297the intersection. The result may be empty, use @code{gdk-region-empty} to check. 2298 2299@table @var 2300@item widget 2301a @code{<gtk-widget>} 2302 2303@item region 2304a @code{<gdk-region>}, in the same coordinate system as 2305@var{widget->allocation}. That is, relative to @var{widget->window} for 2306@samp{NO_WINDOW} widgets; relative to the parent window of @var{widget->window} 2307for widgets with their own window. 2308 2309@item ret 2310A newly allocated region holding the intersection of @var{widget} and 2311@var{region}. The coordinates of the return value are relative to 2312@var{widget->window} for @samp{NO_WINDOW} widgets, and relative to the parent 2313window of @var{widget->window} for widgets with their own window. 2314 2315@end table 2316 2317@end deffn 2318 2319@deffn Function gtk-widget-send-expose (self@tie{}@code{<gtk-widget>}) (event@tie{}@code{<gdk-event>}) @result{}@tie{} (ret@tie{}@code{int}) 2320@deffnx Method send-expose 2321Very rarely-used function. This function is used to emit an expose event signals 2322on a widget. This function is not normally used directly. The only time it is 2323used is when propagating an expose event to a child @samp{NO_WINDOW} widget, and 2324that is normally done using @code{gtk-container-propagate-expose}. 2325 2326If you want to force an area of a window to be redrawn, use 2327@code{gdk-window-invalidate-rect} or @code{gdk-window-invalidate-region}. To 2328cause the redraw to be done immediately, follow that call with a call to 2329@code{gdk-window-process-updates}. 2330 2331@table @var 2332@item widget 2333a @code{<gtk-widget>} 2334 2335@item event 2336a expose @code{<gdk-event>} 2337 2338@item ret 2339return from the event signal emission (@samp{@code{#t}} if the event was 2340handled) 2341 2342@end table 2343 2344@end deffn 2345 2346@deffn Function gtk-widget-style-get-property (self@tie{}@code{<gtk-widget>}) (property_name@tie{}@code{mchars}) (value@tie{}@code{<gvalue>}) 2347@deffnx Method style-get-property 2348Gets the value of a style property of @var{widget}. 2349 2350@table @var 2351@item widget 2352a @code{<gtk-widget>} 2353 2354@item property-name 2355the name of a style property 2356 2357@item value 2358location to return the property value 2359 2360@end table 2361 2362@end deffn 2363 2364@deffn Function gtk-widget-get-accessible (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<atk-object>}) 2365@deffnx Method get-accessible 2366Returns the accessible object that describes the widget to an assistive 2367technology. 2368 2369If no accessibility library is loaded (i.e. no ATK implementation library is 2370loaded via @env{GTK_MODULES} or via another application library, such as 2371libgnome), then this @code{<atk-object>} instance may be a no-op. Likewise, if 2372no class-specific @code{<atk-object>} implementation is available for the widget 2373instance in question, it will inherit an @code{<atk-object>} implementation from 2374the first ancestor class for which such an implementation is defined. 2375 2376The documentation of the 2377@uref{http://developer.gnome.org/doc/API/2.0/atk/index.html,ATK} library 2378contains more information about accessible objects and their uses. 2379 2380@table @var 2381@item widget 2382a @code{<gtk-widget>} 2383 2384@item ret 2385the @code{<atk-object>} associated with @var{widget} 2386 2387@end table 2388 2389@end deffn 2390 2391@deffn Function gtk-widget-child-focus (self@tie{}@code{<gtk-widget>}) (direction@tie{}@code{<gtk-direction-type>}) @result{}@tie{} (ret@tie{}@code{bool}) 2392@deffnx Method child-focus 2393This function is used by custom widget implementations; if you're writing an 2394app, you'd use @code{gtk-widget-grab-focus} to move the focus to a particular 2395widget, and @code{gtk-container-set-focus-chain} to change the focus tab order. 2396So you may want to investigate those functions instead. 2397 2398@code{gtk-widget-child-focus} is called by containers as the user moves around 2399the window using keyboard shortcuts. @var{direction} indicates what kind of 2400motion is taking place (up, down, left, right, tab forward, tab backward). 2401@code{gtk-widget-child-focus} invokes the "focus" signal on @code{<gtk-widget>}; 2402widgets override the default handler for this signal in order to implement 2403appropriate focus behavior. 2404 2405The "focus" default handler for a widget should return @samp{@code{#t}} if 2406moving in @var{direction} left the focus on a focusable location inside that 2407widget, and @samp{@code{#f}} if moving in @var{direction} moved the focus 2408outside the widget. If returning @samp{@code{#t}}, widgets normally call 2409@code{gtk-widget-grab-focus} to place the focus accordingly; if returning 2410@samp{@code{#f}}, they don't modify the current focus location. 2411 2412This function replaces @code{gtk-container-focus} from GTK+ 1.2. It was 2413necessary to check that the child was visible, sensitive, and focusable before 2414calling @code{gtk-container-focus}. @code{gtk-widget-child-focus} returns 2415@samp{@code{#f}} if the widget is not currently in a focusable state, so there's 2416no need for those checks. 2417 2418@table @var 2419@item widget 2420a @code{<gtk-widget>} 2421 2422@item direction 2423direction of focus movement 2424 2425@item ret 2426@samp{@code{#t}} if focus ended up inside @var{widget} 2427 2428@end table 2429 2430@end deffn 2431 2432@deffn Function gtk-widget-child-notify (self@tie{}@code{<gtk-widget>}) (child_property@tie{}@code{mchars}) 2433@deffnx Method child-notify 2434Emits a "child-notify" signal for the child property@var{child-property} on 2435@var{widget}. 2436 2437This is the analogue of @code{g-object-notify} for child properties. 2438 2439@table @var 2440@item widget 2441a @code{<gtk-widget>} 2442 2443@item child-property 2444the name of a child property installed on the class of @var{widget}'s parent. 2445 2446@end table 2447 2448@end deffn 2449 2450@deffn Function gtk-widget-freeze-child-notify (self@tie{}@code{<gtk-widget>}) 2451@deffnx Method freeze-child-notify 2452Stops emission of "child-notify" signals on @var{widget}. The signals are queued 2453until @code{gtk-widget-thaw-child-notify} is called on @var{widget}. 2454 2455This is the analogue of @code{g-object-freeze-notify} for child properties. 2456 2457@table @var 2458@item widget 2459a @code{<gtk-widget>} 2460 2461@end table 2462 2463@end deffn 2464 2465@deffn Function gtk-widget-get-child-visible (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 2466@deffnx Method get-child-visible 2467Gets the value set with @code{gtk-widget-set-child-visible}. If you feel a need 2468to use this function, your code probably needs reorganization. 2469 2470This function is only useful for container implementations and never should be 2471called by an application. 2472 2473@table @var 2474@item widget 2475a @code{<gtk-widget>} 2476 2477@item ret 2478@samp{@code{#t}} if the widget is mapped with the parent. 2479 2480@end table 2481 2482@end deffn 2483 2484@deffn Function gtk-widget-get-parent (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 2485@deffnx Method get-parent 2486Returns the parent container of @var{widget}. 2487 2488@table @var 2489@item widget 2490a @code{<gtk-widget>} 2491 2492@item ret 2493the parent container of @var{widget}, or @samp{@code{#f}} 2494 2495@end table 2496 2497@end deffn 2498 2499@deffn Function gtk-widget-get-settings (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gtk-settings>}) 2500@deffnx Method get-settings 2501Gets the settings object holding the settings (global property settings, RC file 2502information, etc) used for this widget. 2503 2504Note that this function can only be called when the @code{<gtk-widget>} is 2505attached to a toplevel, since the settings object is specific to a particular 2506@code{<gdk-screen>}. 2507 2508@table @var 2509@item widget 2510a @code{<gtk-widget>} 2511 2512@item ret 2513the relevant @code{<gtk-settings>} object 2514 2515@end table 2516 2517@end deffn 2518 2519@deffn Function gtk-widget-get-clipboard (self@tie{}@code{<gtk-widget>}) (selection@tie{}@code{<gdk-atom>}) @result{}@tie{} (ret@tie{}@code{<gtk-clipboard>}) 2520@deffnx Method get-clipboard 2521Returns the clipboard object for the given selection to be used with 2522@var{widget}. @var{widget} must have a @code{<gdk-display>} associated with it, 2523so must be attached to a toplevel window. 2524 2525@table @var 2526@item widget 2527a @code{<gtk-widget>} 2528 2529@item selection 2530a @code{<gdk-atom>} which identifies the clipboard to use. 2531@samp{GDK_SELECTION_CLIPBOARD} gives the default clipboard. Another common value 2532is @samp{GDK_SELECTION_PRIMARY}, which gives the primary X selection. 2533 2534@item ret 2535the appropriate clipboard object. If no clipboard already exists, a new one will 2536be created. Once a clipboard object has been created, it is persistent for all 2537time. 2538 2539@end table 2540 2541Since 2.2 2542 2543@end deffn 2544 2545@deffn Function gtk-widget-get-display (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gdk-display>}) 2546@deffnx Method get-display 2547Get the @code{<gdk-display>} for the toplevel window associated with this 2548widget. This function can only be called after the widget has been added to a 2549widget hierarchy with a @code{<gtk-window>} at the top. 2550 2551In general, you should only create display specific resources when a widget has 2552been realized, and you should free those resources when the widget is 2553unrealized. 2554 2555@table @var 2556@item widget 2557a @code{<gtk-widget>} 2558 2559@item ret 2560the @code{<gdk-display>} for the toplevel for this widget. 2561 2562@end table 2563 2564Since 2.2 2565 2566@end deffn 2567 2568@deffn Function gtk-widget-get-root-window (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gdk-window>}) 2569@deffnx Method get-root-window 2570Get the root window where this widget is located. This function can only be 2571called after the widget has been added to a widget heirarchy with 2572@code{<gtk-window>} at the top. 2573 2574The root window is useful for such purposes as creating a popup 2575@code{<gdk-window>} associated with the window. In general, you should only 2576create display specific resources when a widget has been realized, and you 2577should free those resources when the widget is unrealized. 2578 2579@table @var 2580@item widget 2581a @code{<gtk-widget>} 2582 2583@item ret 2584the @code{<gdk-window>} root window for the toplevel for this widget. 2585 2586@end table 2587 2588Since 2.2 2589 2590@end deffn 2591 2592@deffn Function gtk-widget-get-screen (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gdk-screen>}) 2593@deffnx Method get-screen 2594Get the @code{<gdk-screen>} from the toplevel window associated with this 2595widget. This function can only be called after the widget has been added to a 2596widget hierarchy with a @code{<gtk-window>} at the top. 2597 2598In general, you should only create screen specific resources when a widget has 2599been realized, and you should free those resources when the widget is 2600unrealized. 2601 2602@table @var 2603@item widget 2604a @code{<gtk-widget>} 2605 2606@item ret 2607the @code{<gdk-screen>} for the toplevel for this widget. 2608 2609@end table 2610 2611Since 2.2 2612 2613@end deffn 2614 2615@deffn Function gtk-widget-has-screen (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 2616@deffnx Method has-screen 2617Checks whether there is a @code{<gdk-screen>} is associated with this widget. 2618All toplevel widgets have an associated screen, and all widgets added into a 2619heirarchy with a toplevel window at the top. 2620 2621@table @var 2622@item widget 2623a @code{<gtk-widget>} 2624 2625@item ret 2626@samp{@code{#t}} if there is a @code{<gdk-screen>} associcated with the widget. 2627 2628@end table 2629 2630Since 2.2 2631 2632@end deffn 2633 2634@deffn Function gtk-widget-get-size-request (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (width@tie{}@code{int}) (height@tie{}@code{int}) 2635@deffnx Method get-size-request 2636Gets the size request that was explicitly set for the widget using 2637@code{gtk-widget-set-size-request}. A value of -1 stored in @var{width} or 2638@var{height} indicates that that dimension has not been set explicitly and the 2639natural requisition of the widget will be used intead. See 2640@code{gtk-widget-set-size-request}. To get the size a widget will actually use, 2641call @code{gtk-widget-size-request} instead of this function. 2642 2643@table @var 2644@item widget 2645a @code{<gtk-widget>} 2646 2647@item width 2648return location for width, or @samp{@code{#f}} 2649 2650@item height 2651return location for height, or @samp{@code{#f}} 2652 2653@end table 2654 2655@end deffn 2656 2657@deffn Function gtk-widget-set-child-visible (self@tie{}@code{<gtk-widget>}) (is_visible@tie{}@code{bool}) 2658@deffnx Method set-child-visible 2659Sets whether @var{widget} should be mapped along with its when its parent is 2660mapped and @var{widget} has been shown with @code{gtk-widget-show}. 2661 2662The child visibility can be set for widget before it is added to a container 2663with @code{gtk-widget-set-parent}, to avoid mapping children unnecessary before 2664immediately unmapping them. However it will be reset to its default state of 2665@samp{@code{#t}} when the widget is removed from a container. 2666 2667Note that changing the child visibility of a widget does not queue a resize on 2668the widget. Most of the time, the size of a widget is computed from all visible 2669children, whether or not they are mapped. If this is not the case, the container 2670can queue a resize itself. 2671 2672This function is only useful for container implementations and never should be 2673called by an application. 2674 2675@table @var 2676@item widget 2677a @code{<gtk-widget>} 2678 2679@item is-visible 2680if @samp{@code{#t}}, @var{widget} should be mapped along with its parent. 2681 2682@end table 2683 2684@end deffn 2685 2686@deffn Function gtk-widget-set-size-request (self@tie{}@code{<gtk-widget>}) (width@tie{}@code{int}) (height@tie{}@code{int}) 2687@deffnx Method set-size-request 2688Sets the minimum size of a widget; that is, the widget's size request will be 2689@var{width} by @var{height}. You can use this function to force a widget to be 2690either larger or smaller than it normally would be. 2691 2692In most cases, @code{gtk-window-set-default-size} is a better choice for 2693toplevel windows than this function; setting the default size will still allow 2694users to shrink the window. Setting the size request will force them to leave 2695the window at least as large as the size request. When dealing with window 2696sizes, @code{gtk-window-set-geometry-hints} can be a useful function as well. 2697 2698Note the inherent danger of setting any fixed size - themes, translations into 2699other languages, different fonts, and user action can all change the appropriate 2700size for a given widget. So, it's basically impossible to hardcode a size that 2701will always be correct. 2702 2703The size request of a widget is the smallest size a widget can accept while 2704still functioning well and drawing itself correctly. However in some strange 2705cases a widget may be allocated less than its requested size, and in many cases 2706a widget may be allocated more space than it requested. 2707 2708If the size request in a given direction is -1 (unset), then the "natural" size 2709request of the widget will be used instead. 2710 2711Widgets can't actually be allocated a size less than 1 by 1, but you can pass 27120,0 to this function to mean "as small as possible." 2713 2714@table @var 2715@item widget 2716a @code{<gtk-widget>} 2717 2718@item width 2719width @var{widget} should request, or -1 to unset 2720 2721@item height 2722height @var{widget} should request, or -1 to unset 2723 2724@end table 2725 2726@end deffn 2727 2728@deffn Function gtk-widget-thaw-child-notify (self@tie{}@code{<gtk-widget>}) 2729@deffnx Method thaw-child-notify 2730Reverts the effect of a previous call to @code{gtk-widget-freeze-child-notify}. 2731This causes all queued "child-notify" signals on @var{widget} to be emitted. 2732 2733@table @var 2734@item widget 2735a @code{<gtk-widget>} 2736 2737@end table 2738 2739@end deffn 2740 2741@deffn Function gtk-widget-set-no-show-all (self@tie{}@code{<gtk-widget>}) (no_show_all@tie{}@code{bool}) 2742@deffnx Method set-no-show-all 2743Sets the "no_show_all" property, which determines whether calls to 2744@code{gtk-widget-show-all} and @code{gtk-widget-hide-all} will affect this 2745widget. 2746 2747This is mostly for use in constructing widget hierarchies with externally 2748controlled visibility, see @code{<gtk-ui-manager>}. 2749 2750@table @var 2751@item widget 2752a @code{<gtk-widget>} 2753 2754@item no-show-all 2755the new value for the "no_show_all" property 2756 2757@end table 2758 2759Since 2.4 2760 2761@end deffn 2762 2763@deffn Function gtk-widget-get-no-show-all (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 2764@deffnx Method get-no-show-all 2765Returns the current value of the "no_show_all" property, which determines 2766whether calls to @code{gtk-widget-show-all} and @code{gtk-widget-hide-all} will 2767affect this widget. 2768 2769@table @var 2770@item widget 2771a @code{<gtk-widget>} 2772 2773@item ret 2774the current value of the "no_show_all" property. 2775 2776@end table 2777 2778Since 2.4 2779 2780@end deffn 2781 2782@deffn Function gtk-widget-list-mnemonic-labels (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{glist-of}) 2783@deffnx Method list-mnemonic-labels 2784Returns a newly allocated list of the widgets, normally labels, for which this 2785widget is a the target of a mnemonic (see for example, 2786@code{gtk-label-set-mnemonic-widget}). 2787 2788The widgets in the list are not individually referenced. If you want to iterate 2789through the list and perform actions involving callbacks that might destroy the 2790widgets, you @emph{must} call @samp{g_list_foreach (result, (GFunc)g_object_ref, 2791NULL)} first, and then unref all the widgets afterwards. 2792 2793@table @var 2794@item widget 2795a @code{<gtk-widget>} 2796 2797@item ret 2798the list of mnemonic labels; free this list with @code{g-list-free} when you are 2799done with it. 2800 2801@end table 2802 2803Since 2.4 2804 2805@end deffn 2806 2807@deffn Function gtk-widget-add-mnemonic-label (self@tie{}@code{<gtk-widget>}) (label@tie{}@code{<gtk-widget>}) 2808@deffnx Method add-mnemonic-label 2809Adds a widget to the list of mnemonic labels for this widget. (See 2810@code{gtk-widget-list-mnemonic-labels}). Note the list of mnemonic labels for 2811the widget is cleared when the widget is destroyed, so the caller must make sure 2812to update its internal state at this point as well, by using a connection to the 2813::destroy signal or a weak notifier. 2814 2815@table @var 2816@item widget 2817a @code{<gtk-widget>} 2818 2819@item label 2820a @code{<gtk-widget>} that acts as a mnemonic label for @var{widget}. 2821 2822@end table 2823 2824Since 2.4 2825 2826@end deffn 2827 2828@deffn Function gtk-widget-remove-mnemonic-label (self@tie{}@code{<gtk-widget>}) (label@tie{}@code{<gtk-widget>}) 2829@deffnx Method remove-mnemonic-label 2830Removes a widget from the list of mnemonic labels for this widget. (See 2831@code{gtk-widget-list-mnemonic-labels}). The widget must have previously been 2832added to the list with @code{gtk-widget-add-mnemonic-label}. 2833 2834@table @var 2835@item widget 2836a @code{<gtk-widget>} 2837 2838@item label 2839a @code{<gtk-widget>} that was previously set as a mnemnic label for 2840@var{widget} with @code{gtk-widget-add-mnemonic-label}. 2841 2842@end table 2843 2844Since 2.4 2845 2846@end deffn 2847 2848@deffn Function gtk-widget-get-action (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{<gtk-action>}) 2849@deffnx Method get-action 2850Returns the @code{<gtk-action>} that @var{widget} is a proxy for. See also 2851@code{gtk-action-get-proxies}. 2852 2853@table @var 2854@item widget 2855a @code{<gtk-widget>} 2856 2857@item ret 2858the action that a widget is a proxy for, or @samp{@code{#f}}, if it is not 2859attached to an action. 2860 2861@end table 2862 2863Since 2.10 2864 2865@end deffn 2866 2867@deffn Function gtk-widget-is-composited (self@tie{}@code{<gtk-widget>}) @result{}@tie{} (ret@tie{}@code{bool}) 2868@deffnx Method is-composited 2869Whether @var{widget} can rely on having its alpha channel drawn correctly. On 2870X11 this function returns whether a compositing manager is running for 2871@var{widget}'s screen 2872 2873@table @var 2874@item widget 2875a @code{<gtk-widget>} 2876 2877@item ret 2878@samp{@code{#t}} if the widget can rely on its alpha channel being drawn 2879correctly. 2880 2881@end table 2882 2883Since 2.10 2884 2885@end deffn 2886 2887@deffn Function gtk-requisition-copy (self@tie{}@code{<gtk-requisition>}) @result{}@tie{} (ret@tie{}@code{<gtk-requisition>}) 2888Copies a @code{<gtk-requisition>}. 2889 2890@table @var 2891@item requisition 2892a @code{<gtk-requisition>}. 2893 2894@item ret 2895a copy of @var{requisition}. 2896 2897@end table 2898 2899@end deffn 2900 2901 2902@c %end of fragment 2903