📄 gtkbox.sgml
字号:
<!-- ##### SECTION Title ##### -->GtkBox<!-- ##### SECTION Short_Description ##### -->Base class for box containers<!-- ##### SECTION Long_Description ##### --><para>GtkBox is an abstract widget which encapsulates functionality for aparticular kind of container, one that organizes a variable number ofwidgets into a rectangular area. GtkBox currently has two derivedclasses, #GtkHBox and #GtkVBox.</para><para>The rectangular area of a GtkBox is organized into either a single rowor a single column of child widgets depending upon whether the box isof type #GtkHBox or #GtkVBox, respectively. Thus, all children of aGtkBox are allocated one dimension in common, which is the height of arow, or the width of a column.</para><para>GtkBox uses a notion of <emphasis>packing</emphasis>. Packing refers toadding widgets with reference to a particular position in a#GtkContainer. For a GtkBox, there are two reference positions: the<emphasis>start</emphasis> and the <emphasis>end</emphasis> of the box. For a #GtkVBox, the start is defined as the top of the box and the end isdefined as the bottom. For a #GtkHBox the start is defined as theleft side and the end is defined as the right side.</para><para>Use repeated calls to gtk_box_pack_start() to pack widgets into aGtkBox from start to end. Use gtk_box_pack_end() to add widgets fromend to start. You may intersperse these calls and add widgets fromboth ends of the same GtkBox.</para><para>Use gtk_box_pack_start_defaults() or gtk_box_pack_end_defaults()to pack widgets into a GtkBox if you do not need to specify the#GtkBox:expand, #GtkBox:fill, or #GtkBox:padding child properties for the child to be added.</para><para>Because GtkBox is a #GtkContainer, you may also usegtk_container_add() to insert widgets into the box, and they will bepacked as if with gtk_box_pack_start_defaults(). Usegtk_container_remove() to remove widgets from the GtkBox.</para><para>Use gtk_box_set_homogeneous() to specify whether or not all childrenof the GtkBox are forced to get the same amount of space.</para><para>Use gtk_box_set_spacing() to determine how much space will beminimally placed between all children in the GtkBox.</para><para>Use gtk_box_reorder_child() to move a GtkBox child to a differentplace in the box.</para><para>Use gtk_box_set_child_packing() to reset the #GtkBox:expand, #GtkBox:fill and #GtkBox:padding child properties.Use gtk_box_query_child_packing() to query these fields.</para><!-- ##### SECTION See_Also ##### --><para><variablelist><varlistentry><term>#GtkHBox</term><listitem><para>a derived class that organizes widgets into a row.</para></listitem></varlistentry><varlistentry><term>#GtkVBox</term><listitem><para>a derived class that organizes widgets into a column.</para></listitem></varlistentry><varlistentry><term>#GtkFrame</term><listitem><para>a #GtkWidget useful for drawing a border around a GtkBox.</para></listitem></varlistentry><varlistentry><term>#GtkTable</term><listitem><para>a #GtkContainer for organizing widgets into a grid,rather than independent rows or columns.</para></listitem></varlistentry><varlistentry><term>#GtkLayout</term><listitem><para>a #GtkContainer for organizing widgets into arbitrarylayouts.</para></listitem></varlistentry></variablelist></para><!-- ##### SECTION Stability_Level ##### --><!-- ##### STRUCT GtkBox ##### --><para>The #GtkBox-struct describes an instance of GtkBox and contains the following fields. (These fields should be considered read-only. They should never be set by an application.)</para>@children: a list of children belonging the GtkBox. The data is a list of structures of type #GtkBoxChild-struct.@spacing: the number of pixels to put between children of the GtkBox, zero by default. Use gtk_box_set_spacing() to set this field.@homogeneous: a flag that if %TRUE forces all children to get equal space in the GtkBox; %FALSE by default. Use gtk_box_set_homogeneous() to set this field.<!-- ##### ARG GtkBox:homogeneous ##### --><para></para><!-- ##### ARG GtkBox:spacing ##### --><para></para><!-- ##### ARG GtkBox:expand ##### --><para></para><!-- ##### ARG GtkBox:fill ##### --><para></para><!-- ##### ARG GtkBox:pack-type ##### --><para></para><!-- ##### ARG GtkBox:padding ##### --><para></para><!-- ##### ARG GtkBox:position ##### --><para></para><!-- ##### STRUCT GtkBoxChild ##### --><para>The #GtkBoxChild-struct holds a child widget of GtkBox and describeshow the child is to be packed into the GtkBox. Usegtk_box_query_child_packing() and gtk_box_set_child_packing() to queryand reset the <structfield>padding</structfield>,<structfield>expand</structfield>, <structfield>fill</structfield>,and <structfield>pack</structfield> fields.</para><para>#GtkBoxChild-struct contains the following fields. (These fieldsshould be considered read-only. They should never be directly set by anapplication.)</para>@widget: the child widget, packed into the GtkBox.@padding: the number of extra pixels to put between this child and its neighbors, set when packed, zero by default.@expand: flag indicates whether extra space should be given to this child. Any extra space given to the parent GtkBox is divided up among all children with this attribute set to %TRUE; set when packed, %TRUE by default.@fill: flag indicates whether any extra space given to this child due to its @expand attribute being set is actually allocated to the child, rather than being used as padding around the widget; set when packed, %TRUE by default.@pack: one of #GtkPackType indicating whether the child is packed with reference to the start (top/left) or end (bottom/right) of the GtkBox.@is_secondary: %TRUE if the child is secondary<!-- ##### FUNCTION gtk_box_pack_start ##### --><para></para>@box: @child: @expand: @box@fill: @padding: <!-- ##### FUNCTION gtk_box_pack_end ##### --><para></para>@box: @child: @expand: @fill: @padding: <!-- ##### FUNCTION gtk_box_pack_start_defaults ##### --><para></para>@box: @widget: <!-- ##### FUNCTION gtk_box_pack_end_defaults ##### --><para></para>@box: @widget: <!-- ##### FUNCTION gtk_box_get_homogeneous ##### --><para></para>@box: @Returns: <!-- ##### FUNCTION gtk_box_set_homogeneous ##### --><para></para>@box: @homogeneous: <!-- ##### FUNCTION gtk_box_get_spacing ##### --><para></para>@box: @Returns: <!-- ##### FUNCTION gtk_box_set_spacing ##### --><para></para>@box: @spacing: <!-- ##### FUNCTION gtk_box_reorder_child ##### --><para></para>@box: @child: @position: <!-- ##### FUNCTION gtk_box_query_child_packing ##### --><para></para>@box: @child: @expand: @fill: @padding: @pack_type: <!-- ##### FUNCTION gtk_box_set_child_packing ##### --><para></para>@box: @child: @expand: @fill: @padding: @pack_type:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -