📄 gtk.html
字号:
<H3><A NAME="SEC23" HREF="gtk_toc.html#TOC23">Options</A></H3><P><DL><DT><U>User Option:</U> <B>arrow_type</B><DD><A NAME="IDX74"></A>The <VAR>arrow_type</VAR> option specifies which direction the arrow willpoint. It can be one of <CODE>GTK_ARROW_UP</CODE>, <CODE>GTK_ARROW_DOWN</CODE>,<CODE>GTK_ARROW_LEFT</CODE> or <CODE>GTK_ARROW_RIGHT</CODE>. This will set the arrowpointing in the direction specified.</DL></P><P><DL><DT><U>User Option:</U> <B>shadow_type</B><DD><A NAME="IDX75"></A>The <VAR>shadow_type</VAR> option specifies how to draw the shadow for thearrow. Currently, only the <CODE>GTK_SHADOW_IN</CODE> and<CODE>GTK_SHADOW_OUT</CODE> shadow types are supported for drawingarrows. Other shadow types will cause nothing to be drawn.</DL></P><H3><A NAME="SEC24" HREF="gtk_toc.html#TOC24">Signals</A></H3><H3><A NAME="SEC25" HREF="gtk_toc.html#TOC25">Functions</A></H3><P><DL><DT><U>Function:</U> guint <B>gtk_arrow_get_type</B> <I>(void)</I><DD><A NAME="IDX76"></A>Returns the <CODE>GtkArrow</CODE> type identifier.</DL></P><P><DL><DT><U>Function:</U> GtkWidget* <B>gtk_arrow_new</B> <I>(GtkArrowType <VAR>arrow_type</VAR>, GtkShadowType <VAR>shadow_type</VAR>)</I><DD><A NAME="IDX77"></A>Create a new <CODE>GtkArrow</CODE> object and initialize it with the values<VAR>arrow_type</VAR> and <VAR>shadow_type</VAR>. The new widget is returned as apointer to a <CODE>GtkWidget</CODE> object. <CODE>NULL</CODE> is returned onfailure.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_arrow_set</B> <I>(GtkArrow *<VAR>arrow</VAR>, GtkArrowType <VAR>arrow_type</VAR>, GtkShadowType <VAR>shadow_type</VAR>)</I><DD><A NAME="IDX78"></A>Set the <VAR>arrow_type</VAR> and <VAR>shadow_type</VAR> options of an arrowwidget. It is important to not set the fields of the <CODE>GtkArrow</CODE>structure directly (or, for that matter, any type derived from<CODE>GtkObject</CODE>).</DL></P><P>@gtkstdmacros{Arrow, ARROW}</P><H2><A NAME="SEC26" HREF="gtk_toc.html#TOC26">The aspect frame widget</A></H2><H3><A NAME="SEC27" HREF="gtk_toc.html#TOC27">Description</A></H3><P>Ensure that the child window has a specified aspect ratio or, ifobey_child, has the same aspect ratio as its requested size. Derivedfrom see section <A HREF="gtk.html#SEC125">The frame widget</A>).</P><H3><A NAME="SEC28" HREF="gtk_toc.html#TOC28">Options</A></H3><P><DL><DT><U>User Option:</U> <B>label</B><DD><A NAME="IDX79"></A></DL></P><P><DL><DT><U>User Option:</U> <B>xalign</B><DD><A NAME="IDX80"></A></DL></P><P><DL><DT><U>User Option:</U> <B>yalign</B><DD><A NAME="IDX81"></A></DL></P><P><DL><DT><U>User Option:</U> <B>ratio</B><DD><A NAME="IDX82"></A></DL></P><P><DL><DT><U>User Option:</U> <B>obey_child</B><DD><A NAME="IDX83"></A></DL></P><H3><A NAME="SEC29" HREF="gtk_toc.html#TOC29">Signals</A></H3><H3><A NAME="SEC30" HREF="gtk_toc.html#TOC30">Functions</A></H3><P><DL><DT><U>Function:</U> guint <B>gtk_aspect_frame_get_type</B> <I>(void)</I><DD><A NAME="IDX84"></A>Returns the <CODE>GtkAspectFrame</CODE> type identifier.</DL></P><P><DL><DT><U>Function:</U> GtkWidget* <B>gtk_aspect_frame_new</B> <I>(gchar *<VAR>label</VAR>, gfloat <VAR>xalign</VAR>, gfloat <VAR>yalign</VAR>, gfloat <VAR>ratio</VAR>, gint <VAR>obey_child</VAR>)</I><DD><A NAME="IDX85"></A>Create a new <CODE>GtkAspectFrame</CODE> object and initialize it with the values <VAR>label</VAR>, <VAR>xalign</VAR>, <VAR>yalign</VAR>, <VAR>ratio</VAR> and <VAR>obey_child</VAR>.The new widget is returned as a pointer to a <CODE>GtkWidget</CODE> object. <CODE>NULL</CODE> is returned on failure.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_aspect_frame_set</B> <I>(GtkAspectFrame *<VAR>aspect_frame</VAR>, gfloat <VAR>xalign</VAR>, gfloat <VAR>yalign</VAR>, gfloat <VAR>ratio</VAR>, gint <VAR>obey_child</VAR>)</I><DD><A NAME="IDX86"></A></DL></P><P>@gtkstdmacros{AspectFrame, ASPECT_FRAME}</P><H2><A NAME="SEC31" HREF="gtk_toc.html#TOC31">The bin widget</A></H2><H3><A NAME="SEC32" HREF="gtk_toc.html#TOC32">Description</A></H3><P>The bin widget is a container (see section <A HREF="gtk.html#SEC75">The container widget</A>) derived from thecontainer widget. It is an abstract base class. That is, it is notpossible to create an actual bin widget. It exists only to provide abase of functionality for other widgets. Specifically, the bin widgetprovides a base for several other widgets that contain only a singlechild. These widgets include alignments (see section <A HREF="gtk.html#SEC16">The alignment widget</A>), frames(see section <A HREF="gtk.html#SEC125">The frame widget</A>), items (see section <A HREF="gtk.html#SEC180">The item widget</A>), viewports(see section <A HREF="gtk.html#SEC342">The viewport widget</A>) and windows (see section <A HREF="gtk.html#SEC374">The window widget</A>)</P><H3><A NAME="SEC33" HREF="gtk_toc.html#TOC33">Options</A></H3><H3><A NAME="SEC34" HREF="gtk_toc.html#TOC34">Signals</A></H3><H3><A NAME="SEC35" HREF="gtk_toc.html#TOC35">Functions</A></H3><P><DL><DT><U>Function:</U> guint <B>gtk_bin_get_type</B> <I>(void)</I><DD><A NAME="IDX87"></A>Returns the <CODE>GtkBin</CODE> type identifier.</DL></P><P>@gtkstdmacros{Bin, BIN}</P><H2><A NAME="SEC36" HREF="gtk_toc.html#TOC36">The box widget</A></H2><H3><A NAME="SEC37" HREF="gtk_toc.html#TOC37">Description</A></H3><P>The box widget is a container (see section <A HREF="gtk.html#SEC75">The container widget</A>) derived from thecontainer widget. It is an abstract base class used by the horizontalbox (see section <A HREF="gtk.html#SEC135">The horizontal box widget</A>), the vertical box (see section <A HREF="gtk.html#SEC332">The vertical box widget</A>) and the (see section <A HREF="gtk.html#SEC41">The button box widget</A>) widgets to provide a base of common functionality.</P><P>A box provides an abstraction for organizing the position and size ofwidgets. Widgets in a box are laid out horizontally or vertically. Byusing a box widget appropriately, a programmer can control how widgetsare positioned and how they will be allocated space when a window getsresized.</P><P>The key attribute of boxes is that they position their children in asingle row (horizontal boxes) or column (vertical boxes). In the case ofhorizontal boxes, all children are stretched vertically. The verticalsize of the box is determined by the largest vertical requisition of allof its children. Similarly, a vertical box stretches all of its childrenhorizontally. The horizontal size (of the vertical box) is determined bythe largest horizontal requisition of all of its children. An alignmentwidget (see section <A HREF="gtk.html#SEC16">The alignment widget</A>) can be used to control child allocationmore precisely on a per child basis.</P><P>The second attribute of boxes is how they expand children. In the caseof a horizontal box, the main control is over how children are expandedhorizontally to fill the allocated area. (The rest of this discussionwill focus on horizontal boxes but it applies to vertical boxes aswell).</P><P>There are two flags which can be set controlling how a widget isexpanded horizontally in a horizontal box. These are the <CODE>expand</CODE>and <CODE>fill</CODE>. There operation is fairly simple. If <CODE>expand</CODE> isset, the child's potentially allocated area will expand to fill availablespace. If <CODE>fill</CODE> is set, the child's actual allocated area will beits potentially allocated area. There is a difference betweenthe potentially area (which is the area the box widget sets aside forthe child) and the actual allocated area (which is the area the boxwidget actual allocates for the widget via<CODE>gtk_widget_size_allocate</CODE>).</P><P>The allocation of space to children occurs as follows (for horizontalboxes):<OL><LI>All children are allocated at least their requested size horizontallyand the maximum requested child size vertically.<LI>Any child with the <CODE>expand</CODE> flag set is allocated <CODE>extra_width/ nexpand_children</CODE> extra pixels horizontally. If the <CODE>homogeneous</CODE>flag was set, all children are considered to have the <CODE>expand</CODE> flagset. That is, all children will be allocated the same area.Thehorizontal box is a fair widget and, as such, divides up any extraallocated space evenly among the "expand" children. (Those childrenwhich have the <CODE>expand</CODE> flag set). The exception occurs when<CODE>extra_width / nexpand_children</CODE> does not divide cleanly. The extraspace is given to the last widget.<LI><CODE>spacing</CODE> number of pixels separate each child. Note: Theseparation is between the potentially allocated area for each child andnot the actual allocated area. The <CODE>padding</CODE> value associated witheach child causes that many pixels to be left empty to each side of thechild.<LI>If a child has the <CODE>fill</CODE> flag set it is allocated its potentiallyallocated area. If it does not, it is allocated its requested sizehorizontally and centered within its potentially allocated area. Itsvertical allocation is still the maximum requested size of any child.<LI>Children placed at the start of the box are placed in order of additionto the box from left to right in the boxes allocated area.. Childrenplaced at the end of the box are placed in order of addition from rightto left in the boxes allocated area.</OL><P>See section <A HREF="gtk.html#SEC135">The horizontal box widget</A>, and section <A HREF="gtk.html#SEC332">The vertical box widget</A>, for code examples of using horizontaland vertical boxes.</P><H3><A NAME="SEC38" HREF="gtk_toc.html#TOC38">Options</A></H3><P><DL><DT><U>User Option:</U> <B>expand</B><DD><A NAME="IDX88"></A></DL></P><P><DL><DT><U>User Option:</U> <B>fill</B><DD><A NAME="IDX89"></A></DL></P><P><DL><DT><U>User Option:</U> <B>padding</B><DD><A NAME="IDX90"></A></DL></P><P><DL><DT><U>User Option:</U> <B>expand</B><DD><A NAME="IDX91"></A></DL></P><H3><A NAME="SEC39" HREF="gtk_toc.html#TOC39">Signals</A></H3><H3><A NAME="SEC40" HREF="gtk_toc.html#TOC40">Functions</A></H3><P><DL><DT><U>Function:</U> guint <B>gtk_box_get_type</B> <I>(void)</I><DD><A NAME="IDX92"></A>Returns the <CODE>GtkBox</CODE> type identifier.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_box_pack_start</B> <I>(GtkBox *<VAR>box</VAR>, GtkWidget *<VAR>child</VAR>, gint <VAR>expand</VAR>, gint <VAR>fill</VAR>, gint <VAR>padding</VAR>)</I><DD><A NAME="IDX93"></A>Add <VAR>child</VAR> to the front of <VAR>box</VAR>. The flags <VAR>expand</VAR> and<VAR>fill</VAR> and the padding value of <VAR>padding</VAR> are associated with<VAR>child</VAR>.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_box_pack_end</B
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -