📄 gtk.html
字号:
</DL></P><P><DL><DT><U>Function:</U> gint <B>gtk_signal_connect</B> <I>(GtkObject *<VAR>object</VAR>, gchar *<VAR>name</VAR>, GtkSignalFunc <VAR>func</VAR>, gpointer <VAR>func_data</VAR>)</I><DD><A NAME="IDX52"></A>Connects a signal handling function to a signal emittingobject. <VAR>func</VAR> is connected to the signal <VAR>name</VAR> emitted by<VAR>object</VAR>. The arguments and returns type of <VAR>func</VAR> should matchthe arguments and return type of the signal <VAR>name</VAR>. However,<VAR>func</VAR> may take the extra argument of <VAR>func_data</VAR>. Due to the Ccalling convention it is OK to ignore the extra argument. (It is OK toignore all the arguments in fact).</P><P><CODE>gtk_signal_connect</CODE> returns an integer identifier for theconnection which can be used to refer to it in the future. Specificallyit is useful for removing the connection and/or blocking it from beingused.</DL></P><P><DL><DT><U>Function:</U> gint <B>gtk_signal_connect_after</B> <I>(GtkObject *<VAR>object</VAR>, gchar *<VAR>name</VAR>, GtkSignalFunc <VAR>func</VAR>, gpointer <VAR>func_data</VAR>)</I><DD><A NAME="IDX53"></A>Similar to <CODE>gtk_signal_connect</CODE> except the signal handler isconnected in the "after" slot. This allows a signal handler to beguaranteed to run after other signal handlers connected to the samesignal on the same object and after the class function associated withthe signal.</P><P>Like <CODE>gtk_signal_connect</CODE>, <CODE>gtk_signal_connect_after</CODE> returnsan integer identifier which can be used to refer to the connection.</DL></P><P><DL><DT><U>Function:</U> gint <B>gtk_signal_connect_object</B> <I>(GtkObject *<VAR>object</VAR>, gchar *<VAR>name</VAR>, GtkSignalFunc <VAR>func</VAR>, GtkObject *<VAR>slot_object</VAR>)</I><DD><A NAME="IDX54"></A>Connects <VAR>func</VAR> to the signal <VAR>name</VAR> emitted by<VAR>object</VAR>. Similar to <CODE>gtk_signal_connect</CODE> with the differencethat <VAR>slot_object</VAR> is passed as the first parameter to <VAR>func</VAR>instead of the signal emitting object. This can be useful for connectinga signal emitted by one object to a signal in another object. A commonusage is to connect the "destroy" signal of dialog to the "clicked"signal emitted by a "close" button in the dialog. That is, the"clicked" signal emitted by the button will caused the "destroy"signal to be emitted for the dialog. This is also the "right" way tohandle closing of a dialog since the "destroy" signal will be sent ifthe dialog is deleted using a window manager function and this enablesthe two methods of closing the window to be handled by the samemechanism. Returns an integer identifier which can be used to refer tothe connection.</DL></P><P><DL><DT><U>Function:</U> gint <B>gtk_signal_connect_object_after</B> <I>(GtkObject *<VAR>object</VAR>, gchar *<VAR>name</VAR>, GtkSignalFunc <VAR>func</VAR>, GtkObject *<VAR>slot_object</VAR>)</I><DD><A NAME="IDX55"></A>Similar to <CODE>gtk_signal_connect_object</CODE> except the signal handler isconnected in the "after" slot. This allows a signal handler to beguaranteed to run after other signal handlers connected to the samesignal on the same object and after the class function associated withthe signal. Returns an integer identifier which can be used to refer tothe connection.</DL></P><P><DL><DT><U>Function:</U> gint <B>gtk_signal_connect_interp</B> <I>(GtkObject *<VAR>object</VAR>, gchar *<VAR>name</VAR>, GtkCallbackMarshal <VAR>func</VAR>, gpointer <VAR>data</VAR>, GtkDestroyNotify <VAR>destroy_func</VAR>, gint <VAR>after</VAR>)</I><DD><A NAME="IDX56"></A></DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_disconnect</B> <I>(GtkObject *<VAR>object</VAR>, gint <VAR>id</VAR>)</I><DD><A NAME="IDX57"></A>Disconnects a signal handler from an object. The signal handler isidentified by the integer <VAR>id</VAR> which is returned by the<CODE>gtk_signal_connect*</CODE> family of functions.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_disconnect_by_data</B> <I>(GtkObject *<VAR>object</VAR>, gpointer <VAR>data</VAR>)</I><DD><A NAME="IDX58"></A>Disconnects a signal handler from an object. The signal handler isidentified by the <VAR>data</VAR> argument specified as the <VAR>func_data</VAR>argument to the <CODE>gtk_signal_connect*</CODE> family of functions. For the<CODE>gtk_signal_connect_object*</CODE> functions, <VAR>data</VAR> refers to the<VAR>slot_object</VAR>.</P><P><STRONG>Note:</STRONG> This will remove all signal handlers connected to<VAR>object</VAR> which were connected using <VAR>data</VAR> as their<VAR>func_data</VAR> argument. Multiple signal handlers may be disconnectedwith this call.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_handler_block</B> <I>(GtkObject *<VAR>object</VAR>, gint <VAR>id</VAR>)</I><DD><A NAME="IDX59"></A>Blocks calling of a signal handler during signal emission. The signalhandler is identified by the integer <VAR>id</VAR> which is returned by the<CODE>gtk_signal_connect*</CODE> family of functions. If the signal is alreadyblocked no change is made.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_handler_block_by_data</B> <I>(GtkObject *<VAR>object</VAR>, gint <VAR>data</VAR>)</I><DD><A NAME="IDX60"></A>Blocks calling of a signal handler during signal emission. The signalhandler is identified by the <VAR>data</VAR> argument specified as the<VAR>func_data</VAR> argument to the <CODE>gtk_signal_connect*</CODE> family offunctions. For the <CODE>gtk_signal_connect_object*</CODE> functions,<VAR>data</VAR> refers to the <VAR>slot_object</VAR>. If the signal is alreadyblocked no change is made.</P><P><STRONG>Note:</STRONG> This will block all signal handlers connected to<VAR>object</VAR> which were connected using <VAR>data</VAR> as their<VAR>func_data</VAR> argument. Multiple signal handlers may be blockedwith this call.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_handler_unblock</B> <I>(GtkObject *<VAR>object</VAR>, gint <VAR>id</VAR>)</I><DD><A NAME="IDX61"></A>Unblocks calling of a signal handler during signal emission. The signalhandler is identified by the integer <VAR>id</VAR> which is returned by the<CODE>gtk_signal_connect*</CODE> family of functions. If the signal is alreadyunblocked no change is made.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_handler_unblock_by_data</B> <I>(GtkObject *<VAR>object</VAR>, gint <VAR>data</VAR>)</I><DD><A NAME="IDX62"></A>Unblocks calling of a signal handler during signal emission. The signalhandler is identified by the <VAR>data</VAR> argument specified as the<VAR>func_data</VAR> argument to the <CODE>gtk_signal_connect*</CODE> family offunctions. For the <CODE>gtk_signal_connect_object*</CODE> functions,<VAR>data</VAR> refers to the <VAR>slot_object</VAR>. If the signal is alreadyunblocked no change is made.</P><P><STRONG>Note:</STRONG> This will unblock all signal handlers connected to<VAR>object</VAR> which were connected using <VAR>data</VAR> as their<VAR>func_data</VAR> argument. Multiple signal handlers may be unblockedwith this call.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_handlers_destroy</B> <I>(GtkObject *<VAR>object</VAR>)</I><DD><A NAME="IDX63"></A>Destroy all of the signal handlers connected to <VAR>object</VAR>. Thereshould normally never be reason to call this function as it is calledautomatically when <VAR>object</VAR> is destroyed.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_default_marshaller</B> <I>(GtkObject *<VAR>object</VAR>, GtkSignalFunc <VAR>func</VAR>, gpointer <VAR>func_data</VAR>, GtkSignalParam *<VAR>params</VAR>)</I><DD><A NAME="IDX64"></A><CODE>gtk_signal_new</CODE> requires a callback in order to actually call asignal handler for a particular signal. The vast majority of signals areof the particular form:</P><PRE> (* std_signal) (gpointer std_arg);</PRE><P><CODE>gtk_signal_default_marshaller</CODE> is a signal marshaller whichmarshals arguments for a signal of that form.</DL></P><P><DL><DT><U>Function:</U> void <B>gtk_signal_set_funcs</B> <I>(GtkSignalMarshal <VAR>marshal_func</VAR>, GtkSignalDestroy <VAR>destroy_fun</VAR>)</I><DD><A NAME="IDX65"></A></DL></P><H1><A NAME="SEC15" HREF="gtk_toc.html#TOC15">Widget Overview</A></H1><P><A NAME="IDX66"></A></P><P>Widgets are the general term used to describe user interface objects. Awidget defines a class interface that all user interface objects conformto. This interface allows a uniform method for dealing with operationscommon to all objects such as hiding and showing, size requisition andallocation and events.</P><P>The common interface that widgets must adhere to is described by theGtkWidget and GtkWidgetClass structure. For the purposes of using GTKthese structures can be considered read-only and, for the most part,opaque.</P><P>All widget creation routines in GTK return pointers to GtkWidgetstructures. In reality, all widget creation routines create structuresthat can be viewed as equivalent to the GtkWidget structure, but oftenhave contain additional information. See section <A HREF="gtk.html#SEC414">Object internals</A>.</P><P>The widgets available for use are implemented in a hierarchy. Severalwidgets exist solely as common bases for more specific widgets. Forexample, it is not possible to create a ruler widget itself, but theruler widget provides a base and functionality common to the horizontaland vertical rulers.</P><P>The available widgets (in alphabetical order):</P><H2><A NAME="SEC16" HREF="gtk_toc.html#TOC16">The alignment widget</A></H2><H3><A NAME="SEC17" HREF="gtk_toc.html#TOC17">Description</A></H3><P>The alignment widget is a container (see section <A HREF="gtk.html#SEC75">The container widget</A>) derived fromthe bin widget (see section <A HREF="gtk.html#SEC31">The bin widget</A>). Its entire purpose is to give theprogrammer flexibility in how the child it manages is positioned when awindow is resized.</P><P>Normally, a widget is allocated at least as much size as itrequests. (see section <A HREF="gtk.html#SEC75">The container widget</A> for a discussion of geometrymanagement). When a widget is allocated more size than it requests thereis a question of how the widget should expand. By convention, most GTKwidgets expand to fill their allocated space. Sometimes this behavior isnot desired. The alignment widget allows the programmer to specify how awidget should expand and position itself to fill the area it isallocated.</P><H3><A NAME="SEC18" HREF="gtk_toc.html#TOC18">Options</A></H3><P><DL><DT><U>User Option:</U> <B>xscale</B><DD><A NAME="IDX67"></A><DT><U>User Option:</U> <B>yscale</B><DD><A NAME="IDX68"></A>The <VAR>xscale</VAR> and <VAR>yscale</VAR> options specify how to scale the childwidget. If the scale value is 0.0, the child widget is allocated exactlythe size it requested in that dimension. If the scale value is 1.0, thechild widget is allocated all of the space in a dimension. A scale valueof 1.0 for both x and y is equivalent to not using an alignment widget.</DL></P><P><DL><DT><U>User Option:</U> <B>xalign</B><DD><A NAME="IDX69"></A><DT><U>User Option:</U> <B>yalign</B><DD><A NAME="IDX70"></A>The <VAR>xalign</VAR> and <VAR>yalign</VAR> options specify how to position thechild widget when it is not allocated all the space available to it(because the <VAR>xscale</VAR> and/or <VAR>yscale</VAR> options are less than1.0). If an alignment value is 0.0 the widget is positioned to the left(or top) of its allocated space. An alignment value of 1.0 positions thewidget to the right (or bottom) of its allocated space. A common usageis to specify <VAR>xalign</VAR> and <VAR>yalign</VAR> to be 0.5 which causes thewidget to be centered within its allocated area.</DL></P><H3><A NAME="SEC19" HREF="gtk_toc.html#TOC19">Signals</A></H3><H3><A NAME="SEC20" HREF="gtk_toc.html#TOC20">Functions</A></H3><P><DL><DT><U>Function:</U> guint <B>gtk_alignment_get_type</B> <I>(void)</I><DD><A NAME="IDX71"></A>Returns the <CODE>GtkAlignment</CODE> type identifier.</DL></P><P><DL><DT><U>Function:</U> GtkWidget* <B>gtk_alignment_new</B> <I>(gfloat <VAR>xalign</VAR>, gfloat <VAR>yalign</VAR>, gfloat <VAR>xscale</VAR>, gfloat <VAR>yscale</VAR>)</I><DD><A NAME="IDX72"></A>Create a new <CODE>GtkAlignment</CODE> object and initialize it with thevalues <VAR>xalign</VAR>, <VAR>yalign</VAR>, <VAR>xscale</VAR> and <VAR>yscale</VAR>. Thenew 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_alignment_set</B> <I>(GtkAlignment *<VAR>alignment</VAR>, gfloat <VAR>xalign</VAR>, gfloat <VAR>yalign</VAR>, gfloat <VAR>xscale</VAR>, gfloat <VAR>yscale</VAR>)</I><DD><A NAME="IDX73"></A>Set the <VAR>xalign</VAR>, <VAR>yalign</VAR>, <VAR>xscale</VAR> and <VAR>yscale</VAR> optionsof an alignment widget. It is important to not set the fields of the<CODE>GtkAlignment</CODE> structure directly (or, for that matter, any typederived from <CODE>GtkObject</CODE>).</DL></P><P>@gtkstdmacros{Alignment, ALIGNMENT}</P><H2><A NAME="SEC21" HREF="gtk_toc.html#TOC21">The arrow widget</A></H2><H3><A NAME="SEC22" HREF="gtk_toc.html#TOC22">Description</A></H3><P>The arrow widget is derived from the misc widget (see section <A HREF="gtk.html#SEC218">The misc widget</A>) andis intended for use where a directional arrow (in one of the fourcardinal directions) is desired. As such, it has very limitedfunctionality and basically only draws itself in a particular directionand with a particular shadow type. The arrow widget will expand to fillall the space it is allocated.</P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -