AspectFrame

The gtk.AspectFrame 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. gtk.AspectFrame derives from gtk.Frame, so it can draw a label and a frame around the child. The frame will be “shrink-wrapped” to the size of the child.

CSS nodes

GtkAspectFrame uses a CSS node with name frame.

Constructors

this
this(GtkAspectFrame* gtkAspectFrame, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(string label, float xalign, float yalign, float ratio, bool obeyChild)

Create a new gtk.AspectFrame

Members

Functions

getAspectFrameStruct
GtkAspectFrame* getAspectFrameStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

set
void set(float xalign, float yalign, float ratio, bool obeyChild)

Set parameters for an existing gtk.AspectFrame

Static functions

getType
GType getType()

Variables

gtkAspectFrame
GtkAspectFrame* gtkAspectFrame;

the main Gtk struct

Inherited Members

From Frame

gtkFrame
GtkFrame* gtkFrame;

the main Gtk struct

getFrameStruct
GtkFrame* getFrameStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getLabel
string getLabel()

If the frame’s label widget is a gtk.Label, returns the text in the label widget. (The frame will have a gtk.Label for the label widget if a non-NULL argument was passed to Frame.new.)

getLabelAlign
void getLabelAlign(float xalign, float yalign)

Retrieves the X and Y alignment of the frame’s label. See Frame.setLabelAlign.

getLabelWidget
Widget getLabelWidget()

Retrieves the label widget for the frame. See Frame.setLabelWidget.

getShadowType
GtkShadowType getShadowType()

Retrieves the shadow type of the frame. See Frame.setShadowType.

setLabel
void setLabel(string label)

Removes the current label-widget. If label is not NULL, creates a new gtk.Label with that text and adds it as the label-widget.

setLabelAlign
void setLabelAlign(float xalign, float yalign)

Sets the alignment of the frame widget’s label. The default values for a newly created frame are 0.0 and 0.5.

setLabelWidget
void setLabelWidget(Widget labelWidget)

Sets the label-widget for the frame. This is the widget that will appear embedded in the top edge of the frame as a title.

setShadowType
void setShadowType(GtkShadowType type)

Sets the shadow-type for frame, i.e. whether it is drawn without (GTK_SHADOW_NONE) or with (other values) a visible border. Values other than GTK_SHADOW_NONE are treated identically by GtkFrame. The chosen type is applied by removing or adding the .flat class to the CSS node named border.