1----------------------------------------------------------------------- 2-- GtkAda - Ada95 binding for Gtk+/Gnome -- 3-- -- 4-- Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet -- 5-- Copyright (C) 2000-2013, AdaCore -- 6-- -- 7-- This library is free software; you can redistribute it and/or -- 8-- modify it under the terms of the GNU General Public -- 9-- License as published by the Free Software Foundation; either -- 10-- version 2 of the License, or (at your option) any later version. -- 11-- -- 12-- This library is distributed in the hope that it will be useful, -- 13-- but WITHOUT ANY WARRANTY; without even the implied warranty of -- 14-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- 15-- General Public License for more details. -- 16-- -- 17-- You should have received a copy of the GNU General Public -- 18-- License along with this library; if not, write to the -- 19-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- 20-- Boston, MA 02111-1307, USA. -- 21-- -- 22-- As a special exception, if other files instantiate generics from -- 23-- this unit, or you link this unit with other files to produce an -- 24-- executable, this unit does not by itself cause the resulting -- 25-- executable to be covered by the GNU General Public License. This -- 26-- exception does not however invalidate any other reasons why the -- 27-- executable file might be covered by the GNU Public License. -- 28----------------------------------------------------------------------- 29 30-- <description> 31-- 32-- This widget is the base of the tree for displayable objects. 33-- (A displayable object is one which takes up some amount 34-- of screen real estate). It provides a common base and interface 35-- which actual widgets must adhere to. 36-- 37-- This package provides some services which might have been more appropriate 38-- in some other packages, but could not because of dependency circularities 39-- (there are for instance some functions relating to colors and colormaps). 40-- We have tried to reference these functions in the other packages as well. 41-- 42-- </description> 43-- <c_version>2.16.6</c_version> 44-- <group>Abstract base classes</group> 45 46with System; 47with Glib.Object; 48with Glib.Properties; 49with Glib.Glist; 50pragma Elaborate_All (Glib.Glist); 51with Glib.GSlist; 52pragma Elaborate_All (Glib.GSlist); 53with Glib.Values; 54 55with Pango.Context; 56with Pango.Font; 57with Pango.Layout; 58 59with Gdk.Color; 60with Gdk.Event; 61with Gdk.Bitmap; 62with Gdk.Rectangle; 63with Gdk.Region; 64with Gdk.Pixbuf; 65with Gdk.Pixmap; 66with Gdk.Types; 67with Gdk.Visual; 68with Gdk.Window; 69 70with Gtk.Accel_Group; 71with Gtk.Adjustment; 72with Gtk.Enums; 73with Gtk.Style; 74 75package Gtk.Widget is 76 type Gtk_Widget_Record is new Glib.Object.GObject_Record with private; 77 type Gtk_Widget is access all Gtk_Widget_Record'Class; 78 79 type Gtk_Requisition is record 80 Width : Gint; 81 Height : Gint; 82 end record; 83 -- Gtk_Requisition is the desired amount of screen real-estate a widget 84 -- requests to the server. Its real allocated size might be different. 85 -- See the section in the GtkAda user guide on how to create new widgets 86 -- in Ada, and the examples/base_widget directory for an example on how to 87 -- use this. 88 pragma Convention (C, Gtk_Requisition); 89 90 type Gtk_Requisition_Access is access all Gtk_Requisition; 91 pragma Convention (C, Gtk_Requisition_Access); 92 -- This type is used to create new widgets. 93 94 type Gtk_Allocation is record 95 X : Gint; 96 Y : Gint; 97 Width : Allocation_Int; 98 Height : Allocation_Int; 99 end record; 100 -- Gtk_Allocation indicates a size and position a widget was allocated. 101 -- See the section in the user guide on how to create new widgets for more 102 -- information. 103 pragma Convention (C, Gtk_Allocation); 104 105 type Gtk_Allocation_Access is access all Gtk_Allocation; 106 pragma Convention (C, Gtk_Allocation_Access); 107 -- This type is used to create new widgets. 108 109 function Get_Type return Glib.GType; 110 -- Return the internal type associated with a Gtk_Widget. 111 112 function Requisition_Get_Type return Glib.GType; 113 -- Return the internal type for a Gtk_Requisition 114 115 -------------------------------------- 116 -- Definitions for lists of widgets -- 117 -------------------------------------- 118 119 -- <doc_ignore> 120 function Convert (W : Gtk_Widget) return System.Address; 121 function Convert (W : System.Address) return Gtk_Widget; 122 -- </doc_ignore> 123 124 package Widget_List is new Glib.Glist.Generic_List (Gtk_Widget); 125 package Widget_SList is new Glib.GSlist.Generic_SList (Gtk_Widget); 126 127 ------------------------- 128 -- Widgets' life cycle -- 129 ------------------------- 130 131 procedure Destroy (Widget : access Gtk_Widget_Record); 132 -- Destroy the widget. 133 -- This emits a "destroy" signal, calls all your handlers, and then 134 -- unconnects them all. The object is then unref-ed, and if its reference 135 -- count goes down to 0, the memory associated with the object and its 136 -- user data is freed. 137 -- Note that when you destroy handlers are called, the user_data is still 138 -- available. 139 -- 140 -- When a widget is destroyed, it will break any references it holds to 141 -- other objects. If the widget is inside a container, the widget will be 142 -- removed from the container. If the widget is a toplevel (derived from 143 -- Gtk_Window), it will be removed from the list of toplevels, and the 144 -- reference GTK+ holds to it will be removed. Removing widget from its 145 -- container or the list of toplevels results in the widget being 146 -- finalized, unless you've added additional references to the widget with 147 -- Ref. 148 -- 149 -- In most cases, only toplevel widgets (windows) require explicit 150 -- destruction, because when you destroy a toplevel its children will be 151 -- destroyed as well. 152 153 procedure Destroy_Cb (Widget : access Gtk_Widget_Record'Class); 154 -- This function should be used as a callback to destroy a widget. 155 -- All it does is call Destroy on its argument, but its profile is 156 -- compatible with the handlers found in Gtk.Handlers. 157 158 procedure Unparent (Widget : access Gtk_Widget_Record'Class); 159 -- This function is only for use in widget implementations. 160 -- Should be called by implementations of the remove method 161 -- on Gtk_Container, to dissociate a child from the container. 162 -- Users should call Remove instead. 163 -- This function might be dangereous: it correctly updates widget to 164 -- reflect that it no longer belongs to its parent, however the parent 165 -- keeps an internal pointer to the widget, which will result in a 166 -- storage_error if you try to further access it. 167 168 procedure Show (Widget : access Gtk_Widget_Record); 169 -- Schedule the widget to be displayed on the screen when its parent is 170 -- also shown (emits the "show" signal). 171 -- If its ancestors are already mapped to the screen, then the widget is 172 -- immediately displayed through a call to Map below. 173 174 procedure Show_Now (Widget : access Gtk_Widget_Record); 175 -- Show the widget. 176 -- If it is an unmapped toplevel widget, wait for it to be mapped. This 177 -- creates a recursive main_loop. 178 179 procedure Hide (Widget : access Gtk_Widget_Record); 180 -- Hide the widget from the screen (emits the "hide" signal). 181 -- If Widget was visible, it is immediately hidden. 182 -- If one of its ancestor is later shown on the screen, Widget won't 183 -- appear. 184 -- Note that on some window managers, including CDE, hiding an iconified 185 -- window will not do anything. You should in addition call 186 -- Gdk.Window.Withdraw to make sure the window is properly hidden. 187 188 procedure Show_All (Widget : access Gtk_Widget_Record); 189 -- Show Widget and all its children recursively. 190 -- See also Set_Child_Visible below 191 192 procedure Hide_All (Widget : access Gtk_Widget_Record); 193 -- Hide Widget and all its children. 194 -- Note that if you simply want to delete Widget from the screen, you can 195 -- simply call the Hide subprogram on it. This procedure Hide_All should 196 -- only be used if you want to unschedule a widget to be displayed later, 197 -- not to remove an actual widget from the screen. 198 -- See also Set_Child_Visible below. 199 200 procedure Set_No_Show_All 201 (Widget : access Gtk_Widget_Record; No_Show_All : Boolean); 202 function Get_No_Show_All 203 (Widget : access Gtk_Widget_Record) return Boolean; 204 -- Sets the "no_show_all" property, which determines whether calls to 205 -- Show_All() and Hide_All() will affect this widget. 206 -- This is mostly for use in constructing widget hierarchies with 207 -- externally controlled visibility. 208 209 procedure Map (Widget : access Gtk_Widget_Record); 210 -- Map a widget to the screen. 211 -- A window is created for it on the screen (through a call to Realize) and 212 -- Widget is then drawn on the screen (if its ancestors are also mapped). 213 -- This function is recursive and will also map all the children of Widget. 214 -- 215 -- It is recommended to use the higher-level Show instead. 216 217 procedure Unmap (Widget : access Gtk_Widget_Record); 218 -- Unmap a widget from the screen. 219 -- This results in the widget being hidden, but not destroyed. It can be 220 -- shown again any time through a call to Map (provided its ancestors are 221 -- also mapped). 222 -- 223 -- It is recommended to use the higher-level Hide instead. 224 225 procedure Realize (Widget : access Gtk_Widget_Record); 226 -- Create a window for Widget and its ancestors (emit the "realize" signal) 227 -- This does not mean that the widget will appear on the screen, but 228 -- resources such as colormaps, etc. become available. 229 -- Some routines require that the widget is realized before any call. 230 -- You must set the Event_Mask before calling this routine if you want to 231 -- change it from its default value. 232 233 procedure Unrealize (Widget : access Gtk_Widget_Record); 234 -- Hide the widget from the screen and deletes the associated window. 235 -- This does not destroy the widget itself, only its server-side 236 -- resources. 237 238 generic 239 type Widget_Type is new Gtk_Widget_Record with private; 240 with procedure Realize_Proc (Widget : access Widget_Type'Class); 241 package Realize_Handling is 242 243 procedure Set_Realize (Widget : access Gtk_Widget_Record'Class); 244 -- Set the realize handler at the low level. 245 -- This is needed to replace the default realize in new widgets. 246 247 private 248 -- <doc_ignore> 249 procedure Internal_Realize (Widget : System.Address); 250 -- The wrapper passed to Gtk+. 251 pragma Convention (C, Internal_Realize); 252 -- </doc_ignore> 253 end Realize_Handling; 254 255 function Hide_On_Delete (Widget : access Gtk_Widget_Record'Class) 256 return Boolean; 257 -- Hide widget and return True. 258 -- This function is intended to be used as a callback. 259 260 procedure Set_Child_Visible 261 (Widget : access Gtk_Widget_Record; Is_Visible : Boolean); 262 function Get_Child_Visible 263 (Widget : access Gtk_Widget_Record) return Boolean; 264 -- Sets whether Widget should be mapped along with its parent when its 265 -- parent is mapped and Widget has been shown with Show. 266 -- 267 -- "mapped" indicates the moment the window is actually shown on the 268 -- screen. Show and Hide indicate your intention to show Widget on the 269 -- scree or not, but if the parent of Widget is itself not shown at that 270 -- time, the two commands Show and Hide have no immediate effect, and just 271 -- set a flag to save your intent. 272 -- Set_Child_Visible indicates that the widget shouldn't be part of the 273 -- recursive processing done by Show_All and Hide_All on the parent. You 274 -- have decided once and for all what the behavior should be, and you don't 275 -- want it to be changed by future calls to Show_All and Hide_All. 276 -- 277 -- The child visibility can be set for widget before it is added to a 278 -- container with Set_Parent, to avoid mapping children unnecessary before 279 -- immediately unmapping them. However it will be reset to its default 280 -- state of True when the widget is removed from a container. 281 -- 282 -- Note that changing the child visibility of a widget does not 283 -- queue a resize on the widget. Most of the time, the size of 284 -- a widget is computed from all visible children, whether or 285 -- not they are mapped. If this is not the case, the container 286 -- can queue a resize itself. 287 -- 288 -- This function is only useful for container implementations and 289 -- should generally not be called by an application. 290 291 function Has_Screen (Widget : access Gtk_Widget_Record) return Boolean; 292 -- Checks whether there is a Gdk_Screen is associated with 293 -- this widget. All toplevel widgets have an associated 294 -- screen, and all widgets added into a hierarchy with a toplevel 295 -- window at the top. 296 297 ---------------------- 298 -- Drawing a widget -- 299 ---------------------- 300 301 procedure Queue_Draw (Widget : access Gtk_Widget_Record); 302 -- Add a drawing request to the event queue for the whole widget. 303 -- This is more efficient than calling Draw directly, since GtkAda groups 304 -- drawing requests as much as possible to speed up the drawing process. 305 -- The actual drawing will take place as soon as GtkAda is not busy 306 -- processing other events, but before idle events. 307 308 procedure Queue_Draw_Area 309 (Widget : access Gtk_Widget_Record; 310 X : Gint; 311 Y : Gint; 312 Width : Gint; 313 Height : Gint); 314 -- Add a drawing request to the event queue for part of the widget. 315 -- This is more efficient that calling Draw directly (see Queue_Draw). 316 317 procedure Queue_Resize (Widget : access Gtk_Widget_Record); 318 -- Queue drawing requests after a resizing of the widget. 319 -- This clears the widget, and its parent if any, so that everything is 320 -- correctly redrawn. 321 -- You should not have to call this function directly. 322 -- For a Gtk_Window, check the procedure Gtk.Window.Resize instead. 323 324 procedure Queue_Resize_No_Redraw (Widget : access Gtk_Widget_Record); 325 -- This function works like Queue_Resize(), except that the 326 -- widget is not invalidated (ie will not be redrawn) 327 328 function Create_Pango_Context 329 (Widget : access Gtk_Widget_Record) return Pango.Context.Pango_Context; 330 -- Create a new Pango_Context with the appropriate colormap, font 331 -- description, and base direction for drawing text for this widget. See 332 -- also Get_Pango_Context. 333 -- The returned context must be freed by the caller. 334 335 function Create_Pango_Layout 336 (Widget : access Gtk_Widget_Record; Text : UTF8_String := "") 337 return Pango.Layout.Pango_Layout; 338 -- Return a new pango_layout that displays Text. This fully handles 339 -- internationalization, and should be the preferred way to display text, 340 -- rather than Gdk.Drawable.Draw_Text 341 -- Text must be a valid Utf8 text, see Glib.Convert. 342 343 ----------------------- 344 -- Size and position -- 345 ----------------------- 346 347 procedure Size_Request 348 (Widget : access Gtk_Widget_Record; 349 Requisition : in out Gtk_Requisition); 350 -- Emit a "size_request" event for the widget 351 352 procedure Set_Size_Request 353 (Widget : access Gtk_Widget_Record; 354 Width, Height : Gint := -1); 355 procedure Get_Size_Request 356 (Widget : access Gtk_Widget_Record; 357 Width, Height : out Gint); 358 -- Sets the minimum size of a widget; that is, the widget's size request 359 -- will be Width by Height. You can use this function to force a widget to 360 -- be either larger or smaller than it normally would be. 361 -- 362 -- In most cases, Set_Default_Size is a better choice for toplevel windows 363 -- than this function; setting the default size will still allow users to 364 -- shrink the window. Setting the size request will force them to leave the 365 -- window at least as large as the size request. When dealing with window 366 -- sizes, Gtk.Windo.Set_Geometry_Hints can be a useful function as well. 367 -- 368 -- Note the inherent danger of setting any fixed size - themes, 369 -- translations into other languages, different fonts, and user action can 370 -- all change the appropriate size for a given widget. So, it's basically 371 -- impossible to hardcode a size that will always be correct. 372 -- 373 -- The size request of a widget is the smallest size a widget can accept 374 -- while still functioning well and drawing itself correctly. However in 375 -- some strange cases a widget may be allocated less than its requested 376 -- size, and in many cases a widget may be allocated more space than it 377 -- requested. 378 -- 379 -- If the size request in a given direction is -1 (unset), then 380 -- the "natural" size request of the widget will be used instead. 381 -- 382 -- Widgets can't actually be allocated a size less than 1 by 1, but 383 -- you can pass 0,0 to this function to mean "as small as possible." 384 385 procedure Size_Allocate 386 (Widget : access Gtk_Widget_Record; 387 Allocation : Gtk_Allocation); 388 -- Emit a "size_allocate" event for the widget. 389 -- Allocation'size is first constrained to a range between 1x1 and 390 -- 32767x32767. 391 -- A clear and draw request is also queued if required. 392 393 function Get_Child_Requisition 394 (Widget : access Gtk_Widget_Record) return Gtk_Requisition; 395 -- Return the size requests by the widget. 396 -- This is the ideal size for the widget, not necessarily its actual size. 397 -- See the user guide's section on how to create new widgets for more 398 -- information on the size requisition and allocation. 399 400 function Get_Allocation_Width 401 (Widget : access Gtk_Widget_Record) return Allocation_Int; 402 -- Return the current width of the widget. 403 404 function Get_Allocation_Height 405 (Widget : access Gtk_Widget_Record) return Allocation_Int; 406 -- Return the current height of the widget. 407 408 function Get_Allocation_X (Widget : access Gtk_Widget_Record) return Gint; 409 -- Return the current position of the widget, relative to its parent. 410 411 function Get_Allocation_Y (Widget : access Gtk_Widget_Record) return Gint; 412 -- Return the current position of the widget, relative to its parent. 413 414 procedure Set_Redraw_On_Allocate 415 (Widget : access Gtk_Widget_Record; 416 Redraw_On_Allocate : Boolean); 417 -- Sets whether the entire widget is queued for drawing when its size 418 -- allocation changes. By default, this setting is %TRUE and the entire 419 -- widget is redrawn on every size change. If your widget leaves the upper 420 -- left unchanged when made bigger, turning this setting on will improve 421 -- performance. Note that for %NO_WINDOW widgets setting this flag to 422 -- %FALSE turns off all allocation on resizing: the widget will not even 423 -- redraw if its position changes; this is to allow containers that don't 424 -- draw anything to avoid excess invalidations. If you set this flag on 425 -- %NO_WINDOW widget that *does* draw on Get_Window (Widget), you are 426 -- responsible for invalidating both the old and new allocation of the 427 -- widget when the widget is moved and responsible for invalidating regions 428 -- newly when the widget increases size. 429 430 ------------------ 431 -- Accelerators -- 432 ------------------ 433 434 procedure Add_Accelerator 435 (Widget : access Gtk_Widget_Record; 436 Accel_Signal : Glib.Signal_Name; 437 Accel_Group : Gtk.Accel_Group.Gtk_Accel_Group; 438 Accel_Key : Gdk.Types.Gdk_Key_Type; 439 Accel_Mods : Gdk.Types.Gdk_Modifier_Type; 440 Accel_Flags : Gtk.Accel_Group.Gtk_Accel_Flags); 441 -- Add a new accelerator for the widget. 442 -- The signal Accel_Signal will be sent to Widget when the matching 443 -- key is pressed and the widget has the focus. 444 -- Consider using Gtk.Accel_Map.Add_Entry instead, which is compatible with 445 -- interactive change of accelerators by the user. 446 447 procedure Remove_Accelerator 448 (Widget : access Gtk_Widget_Record; 449 Accel_Group : Gtk.Accel_Group.Gtk_Accel_Group; 450 Accel_Key : Gdk.Types.Gdk_Key_Type; 451 Accel_Mods : Gdk.Types.Gdk_Modifier_Type); 452 -- Remove an accelerator for the widget. 453 454 function Can_Activate_Accel 455 (Widget : access Gtk_Widget_Record; 456 Signal_Id : Gulong) return Boolean; 457 -- Determines whether an accelerator that activates the signal identified 458 -- by Signal_Id can currently be activated. This is done by emitting the 459 -- GtkWidget::can-activate-accel signal on Widget; if the signal isn't 460 -- overridden by handler or in a derived widget, then the default check is 461 -- that the widget must be sensitive, and the widget and all its ancestors 462 -- mapped. 463 -- Signal_Id comes from the value returned by Gtk.Handlers.Connect 464 465 procedure Set_Accel_Path 466 (Widget : access Gtk_Widget_Record; 467 Accel_Path : UTF8_String; 468 Group : Gtk.Accel_Group.Gtk_Accel_Group); 469 -- Set the path that will be used to reference the widget in calls to the 470 -- subprograms in Gtk.Accel_Map. This means, for instance, that the widget 471 -- is fully setup for interactive modification of the shortcuts by the 472 -- user, should he choose to activate this possibility in his themes (see 473 -- gtk-accel_map.ads for more information). 474 475 function List_Mnemonic_Labels 476 (Widget : access Gtk_Widget_Record) 477 return Widget_List.Glist; 478 -- Returns a newly allocated list of the widgets, normally labels, for 479 -- which this widget is a the target of a mnemonic (see for example, 480 -- gtk.label.set_mnemonic_widget). 481 -- The widgets in the list are not individually referenced. If you want to 482 -- iterate through the list and perform actions involving callbacks that 483 -- might destroy the widgets, you must call Ref first, and then unref all 484 -- the widgets afterwards. 485 -- The caller must free the returned list. 486 487 procedure Add_Mnemonic_Label 488 (Widget : access Gtk_Widget_Record; 489 Label : access Gtk_Widget_Record'Class); 490 -- Adds a widget to the list of mnemonic labels for this widget. (See 491 -- List_Mnemonic_Labels). Note the list of mnemonic labels for the widget 492 -- is cleared when the widget is destroyed, so the caller must make sure to 493 -- update its internal state at this point as well, by using a connection 494 -- to the ::destroy signal or a weak notifier. 495 496 procedure Remove_Mnemonic_Label 497 (Widget : access Gtk_Widget_Record; 498 Label : access Gtk_Widget_Record'Class); 499 -- Removes a widget from the list of mnemonic labels for this widget. The 500 -- widget must have previously been added to the list with 501 -- Add_Mnemonic_Label. 502 503 function Mnemonic_Activate 504 (Widget : access Gtk_Widget_Record; 505 Group_Cycling : Boolean) return Boolean; 506 -- Emits the signal "mnemonic_activate". 507 -- In general (depending on what is connected to this signal), this results 508 -- in calling the "activate" signal on the widget, as if a mnemonic had 509 -- been used (when Group_Cycling if False), or to grab the focus on the 510 -- widget when Group_Cycling is True) 511 512 ------------------------- 513 -- Events and signals -- 514 ------------------------- 515 516 function Event 517 (Widget : access Gtk_Widget_Record'Class; 518 Event : Gdk.Event.Gdk_Event) return Boolean; 519 -- Emit a signal on the widget. 520 -- The exact signal depends on the event type (i.e. if the type is 521 -- Gdk_Button_Press, then a "button_press" signal is emitted). 522 523 procedure Send_Expose 524 (Widget : access Gtk_Widget_Record; 525 Event : Gdk.Event.Gdk_Event_Expose); 526 -- Emit an expose event signals on a widget. 527 -- This function is not normally used directly. The only time it is used 528 -- is when propagating an expose event to a child No_Window widget, and 529 -- that is normally done using Gtk.Container.Propagate_Expose. 530 -- 531 -- If you want to force an area of a window to be redrawn, 532 -- use Gdk.Window.Invalidate_Rect or Gdk.Window.Invalidate_Region. 533 -- To cause the redraw to be done immediately, follow that call 534 -- with a call to Gdk.Window.Process_Updates. 535 536 procedure Activate (Widget : access Gtk_Widget_Record); 537 -- Emit an activate signal on the widget. 538 -- The exact signal emitted depends on the widget type (i.e. for a 539 -- Gtk_Button this emits a "clicked" signal, for a Gtk_Editable this emits 540 -- the "activate" signal, ...). 541 542 procedure Grab_Focus (Widget : access Gtk_Widget_Record); 543 -- Emit the "grab_focus" signal for the widget. 544 -- This is sent when the widget gets the focus. Its visual aspect might 545 -- change. 546 -- The "Can_Focus" flag must have been set first. 547 -- See also Gtk.Widget.Child_Focus, which should be used instead when 548 -- writting new widgets in Ada 549 550 function Is_Focus (Widget : access Gtk_Widget_Record) return Boolean; 551 -- Determines if the widget is the focus widget within its 552 -- toplevel. (This does not mean that the HAS_FOCUS flag is 553 -- necessarily set; HAS_FOCUS will only be set if the 554 -- toplevel widget additionally has the global input focus) 555 556 function Child_Focus 557 (Child : access Gtk_Widget_Record'Class; 558 Direction : Gtk.Enums.Gtk_Direction_Type := Gtk.Enums.Dir_Tab_Forward) 559 return Boolean; 560 -- Used by custom widget implementations to indicate the focus child. 561 -- If you're writing an app, you'd use Grab_Focus to move the focus to a 562 -- particular widget, and Gtk.Container.Set_Focus_Chain to change the focus 563 -- tab order. So you may want to investigate those functions instead. 564 -- 565 -- Child_Focus is called by containers as the user moves around 566 -- the window using keyboard shortcuts. Direction indicates what kind of 567 -- motion is taking place (up, down, left, right, tab forward, tab 568 -- backward). Child_Focus invokes the "focus" signal on Child; 569 -- widgets override the default handler for this signal in order to 570 -- implement appropriate focus behavior. 571 -- 572 -- The "focus" default handler for a widget should return True if moving in 573 -- Direction left the focus on a focusable location inside that widget, and 574 -- False if moving in Direction moved the focus outside the widget. If 575 -- returning True, widgets normally call Grab_Focus to place the 576 -- focus accordingly; if returning False, they don't modify the current 577 -- focus location. 578 -- 579 -- This function replaces Gtk.Container.Focus from GTK+ 1.2. It was 580 -- necessary to check that the child was visible, sensitive, and focusable 581 -- before calling Gtk.Container.Focus. Child_Focus returns False 582 -- if the widget is not currently in a focusable state, so there's no need 583 -- for those checks. 584 -- 585 -- Return value: True if focus ended up inside Child 586 587 procedure Set_Events 588 (Widget : access Gtk_Widget_Record; 589 Events : Gdk.Event.Gdk_Event_Mask); 590 function Get_Events 591 (Widget : access Gtk_Widget_Record) return Gdk.Event.Gdk_Event_Mask; 592 -- Sets or gets the event mask for the widget. 593 -- Widget should not have been realized before, or nothing is done. 594 -- This is the only way you can explicitly get mouse or keyboards events on 595 -- widgets that do not automatically get them, as for instance in a 596 -- Gtk_Drawing_Area. 597 598 procedure Add_Events 599 (Widget : access Gtk_Widget_Record; 600 Events : Gdk.Event.Gdk_Event_Mask); 601 -- Add some events to the current event mask of the widget. 602 603 procedure Set_Extension_Events 604 (Widget : access Gtk_Widget_Record; 605 Mode : Gdk.Types.Gdk_Extension_Mode); 606 function Get_Extension_Events 607 (Widget : access Gtk_Widget_Record) return Gdk.Types.Gdk_Extension_Mode; 608 -- Set the extension event mask for the widget. 609 -- This is used to activate some special input modes for other devices than 610 -- keyboard and mouse. 611 612 function Default_Motion_Notify_Event 613 (Widget : access Gtk_Widget_Record'Class; 614 Event : Gdk.Event.Gdk_Event) return Gint; 615 -- Access to the standard default callback for motion events: 616 -- This is mainly used for rulers in Gtk.Ruler (See the example in 617 -- testgtk, with create_rulers.adb) 618 619 function Has_Default_Motion_Notify_Handler 620 (Widget : access Gtk_Widget_Record'Class) return Boolean; 621 -- Return True if Widget has a default handler for motion_notify events. 622 -- Note that the function Default_Motion_Notify_Event should not be called 623 -- if this one returns False, since it would create a segmentation fault. 624 625 procedure Error_Bell (Widget : access Gtk_Widget_Record); 626 -- Notifies the user about an input-related error on this widget. 627 -- If the GtkSettings:gtk-error-bell setting is True, it calls 628 -- Gdk_Window_Beep, otherwise it does nothing. 629 -- 630 -- Note that the effect of Gdk_Window_Beep can be configured in many 631 -- ways, depending on the windowing backend and the desktop environment 632 -- or window manager that is used. 633 634 function Keynav_Failed 635 (Widget : access Gtk_Widget_Record; 636 Direction : Gtk.Enums.Gtk_Direction_Type) 637 return Boolean; 638 -- This function should be called whenever keyboard navigation within 639 -- a single widget hits a boundary. The function emits the 640 -- GtkWidget::keynav-failed signal on the widget and its return 641 -- value should be interpreted in a way similar to the return value of 642 -- Child_Focus. 643 -- 644 -- When True is returned, stay in the widget, the failed keyboard 645 -- navigation is Ok and/or there is nowhere we can/should move the 646 -- focus to. 647 -- 648 -- When False is returned, the caller should continue with keyboard 649 -- navigation outside the widget, e.g. by calling Child_Focus on the 650 -- widget's toplevel. 651 -- 652 -- The default ::keynav-failed handler returns True for 653 -- Dir_Tab_Forward and Dir_Tab_Backward. For the other values of 654 -- Gtk_Direction_Type, it looks at the 655 -- GtkSettings:gtk-keynav-cursor-only setting and returns False 656 -- if the setting is True. This way the entire user interface 657 -- becomes cursor-navigatable on input devices such as mobile phones 658 -- which only have cursor keys but no tab key. 659 -- 660 -- Whenever the default handler returns True, it also calls 661 -- Error_Bell to notify the user of the failed keyboard navigation. 662 -- 663 -- A use case for providing an own implementation of ::keynav-failed 664 -- (either by connecting to it or by overriding it) would be a row of 665 -- Gtk_Entry widgets where the user should be able to navigate the 666 -- entire row with the cursor keys, as e.g. known from user interfaces 667 -- that require entering license keys. 668 669 -------------------------- 670 -- Colors and colormaps -- 671 -------------------------- 672 673 procedure Set_Colormap 674 (Widget : access Gtk_Widget_Record; 675 Cmap : Gdk.Color.Gdk_Colormap); 676 function Get_Colormap 677 (Widget : access Gtk_Widget_Record) return Gdk.Color.Gdk_Colormap; 678 -- Modify the colormap of the widget. 679 -- The widget must not have been realized when you set the colormap. 680 -- The colormap is generally the same one for all widget, but might be 681 -- different if for instance Gtk_Drawing_Area needs to display some 682 -- different colors on a screen that only has a limited amount of colors. 683 684 function Get_Visual 685 (Widget : access Gtk_Widget_Record) return Gdk.Visual.Gdk_Visual; 686 -- Get the visual used for the widget. 687 -- I.e. the structure that indicates the depth of the widget (number of 688 -- bits per pixel), and some information used internally by GtkAda to 689 -- handle colors and colormaps. 690 691 procedure Push_Colormap (Cmap : Gdk.Color.Gdk_Colormap); 692 procedure Pop_Colormap; 693 -- Modify temporarily the default colormap set for newly created widgets. 694 -- You should use this in pair with Pop_Colormap (Push the new value, 695 -- create the widget, and pop the value). 696 697 procedure Set_Default_Colormap (Cmap : Gdk.Color.Gdk_Colormap); 698 function Get_Default_Colormap return Gdk.Color.Gdk_Colormap; 699 -- Modify permanently the default colormap used when a widget is created. 700 -- If you only want to modify this colormap temporarily for a few widgets, 701 -- you should consider using Push_Colormap and Pop_Colormap instead. 702 -- See also Gdk.Screen.Get_Default_Colormap for a multihead-aware version 703 704 function Get_Default_Visual return Gdk.Visual.Gdk_Visual; 705 -- Return the default visual used when a new widget is created. 706 707 function Is_Composited (Widget : access Gtk_Widget_Record) return Boolean; 708 -- Returns whether Widget can rely on having its alpha channel 709 -- drawn correctly. On X11 this function returns whether a 710 -- compositing manager is running for Widget's screen. 711 -- 712 -- Please note that the semantics of this call will change 713 -- in the future if used on a widget that has a composited 714 -- window in its hierarchy (as set by Gdk.Window.Set_Composited). 715 716 ------------ 717 -- Styles -- 718 ------------ 719 720 procedure Set_Style 721 (Widget : access Gtk_Widget_Record; 722 Style : Gtk.Style.Gtk_Style); 723 function Get_Style (Widget : access Gtk_Widget_Record) 724 return Gtk.Style.Gtk_Style; 725 -- Set or get the style for a given widget. 726 -- See also Gtk.Rc.Modify_Style 727 728 function Get_Default_Style return Gtk.Style.Gtk_Style; 729 -- Get the default global style. 730 731 procedure Ensure_Style (Widget : access Gtk_Widget_Record); 732 -- Make sure that the widget has a style associated to it. 733 -- Either the default one as set by Set_Default_Style above or one set by 734 -- the user with Set_Style. 735 736 procedure Restore_Default_Style (Widget : access Gtk_Widget_Record); 737 -- Restore the default style that was set for the widget. 738 -- The default style is the first one that was set either by a call 739 -- to Set_Style or Set_Default_Style. 740 741 procedure Reset_Rc_Styles (Widget : access Gtk_Widget_Record); 742 -- Restore the Rc style recursively for widget and its children. 743 744 function Get_Pango_Context (Widget : access Gtk_Widget_Record) 745 return Pango.Context.Pango_Context; 746 -- Get a Pango_Context with the appropriate colormap, font description and 747 -- base direction for this widget. Unlike the context returned by 748 -- Create_Pango_Context, this context is owned by the widget (it can be 749 -- used as long as widget exists), and will be updated to match any changes 750 -- to the widget's attributes. 751 -- 752 -- If you create and keep a Pango_Layout using this context, you must deal 753 -- with changes to the context by calling Pango_Layout.Context_Changed on 754 -- the layout in response to the ::style_set and ::direction_set signals 755 -- for the widget. 756 757 procedure Modify_Fg 758 (Widget : access Gtk_Widget_Record; 759 State_Type : Enums.Gtk_State_Type; 760 Color : Gdk.Color.Gdk_Color); 761 -- Sets the foreground color for a widget in a particular state. All 762 -- other style values are left untouched. 763 764 procedure Modify_Bg 765 (Widget : access Gtk_Widget_Record; 766 State_Type : Enums.Gtk_State_Type; 767 Color : Gdk.Color.Gdk_Color); 768 -- Sets the background color for a widget in a particular state. All 769 -- other style values are left untouched. This procedure has no effect 770 -- when Widget has no physical window associated to it (for instance 771 -- a Gtk_Label). In such cases, you must put widget inside a 772 -- Gtk_Event_Box, and set the background color of the box itself. 773 774 procedure Modify_Text 775 (Widget : access Gtk_Widget_Record; 776 State_Type : Enums.Gtk_State_Type; 777 Color : Gdk.Color.Gdk_Color); 778 -- Sets the text color for a widget in a particular state. All other 779 -- style values are left untouched. The text color is the foreground 780 -- color used along with the base color (see Modify_Base) 781 -- for widgets such as Gtk_Entry and Gtk_Text_View. 782 -- 783 -- Note that this will not work with a Gtk_Button. Modify_Fg should be 784 -- called on the button's label in order to set the color of its label. 785 -- For example, assuming a simple button with a label attached to it: 786 -- 787 -- Modify_Fg (Get_Child (My_Button), My_State, My_New_Color); 788 789 procedure Modify_Base 790 (Widget : access Gtk_Widget_Record; 791 State_Type : Enums.Gtk_State_Type; 792 Color : Gdk.Color.Gdk_Color); 793 -- Sets the base color for a widget in a particular state. 794 -- All other style values are left untouched. The base color 795 -- is the background color used along with the text color 796 -- (see Modify_Text) for widgets such as Gtk_Entry and Gtk_Text_View. 797 798 procedure Modify_Font 799 (Widget : access Gtk_Widget_Record; 800 Desc : Pango.Font.Pango_Font_Description); 801 -- Modify the font used for the widget. 802 -- Desc must be freed by the caller to avoid memory leaks 803 804 procedure Set_Default_Direction (Dir : Gtk.Enums.Gtk_Text_Direction); 805 function Get_Default_Direction return Gtk.Enums.Gtk_Text_Direction; 806 -- Obtains the current default reading direction. See 807 -- Set_Default_Direction(). 808 809 procedure Set_Direction 810 (Widget : access Gtk_Widget_Record; Dir : Gtk.Enums.Gtk_Text_Direction); 811 function Get_Direction 812 (Widget : access Gtk_Widget_Record) return Gtk.Enums.Gtk_Text_Direction; 813 -- Sets the reading direction on a particular widget. This direction 814 -- controls the primary direction for widgets containing text, 815 -- and also the direction in which the children of a container are 816 -- packed. The ability to set the direction is present in order 817 -- so that correct localization into languages with right-to-left 818 -- reading directions can be done. Generally, applications will 819 -- let the default reading direction present, except for containers 820 -- where the containers are arranged in an order that is explicitely 821 -- visual rather than logical (such as buttons for text justification). 822 -- 823 -- If the direction is set to TEXT_DIR_NONE, then the value 824 -- set by Set_Default_Direction will be used. 825 826 procedure Modify_Cursor 827 (Widget : access Gtk_Widget_Record; 828 Primary : Gdk.Color.Gdk_Color; 829 Secondary : Gdk.Color.Gdk_Color); 830 -- Sets the cursor color to use in a widget, overriding the 831 -- GtkWidget:cursor-color and GtkWidget:secondary-cursor-color 832 -- style properties. All other style values are left untouched. 833 -- See also Gtk.Rc.Modify_Style. 834 835 ------------------- 836 -- Widgets' tree -- 837 ------------------- 838 839 procedure Set_Name 840 (Widget : access Gtk_Widget_Record; 841 Name : UTF8_String); 842 -- Set the name for the widget. 843 -- This name is used purely internally to identify the widget, and does not 844 -- give any visual clue. 845 846 function Get_Name (Widget : access Gtk_Widget_Record) return UTF8_String; 847 -- Return the name of the widget if it was set by Set_Name. 848 -- Return the name of its class otherwise. 849 850 function Path (Widget : access Gtk_Widget_Record) return String; 851 function Path_Reversed (Widget : access Gtk_Widget_Record) return String; 852 -- Obtains the full path to Widget. The path is simply the name of a 853 -- widget and all its parents in the container hierarchy, separated by 854 -- periods. The name of a widget comes from 855 -- Get_Name. Paths are used to apply styles to a widget 856 -- in gtkrc configuration files. Widget names are the type of the 857 -- widget by default (e.g. "GtkButton") or can be set to an 858 -- application-specific value with Set_Name. By setting 859 -- the name of a widget, you allow users or theme authors to apply 860 -- styles to that specific widget in their gtkrc 861 -- file. 862 -- Path_Reverse fills in the path in reverse order, starting with widget's 863 -- name instead of starting with the name of the outermost ancestor. 864 865 function Class_Path (Widget : access Gtk_Widget_Record) return String; 866 function Class_Path_Reversed 867 (Widget : access Gtk_Widget_Record) return String; 868 -- Same as Path(), but always uses the name of a widget's type, 869 -- never uses a custom name set with Set_Name. 870 871 function Get_Ancestor 872 (Widget : access Gtk_Widget_Record; 873 Ancestor_Type : Gtk_Type) return Gtk_Widget; 874 -- Return the closest ancestor of Widget which is of type Ancestor_Type. 875 -- Return null if there is none. 876 877 procedure Set_Parent 878 (Widget : access Gtk_Widget_Record; 879 Parent : access Gtk_Widget_Record'Class); 880 function Get_Parent (Widget : access Gtk_Widget_Record) return Gtk_Widget; 881 -- Modify the parent for the widget. 882 -- This is not the recommended way to do this, you should use 883 -- Gtk.Container.Add or Gtk.Box.Pack_Start instead. 884 885 procedure Set_Parent_Window 886 (Widget : access Gtk_Widget_Record; 887 Window : Gdk.Window.Gdk_Window); 888 function Get_Parent_Window 889 (Widget : access Gtk_Widget_Record) return Gdk.Window.Gdk_Window; 890 -- Set the parent window for the actual Gdk_Window of the widget. This sets 891 -- up required internal fields, and should be used only when you implement 892 -- your own container, as opposed to using one of the standard containers. 893 894 function Get_Toplevel (Widget : access Gtk_Widget_Record) return Gtk_Widget; 895 -- This function returns the topmost widget in the container hierarchy 896 -- Widget is a part of. If Widget has no parent widgets, it will be 897 -- returned as the topmost widget. 898 -- 899 -- Note the difference in behavior vs. Get_Ancestor: 900 -- Get_Ancestor (Widget, GTK_TYPE_WINDOW) would return null 901 -- if Widget wasn't inside a toplevel window, and if the 902 -- window was inside a Gtk_Window-derived widget which was in turn 903 -- inside the toplevel Gtk_Window. While the second case may 904 -- seem unlikely, it actually happens when a Gtk_Plug is embedded 905 -- inside a Gtk_Socket within the same application. 906 -- 907 -- To reliably find the toplevel Gtk_Window, use 908 -- Get_Toplevel and check if the "toplevel" flag 909 -- is set on the result: 910 -- 911 -- Toplevel := Get_Toplevel (Widget); 912 -- if Top_Level_Is_Set (Toplevel) then 913 -- [ Perform some action on Toplevel. ] 914 -- end if; 915 916 function Is_Ancestor 917 (Widget : access Gtk_Widget_Record; 918 Ancestor : access Gtk_Widget_Record'Class) return Boolean; 919 -- Return True if Ancestor is in the ancestor tree for Widget. 920 -- I.e. if Widget is contained within Ancestor. 921 922 procedure Reparent 923 (Widget : access Gtk_Widget_Record; 924 New_Parent : access Gtk_Widget_Record'Class); 925 -- Change the parent of the widget dynamically. 926 -- If both the new parent and the widget are shown, then the widget is 927 -- visually redrawn in its new parent. 928 929 procedure Translate_Coordinates 930 (Src_Widget : Gtk_Widget; 931 Dest_Widget : Gtk_Widget; 932 Src_X : Gint; 933 Src_Y : Gint; 934 Dest_X : out Gint; 935 Dest_Y : out Gint; 936 Result : out Boolean); 937 -- Translate coordinates relative to Src_Widget's allocation to coordinates 938 -- relative to Dest_Widget's allocations. In order to perform this 939 -- operation, both widgets must be realized, and must share a common 940 -- toplevel. 941 -- 942 -- Result is set to False if either widget was not realized, or there 943 -- was no common ancestor. In this case, nothing is stored in Dest_X and 944 -- Dest_Y. Otherwise True. 945 946 function Get_Root_Window 947 (Widget : access Gtk_Widget_Record) return Gdk.Window.Gdk_Window; 948 -- Get the root window where this widget is located. This function can only 949 -- be called after the widget has been added to a widget hierarchy. 950 -- 951 -- The root window is useful for such purposes as creating a popup 952 -- Gdk_Window associated with the window. In general, you should only 953 -- create display specific resources when a widget has been realized, and 954 -- you should free those resources when the widget is unrealized. 955 956 procedure Set_Composite_Name 957 (Widget : access Gtk_Widget_Record; Name : String); 958 function Get_Composite_Name 959 (Widget : access Gtk_Widget_Record) return String; 960 -- Sets or gets a widgets composite name. The widget must be 961 -- a composite child of its parent; see Push_Composite_Child. 962 963 procedure Push_Composite_Child; 964 procedure Pop_Composite_Child; 965 -- Makes all newly-created widgets as composite children until 966 -- the corresponding Pop_Composite_Child call. 967 -- 968 -- A composite child is a child that's an implementation detail of the 969 -- container it's inside and should not be visible to people using the 970 -- container. Composite children aren't treated differently by GTK (but 971 -- see gtk.container.foreach() vs. gtk.container.forall()), but e.g. GUI 972 -- builders might want to treat them in a different way. 973 -- 974 -- Here is a simple example: 975 -- Push_Composite_Child; 976 -- Gtk_New (Scrolled_Window.Hscrollbar, Hadjustment); 977 -- Set_Composite_Name (Scrolled_Window.Hscrollbar, "hscrollbar"); 978 -- Pop_Composite_Child; 979 -- Set_Parent (Scrolled_Window.Hscrollbar, Scrolled_Window); 980 -- Ref (Scrolled_Window.Hscrollbar); 981 982 -------------------- 983 -- Misc functions -- 984 -------------------- 985 986 procedure Set_Scroll_Adjustments 987 (Widget : access Gtk_Widget_Record; 988 Hadj : Gtk.Adjustment.Gtk_Adjustment; 989 Vadj : Gtk.Adjustment.Gtk_Adjustment); 990 -- Emit the "set_scroll_adjustments" signal. 991 -- The exact signal emitted depends on the widget type (see 992 -- Glib.Object.Initialize_Class_Record). 993 -- The handler creates the adjustments if null is passed as argument, and 994 -- makes sure both adjustments are in the correct range. 995 996 function Intersect 997 (Widget : access Gtk_Widget_Record; 998 Area : Gdk.Rectangle.Gdk_Rectangle; 999 Intersection : access Gdk.Rectangle.Gdk_Rectangle) return Boolean; 1000 -- Return True if the widget intersects the screen area Area. 1001 -- The intersection area is returned in Intersection. 1002 1003 function Region_Intersect 1004 (Widget : access Gtk_Widget_Record; 1005 Region : Gdk.Region.Gdk_Region) 1006 return Gdk.Region.Gdk_Region; 1007 -- Region must be in the same coordinate system as the widget's allocation, 1008 -- ie relative to the widget's window, or to the parent's window for 1009 -- No_Window widgets. 1010 -- Returns a newly allocated region. The coordinats are in the same system 1011 -- as described above. 1012 -- Computes the intersection of a Widget's area and Region, returning 1013 -- the intersection. The result may be empty, use gdk.region.empty to 1014 -- check. 1015 1016 procedure Grab_Default (Widget : access Gtk_Widget_Record); 1017 -- The widget becomes the default widget for its parent window or dialog. 1018 -- All keyboard events will be sent to it if no other widget has the focus. 1019 -- Note that the "Can_Default" flag must have been set first on WIDGET. 1020 1021 procedure Set_State 1022 (Widget : access Gtk_Widget_Record; 1023 State : Enums.Gtk_State_Type); 1024 function Get_State 1025 (Widget : access Gtk_Widget_Record) return Enums.Gtk_State_Type; 1026 -- Modify the state of the widget. 1027 -- This modifies its visual aspect, and thus should be used only if you 1028 -- change its behavior at the same time, so as not to confuse the user. 1029 1030 procedure Set_Sensitive 1031 (Widget : access Gtk_Widget_Record; 1032 Sensitive : Boolean := True); 1033 -- Modify the sensitivity of the widget. 1034 -- An insensitive widget is generally grayed out, and can not be activated. 1035 -- For instance, an insensitive menu item is grayed, and can never be 1036 -- selected. 1037 1038 procedure Set_App_Paintable 1039 (Widget : access Gtk_Widget_Record; 1040 App_Paintable : Boolean); 1041 -- Modify the "App_Paintable" flag for the widget. 1042 1043 procedure Set_Double_Buffered 1044 (Widget : access Gtk_Widget_Record; 1045 Double_Buffered : Boolean := True); 1046 -- Modify the "Double_Buffered" flag for the widget. 1047 1048 procedure Get_Pointer 1049 (Widget : access Gtk_Widget_Record; 1050 X : out Gint; 1051 Y : out Gint); 1052 -- Return the coordinates of the pointer (i.e. mouse) relative to Widget. 1053 1054 procedure Set_Window 1055 (Widget : access Gtk_Widget_Record; 1056 Window : Gdk.Window.Gdk_Window); 1057 function Get_Window 1058 (Widget : access Gtk_Widget_Record) return Gdk.Window.Gdk_Window; 1059 -- Set the Gdk window associated with the widget. 1060 -- You can use this window if you need to draw directly on the widget using 1061 -- the functions found in the Gdk hierarchy. 1062 -- These functions are rarely used except when you implement your own own 1063 -- widget types. Predefined widgets takes care of that automatically. 1064 1065 procedure Shape_Combine_Mask 1066 (Widget : access Gtk_Widget_Record; 1067 Shape_Mask : Gdk.Bitmap.Gdk_Bitmap; 1068 Offset_X : Gint; 1069 Offset_Y : Gint); 1070 -- Modify the shape of the window that contains the widget. 1071 -- This allows for transparent windows, and requires the Xext library to be 1072 -- available on your system. If this library is not available, your program 1073 -- will still work. 1074 -- See the manual page for XShapeCombineMask(3x) for more information. 1075 1076 procedure Input_Shape_Combine_Mask 1077 (Widget : access Gtk_Widget_Record; 1078 Shape_Mask : Gdk.Bitmap.Gdk_Bitmap; 1079 Offset_X : Gint; 1080 Offset_Y : Gint); 1081 -- Sets an input shape for this widget's GDK window. This allows for 1082 -- windows which react to mouse click in a nonrectangular region, see 1083 -- Gdk.Window.Input_Shape_Combine_Mask for more information. 1084 1085 procedure Reset_Shapes (Widget : access Gtk_Widget_Record); 1086 -- Recursively resets the shape on this widget and its descendants. 1087 1088 function Render_Icon 1089 (Widget : access Gtk_Widget_Record; 1090 Stock_Id : String; 1091 Size : Gtk.Enums.Gtk_Icon_Size; 1092 Detail : UTF8_String := "") return Gdk.Pixbuf.Gdk_Pixbuf; 1093 -- A convenience function that uses the theme engine for Widget, to lookup 1094 -- a Stock_Id (see Gtk.Stock) and render it to a pixbuf (see Gdk.Pixbuf). 1095 -- Detail should be a string that identifies the widget or code doing the 1096 -- rendering, so that the theme engine can special-case rendering for that 1097 -- widget or code. It can be left to the empty stirng to get the default 1098 -- behavior. 1099 -- 1100 -- Null is returned if Stock_Id wasn't known. 1101 1102 function Get_Snapshot 1103 (Widget : access Gtk_Widget_Record; 1104 Clip_Rect : Gdk.Rectangle.Gdk_Rectangle_Access) 1105 return Gdk.Pixmap.Gdk_Pixmap; 1106 -- Create a Gdk_Pixmap of the contents of the widget and its children. 1107 -- 1108 -- Works even if the widget is obscured. The depth and visual of the 1109 -- resulting pixmap is dependent on the widget being snapshot and likely 1110 -- differs from those of a target widget displaying the pixmap. 1111 -- The function Gdk.Pixbuf.Get_From_Drawable can be used to convert 1112 -- the pixmap to a visual independant representation. 1113 -- 1114 -- The snapshot area used by this function is the Widget's allocation plus 1115 -- any extra space occupied by additional windows belonging to this widget 1116 -- (such as the arrows of a spin button). Thus, the resulting snapshot 1117 -- pixmap is possibly larger than the allocation. 1118 -- 1119 -- If Clip_Rect is non-null, the resulting pixmap is shrunken to 1120 -- match the specified clip_rect. The (x,y) coordinates of Clip_Rect are 1121 -- interpreted widget relative. If width or height of Clip_Rect are 0 or 1122 -- negative, the width or height of the resulting pixmap will be shrunken 1123 -- by the respective amount. 1124 -- 1125 -- For instance using a Clip_Rect'(+5, +5, -10, -10) will chop off 5 pixels 1126 -- at each side of the snapshot pixmap. 1127 -- 1128 -- If non-null, Clip_Rect will contain the exact widget-relative snapshot 1129 -- coordinates upon return. A Clip_Rect of (-1, -1, 0, 0) can be used to 1130 -- preserve the auto-grown snapshot area and use Clip_Rect as a pure output 1131 -- parameter. 1132 -- 1133 -- The returned pixmap can be null, if the resulting Clip_Area was empty. 1134 1135 -------------- 1136 -- Tooltips -- 1137 -------------- 1138 1139 function Get_Tooltip_Text 1140 (Widget : access Gtk_Widget_Record) return UTF8_String; 1141 procedure Set_Tooltip_Text 1142 (Widget : access Gtk_Widget_Record; 1143 Text : UTF8_String); 1144 -- Gets/Sets text as the contents of the tooltip. This function will take 1145 -- care of setting GtkWidget::has-tooltip to TRUE and of the default 1146 -- handler for the GtkWidget::query-tooltip signal. 1147 -- 1148 -- See also the GtkWidget:tooltip-text property and Gtk_Tooltips.Set_Text. 1149 1150 function Get_Tooltip_Markup 1151 (Widget : access Gtk_Widget_Record) return UTF8_String; 1152 procedure Set_Tooltip_Markup 1153 (Widget : access Gtk_Widget_Record; 1154 Text : UTF8_String); 1155 -- Gets/Sets tooltip contents, marked up with the Pango text markup 1156 -- language. 1157 -- 1158 -- This function will take care of setting GtkWidget:has-tooltip to TRUE 1159 -- and of the default handler for the GtkWidget::query-tooltip signal. 1160 -- 1161 -- See also the GtkWidget::tooltip-markup property and 1162 -- Gtk_Tooltips.Set_Markup. 1163 1164 procedure Set_Tooltip_Window 1165 (Widget : access Gtk_Widget_Record; 1166 Custom_Window : access Gtk_Widget_Record'Class); 1167 -- Custom_Window : access Gtk.Window.Gtk_Window_Record'Class); 1168 -- 1169 -- Replaces the default, usually yellow, window used for displaying 1170 -- tooltips with custom_window. GTK+ will take care of showing and hiding 1171 -- Custom_Window at the right moment, to behave likewise as the default 1172 -- tooltip window. If Custom_Window is NULL, the default tooltip window 1173 -- will be used. 1174 1175 function Get_Tooltip_Window 1176 (Widget : access Gtk_Widget_Record) return Gtk_Widget; 1177 -- return Gtk.Window.Gtk_Window; 1178 -- 1179 -- Returns the GtkWindow of the current tooltip. This can be the GtkWindow 1180 -- created by default, or the custom tooltip window set using 1181 -- Gtk.Widget.Set_Tooltip_Window. 1182 1183 function Get_Has_Tooltip (Widget : access Gtk_Widget_Record) return Boolean; 1184 procedure Set_Has_Tooltip 1185 (Widget : access Gtk_Widget_Record; 1186 Has_Tooltip : Boolean); 1187 -- Gets/Sets the has-tooltip property on Widget to Has_Tooltip. See 1188 -- GtkWidget:has-tooltip for more information. 1189 1190 procedure Trigger_Tooltip_Query (Widget : access Gtk_Widget_Record); 1191 -- Triggers a tooltip query on the display where the toplevel of Widget 1192 -- is located. See Gtk.Tooltip.Trigger_Tooltip_Query for more 1193 -- information. 1194 1195 -------------------------- 1196 -- Creating new widgets -- 1197 -------------------------- 1198 -- Although the core subprogram for creating new widgets is 1199 -- Glib.Gobjects.Initialize_Class_Record, it is often useful to override 1200 -- some internal pointers to functions. 1201 -- The functions below are not needed unless you are writting your own 1202 -- widgets, and should be reserved for advanced customization of the 1203 -- standard widgets. 1204 1205 procedure Set_Scroll_Adjustments_Signal 1206 (Widget : Glib.Object.GObject_Class; Signal : String); 1207 -- Modify the signal to be sent when the adjustments are modified. 1208 -- This is only useful when you are rewritting your own widget that can be 1209 -- embedded directly in a Gtk_Scrolled_Window, without any Gtk_Viewport. 1210 -- 1211 -- Signal is the name of the signal that will be emitted when Widget is 1212 -- put inside a Gtk_Scrolled_Window. 1213 -- 1214 -- Note that the handlers for this signal must take two arguments in 1215 -- addition to the widget (the horizontal and vertical adjustments to be 1216 -- used). See Gtk.Scrolled_Window and Gtk.Widget.Set_Scroll_Adjustment for 1217 -- more information on this signal. 1218 1219 type Size_Allocate_Handler is access procedure 1220 (Widget : System.Address; Allocation : Gtk_Allocation); 1221 pragma Convention (C, Size_Allocate_Handler); 1222 -- Widget is the gtk+ C widget, that needs to be converted to Ada through 1223 -- a call to: 1224 -- declare 1225 -- Stub : Gtk_Widget_Record; -- or the exact type you expect 1226 -- begin 1227 -- My_Widget := Gtk_Widget (Glib.Object.Get_User_Data (Widget, Stub); 1228 -- end; 1229 1230 procedure Set_Default_Size_Allocate_Handler 1231 (Klass : Glib.Object.GObject_Class; 1232 Handler : Size_Allocate_Handler); 1233 -- Override the default size_allocate handler for this class. This handler 1234 -- is automatically called in several cases (when a widget is dynamically 1235 -- resized for instance), not through a signal. Thus, if you need to 1236 -- override the default behavior provided by one of the standard 1237 -- containers, you can not simply use Gtk.Handlers.Emit_Stop_By_Name, and 1238 -- you must override the default handler. Note also that this handler 1239 -- is automatically inherited by children of this class. 1240 1241 procedure Set_Allocation 1242 (Widget : access Gtk_Widget_Record'Class; Alloc : Gtk_Allocation); 1243 -- Modifies directly the internal field of Widget to register the new 1244 -- allocation. 1245 -- Beware that the only use of this method is inside a callback set 1246 -- by Set_Default_Size_Allocate_Handler. If you simply want to resize 1247 -- or reposition a widget, use Size_Allocate instead. 1248 1249 type Expose_Event_Handler is access function 1250 (Widget : System.Address; Event : Gdk.Event.Gdk_Event) return Boolean; 1251 pragma Convention (C, Expose_Event_Handler); 1252 function Default_Expose_Event_Handler (Klass : GObject_Class) 1253 return Expose_Event_Handler; 1254 -- Return the default expose event handler for the widget class Klass. The 1255 -- typical use for this function is when you are writting your own 1256 -- container class. You should then, from your own handler for 1257 -- expose_event, call the one of the parent class, so that all the children 1258 -- are automatically redrawn. 1259 1260 ----------- 1261 -- Flags -- 1262 ----------- 1263 -- Some flags are defined for all the visual objects (widgets). 1264 -- These flags are important in that they define exactly the different 1265 -- states a widget can be in. 1266 -- 1267 -- - "Toplevel": 1268 -- Set if the widget is a toplevel widget, ie has no parent. This is 1269 -- mostly true for windows and dialogs. 1270 -- 1271 -- - "No_Window": 1272 -- Set if the widget does not have an associated X11 window, ie can not 1273 -- receive events directly. For instance, a Gtk_Toolbar does not have 1274 -- an associated window. These objects are more lightweight, but require 1275 -- more work from GtkAda. This flag is only set if the widget will never 1276 -- have a window, even after it is realized. 1277 -- 1278 -- - "Realized": 1279 -- Set if the widget has been realized, ie its associated X11 window has 1280 -- been created (providing the widget excepts a window, see the No_Window 1281 -- flag 1282 -- 1283 -- - "Mapped": 1284 -- Set if the widget is visible on the screen. This is only possible if 1285 -- the Visible flag is also set. 1286 -- 1287 -- - "Visible": 1288 -- Set if the widget will be displayed on the screen when mapped (see the 1289 -- functions Show and Hide in this package). 1290 -- 1291 -- - "Sensitive": 1292 -- Set if the widget is listening to events. See the function 1293 -- Set_Sensitive in this package. An insensitive widget will generally 1294 -- have a different visual aspect to clue that it is unavailable (for 1295 -- instance an insensitive item menu will be grayed) 1296 -- 1297 -- - "Parent_Sensitive": 1298 -- Set if the parent is sensitive. A widget is sensitive only if both 1299 -- the Sensitive and Parent_Sensitive are set. 1300 -- 1301 -- - "Can_Focus": 1302 -- Set if the widget can have the focus, ie get keyboard events. Most 1303 -- widgets can not have the focus. 1304 -- 1305 -- - "Has_Focus": 1306 -- Set if the widget currently has the focus. See the function Grab_Focus 1307 -- in this package. See also the subprogram Gtk.Widget.Is_Focus 1308 -- 1309 -- - "Can_Default": 1310 -- Set if the widget can be the default widget in a window, ie the one 1311 -- that will get the keyboard events by default. For instance, the 1312 -- default button in a dialog is the one that gets clicked on when the 1313 -- user pressed Enter anywhere in the dialog. 1314 -- 1315 -- - "Has_Default": 1316 -- Set if the widget is currently the default widget. See the function 1317 -- Grab_Default in this package. 1318 -- 1319 -- - "Has_Grab": 1320 -- Set if the widget currently grabs all mouse and keyboard events in 1321 -- the application, even if it does not have the focus. There can be only 1322 -- such widget per application at any given time. 1323 -- 1324 -- - "Rc_Style": 1325 -- Set if the widget's style is either the default style, or in a 1326 -- customization file. This is unset if the style has been modified by 1327 -- the user. 1328 -- 1329 -- - "Composite_Child": 1330 -- This indicates whether the widget is composed of other widgets 1331 -- 1332 -- - "No_Reparent": 1333 -- This flags is never used in gtk+. 1334 -- 1335 -- - "App_Paintable": 1336 -- For some containers (including Gtk_Window and Gtk_Layout), this is 1337 -- unset when the container itself has some special drawing routines. It 1338 -- indicates whether the application will paint directly on the widget. 1339 -- 1340 -- - "Receives_Default": 1341 -- Set when the widget receives the default at the time it receives the 1342 -- focus. This is how the default button in a dialog is automatically 1343 -- changed when you press another button. 1344 1345 In_Destruction : constant := 2 ** 0; 1346 Floating : constant := 2 ** 1; 1347 Reserved_1 : constant := 2 ** 2; 1348 Reserved_2 : constant := 2 ** 3; 1349 Toplevel : constant := 2 ** 4; 1350 No_Window : constant := 2 ** 5; 1351 Realized : constant := 2 ** 6; 1352 Mapped : constant := 2 ** 7; 1353 Visible : constant := 2 ** 8; 1354 Sensitive : constant := 2 ** 9; 1355 Parent_Sensitive : constant := 2 ** 10; 1356 Can_Focus : constant := 2 ** 11; 1357 Has_Focus : constant := 2 ** 12; 1358 Can_Default : constant := 2 ** 13; 1359 Has_Default : constant := 2 ** 14; 1360 Has_Grab : constant := 2 ** 15; 1361 Rc_Style : constant := 2 ** 16; 1362 Composite_Child : constant := 2 ** 17; 1363 No_Reparent : constant := 2 ** 18; 1364 App_Paintable : constant := 2 ** 19; 1365 Receives_Default : constant := 2 ** 20; 1366 Double_Buffered : constant := 2 ** 21; 1367 1368 function Flags (Widget : access Gtk_Widget_Record) return Guint32; 1369 -- Return the flags that are set for the object, as a binary mask. 1370 1371 procedure Set_Flags (Widget : access Gtk_Widget_Record; Flags : Guint32); 1372 -- Set some specific flags for the object. 1373 -- Flags is a mask that will be added to the current flags of the object. 1374 1375 procedure Unset_Flags (Widget : access Gtk_Widget_Record; Flags : Guint32); 1376 -- Unset some specific flags for the object. 1377 -- Flags is a mask that will be deleted from the current flags of the 1378 -- object. 1379 1380 function Flag_Is_Set 1381 (Widget : access Gtk_Widget_Record; Flag : Guint32) return Boolean; 1382 -- Return True if the specific flag Flag is set for the object. 1383 1384 function In_Destruction_Is_Set 1385 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1386 -- Test if the Destroyed flag is set for the object. 1387 1388 -- <doc_ignore> 1389 function Destroyed_Is_Set (Widget : access Gtk_Widget_Record'Class) 1390 return Boolean renames In_Destruction_Is_Set; 1391 -- backward compatibility only 1392 -- </doc_ignore> 1393 1394 function Floating_Is_Set 1395 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1396 -- Test if the Floating flag is set for the object. 1397 1398 function Toplevel_Is_Set 1399 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1400 -- Test whether the Toplevel flag is set. 1401 1402 function No_Window_Is_Set 1403 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1404 -- Test whether the No_Window flag is set. 1405 1406 function Realized_Is_Set 1407 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1408 -- Test whether the Realized flag is set. 1409 1410 function Mapped_Is_Set 1411 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1412 -- Test whether the Mapped flag is set. 1413 1414 function Visible_Is_Set 1415 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1416 -- Test whether the Visible flag is set. 1417 1418 function Drawable_Is_Set 1419 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1420 -- True if the widget is both visible and mapped. 1421 -- In other words, if it does appear on the screen. 1422 1423 function Is_Sensitive 1424 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1425 -- Test whether the widget is Sensitive. 1426 1427 function Can_Focus_Is_Set 1428 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1429 -- Test whether the Can_Focus flag is set. 1430 1431 function Has_Focus_Is_Set 1432 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1433 -- Test whether the Has_Focus flag is set. 1434 1435 function Has_Default_Is_Set 1436 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1437 -- Test whether the Has_Default flag is set. 1438 1439 function Has_Grab_Is_Set 1440 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1441 -- Test whether the Has_Grab flag is set. 1442 1443 function Rc_Style_Is_Set 1444 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1445 -- Test whether the Rc_Style flag is set. 1446 1447 function Double_Buffered_Is_Set 1448 (Widget : access Gtk_Widget_Record'Class) return Boolean; 1449 -- Test whether the Double_Buffered flag is set. 1450 1451 -------------------- 1452 -- GValue support -- 1453 -------------------- 1454 1455 function Get_Requisition 1456 (Value : Glib.Values.GValue) return Gtk_Requisition_Access; 1457 -- Convert a value into a Gtk_Requisition_Access. 1458 1459 function Get_Allocation 1460 (Value : Glib.Values.GValue) return Gtk_Allocation_Access; 1461 -- Convert a value into a Gtk_Allocation_Access. 1462 1463 ----------------- 1464 -- Obsolescent -- 1465 ----------------- 1466 -- All subprograms below are now obsolescent in gtk+. They might be removed 1467 -- from future versions of gtk+ (and therefore GtkAda). 1468 -- To find out whether your code uses any of these, we recommend compiling 1469 -- with the -gnatwj switch 1470 -- <doc_ignore> 1471 1472 procedure Draw 1473 (Widget : access Gtk_Widget_Record; 1474 Area : Gdk.Rectangle.Gdk_Rectangle := Gdk.Rectangle.Full_Area); 1475 pragma Obsolescent; -- Draw 1476 -- Emit a "draw" signal for a specific area of the widget. 1477 -- The visual aspect might be different whether the widget has the focus 1478 -- or not. 1479 1480 procedure Set_UPosition 1481 (Widget : access Gtk_Widget_Record; 1482 X, Y : Gint); 1483 pragma Obsolescent; -- Set_Uposition 1484 -- Modify the position of the widget. 1485 -- This should be used only for toplevel widgets (windows and dialogs), 1486 -- since other widgets' positions are handled by their parent. 1487 1488 procedure Set_USize 1489 (Widget : access Gtk_Widget_Record; 1490 Width, Height : Gint); 1491 pragma Obsolescent ("Use Set_Size_Request instead"); -- Set_Usize 1492 -- Modify the size of the widget. 1493 -- This sets an absolute size for the widget, no matter what its requested 1494 -- size would be. For Gtk_Windows, you should consider using 1495 -- Set_Default_Size instead, which sets a minimal size, but use the 1496 -- widget's requested size if it is bigger. 1497 -- If Width or Height is negative, they are ignored, and the widget's 1498 -- default width is kept. 1499 1500 procedure Queue_Clear (Widget : access Gtk_Widget_Record); 1501 pragma Obsolescent; -- Queue_Clear 1502 -- Add a clear request to the event queue for the whole widget. 1503 -- This is added to the same list as for Queue_Draw, and thus is coalesced 1504 -- as much as possible with other drawing requests. 1505 1506 procedure Queue_Clear_Area 1507 (Widget : access Gtk_Widget_Record; 1508 X : Gint; 1509 Y : Gint; 1510 Width : Gint; 1511 Height : Gint); 1512 pragma Obsolescent; -- Queue_Clear_Area 1513 -- Add a clear request to the event queue for part of the widget. 1514 -- This is added to the same list as for Queue_Draw, and thus is coalesced 1515 -- as much as possible with other drawing requests. 1516 1517 -- </doc_ignore> 1518 1519 ---------------- 1520 -- Properties -- 1521 ---------------- 1522 -- The following properties are defined for this widget. See 1523 -- Glib.Properties for more information on properties. 1524 1525 -- <properties> 1526 -- Name: Name_Property 1527 -- Type: UTF8_String 1528 -- Flags: read-write 1529 -- Descr: The name of the widget 1530 -- See also: Set_Name procedure 1531 -- 1532 -- Name: Parent_Property 1533 -- Type: Gtk_Container'Class 1534 -- Flags: read-write 1535 -- Descr: The parent widget of this widget. 1536 -- See also: Set_Parent or Add procecures 1537 -- 1538 -- Name: X_Property 1539 -- Type: Gint 1540 -- Flags: read-write 1541 -- Descr: The x coordinate of the top-left corner of the widget, 1542 -- or -1 if not set 1543 -- 1544 -- Name: Y_Property 1545 -- Type: Gint 1546 -- Flags: read-write 1547 -- Descr: The y coordinate of the top-left corner of the widget, 1548 -- or -1 if not set 1549 -- 1550 -- Name: Width_Property 1551 -- Type: Gint 1552 -- Flags: read-write 1553 -- Descr: The width of the widget or -1 if not set 1554 -- See also: Set_USize 1555 -- 1556 -- Name: Height_Property 1557 -- Type: Gint 1558 -- Flags: read-write 1559 -- Descr: The height of the widget or -1 if not set 1560 -- See also: Set_USize 1561 -- 1562 -- Name: Visible_Property 1563 -- Type: Boolean 1564 -- Flags: read-write 1565 -- Descr: Whether the widget is visible 1566 -- See also: Hide and Show procedures 1567 -- 1568 -- Name: Sensitive_Property 1569 -- Type: Boolean 1570 -- Flags: read-write 1571 -- Descr: Whether the widget responds to input 1572 -- See also: Set_Sensitive 1573 -- 1574 -- Name: App_Paintable_Property 1575 -- Type: Boolean 1576 -- Flags: read-write 1577 -- Descr: Whether the application will paint directly on the widget 1578 -- See also: Set_App_Paintable 1579 -- 1580 -- Name: Can_Focus_Property 1581 -- Type: Boolean 1582 -- Flags: read-write 1583 -- Descr: Whether the widget can accept the input focus (keyboard) 1584 -- See also: Set or unset the flag Can_Focus 1585 -- 1586 -- Name: Has_Focus_Property 1587 -- Type: Boolean 1588 -- Flags: read-write 1589 -- Descr: Whether the widget has the input focus 1590 -- See also: Grab_Focus 1591 -- 1592 -- Name: Can_Default_Property 1593 -- Type: Boolean 1594 -- Flags: read-write 1595 -- Descr: Whether the widget can be the default widget 1596 -- See also: Set or unset the flag Can_Default 1597 -- 1598 -- Name: Has_Default_Property 1599 -- Type: Boolean 1600 -- Flags: read-write 1601 -- Descr: Whether the widget is the default widget 1602 -- See also: Grab_Default 1603 -- 1604 -- Name: Receives_Default_Property 1605 -- Type: Boolean 1606 -- Flags: read-write 1607 -- Descr: If True, the widget will receive the default action when 1608 -- it is focused 1609 -- See also: Set or unset the flag Receives_Default 1610 -- 1611 -- Name: Composite_Child_Property 1612 -- Type: Boolean 1613 -- Flags: read-write 1614 -- Descr: Whether the widget is composed of other widgets 1615 -- See also: Set or unset the flag Composite_Child 1616 -- 1617 -- Name: Style_Property 1618 -- Type: Gtk_Style 1619 -- Flags: read-write 1620 -- Descr: The style of the widget, which contains information about how 1621 -- it will look (colors etc). 1622 -- See also: Set_Style 1623 -- 1624 -- Name: Events_Property 1625 -- Type: flags 1626 -- Flags: read-write 1627 -- Descr: The event mask that decides what kind of GdkEvents this widget 1628 -- gets. 1629 -- See also: Set_Events 1630 -- 1631 -- Name: Prop_Extensions_Events_Property 1632 -- Type: flags 1633 -- Flags: read-write 1634 -- Descr: The mask that decides what kind of extension events this widget 1635 -- gets. 1636 -- See also: Set_Extension_Events 1637 -- 1638 -- Name: Extension_Events_Property 1639 -- Type: Enum 1640 -- Descr: The mask that decides what kind of extension events this widget 1641 -- gets 1642 -- 1643 -- Name: Height_Request_Property 1644 -- Type: Int 1645 -- Descr: Override for height request of the widget, or -1 if natural 1646 -- request should be used 1647 -- 1648 -- Name: Is_Focus_Property 1649 -- Type: Boolean 1650 -- Descr: Whether the widget is the focus widget within the toplevel 1651 -- 1652 -- Name: No_Show_All_Property 1653 -- Type: Boolean 1654 -- Descr: Whether gtk_widget_show_all() should not affect this widget 1655 -- 1656 -- Name: Width_Request_Property 1657 -- Type: Int 1658 -- Descr: Override for width request of the widget, or -1 if natural 1659 -- request should be used 1660 -- 1661 -- Name: Tooltip_Markup_Property 1662 -- Type: String 1663 -- Descr: The contents of the tooltip for this widget 1664 -- 1665 -- Name: Tooltip_Text_Property 1666 -- Type: String 1667 -- Descr: The contents of the tooltip for this widget 1668 -- 1669 -- Name: Has_Tooltip 1670 -- Type: Boolean 1671 -- Descr: Enables or disables the emission of "query-tooltip" on widget. A 1672 -- value of TRUE indicates that widget can have a tooltip, in this 1673 -- case the widget will be queried using "query-tooltip" to 1674 -- determine whether it will provide a tooltip or not. 1675 -- 1676 -- Note that setting this property to TRUE for the first time will 1677 -- change the event masks of the GdkWindows of this widget to 1678 -- include leave-notify and motion-notify events. This cannot and 1679 -- will not be undone when the property is set to FALSE again. 1680 -- 1681 -- Name: Window_Property 1682 -- Type: Object 1683 -- Descr: The widget's window if it is realized 1684 -- 1685 -- </properties> 1686 1687 procedure Child_Notify 1688 (Widget : access Gtk_Widget_Record; 1689 Child_Property : String); 1690 -- Emits a "child-notify" signal for the child property on Widget. 1691 -- This signal indicates the the value of the child property has changed on 1692 -- the parent, and thus that Widget should refresh itself if needed. 1693 -- 1694 -- Child_Property is the name of a child property installed on Widget's 1695 -- parent. You should use Glib.Propert_Name to get the name from the 1696 -- property declaration in each of the GtkAda packages 1697 1698 procedure Freeze_Child_Notify (Widget : access Gtk_Widget_Record); 1699 -- Stops emission of "child-notify" signals on Widget. The signals are 1700 -- queued until Thaw_Child_Notify() is called on Wwidget. 1701 1702 procedure Thaw_Child_Notify (Widget : access Gtk_Widget_Record); 1703 -- Reverts the effect of a previous call to Freeze_Child_Notify. 1704 -- This causes all queued "child-notify" signals on Widget to be emitted. 1705 1706 procedure Class_Install_Style_Property 1707 (Klass : Glib.Object.GObject_Class; 1708 Pspec : Glib.Param_Spec); 1709 -- Installs a style property on a widget class. The parser for the 1710 -- style property is determined by the value type of Pspec. 1711 -- A style property configures the look-and-feel of a widget class. They 1712 -- are generally modified by the current gtk+ theme, although users can 1713 -- also modify them in their own configuration file. 1714 1715 function Class_List_Style_Properties 1716 (Klass : Glib.Object.GObject_Class) return Glib.Param_Spec_Array; 1717 -- Returns all style properties of a widget class. 1718 1719 function Class_Find_Style_Property 1720 (Klass : Glib.Object.GObject_Class; 1721 Property_Name : String) return Glib.Param_Spec; 1722 -- Finds a style property of a widget class by name. 1723 -- Klass must be a descendent of Gtk_Widget. 1724 -- You should use Glib.Property_Name to get the name from the property 1725 -- declaration in each of the GtkAda packages 1726 1727 procedure Style_Get_Property 1728 (Widget : access Gtk_Widget_Record; 1729 Property_Name : String; 1730 Value : out Glib.Values.GValue); 1731 -- Gets the value of a style property of Widget. 1732 -- You should use Glib.Property_Name to get the name from the property 1733 -- declaration in each of the GtkAda packages 1734 1735 Name_Property : constant Glib.Properties.Property_String; 1736 Parent_Property : constant Glib.Properties.Property_Object; 1737 X_Property : constant Glib.Properties.Property_Int; 1738 Y_Property : constant Glib.Properties.Property_Int; 1739 Width_Property : constant Glib.Properties.Property_Int; 1740 Height_Property : constant Glib.Properties.Property_Int; 1741 Visible_Property : constant Glib.Properties.Property_Boolean; 1742 Sensitive_Property : constant Glib.Properties.Property_Boolean; 1743 App_Paintable_Property : constant Glib.Properties.Property_Boolean; 1744 Can_Focus_Property : constant Glib.Properties.Property_Boolean; 1745 Has_Focus_Property : constant Glib.Properties.Property_Boolean; 1746 Can_Default_Property : constant Glib.Properties.Property_Boolean; 1747 Has_Default_Property : constant Glib.Properties.Property_Boolean; 1748 Receives_Default_Property : constant Glib.Properties.Property_Boolean; 1749 Composite_Child_Property : constant Glib.Properties.Property_Boolean; 1750 Style_Property : constant Glib.Properties.Property_Object; 1751 Events_Property : constant Gdk.Event.Property_Gdk_Event_Mask; 1752 Prop_Extensions_Events_Property : 1753 constant Gdk.Types.Property_Gdk_Extension_Mode; 1754 Extension_Events_Property : constant Gdk.Types.Property_Gdk_Extension_Mode; 1755 Height_Request_Property : constant Glib.Properties.Property_Int; 1756 Is_Focus_Property : constant Glib.Properties.Property_Boolean; 1757 No_Show_All_Property : constant Glib.Properties.Property_Boolean; 1758 Width_Request_Property : constant Glib.Properties.Property_Int; 1759 Tooltip_Markup_Property : constant Glib.Properties.Property_String; 1760 Tooltip_Text_Property : constant Glib.Properties.Property_String; 1761 Has_Tooltip_Property : constant Glib.Properties.Property_Boolean; 1762 Window_Property : constant Glib.Properties.Property_Object; 1763 1764 ---------------------- 1765 -- Style Properties -- 1766 ---------------------- 1767 -- The following properties can be changed through the gtk theme and 1768 -- configuration files, and retrieved through Gtk.Widget.Style_Get_Property 1769 1770 -- <style_properties> 1771 -- Name: Cursor_Aspect_Ratio_Property 1772 -- Type: Float 1773 -- Descr: Aspect ratio with which to draw insertion cursor 1774 -- 1775 -- Name: Cursor_Color_Property 1776 -- Type: Boxed 1777 -- Descr: Color with which to draw insertion cursor 1778 -- 1779 -- Name: Draw_Border_Property 1780 -- Type: Boxed 1781 -- Descr: Size of areas outside the widget's allocation to draw 1782 -- 1783 -- Name: Focus_Line_Pattern_Property 1784 -- Type: String 1785 -- Descr: Dash pattern used to draw the focus indicator 1786 -- 1787 -- Name: Focus_Line_Width_Property 1788 -- Type: Int 1789 -- Descr: Width, in pixels, of the focus indicator line 1790 -- 1791 -- Name: Focus_Padding_Property 1792 -- Type: Int 1793 -- Descr: Width, in pixels, between focus indicator and the widget 'box' 1794 -- 1795 -- Name: Interior_Focus_Property 1796 -- Type: Boolean 1797 -- Descr: Whether to draw the focus indicator inside widgets 1798 -- 1799 -- Name: Link_Color_Property 1800 -- Type: Boxed 1801 -- Descr: Color of unvisited links 1802 -- 1803 -- Name: Scroll_Arrow_Hlength_Property 1804 -- Type: Int 1805 -- Descr: The length of horizontal scroll arrows 1806 -- 1807 -- Name: Scroll_Arrow_Vlength_Property 1808 -- Type: Int 1809 -- Descr: The length of vertical scroll arrows 1810 -- 1811 -- Name: Secondary_Cursor_Color_Property 1812 -- Type: Boxed 1813 -- Descr: Color with which to draw the secondary insertion cursor when 1814 -- editing mixed right-to-left and left-to-right text 1815 -- 1816 -- Name: Separator_Height_Property 1817 -- Type: Int 1818 -- Descr: The height of separators if \ 1819 -- 1820 -- Name: Separator_Width_Property 1821 -- Type: Int 1822 -- Descr: The width of separators if wide-separators is TRUE 1823 -- 1824 -- Name: Visited_Link_Color_Property 1825 -- Type: Boxed 1826 -- Descr: Color of visited links 1827 -- 1828 -- Name: Wide_Separators_Property 1829 -- Type: Boolean 1830 -- Descr: Whether separators have configurable width and should be drawn 1831 -- using a box instead of a line 1832 -- </style_properties> 1833 1834 Cursor_Aspect_Ratio_Property : constant Glib.Properties.Property_Float; 1835 -- Cursor_Color_Property : constant Glib.Properties.Property_Boxed; 1836 -- Draw_Border_Property : constant Glib.Properties.Property_Boxed; 1837 Focus_Line_Pattern_Property : constant Glib.Properties.Property_String; 1838 Focus_Line_Width_Property : constant Glib.Properties.Property_Int; 1839 Focus_Padding_Property : constant Glib.Properties.Property_Int; 1840 Interior_Focus_Property : constant Glib.Properties.Property_Boolean; 1841 Link_Color_Property : constant Glib.Properties.Property_Boxed; 1842 Scroll_Arrow_Hlength_Property : constant Glib.Properties.Property_Int; 1843 Scroll_Arrow_Vlength_Property : constant Glib.Properties.Property_Int; 1844 -- Secondary_Cursor_Color_Property : constant 1845 -- Glib.Properties.Property_Boxed; 1846 Separator_Height_Property : constant Glib.Properties.Property_Int; 1847 Separator_Width_Property : constant Glib.Properties.Property_Int; 1848 Visited_Link_Color_Property : constant Glib.Properties.Property_Boxed; 1849 Wide_Separators_Property : constant Glib.Properties.Property_Boolean; 1850 1851 ------------- 1852 -- Signals -- 1853 ------------- 1854 1855 -- <signals> 1856 -- The following new signals are defined for this widget: 1857 -- 1858 -- - "show" 1859 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1860 -- Emitted when a widget is to be shown (see explanation for the Show 1861 -- subprogam). This schedules the widget to be displayed on the screen, 1862 -- and if this is a toplevel widget it actually appears on the screen 1863 -- and all its children that have been shown. 1864 -- 1865 -- - "hide" 1866 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1867 -- Emitted when a widget is to be hidden (see explanation for the Hide 1868 -- subprogram). Hides the widget from the screen, and if its parent is 1869 -- shown, the widget will not appear on the screen again. 1870 -- 1871 -- - "map" 1872 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1873 -- Emitted when a widget is mapped on the screen (the default handler 1874 -- simply emits the "show" signal). 1875 -- 1876 -- - "unmap" 1877 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1878 -- Emitted when a widget needs to be unmapped on the screen (the default 1879 -- handler simply emits the "hide" signal). 1880 -- 1881 -- - "realize" 1882 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1883 -- Emitted when a widget is realized. The default handler creates the 1884 -- Gdk window associated with the widget, and its ancestors. 1885 -- 1886 -- - "unrealize" 1887 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1888 -- Emitted when a widget is unrealized. The default handler destroys the 1889 -- Gdk windows of the widget and all its children. 1890 -- 1891 -- - "draw" 1892 -- procedure Handler (Widget : access Gtk_Widget_Record'Class; 1893 -- Area : Gdk.Rectangle.Gdk_Rectangle); 1894 -- Emitted when a widget needs to be drawn. The default handler emits 1895 -- the "expose" event. 1896 -- 1897 -- - "draw_focus" 1898 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1899 -- Emitted when a widget needs to be drawn and it has the focus. Some 1900 -- widgets might want to provide visual clues that they have the focus, 1901 -- like a black border. This is never called if the widget can not have 1902 -- the focus (ie the "Can_Focus" flag is unset). 1903 -- 1904 -- - "draw_default" 1905 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1906 -- Emitted when a widget needs to be drawn and it does not have the 1907 -- focus. This is never called if the widget can not have the focus 1908 -- (ie the "Can_Focus" flag is unset). 1909 -- 1910 -- - "size_request" 1911 -- procedure Handler (Widget : access Gtk_Widget_Record'Class; 1912 -- Requisition : access Gtk_Requisition); 1913 -- Should return (in Requisition) the ideal size the widget would like to 1914 -- have. It is not sure this is the size that will be assigned to it, 1915 -- since it depends on the size of its parent). 1916 -- 1917 -- - "size_allocate" 1918 -- procedure Handler (Widget : access Gtk_Widget_Record'Class; 1919 -- Allocation : Gtk_Allocation); 1920 -- A size and position were assigned to the widget. This is called every 1921 -- time the size of the widget changes. 1922 -- The default handler takes care of resizing and moving the widget. 1923 -- 1924 -- - "state_changed" 1925 -- procedure Handler (Widget : access Gtk_Widget_Record'Class; 1926 -- Previous_State : Gtk.Enums.Gtk_State_Type); 1927 -- The state of the widget has changed. 1928 -- 1929 -- - "parent_set" 1930 -- procedure Handler (Widget : access Gtk_Widget_Record'Class; 1931 -- Previous_Parent : access Gtk_Widget_Record'Class); 1932 -- A new parent has been set for the widget. The previous parent is 1933 -- given in arguments (if there was none, 1934 -- Gdk.Is_Created (Previous_Parent) returns False). 1935 -- 1936 -- - "style_set" 1937 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1938 -- Previous_Style : Gtk.Style.Gtk_Style); 1939 -- The widget's style has been changed (this is not call when some 1940 -- settings in the style are changed, only when the style itself is 1941 -- completely changed with a call to Set_Style or Set_Default_Style). 1942 -- 1943 -- - "add_accelerator" 1944 -- ??? 1945 -- 1946 -- - "remove_accelerator" 1947 -- ??? 1948 -- 1949 -- - "grab_focus" 1950 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 1951 -- The widget has got the focus, ie will now get the keyboard events 1952 -- sent to a window. This is only called if the "Can_Focus" flag is 1953 -- set. The "Has_Focus" flag might not be set when this signal is 1954 -- emitted. 1955 -- 1956 -- - "event" 1957 -- function Handler (Widget : access Gtk_Widget_Record'Class; 1958 -- Event : Gdk.Event.Gdk_Event) 1959 -- return Boolean; 1960 -- Some event was sent to the widget. This covers all the cases 1961 -- below, and acts as a general handler. This is called in addition to 1962 -- the relevant specific handler below. 1963 -- If the handler returns False, the event might be pass to the parent 1964 -- of widget (if no other handler of widget has returned True). 1965 -- 1966 -- - "button_press_event" 1967 -- function Handler (Widget : access Gtk_Widget_Record'Class; 1968 -- Event : Gdk.Event.Gdk_Event_Button) 1969 -- return Boolean; 1970 -- A button was pressed while the pointer was inside the widget. 1971 -- To get this signal, some widgets by have to use the Set_Events 1972 -- subprogram first to get this event. 1973 -- If the handler returns False, the event might be pass to the parent 1974 -- of widget (if no other handler of widget has returned True). 1975 -- 1976 -- - "button_release_event" 1977 -- function Handler (Widget : access Gtk_Widget_Record'Class; 1978 -- Event : Gdk.Event.Gdk_Event_Button) 1979 -- return Boolean; 1980 -- A button was released while the pointer was inside the widget. 1981 -- Note that in some cases (Gtk_Buttons for instance), another "clicked" 1982 -- signal could be emitted). This "button_release_event" should mainly 1983 -- be used for widgets that don't already have specific signals to cover 1984 -- that case (Gtk_Drawing_Area for instance). 1985 -- 1986 -- To get this signal, some widgets may have to use the Set_Events 1987 -- subprogram first to get this event. 1988 -- 1989 -- If the handler returns False, the event might be pass to the parent 1990 -- of widget (if no other handler of widget has returned True). 1991 -- 1992 -- - "motion_notify_event" 1993 -- function Handler (Widget : access Gtk_Widget_Record'Class; 1994 -- Event : Gdk.Event.Gdk_Event_Motion) 1995 -- return Boolean; 1996 -- The pointer has moved while remaining inside the widget. 1997 -- The Set_Events subprogram has to be called first to get this event. 1998 -- 1999 -- If the handler returns False, the event might be pass to the parent 2000 -- of widget (if no other handler of widget has returned True). 2001 -- 2002 -- - "delete_event" 2003 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2004 -- Event : Gdk.Event.Gdk_Event) 2005 -- return Boolean; 2006 -- The user has clicked on the "close" button in the window's frame 2007 -- (the button that is automatically set by the window manager). If the 2008 -- handler returns False, the widget will be destroyed (and the window 2009 -- closed), but if the handler returns True, nothing will be done. 2010 -- This is a good way to prevent the user from closing your application's 2011 -- window if there should be some clean ups first (like saving the 2012 -- document). 2013 -- 2014 -- - "destroy" 2015 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 2016 -- 2017 -- Raised when the widget is about to be destroyed. The "destroyed" 2018 -- flag has been set on the object first. Handlers should not keep 2019 -- a reference on the object. 2020 -- Note that when your destroy handlers are called, the user_data is 2021 -- still available. 2022 -- The default implementation destroys all the handlers. 2023 -- 2024 -- - "destroy_event" 2025 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2026 -- Event : Gdk.Event.Gdk_Event) 2027 -- return Boolean; 2028 -- This signal is apparently never emitted by Gtk+. You might want to 2029 -- use "destroy" instead. 2030 -- 2031 -- - "expose_event" 2032 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2033 -- Event : Gdk.Event.Gdk_Event_Expose) 2034 -- return Boolean; 2035 -- The widget needs to be partly redrawn. The exact area to redraw is 2036 -- found in Event. For some widgets, you should rather connect to the 2037 -- "draw" signal. However, for instance for Gtk_Drawing_Area widgets, 2038 -- you have to use this, after setting the correct event mask with 2039 -- Set_Events. 2040 -- If the handler returns False, the event might be passed to the parent 2041 -- of widget (if no other handler of widget has returned True). 2042 -- 2043 -- - "key_press_event" 2044 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2045 -- Event : Gdk.Event.Gdk_Event_Key) 2046 -- return Boolean; 2047 -- A key has been pressed while Widget had the focus. Note that some 2048 -- widgets like Gtk_Editable provide some higher-level signals to handle 2049 -- this. 2050 -- If the handler returns False, the event might be pass to the parent 2051 -- of widget (if no other handler of widget has returned True). 2052 -- 2053 -- - "key_release_event" 2054 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2055 -- Event : Gdk.Event.Gdk_Event_Key) 2056 -- return Boolean; 2057 -- A key has been released while Widget had the focus. 2058 -- If the handler returns False, the event might be pass to the parent 2059 -- of widget (if no other handler of widget has returned True). 2060 -- 2061 -- - "enter_notify_event" 2062 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2063 -- Event : Gdk.Event.Gdk_Event_Crossing) 2064 -- return Boolean; 2065 -- The pointer has just entered the widget. If the "Can_Focus" flag is 2066 -- set, Widget will gain the focus, and the widget might be drawn 2067 -- differently. 2068 -- If the handler returns False, the event might be pass to the parent 2069 -- of widget (if no other handler of widget has returned True). 2070 -- 2071 -- - "leave_notify_event" 2072 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2073 -- Event : Gdk.Event.Gdk_Event_Crossing) 2074 -- return Boolean; 2075 -- The pointer has just leaved the widget. If the "Can_Focus" flag is 2076 -- set, Widget will gain the focus, and the widget might be drawn 2077 -- differently. 2078 -- If the handler returns False, the event might be pass to the parent 2079 -- of widget (if no other handler of widget has returned True). 2080 -- 2081 -- - "configure_event" 2082 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2083 -- Event : Gdk.Event.Gdk_Event_Configure) 2084 -- return Boolean; 2085 -- Some configuration of the window has changed (it has been 2086 -- moved or resized). 2087 -- If the handler returns False, the event might be pass to the parent 2088 -- of widget (if no other handler of widget has returned True). 2089 -- 2090 -- - "focus_in_event" 2091 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2092 -- Event : Gdk.Event.Gdk_Event_Focus) 2093 -- return Boolean; 2094 -- The widget has just gained the focus. 2095 -- If the handler returns False, the event might be pass to the parent 2096 -- of widget (if no other handler of widget has returned True). 2097 -- This event is only emitted if you called Add_Events with a 2098 -- Enter_Notify_Mask parameter 2099 -- 2100 -- - "focus_out_event" 2101 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2102 -- Event : Gdk.Event.Gdk_Event_Focus) 2103 -- return Boolean; 2104 -- The widget has just lost the focus. 2105 -- If the handler returns False, the event might be pass to the parent 2106 -- of widget (if no other handler of widget has returned True). 2107 -- This event is only emitted if you called Add_Events with a 2108 -- Leave_Notify_Mask parameter 2109 -- 2110 -- - "map_event" 2111 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2112 -- Event : Gdk.Event.Gdk_Event) 2113 -- return Boolean; 2114 -- The widget has just been mapped. This is different from the "map" 2115 -- signal, which is called *before* the widget is actually mapped. 2116 -- If the handler returns False, the event might be pass to the parent 2117 -- of widget (if no other handler of widget has returned True). 2118 -- 2119 -- - "unmap_event" 2120 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2121 -- Event : Gdk.Event.Gdk_Event) 2122 -- return Boolean; 2123 -- The widget has just been unmapped. This is different from the "unmap" 2124 -- signal, which is called *before* the widget is actually unmapped. 2125 -- If the handler returns False, the event might be pass to the parent 2126 -- of widget (if no other handler of widget has returned True). 2127 -- 2128 -- - "property_notify_event" 2129 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2130 -- Event : Gdk.Event.Gdk_Event_Property) 2131 -- return Boolean; 2132 -- ??? 2133 -- 2134 -- - "selection_clear_event" 2135 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2136 -- Event : Gdk.Event.Gdk_Event_Selection) 2137 -- return Boolean; 2138 -- ??? 2139 -- 2140 -- - "selection_request_event" 2141 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2142 -- Event : Gdk.Event.Gdk_Event_Selection) 2143 -- return Boolean; 2144 -- ??? 2145 -- 2146 -- - "selection_notify_event" 2147 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2148 -- Event : Gdk.Event.Gdk_Event_Selection) 2149 -- return Boolean; 2150 -- ??? 2151 -- 2152 -- - "selection_received" 2153 -- Related to the selection mechanism, see Gtk.Selection 2154 -- 2155 -- - "selection_get" 2156 -- Related to the selection mechanism, see Gtk.Selection 2157 -- 2158 -- - "proximity_in_event" 2159 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2160 -- Event : Gdk.Event.Gdk_Event_Proximity) 2161 -- return Boolean; 2162 -- Used for special input devices. See the description of 2163 -- Gdk.Event.Gdk_Event_Proximity. 2164 -- If the handler returns False, the event might be pass to the parent 2165 -- of widget (if no other handler of widget has returned True). 2166 -- 2167 -- - "proximity_out_event" 2168 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2169 -- Event : Gdk.Event.Gdk_Event_Proximity) 2170 -- return Boolean; 2171 -- Used for special input devices. See the description of 2172 -- Gdk.Event.Gdk_Event_Proximity. 2173 -- If the handler returns False, the event might be pass to the parent 2174 -- of widget (if no other handler of widget has returned True). 2175 -- 2176 -- - "drag_leave" 2177 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2178 -- 2179 -- - "drag_begin" 2180 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2181 -- 2182 -- - "drag_end" 2183 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2184 -- 2185 -- - "drag_data_delete" 2186 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2187 -- 2188 -- - "drag_motion" 2189 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2190 -- 2191 -- - "drag_drop" 2192 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2193 -- 2194 -- - "drag_data_get" 2195 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2196 -- 2197 -- - "drag_data_received" 2198 -- Event related to drag-and-drop support. See the Gtk.Dnd documentation. 2199 -- 2200 -- - "visibility_notify_event" 2201 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2202 -- Event : Gdk.Event.Gdk_Event_Visibility) 2203 -- return Boolean; 2204 -- The visibility state of the widget has changed (partially visible, 2205 -- fully visible, ...). You might want to use the "expose" signal 2206 -- instead. 2207 -- If the handler returns False, the event might be pass to the parent 2208 -- of widget (if no other handler of widget has returned True). 2209 -- 2210 -- - "client_event" 2211 -- ??? 2212 -- 2213 -- - "no_expose_event" 2214 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2215 -- Event : Gdk.Event.Gdk_Event) 2216 -- return Boolean; 2217 -- ??? 2218 -- 2219 -- - "child_notify" 2220 -- procedure Handler (Widget : access Gtk_Widget_Record'Class); 2221 -- This signal is emitted when the value of one of the child properties 2222 -- for the widget has been changed. If you are only interested in the 2223 -- changes for a specific property, you can also connect directly to 2224 -- "child_notify::<property>", for instance "child_notify:right_attach" 2225 -- for a child of Gtk.Menu.Gtk_Menu. 2226 -- 2227 -- 2228 -- - "query-tooltip" 2229 -- function Handler (Widget : access Gtk_Widget_Record'Class; 2230 -- Params : Glib.Values.GValues) 2231 -- return Boolean; 2232 -- Emitted when "has-tooltip" is TRUE and the "gtk-tooltip-timeout" has 2233 -- expired with the cursor hovering "above" widget; or emitted when 2234 -- widget got focus in keyboard mode. 2235 -- 2236 -- Using the given coordinates, the signal handler should determine 2237 -- whether a tooltip should be shown for widget. If this is the case TRUE 2238 -- should be returned, FALSE otherwise. Note that if keyboard_mode is 2239 -- TRUE, the values of x and y are undefined and should not be used. 2240 -- 2241 -- The signal handler is free to manipulate tooltip with the therefore 2242 -- destined function calls. 2243 -- </signals> 2244 2245 Signal_Accel_Closures_Changed : constant Glib.Signal_Name := 2246 "accel_closures_changed"; 2247 Signal_Button_Press_Event : constant Glib.Signal_Name := 2248 "button_press_event"; 2249 Signal_Button_Release_Event : constant Glib.Signal_Name := 2250 "button_release_event"; 2251 Signal_Can_Activate_Accel : constant Glib.Signal_Name := 2252 "can_activate_accel"; 2253 Signal_Child_Notify : constant Glib.Signal_Name := 2254 "child_notify"; 2255 Signal_Client_Event : constant Glib.Signal_Name := 2256 "client_event"; 2257 Signal_Configure_Event : constant Glib.Signal_Name := 2258 "configure_event"; 2259 Signal_Delete_Event : constant Glib.Signal_Name := 2260 "delete_event"; 2261 Signal_Destroy : constant Glib.Signal_Name := 2262 "destroy"; 2263 Signal_Destroy_Event : constant Glib.Signal_Name := 2264 "destroy_event"; 2265 Signal_Direction_Changed : constant Glib.Signal_Name := 2266 "direction_changed"; 2267 Signal_Drag_Begin : constant Glib.Signal_Name := 2268 "drag_begin"; 2269 Signal_Drag_Data_Delete : constant Glib.Signal_Name := 2270 "drag_data_delete"; 2271 Signal_Drag_Data_Get : constant Glib.Signal_Name := 2272 "drag_data_get"; 2273 Signal_Drag_Data_Received : constant Glib.Signal_Name := 2274 "drag_data_received"; 2275 Signal_Drag_Drop : constant Glib.Signal_Name := 2276 "drag_drop"; 2277 Signal_Drag_End : constant Glib.Signal_Name := 2278 "drag_end"; 2279 Signal_Drag_Leave : constant Glib.Signal_Name := 2280 "drag_leave"; 2281 Signal_Drag_Motion : constant Glib.Signal_Name := 2282 "drag_motion"; 2283 Signal_Enter_Notify_Event : constant Glib.Signal_Name := 2284 "enter_notify_event"; 2285 Signal_Event : constant Glib.Signal_Name := 2286 "event"; 2287 Signal_Event_After : constant Glib.Signal_Name := 2288 "event-after"; 2289 Signal_Expose_Event : constant Glib.Signal_Name := 2290 "expose_event"; 2291 Signal_Focus : constant Glib.Signal_Name := 2292 "focus"; 2293 Signal_Focus_In_Event : constant Glib.Signal_Name := 2294 "focus_in_event"; 2295 Signal_Focus_Out_Event : constant Glib.Signal_Name := 2296 "focus_out_event"; 2297 Signal_Grab_Broken_Event : constant Glib.Signal_Name := 2298 "grab_broken_event"; 2299 Signal_Grab_Focus : constant Glib.Signal_Name := 2300 "grab_focus"; 2301 Signal_Grab_Notify : constant Glib.Signal_Name := 2302 "grab_notify"; 2303 Signal_Hide : constant Glib.Signal_Name := 2304 "hide"; 2305 Signal_Hierarchy_Changed : constant Glib.Signal_Name := 2306 "hierarchy_changed"; 2307 Signal_Key_Press_Event : constant Glib.Signal_Name := 2308 "key_press_event"; 2309 Signal_Key_Release_Event : constant Glib.Signal_Name := 2310 "key_release_event"; 2311 Signal_Leave_Notify_Event : constant Glib.Signal_Name := 2312 "leave_notify_event"; 2313 Signal_Map : constant Glib.Signal_Name := 2314 "map"; 2315 Signal_Map_Event : constant Glib.Signal_Name := 2316 "map_event"; 2317 Signal_Mnemonic_Activate : constant Glib.Signal_Name := 2318 "mnemonic_activate"; 2319 Signal_Motion_Notify_Event : constant Glib.Signal_Name := 2320 "motion_notify_event"; 2321 Signal_No_Expose_Event : constant Glib.Signal_Name := 2322 "no_expose_event"; 2323 Signal_Parent_Set : constant Glib.Signal_Name := 2324 "parent_set"; 2325 Signal_Popup_Menu : constant Glib.Signal_Name := 2326 "popup_menu"; 2327 Signal_Property_Notify_Event : constant Glib.Signal_Name := 2328 "property_notify_event"; 2329 Signal_Proximity_In_Event : constant Glib.Signal_Name := 2330 "proximity_in_event"; 2331 Signal_Proximity_Out_Event : constant Glib.Signal_Name := 2332 "proximity_out_event"; 2333 Signal_Realize : constant Glib.Signal_Name := 2334 "realize"; 2335 Signal_Query_Tooltip : constant Glib.Signal_Name := 2336 "query-tooltip"; 2337 Signal_Screen_Changed : constant Glib.Signal_Name := 2338 "screen_changed"; 2339 Signal_Scroll_Event : constant Glib.Signal_Name := 2340 "scroll_event"; 2341 Signal_Selection_Clear_Event : constant Glib.Signal_Name := 2342 "selection_clear_event"; 2343 Signal_Selection_Get : constant Glib.Signal_Name := 2344 "selection_get"; 2345 Signal_Selection_Notify_Event : constant Glib.Signal_Name := 2346 "selection_notify_event"; 2347 Signal_Selection_Received : constant Glib.Signal_Name := 2348 "selection_received"; 2349 Signal_Selection_Request_Event : constant Glib.Signal_Name := 2350 "selection_request_event"; 2351 Signal_Show : constant Glib.Signal_Name := 2352 "show"; 2353 Signal_Show_Help : constant Glib.Signal_Name := 2354 "show_help"; 2355 Signal_Size_Allocate : constant Glib.Signal_Name := 2356 "size_allocate"; 2357 Signal_Size_Request : constant Glib.Signal_Name := 2358 "size_request"; 2359 Signal_State_Changed : constant Glib.Signal_Name := 2360 "state_changed"; 2361 Signal_Style_Set : constant Glib.Signal_Name := 2362 "style_set"; 2363 Signal_Unmap : constant Glib.Signal_Name := 2364 "unmap"; 2365 Signal_Unmap_Event : constant Glib.Signal_Name := 2366 "unmap_event"; 2367 Signal_Unrealize : constant Glib.Signal_Name := 2368 "unrealize"; 2369 Signal_Visibility_Notify_Event : constant Glib.Signal_Name := 2370 "visibility_notify_event"; 2371 Signal_Window_State_Event : constant Glib.Signal_Name := 2372 "window_state_event"; 2373 2374private 2375 2376 type Gtk_Widget_Record is new Glib.Object.GObject_Record with null record; 2377 2378 Name_Property : constant Glib.Properties.Property_String := 2379 Glib.Properties.Build ("name"); 2380 Parent_Property : constant Glib.Properties.Property_Object := 2381 Glib.Properties.Build ("parent"); 2382 X_Property : constant Glib.Properties.Property_Int := 2383 Glib.Properties.Build ("x"); 2384 Y_Property : constant Glib.Properties.Property_Int := 2385 Glib.Properties.Build ("y"); 2386 Width_Property : constant Glib.Properties.Property_Int := 2387 Glib.Properties.Build ("width"); 2388 Height_Property : constant Glib.Properties.Property_Int := 2389 Glib.Properties.Build ("height"); 2390 Visible_Property : constant Glib.Properties.Property_Boolean := 2391 Glib.Properties.Build ("visible"); 2392 Sensitive_Property : constant Glib.Properties.Property_Boolean := 2393 Glib.Properties.Build ("sensitive"); 2394 App_Paintable_Property : constant Glib.Properties.Property_Boolean := 2395 Glib.Properties.Build ("app_paintable"); 2396 Can_Focus_Property : constant Glib.Properties.Property_Boolean := 2397 Glib.Properties.Build ("can_focus"); 2398 Has_Focus_Property : constant Glib.Properties.Property_Boolean := 2399 Glib.Properties.Build ("has_focus"); 2400 Can_Default_Property : constant Glib.Properties.Property_Boolean := 2401 Glib.Properties.Build ("can_default"); 2402 Has_Default_Property : constant Glib.Properties.Property_Boolean := 2403 Glib.Properties.Build ("has_default"); 2404 Receives_Default_Property : constant Glib.Properties.Property_Boolean := 2405 Glib.Properties.Build ("receives_default"); 2406 Composite_Child_Property : constant Glib.Properties.Property_Boolean := 2407 Glib.Properties.Build ("composite_child"); 2408 Style_Property : constant Glib.Properties.Property_Object := 2409 Glib.Properties.Build ("style"); 2410 Events_Property : constant Gdk.Event.Property_Gdk_Event_Mask := 2411 Gdk.Event.Build ("events"); 2412 Prop_Extensions_Events_Property : 2413 constant Gdk.Types.Property_Gdk_Extension_Mode := 2414 Gdk.Types.Build ("extension_events"); 2415 Extension_Events_Property : constant Gdk.Types.Property_Gdk_Extension_Mode 2416 := Gdk.Types.Build ("extension-events"); 2417 Height_Request_Property : constant Glib.Properties.Property_Int := 2418 Glib.Properties.Build ("height-request"); 2419 Is_Focus_Property : constant Glib.Properties.Property_Boolean := 2420 Glib.Properties.Build ("is-focus"); 2421 No_Show_All_Property : constant Glib.Properties.Property_Boolean := 2422 Glib.Properties.Build ("no-show-all"); 2423 Width_Request_Property : constant Glib.Properties.Property_Int := 2424 Glib.Properties.Build ("width-request"); 2425 Tooltip_Markup_Property : constant Glib.Properties.Property_String := 2426 Glib.Properties.Build ("tooltip-markup"); 2427 Tooltip_Text_Property : constant Glib.Properties.Property_String := 2428 Glib.Properties.Build ("tooltip-text"); 2429 Has_Tooltip_Property : constant Glib.Properties.Property_Boolean := 2430 Glib.Properties.Build ("has-tooltip"); 2431 Window_Property : constant Glib.Properties.Property_Object := 2432 Glib.Properties.Build ("window"); 2433 2434 Cursor_Aspect_Ratio_Property : constant Glib.Properties.Property_Float := 2435 Glib.Properties.Build ("cursor-aspect-ratio"); 2436-- Cursor_Color_Property : constant Glib.Properties.Property_Boxed := 2437-- Glib.Properties.Build ("cursor-color"); 2438-- Draw_Border_Property : constant Glib.Properties.Property_Boxed := 2439-- Glib.Properties.Build ("draw-border"); 2440 Focus_Line_Pattern_Property : constant Glib.Properties.Property_String := 2441 Glib.Properties.Build ("focus-line-pattern"); 2442 Focus_Line_Width_Property : constant Glib.Properties.Property_Int := 2443 Glib.Properties.Build ("focus-line-width"); 2444 Focus_Padding_Property : constant Glib.Properties.Property_Int := 2445 Glib.Properties.Build ("focus-padding"); 2446 Interior_Focus_Property : constant Glib.Properties.Property_Boolean := 2447 Glib.Properties.Build ("interior-focus"); 2448 Link_Color_Property : constant Glib.Properties.Property_Boxed := 2449 Glib.Properties.Build ("link-color"); 2450 Scroll_Arrow_Hlength_Property : constant Glib.Properties.Property_Int := 2451 Glib.Properties.Build ("scroll-arrow-hlength"); 2452 Scroll_Arrow_Vlength_Property : constant Glib.Properties.Property_Int := 2453 Glib.Properties.Build ("scroll-arrow-vlength"); 2454 -- Secondary_Cursor_Color_Property : constant 2455 -- Glib.Properties.Property_Boxed := 2456 -- Glib.Properties.Build ("secondary-cursor-color"); 2457 Separator_Height_Property : constant Glib.Properties.Property_Int := 2458 Glib.Properties.Build ("separator-height"); 2459 Separator_Width_Property : constant Glib.Properties.Property_Int := 2460 Glib.Properties.Build ("separator-width"); 2461 Visited_Link_Color_Property : constant Glib.Properties.Property_Boxed := 2462 Glib.Properties.Build ("visited-link-color"); 2463 Wide_Separators_Property : constant Glib.Properties.Property_Boolean := 2464 Glib.Properties.Build ("wide-separators"); 2465 2466 pragma Import (C, Pop_Colormap, "gtk_widget_pop_colormap"); 2467 pragma Import (C, Get_Type, "gtk_widget_get_type"); 2468 pragma Import (C, Requisition_Get_Type, "gtk_requisition_get_type"); 2469 pragma Import (C, Get_Default_Colormap, "gtk_widget_get_default_colormap"); 2470 pragma Import (C, Get_Default_Visual, "gtk_widget_get_default_visual"); 2471 pragma Import (C, Push_Colormap, "gtk_widget_push_colormap"); 2472 pragma Import (C, Set_Default_Colormap, "gtk_widget_set_default_colormap"); 2473 pragma Import (C, Set_Default_Size_Allocate_Handler, 2474 "ada_gtk_widget_set_default_size_allocate_handler"); 2475 pragma Import (C, Default_Expose_Event_Handler, 2476 "ada_gtk_default_expose_event_handler"); 2477 pragma Import (C, Push_Composite_Child, "gtk_widget_push_composite_child"); 2478 pragma Import (C, Pop_Composite_Child, "gtk_widget_pop_composite_child"); 2479 pragma Import 2480 (C, Get_Default_Direction, "gtk_widget_get_default_direction"); 2481 pragma Import 2482 (C, Set_Default_Direction, "gtk_widget_set_default_direction"); 2483 pragma Import 2484 (C, Class_Install_Style_Property, 2485 "gtk_widget_class_install_style_property"); 2486 2487 pragma Inline (Toplevel_Is_Set); 2488 pragma Inline (No_Window_Is_Set); 2489 pragma Inline (Realized_Is_Set); 2490 pragma Inline (Mapped_Is_Set); 2491 pragma Inline (Visible_Is_Set); 2492 pragma Inline (Drawable_Is_Set); 2493 pragma Inline (Is_Sensitive); 2494 pragma Inline (Can_Focus_Is_Set); 2495 pragma Inline (Has_Focus_Is_Set); 2496 pragma Inline (Has_Default_Is_Set); 2497 pragma Inline (Has_Grab_Is_Set); 2498 pragma Inline (Rc_Style_Is_Set); 2499 pragma Inline (Double_Buffered_Is_Set); 2500 2501end Gtk.Widget; 2502 2503-- Not needed, so not bound 2504-- No binding: gtk_requisition_copy 2505-- No binding: gtk_requisition_free 2506-- No binding: gtk_widget_ref 2507-- No binding: gtk_widget_unref 2508-- No binding: gtk_widget_new 2509-- No binding: gtk_widget_destroy 2510-- No binding: gtk_widget_destroyed 2511-- No binding: gtk_widget_get_accessible 2512-- No binding: gtk_widget_get_display 2513-- No binding: gtk_widget_get_screen 2514-- No binding: gtk_widget_style_get_valist 2515-- No binding: gtk_widget_set 2516-- No binding: gtk_widget_style_get 2517 2518-- Might be useful, but very complex to explain 2519-- No binding: gtk_widget_list_accel_closures 2520-- No binding: gtk_widget_class_install_style_property_parser 2521 2522-- Binding is in Gtk.RC 2523-- No binding: gtk_widget_modify_style 2524-- No binding: gtk_widget_get_modifier_style 2525 2526-- Binding is in Gtk.Setting 2527-- No binding: gtk_widget_get_settings 2528 2529-- Binding is in Gtk.Clipboard 2530-- No binding: gtk_widget_get_clipboard 2531 2532-- Binding uses custom C glue 2533-- No binding: gtk_widget_get_window 2534