GTK + Learning Notes (eight)

Source: Internet
Author: User
Tags gtk

A framework (Frames) can be used to encapsulate one or a set of artifacts in a box, and the framework itself can have a label. The position of the label and the style of the box can be changed flexibly.

The framework can be created with the following function:

Gtkwidget *gtk_frame_new (const Gchar *label);

The label is placed by default in the upper-left corner of the frame. When you pass a null value as a label parameter, the frame does not display a label. The label text can be changed with the following function.

void Gtk_frame_set_label (Gtkframe *frame,
Const Gchar *label);

The position of the label can be changed with the following function:

void Gtk_frame_set_label_align (Gtkframe *frame,
Gfloat Xalign,
Gfloat yalign);

The xalign and yalign parameter values range between 0.0 and 1.0. XALIGN Specifies the position of the label on the upper horizontal line of the frame member. Yalign has not been used yet. The default value of Xalign is 0.0, which places the label at the leftmost end of the frame widget.

The following function changes the style of the box to show the outline of the frame.

void Gtk_frame_set_shadow_type (Gtkframe *frame,
Gtkshadowtype type);

The type parameter can take one of the following values:

Gtk_shadow_none
Gtk_shadow_in
Gtk_shadow_out
Gtk_shadow_etched_in (default value)
Gtk_shadow_etched_out.

1 /*Create a Frame*/2frame =gtk_frame_new (NULL);3 Gtk_container_add (Gtk_container (window), frame);4 5   /*set the label for a frame*/6Gtk_frame_set_label (Gtk_frame (frame),"GTK Frame Widget");7 8   /*position the label to the right of the frame*/9Gtk_frame_set_label_align (Gtk_frame (frame),1.0,0.0);Ten  One   /*set the style of the frame*/ AGtk_frame_set_shadow_type (Gtk_frame (frame), gtk_shadow_etched_out);

Today's box experience is the highlight of the window.

GTK + Learning Notes (eight)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.