This widget is the base of the tree for displayable objects. (A displayable object is one which takes up some amount of screen real estate). It provides a common base and interface which actual widgets must adhere to.
This package provides some services which might have been more appropriate in some other packages, but could not because of dependency circularities (there are for instance some functions relating to colors and colormaps). We have tried to reference these functions in the other packages as well.
Widget Hierarchy |
---|
Gtk_Object (see section Package Gtk.Object) \___ Gtk_Widget (see section Package Gtk.Widget) |
Signals |
---|
Types |
---|
type Gtk_Allocation is record X : Gint16; Y : Gint16; Width : Guint16; Height : Guint16; end record; | |
Gtk_Allocation indicates a size and position a widget was allocated.
See the section in the user guide on how to create new widgets for more
information.
pragma Pack (Gtk_Allocation);
| |
type Gtk_Allocation_Access is access all Gtk_Allocation; | |
This type is used to create new widgets.
| |
type Gtk_Requisition is record Width : Gint16; Height : Gint16; end record; | |
Gtk_Requisition is the desired amount of screen real-estate a widget
requests to the server. Its real allocated size might be different.
See the section in the GtkAda user guide on how to create new widgets
in Ada, and the examples/base_widget directory for an example on how to
use this.
pragma Pack (Gtk_Requisition);
| |
type Gtk_Requisition_Access is access all Gtk_Requisition; | |
This type is used to create new widgets.
| |
type Widget_Type is new Gtk_Widget_Record with private; | |
|
Subprograms |
---|
Widgets' life cycle | ||
procedure Initialize_Widget (Widget : access Gtk_Widget_Record'Class); | ||
Internal initialization function. | ||
procedure Destroy_Cb (Widget : access Gtk_Widget_Record'Class); | ||
This function should be used as a callback to destroy a widget. | ||
procedure Unparent (Widget : access Gtk_Widget_Record'Class); | ||
Detach the widget from its parent. | ||
procedure Show (Widget : access Gtk_Widget_Record); | ||
Schedule the widget to be displayed on the screen when its parent is | ||
procedure Show_Now (Widget : access Gtk_Widget_Record); | ||
Show the widget. | ||
procedure Hide (Widget : access Gtk_Widget_Record); | ||
Hide the widget from the screen (emits the "hide" signal). | ||
procedure Show_All (Widget : access Gtk_Widget_Record); | ||
Show Widget and all its children recursively.
| ||
procedure Hide_All (Widget : access Gtk_Widget_Record); | ||
Hide Widget and all its children. | ||
procedure Map (Widget : access Gtk_Widget_Record); | ||
Map a widget to the screen.
It is recommended to use the higher-level Show instead.
| ||
procedure Unmap (Widget : access Gtk_Widget_Record); | ||
Unmap a widget from the screen.
It is recommended to use the higher-level Hide instead.
| ||
procedure Realize (Widget : access Gtk_Widget_Record); | ||
Create a window for Widget and its ancestors (emit the "realize" signal) | ||
procedure Unrealize (Widget : access Gtk_Widget_Record); | ||
Hide the widget from the screen and deletes the associated window. | ||
procedure Set_Realize (Widget : access Gtk_Widget_Record'Class); | ||
Set the realize handler at the low level. | ||
function Get_Type return Gtk.Gtk_Type; | ||
Return the internal value associated with a Gtk_Widget.
| ||
Drawing a widget | ||
procedure Queue_Draw (Widget : access Gtk_Widget_Record); | ||
Add a drawing request to the event queue for the whole widget. | ||
procedure Queue_Draw_Area (Widget : access Gtk_Widget_Record; X : Gint; Y : Gint; Width : Gint; Height : Gint); | ||
Add a drawing request to the event queue for part of the widget. | ||
procedure Queue_Clear (Widget : access Gtk_Widget_Record); | ||
Add a clear request to the event queue for the whole widget. | ||
procedure Queue_Clear_Area (Widget : access Gtk_Widget_Record; X : Gint; Y : Gint; Width : Gint; Height : Gint); | ||
Add a clear request to the event queue for part of the widget. | ||
procedure Queue_Resize (Widget : access Gtk_Widget_Record); | ||
Queue drawing requests after a resizing of the widget. | ||
procedure Draw (Widget : access Gtk_Widget_Record; Area : in Gdk.Rectangle.Gdk_Rectangle := Gdk.Rectangle.Full_Area); | ||
Emit a "draw" signal for a specific area of the widget. | ||
procedure Draw_Focus (Widget : access Gtk_Widget_Record); | ||
Emit a "draw_focus" signal for the widget. | ||
procedure Draw_Default (Widget : access Gtk_Widget_Record); | ||
Emit a "draw_default" signal for the widget. | ||
Size and position | ||
procedure Size_Request (Widget : access Gtk_Widget_Record; Requisition : in out Gtk_Requisition); | ||
Emit a "size_request" event for the widget
| ||
procedure Size_Allocate (Widget : access Gtk_Widget_Record; Allocation : in out Gtk_Allocation); | ||
Emit a "size_allocate" event for the widget. | ||
function Get_Child_Requisition (Widget : access Gtk_Widget_Record) return Gtk_Requisition; | ||
Return the size requests by the widget. | ||
procedure Set_UPosition (Widget : access Gtk_Widget_Record; X, Y : in Gint); | ||
Modify the position of the widget. | ||
procedure Set_USize (Widget : access Gtk_Widget_Record; Width, Height : in Gint); | ||
Modify the size of the widget. | ||
function Get_Allocation_Width (Widget : access Gtk_Widget_Record) return Guint; | ||
Return the current width of the widget.
| ||
function Get_Allocation_Height (Widget : access Gtk_Widget_Record) return Guint; | ||
Return the current height of the widget.
| ||
function Get_Allocation_X (Widget : access Gtk_Widget_Record) return Gint; | ||
Return the current position of the widget, relative to its parent.
| ||
function Get_Allocation_Y (Widget : access Gtk_Widget_Record) return Gint; | ||
Return the current position of the widget, relative to its parent.
| ||
Accelerators | ||
procedure Add_Accelerator (Widget : access Gtk_Widget_Record; Accel_Signal : in String; Accel_Group : in Gtk.Accel_Group.Gtk_Accel_Group; Accel_Key : in Gdk.Types.Gdk_Key_Type; Accel_Mods : in Gdk.Types.Gdk_Modifier_Type; Accel_Flags : in Gtk.Accel_Group.Gtk_Accel_Flags); | ||
Add a new accelerator for the widget. | ||
procedure Remove_Accelerator (Widget : access Gtk_Widget_Record; Accel_Group : in Gtk.Accel_Group.Gtk_Accel_Group; Accel_Key : in Gdk.Types.Gdk_Key_Type; Accel_Mods : in Gdk.Types.Gdk_Modifier_Type); | ||
Remove an accelerator for the widget.
| ||
procedure Remove_Accelerators (Widget : access Gtk_Widget_Record; Accel_Signal : in String; Visible_Only : in Boolean := True); | ||
Remove all the accelerators for the widget that emits the Accel_Signal | ||
function Accelerator_Signal (Widget : access Gtk_Widget_Record; Accel_Group : in Gtk.Accel_Group.Gtk_Accel_Group; Accel_Key : in Gdk.Types.Gdk_Key_Type; Accel_Mods : in Gdk.Types.Gdk_Modifier_Type) return Guint; | ||
Return the signal id of the signal emitted when Accel_Key is pressed | ||
procedure Lock_Accelerators (Widget : access Gtk_Widget_Record); | ||
Lock the accelerators for the widget. | ||
procedure Unlock_Accelerators (Widget : access Gtk_Widget_Record); | ||
Unlock the accelerators for the widget. | ||
Events and signals | ||
function Event (Widget : access Gtk_Widget_Record'Class; Event : Gdk.Event.Gdk_Event) return Gint; | ||
Emit a signal on the widget. | ||
procedure Activate (Widget : access Gtk_Widget_Record); | ||
Emit an activate signal on the widget. | ||
procedure Grab_Focus (Widget : access Gtk_Widget_Record); | ||
Emit the "grab_focus" signal for the widget. | ||
procedure Set_Events (Widget : access Gtk_Widget_Record; Events : in Gdk.Types.Gdk_Event_Mask); | ||
Sets the event mask for the widget. | ||
function Get_Events (Widget : access Gtk_Widget_Record) return Gdk.Types.Gdk_Event_Mask; | ||
Get the event mask for the widget. | ||
procedure Add_Events (Widget : access Gtk_Widget_Record; Events : in Gdk.Types.Gdk_Event_Mask); | ||
Add some events to the current event mask of the widget.
| ||
procedure Set_Extension_Events (Widget : access Gtk_Widget_Record; Mode : in Gdk.Types.Gdk_Extension_Mode); | ||
Set the extension event mask for the widget. | ||
function Get_Extension_Events (Widget : access Gtk_Widget_Record) return Gdk.Types.Gdk_Extension_Mode; | ||
Return the current extension events mask.
| ||
function Default_Motion_Notify_Event (Widget : access Gtk_Widget_Record'Class; Event : Gdk.Event.Gdk_Event) return Gint; | ||
Access to the standard default callback for motion events: | ||
function Has_Default_Motion_Notify_Handler (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Return True if Widget has a default handler for motion_notify events. | ||
Colors and colormaps | ||
function Get_Colormap (Widget : access Gtk_Widget_Record) return Gdk.Color.Gdk_Colormap; | ||
Return the colormap used for the widget. This will generally be the | ||
function Get_Visual (Widget : access Gtk_Widget_Record) return Gdk.Visual.Gdk_Visual; | ||
Get the visual used for the widget. | ||
procedure Set_Colormap (Widget : access Gtk_Widget_Record; Cmap : Gdk.Color.Gdk_Colormap); | ||
Modify the colormap of the widget. | ||
procedure Set_Visual (Widget : access Gtk_Widget_Record; Visual : Gdk.Visual.Gdk_Visual); | ||
Modify the visual of the widget. | ||
procedure Push_Colormap (Cmap : Gdk.Color.Gdk_Colormap); | ||
Modify temporarily the default colormap set for newly created widgets. | ||
procedure Pop_Colormap; | ||
See Push_Colormap for more information.
| ||
procedure Push_Visual (Visual : Gdk.Visual.Gdk_Visual); | ||
Modify temporarily the default visual set for newly created widgets. | ||
procedure Pop_Visual; | ||
See Push_Visual for more information.
| ||
function Get_Default_Colormap return Gdk.Color.Gdk_Colormap; | ||
Return the default colormap used when a widget is created.
| ||
procedure Set_Default_Colormap (Cmap : Gdk.Color.Gdk_Colormap); | ||
Modify permanently the default colormap used when a widget is created. | ||
function Get_Default_Visual return Gdk.Visual.Gdk_Visual; | ||
Return the default visual used when a new widget is created.
| ||
procedure Set_Default_Visual (Visual : Gdk.Visual.Gdk_Visual); | ||
Modify permanently the default visual used when a widget is created. | ||
Styles | ||
procedure Push_Style (Style : Gtk.Style.Gtk_Style); | ||
Change the default values for styles. | ||
procedure Pop_Style; | ||
Restore the default values for styles. | ||
procedure Set_Style (Widget : access Gtk_Widget_Record; Style : Gtk.Style.Gtk_Style); | ||
Set the style for a given widget.
| ||
function Get_Style (Widget : access Gtk_Widget_Record) return Gtk.Style.Gtk_Style; | ||
Return the style of a given widget.
| ||
procedure Modify_Style (Widget : access Gtk_Widget_Record; Style : Gtk_Rc_Style); | ||
Modify the default style of a widget.
| ||
procedure Set_Default_Style (Style : Gtk.Style.Gtk_Style); | ||
Set the default global style.
| ||
function Get_Default_Style return Gtk.Style.Gtk_Style; | ||
Get the default global style.
| ||
procedure Set_Rc_Style (Widget : access Gtk_Widget_Record); | ||
Restore the default style of a widget. | ||
procedure Ensure_Style (Widget : access Gtk_Widget_Record); | ||
Make sure that the widget has a style associated to it. | ||
procedure Restore_Default_Style (Widget : access Gtk_Widget_Record); | ||
Restore the default style that was set for the widget. | ||
procedure Reset_Rc_Styles (Widget : access Gtk_Widget_Record); | ||
Restore the Rc style recursively for widget and its children.
| ||
Widgets' tree | ||
procedure Set_Name (Widget : access Gtk_Widget_Record; Name : in String); | ||
Set the name for the widget. | ||
function Get_Name (Widget : access Gtk_Widget_Record) return String; | ||
Return the name of the widget if it was set by Set_Name. | ||
procedure Set_Parent (Widget : access Gtk_Widget_Record; Parent : access Gtk_Widget_Record'Class); | ||
Modify the parent for the widget. | ||
procedure Set_Parent_Window (Widget : access Gtk_Widget_Record; Window : Gdk.Window.Gdk_Window); | ||
Set the parent window for the actual Gdk_Window of the widget. This sets | ||
function Get_Parent (Widget : access Gtk_Widget_Record) return Gtk_Widget; | ||
Return the parent of the widget, or null if Widget is a toplevel | ||
function Get_Toplevel (Widget : access Gtk_Widget_Record) return Gtk_Widget; | ||
Return the toplevel ancestor of the widget. | ||
function Get_Ancestor (Widget : access Gtk_Widget_Record; Ancestor_Type : in Gtk_Type) return Gtk_Widget; | ||
Return the closest ancestor of Widget which is of type Ancestor_Type. | ||
function Is_Ancestor (Widget : access Gtk_Widget_Record; Ancestor : access Gtk_Widget_Record'Class) return Boolean; | ||
Return True if Ancestor is in the ancestor tree for Widget. | ||
procedure Reparent (Widget : access Gtk_Widget_Record; New_Parent : access Gtk_Widget_Record'Class); | ||
Change the parent of the widget dynamically. | ||
Misc functions | ||
procedure Set_Scroll_Adjustments (Widget : access Gtk_Widget_Record; Hadj : Gtk.Adjustment.Gtk_Adjustment; Vadj : Gtk.Adjustment.Gtk_Adjustment); | ||
Emit the "set_scroll_adjustments" signal. | ||
procedure Popup (Widget : access Gtk_Widget_Record; X, Y : in Gint); | ||
Realize the widget (see Realize above), moves it to the screen position | ||
function Intersect (Widget : access Gtk_Widget_Record; Area : Gdk.Rectangle.Gdk_Rectangle; Intersection : access Gdk.Rectangle.Gdk_Rectangle) return Boolean; | ||
Return True if the widget intersects the screen area Area. | ||
procedure Grab_Default (Widget : access Gtk_Widget_Record); | ||
The widget becomes the default widget for its parent window or dialog. | ||
procedure Set_State (Widget : access Gtk_Widget_Record; State : in Enums.Gtk_State_Type); | ||
Modify the state of the widget. | ||
function Get_State (Widget : access Gtk_Widget_Record) return Enums.Gtk_State_Type; | ||
Return the state of the widget.
| ||
procedure Set_Sensitive (Widget : access Gtk_Widget_Record; Sensitive : in Boolean := True); | ||
Modify the sensitivity of the widget. | ||
procedure Set_App_Paintable (Widget : access Gtk_Widget_Record; App_Paintable : Boolean); | ||
Modify the "App_Paintable" flag for the widget.
| ||
procedure Get_Pointer (Widget : access Gtk_Widget_Record; X : out Gint; Y : out Gint); | ||
Return the coordinates of the pointer (i.e. mouse) relative to Widget.
| ||
procedure Set_Window (Widget : access Gtk_Widget_Record; Window : in Gdk.Window.Gdk_Window); | ||
Set the Gdk window associated with the widget.
| ||
function Get_Window (Widget : access Gtk_Widget_Record) return Gdk.Window.Gdk_Window; | ||
Get the Gdk window associated with the widget. | ||
procedure Shape_Combine_Mask (Widget : access Gtk_Widget_Record; Shape_Mask : Gdk.Bitmap.Gdk_Bitmap; Offset_X : Gint; Offset_Y : Gint); | ||
Modify the shape of the window that contains the widget. | ||
Flags | ||
Some additional flags are defined for all the visual objects (widgets).
| ||
function Toplevel_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Toplevel flag is set.
| ||
function No_Window_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the No_Window flag is set.
| ||
function Realized_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Realized flag is set.
| ||
function Mapped_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Mapped flag is set.
| ||
function Visible_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Visible flag is set.
| ||
function Drawable_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
True if the widget is both visible and mapped. | ||
function Is_Sensitive (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the widget is Sensitive.
| ||
function Can_Focus_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Can_Focus flag is set.
| ||
function Has_Focus_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Has_Focus flag is set.
| ||
function Has_Default_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Has_Default flag is set.
| ||
function Has_Grab_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Has_Grab flag is set.
| ||
function Rc_Style_Is_Set (Widget : access Gtk_Widget_Record'Class) return Boolean; | ||
Test whether the Rc_Style flag is set.
|