GTK+ Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
#include <gtk/gtk.h> GtkFrame; GtkWidget* gtk_frame_new (const gchar *label
); void gtk_frame_set_label (GtkFrame *frame
,const gchar *label
); void gtk_frame_set_label_widget (GtkFrame *frame
,GtkWidget *label_widget
); void gtk_frame_set_label_align (GtkFrame *frame
,gfloat xalign
,gfloat yalign
); void gtk_frame_set_shadow_type (GtkFrame *frame
,GtkShadowType type
); const gchar * gtk_frame_get_label (GtkFrame *frame
); void gtk_frame_get_label_align (GtkFrame *frame
,gfloat *xalign
,gfloat *yalign
); GtkWidget * gtk_frame_get_label_widget (GtkFrame *frame
); GtkShadowType gtk_frame_get_shadow_type (GtkFrame *frame
);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkFrame +----GtkAspectFrame
"label" gchar* : Read / Write "label-widget" GtkWidget* : Read / Write "label-xalign" gfloat : Read / Write "label-yalign" gfloat : Read / Write "shadow" GtkShadowType : Read / Write "shadow-type" GtkShadowType : Read / Write
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()
.
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.
Example 45. A UI definition fragment with GtkFrame
1 2 3 4 5 6 7 8 |
<object class="GtkFrame"> <child type="label"> <object class="GtkLabel" id="frame-label"/> </child> <child> <object class="GtkEntry" id="frame-content"/> </child> </object> |
GtkWidget* gtk_frame_new (const gchar *label
);
Creates a new GtkFrame, with optional label label
.
If label
is NULL
, the label is omitted.
|
the text to use as the label of the frame |
Returns : |
a new GtkFrame widget |
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.
|
a GtkFrame |
|
the text to use as the label of the frame. [allow-none] |
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.
|
a GtkFrame |
|
the new label widget |
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.
|
a GtkFrame |
|
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. |
|
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. |
void gtk_frame_set_shadow_type (GtkFrame *frame
,GtkShadowType type
);
Sets the shadow type for frame
.
|
a GtkFrame |
|
the new GtkShadowType |
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()
.)
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()
.
GtkWidget * gtk_frame_get_label_widget (GtkFrame *frame
);
Retrieves the label widget for the frame. See
gtk_frame_set_label_widget()
.
GtkShadowType gtk_frame_get_shadow_type (GtkFrame *frame
);
Retrieves the shadow type of the frame. See
gtk_frame_set_shadow_type()
.
|
a GtkFrame |
Returns : |
the current shadow type of the frame. |
"label-widget"
property"label-widget" GtkWidget* : Read / Write
A widget to display in place of the usual frame label.
"label-xalign"
property"label-xalign" gfloat : Read / Write
The horizontal alignment of the label.
Allowed values: [0,1]
Default value: 0
"label-yalign"
property"label-yalign" gfloat : Read / Write
The vertical alignment of the label.
Allowed values: [0,1]
Default value: 0.5
"shadow"
property"shadow" GtkShadowType : Read / Write
Deprecated property, use shadow_type instead.
Default value: GTK_SHADOW_ETCHED_IN
"shadow-type"
property"shadow-type" GtkShadowType : Read / Write
Appearance of the frame border.
Default value: GTK_SHADOW_ETCHED_IN