GtkAspectFrame — A frame that constrains its child to a particular aspect ratio
GtkWidget * | gtk_aspect_frame_new () |
void | gtk_aspect_frame_set () |
gboolean | obey-child | Read / Write |
float | ratio | Read / Write |
float | xalign | Read / Write |
float | yalign | Read / Write |
struct | GtkAspectFrame |
struct | GtkAspectFrameClass |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkFrame ╰── GtkAspectFrame
GtkAspectFrame implements AtkImplementorIface and GtkBuildable.
#include <gtk/gtk.h>
The GtkAspectFrame is useful when you want pack a widget so that it can resize but always retains the same aspect ratio. For instance, one might be drawing a small preview of a larger image. GtkAspectFrame derives from GtkFrame, so it can draw a label and a frame around the child. The frame will be “shrink-wrapped” to the size of the child.
GtkAspectFrame uses a CSS node with name frame.
GtkWidget * gtk_aspect_frame_new (const gchar *label
,gfloat xalign
,gfloat yalign
,gfloat ratio
,gboolean obey_child
);
Create a new GtkAspectFrame.
label | Label text. | [allow-none] |
xalign | Horizontal alignment of the child within the allocation of the GtkAspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned) | |
yalign | Vertical alignment of the child within the allocation of the GtkAspectFrame. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned) | |
ratio | The desired aspect ratio. | |
obey_child | If |
the new GtkAspectFrame.
void gtk_aspect_frame_set (GtkAspectFrame *aspect_frame
,gfloat xalign
,gfloat yalign
,gfloat ratio
,gboolean obey_child
);
Set parameters for an existing GtkAspectFrame.
aspect_frame | ||
xalign | Horizontal alignment of the child within the allocation of the GtkAspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned) | |
yalign | Vertical alignment of the child within the allocation of the GtkAspectFrame. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned) | |
ratio | The desired aspect ratio. | |
obey_child | If |
struct GtkAspectFrame;
struct GtkAspectFrameClass { GtkFrameClass parent_class; };
“obey-child”
property“obey-child” gboolean
Force aspect ratio to match that of the frame's child.
Owner: GtkAspectFrame
Flags: Read / Write
Default value: TRUE
“ratio”
property“ratio” float
Aspect ratio if obey_child is FALSE.
Owner: GtkAspectFrame
Flags: Read / Write
Allowed values: [0.0001,10000]
Default value: 1
“xalign”
property“xalign” float
X alignment of the child.
Owner: GtkAspectFrame
Flags: Read / Write
Allowed values: [0,1]
Default value: 0.5
“yalign”
property“yalign” float
Y alignment of the child.
Owner: GtkAspectFrame
Flags: Read / Write
Allowed values: [0,1]
Default value: 0.5
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk3/3.24/GtkAspectFrame.html