1.12 <GtkAspectFrame>

Class: <GtkAspectFrame>

It derives from <GtkWidget>.

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 Gtk.AccessibleRole.group role.

Starting from GTK 4.12, <GtkAspectFrame> uses the Gtk.AccessibleRole.generic role.

Properties

Property: aspect-frame:child self

The child widget.

Its value is a <GtkWidget>, or #f.

Set it with (set! (aspect-frame:child self) value).

Property: aspect-frame:obey-child self

Whether the <GtkAspectFrame> should use the aspect ratio of its child.

Its value is a boolean.

Set it with (set! (aspect-frame:obey-child self) value).

Property: aspect-frame:ratio self

The aspect ratio to be used by the <GtkAspectFrame>.

This property is only used if aspect-frame:obey-child is set to #f.

Its value is a real number.

Set it with (set! (aspect-frame:ratio self) value).

Property: aspect-frame:xalign self

The horizontal alignment of the child.

Its value is a real number.

Set it with (set! (aspect-frame:xalign self) value).

Property: aspect-frame:yalign self

The vertical alignment of the child.

Its value is a real number.

Set it with (set! (aspect-frame:yalign self) value).

Procedures

Method: aspect-frame:get-child self ⇒ %return
Method: get-child self ⇒ %return

Gets the child widget of self.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

%return

Returned: a <GtkWidget>, or #f.

the child widget of self

Method: aspect-frame:get-obey-child? self ⇒ %return
Method: get-obey-child? self ⇒ %return

Returns whether the child’s size request should override the set aspect ratio of the <GtkAspectFrame>.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

%return

Returned: a boolean.

whether to obey the child’s size request

Method: aspect-frame:get-ratio self ⇒ %return
Method: get-ratio self ⇒ %return

Returns the desired aspect ratio of the child.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

%return

Returned: a real number.

the desired aspect ratio

Method: aspect-frame:get-xalign self ⇒ %return
Method: get-xalign self ⇒ %return

Returns the horizontal alignment of the child within the allocation of the <GtkAspectFrame>.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

%return

Returned: a real number.

the horizontal alignment

Method: aspect-frame:get-yalign self ⇒ %return
Method: get-yalign self ⇒ %return

Returns the vertical alignment of the child within the allocation of the <GtkAspectFrame>.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

%return

Returned: a real number.

the vertical alignment

Procedure: aspect-frame:new xalign yalign ratio obey-child ⇒ %return

Create a new <GtkAspectFrame>.

xalign

Passed: a real number.

Horizontal alignment of the child within the parent. Ranges from 0.0 (left aligned) to 1.0 (right aligned)

yalign

Passed: a real number.

Vertical alignment of the child within the parent. Ranges from 0.0 (top aligned) to 1.0 (bottom aligned)

ratio

Passed: a real number.

The desired aspect ratio.

obey-child

Passed: a boolean.

If #t, ratio is ignored, and the aspect ratio is taken from the requistion of the child.

%return

Returned: a <GtkWidget>.

the new <GtkAspectFrame>.

Method: aspect-frame:set-child self [child]
Method: set-child self [child]

Sets the child widget of self.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

child

Passed, or left out: a <GtkWidget>, or #f.

the child widget

Method: aspect-frame:set-obey-child self obey-child
Method: set-obey-child self obey-child

Sets whether the aspect ratio of the child’s size request should override the set aspect ratio of the <GtkAspectFrame>.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

obey-child

Passed: a boolean.

If #t, ratio is ignored, and the aspect ratio is taken from the requisition of the child.

Method: aspect-frame:set-ratio self ratio
Method: set-ratio self ratio

Sets the desired aspect ratio of the child.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

ratio

Passed: a real number.

aspect ratio of the child

Method: aspect-frame:set-xalign self xalign
Method: set-xalign self xalign

Sets the horizontal alignment of the child within the allocation of the <GtkAspectFrame>.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

xalign

Passed: a real number.

horizontal alignment, from 0.0 (left aligned) to 1.0 (right aligned)

Method: aspect-frame:set-yalign self yalign
Method: set-yalign self yalign

Sets the vertical alignment of the child within the allocation of the <GtkAspectFrame>.

self

Passed: a <GtkAspectFrame>.

a <GtkAspectFrame>

yalign

Passed: a real number.

horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom aligned)