Preserves the aspect ratio of its child.
The frame can respect the aspect ratio of the child widget, or use its own aspect ratio.
# CSS nodes
GtkAspectFrame uses a CSS node with name aspectframe.
# Accessibility
Until GTK 4.10, GtkAspectFrame used the [enumGtk.AccessibleRole.group] role.
Starting from GTK 4.12, GtkAspectFrame uses the [enumGtk.AccessibleRole.generic] role.
A Gtk_Aspect_Frame keeps its one child at a fixed aspect ratio (width divided by height) however much the frame itself is resized, using the Xalign and Yalign properties to place the child in any space left over. With Obey_Child set, the ratio is taken from the child's own size request instead of from Ratio.
Unlike Gtk_Frame it draws no border and has no label.
<group>Ornaments</group> <gtkada_demo>create_aspect_frame.adb</gtkada_demo>
function "+"
(Widget : access Gtk_Aspect_Frame_Record'Class)
return Gtk.Accessible.Gtk_Accessible
function "+"
(Widget : access Gtk_Aspect_Frame_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_Aspect_Frame_Record'Class)
return Gtk.Constraint_Target.Gtk_Constraint_Target
function "-"
(Interf : Gtk.Accessible.Gtk_Accessible)
return Gtk_Aspect_Frame
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Aspect_Frame
function "-"
(Interf : Gtk.Constraint_Target.Gtk_Constraint_Target)
return Gtk_Aspect_Frame
procedure Announce
(Self : not null access Gtk_Aspect_Frame_Record;
Message : UTF8_String;
Priority : Gtk.Accessible.Gtk_Accessible_Announcement_Priority)
Child_Property : constant Glib.Properties.Property_Object;
Type: Gtk.Widget.Gtk_Widget The child widget.
function Get_Accessible_Id
(Self : not null access Gtk_Aspect_Frame_Record) return UTF8_String
function Get_Accessible_Parent
(Self : not null access Gtk_Aspect_Frame_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Accessible_Role
(Self : not null access Gtk_Aspect_Frame_Record)
return Gtk.Accessible.Gtk_Accessible_Role
function Get_At_Context
(Self : not null access Gtk_Aspect_Frame_Record)
return Gtk.Atcontext.Gtk_Atcontext
function Get_Bounds
(Self : not null access Gtk_Aspect_Frame_Record;
X : out Glib.Gint;
Y : out Glib.Gint;
Width : out Glib.Gint;
Height : out Glib.Gint) return Boolean
function Get_Child
(Self : not null access Gtk_Aspect_Frame_Record)
return Gtk.Widget.Gtk_Widget
Gets the child widget of Self.
the child widget of Self. Has transfer-ownership='none'.
function Get_First_Accessible_Child
(Self : not null access Gtk_Aspect_Frame_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Next_Accessible_Sibling
(Self : not null access Gtk_Aspect_Frame_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Obey_Child
(Self : not null access Gtk_Aspect_Frame_Record) return Boolean
Returns whether the child's size request should override the set aspect ratio of the GtkAspectFrame.
whether to obey the child's size request
function Get_Platform_State
(Self : not null access Gtk_Aspect_Frame_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State) return Boolean
function Get_Ratio
(Self : not null access Gtk_Aspect_Frame_Record)
return Interfaces.C.C_float
Returns the desired aspect ratio of the child.
the desired aspect ratio
function Get_Type return Glib.GType
function Get_Xalign
(Self : not null access Gtk_Aspect_Frame_Record)
return Interfaces.C.C_float
Returns the horizontal alignment of the child within the allocation of the GtkAspectFrame.
the horizontal alignment
function Get_Yalign
(Self : not null access Gtk_Aspect_Frame_Record)
return Interfaces.C.C_float
Returns the vertical alignment of the child within the allocation of the GtkAspectFrame.
the vertical alignment
type Gtk_Aspect_Frame is access all Gtk_Aspect_Frame_Record'Class;
function Gtk_Aspect_Frame_New
(Xalign : Interfaces.C.C_float;
Yalign : Interfaces.C.C_float;
Ratio : Interfaces.C.C_float;
Obey_Child : Boolean) return Gtk_Aspect_Frame
Create a new GtkAspectFrame.
Horizontal alignment of the child within the parent. Ranges from 0.0 (left aligned) to 1.0 (right aligned)
Vertical alignment of the child within the parent. Ranges from 0.0 (top aligned) to 1.0 (bottom aligned)
The desired aspect ratio.
If True, Ratio is ignored, and the aspect ratio is taken from the requistion of the child.
type Gtk_Aspect_Frame_Record is new Gtk_Widget_Record with null record;
procedure Gtk_New
(Self : out Gtk_Aspect_Frame;
Xalign : Interfaces.C.C_float;
Yalign : Interfaces.C.C_float;
Ratio : Interfaces.C.C_float;
Obey_Child : Boolean)
Create a new GtkAspectFrame. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
Horizontal alignment of the child within the parent. Ranges from 0.0 (left aligned) to 1.0 (right aligned)
Vertical alignment of the child within the parent. Ranges from 0.0 (top aligned) to 1.0 (bottom aligned)
The desired aspect ratio.
If True, Ratio is ignored, and the aspect ratio is taken from the requistion of the child.
package Implements_Gtk_Accessible is new Glib.Types.Implements
(Gtk.Accessible.Gtk_Accessible, Gtk_Aspect_Frame_Record, Gtk_Aspect_Frame);
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Aspect_Frame_Record, Gtk_Aspect_Frame);
package Implements_Gtk_Constraint_Target is new Glib.Types.Implements
(Gtk.Constraint_Target.Gtk_Constraint_Target, Gtk_Aspect_Frame_Record, Gtk_Aspect_Frame);
procedure Initialize
(Self : not null access Gtk_Aspect_Frame_Record'Class;
Xalign : Interfaces.C.C_float;
Yalign : Interfaces.C.C_float;
Ratio : Interfaces.C.C_float;
Obey_Child : Boolean)
Create a new GtkAspectFrame. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
Horizontal alignment of the child within the parent. Ranges from 0.0 (left aligned) to 1.0 (right aligned)
Vertical alignment of the child within the parent. Ranges from 0.0 (top aligned) to 1.0 (bottom aligned)
The desired aspect ratio.
If True, Ratio is ignored, and the aspect ratio is taken from the requistion of the child.
Obey_Child_Property : constant Glib.Properties.Property_Boolean;
Whether the GtkAspectFrame should use the aspect ratio of its child.
Ratio_Property : constant Glib.Properties.Property_Float;
The aspect ratio to be used by the GtkAspectFrame.
This property is only used if [propertyGtk.AspectFrame:obey-child] is set to False.
procedure Reset_Property
(Self : not null access Gtk_Aspect_Frame_Record;
Property : Gtk.Accessible.Gtk_Accessible_Property)
procedure Reset_Relation
(Self : not null access Gtk_Aspect_Frame_Record;
Relation : Gtk.Accessible.Gtk_Accessible_Relation)
procedure Reset_State
(Self : not null access Gtk_Aspect_Frame_Record;
State : Gtk.Accessible.Gtk_Accessible_State)
procedure Set_Accessible_Parent
(Self : not null access Gtk_Aspect_Frame_Record;
Parent : Gtk.Accessible.Gtk_Accessible;
Next_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Set_Child
(Self : not null access Gtk_Aspect_Frame_Record;
Child : access Gtk.Widget.Gtk_Widget_Record'Class)
Sets the child widget of Self.
the child widget
procedure Set_Obey_Child
(Self : not null access Gtk_Aspect_Frame_Record;
Obey_Child : Boolean)
Sets whether the aspect ratio of the child's size request should override the set aspect ratio of the GtkAspectFrame.
If True, Ratio is ignored, and the aspect ratio is taken from the requisition of the child.
procedure Set_Ratio
(Self : not null access Gtk_Aspect_Frame_Record;
Ratio : Interfaces.C.C_float)
Sets the desired aspect ratio of the child.
aspect ratio of the child
procedure Set_Xalign
(Self : not null access Gtk_Aspect_Frame_Record;
Xalign : Interfaces.C.C_float)
Sets the horizontal alignment of the child within the allocation of the GtkAspectFrame.
horizontal alignment, from 0.0 (left aligned) to 1.0 (right aligned)
procedure Set_Yalign
(Self : not null access Gtk_Aspect_Frame_Record;
Yalign : Interfaces.C.C_float)
Sets the vertical alignment of the child within the allocation of the GtkAspectFrame.
horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom aligned)
procedure Update_Next_Accessible_Sibling
(Self : not null access Gtk_Aspect_Frame_Record;
New_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Update_Platform_State
(Self : not null access Gtk_Aspect_Frame_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State)
Xalign_Property : constant Glib.Properties.Property_Float;
The horizontal alignment of the child.
Yalign_Property : constant Glib.Properties.Property_Float;
The vertical alignment of the child.