GtkFrame
GtkFrame — A bin with a decorative frame and optional label
Functions
GtkWidget * | gtk_frame_new () |
void | gtk_frame_set_label () |
void | gtk_frame_set_label_widget () |
void | gtk_frame_set_label_align () |
void | gtk_frame_set_shadow_type () |
const gchar * | gtk_frame_get_label () |
void | gtk_frame_get_label_align () |
GtkWidget * | gtk_frame_get_label_widget () |
GtkShadowType | gtk_frame_get_shadow_type () |
Properties
gchar * | label | Read / Write |
GtkWidget * | label-widget | Read / Write |
gfloat | label-xalign | Read / Write |
gfloat | label-yalign | Read / Write |
GtkShadowType | shadow-type | Read / Write |
Types and Values
struct | GtkFrame |
struct | GtkFrameClass |
Object Hierarchy
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkFrame ╰── GtkAspectFrame
Implemented Interfaces
GtkFrame implements AtkImplementorIface and GtkBuildable.
Includes
#include <gtk/gtk.h>
Description
The frame widget is a bin that surrounds its child with a decorative frame and an optional label. If present, the label is drawn in a gap in the top side of the frame. The position of the label can be controlled with gtk_frame_set_label_align()
.
GtkFrame as GtkBuildable
The GtkFrame implementation of the GtkBuildable interface supports placing a child in the label position by specifying “label” as the “type” attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute.
An example of a UI definition fragment with GtkFrame:
CSS nodes
<object class="GtkFrame"> <child type="label"> <object class="GtkLabel" id="frame-label"/> </child> <child> <object class="GtkEntry" id="frame-content"/> </child> </object>
GtkFrame has a main CSS node with name frame and a subnode with name border. The border node is used to render the visible border. The style class .flat can appear with the main node.
Functions
gtk_frame_new ()
GtkWidget *
gtk_frame_new (const gchar *label
);
Creates a new GtkFrame, with optional label label
. If label
is NULL
, the label is omitted.
Parameters
label | the text to use as the label of the frame. | [allow-none] |
Returns
a new GtkFrame widget
gtk_frame_set_label ()
void gtk_frame_set_label (GtkFrame *frame
,const gchar *label
);
Sets the text of the label. If label
is NULL
, the current label is removed.
Parameters
frame | a GtkFrame | |
label | the text to use as the label of the frame. | [allow-none] |
gtk_frame_set_label_widget ()
void gtk_frame_set_label_widget (GtkFrame *frame
,GtkWidget *label_widget
);
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.
Parameters
frame | a GtkFrame | |
label_widget | the new label widget. | [nullable] |
gtk_frame_set_label_align ()
void gtk_frame_set_label_align (GtkFrame *frame
,gfloat xalign
,gfloat yalign
);
Sets the alignment of the frame widget’s label. The default values for a newly created frame are 0.0 and 0.5.
Parameters
frame | a GtkFrame | |
xalign | The position of the label along the top edge of the widget. A value of 0.0 represents left alignment; 1.0 represents right alignment. | |
yalign | The y alignment of the label. A value of 0.0 aligns under the frame; 1.0 aligns above the frame. If the values are exactly 0.0 or 1.0 the gap in the frame won’t be painted because the label will be completely above or below the frame. |
gtk_frame_set_shadow_type ()
void gtk_frame_set_shadow_type (GtkFrame *frame
,GtkShadowType type
);
Sets the shadow type for frame
.
Parameters
frame | a GtkFrame | |
type | the new GtkShadowType |
gtk_frame_get_label ()
const gchar *
gtk_frame_get_label (GtkFrame *frame
);
If the frame’s label widget is a GtkLabel, returns the text in the label widget. (The frame will have a GtkLabel for the label widget if a non-NULL
argument was passed to gtk_frame_new()
.)
Parameters
frame | a GtkFrame |
gtk_frame_get_label_align ()
void gtk_frame_get_label_align (GtkFrame *frame
,gfloat *xalign
,gfloat *yalign
);
Retrieves the X and Y alignment of the frame’s label. See gtk_frame_set_label_align()
.
gtk_frame_get_label_widget ()
GtkWidget *
gtk_frame_get_label_widget (GtkFrame *frame
);
Retrieves the label widget for the frame. See gtk_frame_set_label_widget()
.
Parameters
frame | a GtkFrame |
gtk_frame_get_shadow_type ()
GtkShadowType
gtk_frame_get_shadow_type (GtkFrame *frame
);
Retrieves the shadow type of the frame. See gtk_frame_set_shadow_type()
.
Parameters
frame | a GtkFrame |
Returns
the current shadow type of the frame.
Types and Values
struct GtkFrame
struct GtkFrame;
struct GtkFrameClass
struct GtkFrameClass { GtkBinClass parent_class; void (*compute_child_allocation) (GtkFrame *frame, GtkAllocation *allocation); };
Members
|
Property Details
The “label”
property
“label” gchar *
Text of the frame's label.
Flags: Read / Write
Default value: NULL
The “label-widget”
property
“label-widget” GtkWidget *
A widget to display in place of the usual frame label.
Flags: Read / Write
The “label-xalign”
property
“label-xalign” gfloat
The horizontal alignment of the label.
Flags: Read / Write
Allowed values: [0,1]
Default value: 0
The “label-yalign”
property
“label-yalign” gfloat
The vertical alignment of the label.
Flags: Read / Write
Allowed values: [0,1]
Default value: 0.5
The “shadow-type”
property
“shadow-type” GtkShadowType
Appearance of the frame border.
Flags: Read / Write
Default value: GTK_SHADOW_ETCHED_IN
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk3/3.20/GtkFrame.html