📄 gtk-gtkbuildable.html
字号:
<p></p></div><hr><div class="refsect2" lang="en"><a name="id4449934"></a><h3><a name="GtkBuildableIface"></a>GtkBuildableIface</h3><a class="indexterm" name="id4449946"></a><pre class="programlisting">typedef struct { GTypeInterface g_iface; /* virtual table */ void (* set_name) (GtkBuildable *buildable, const gchar *name); const gchar * (* get_name) (GtkBuildable *buildable); void (* add_child) (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *type); void (* set_buildable_property) (GtkBuildable *buildable, GtkBuilder *builder, const gchar *name, const GValue *value); GObject * (* construct_child) (GtkBuildable *buildable, GtkBuilder *builder, const gchar *name); gboolean (* custom_tag_start) (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *tagname, GMarkupParser *parser, gpointer *data); void (* custom_tag_end) (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *tagname, gpointer *data); void (* custom_finished) (GtkBuildable *buildable, GtkBuilder *builder, GObject *child, const gchar *tagname, gpointer data); void (* parser_finished) (GtkBuildable *buildable, GtkBuilder *builder); GObject * (* get_internal_child) (GtkBuildable *buildable, GtkBuilder *builder, const gchar *childname);} GtkBuildableIface;</pre><p>The GtkBuildableIface interface contains method that arenecessary to allow <a class="link" href="GtkBuilder.html" title="GtkBuilder"><span class="type">GtkBuilder</span></a> to construct an object froma GtkBuilder UI definition.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GTypeInterface">GTypeInterface</a> <em class="structfield"><code>g_iface</code></em>;</span></p></td><td>the parent class</td></tr><tr><td><p><span class="term"><em class="structfield"><code>set_name</code></em> ()</span></p></td><td>Stores the name attribute given in the GtkBuilder UI definition. <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> maps this to the <a class="link" href="GtkWidget.html#GtkWidget--name"><span class="type">"name"</span></a> property, and <a class="link" href="gtk-gtkbuildable.html#gtk-buildable-set-name"><code class="function">gtk_buildable_set_name()</code></a> has a fallback implementation that stores the name as object data. Implement this method if your object has some notion of "name" and it makes sense to map the XML name attribute to it.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>get_name</code></em> ()</span></p></td><td>The getter corresponding to <em class="parameter"><code>set_name</code></em>. Implement this if you implement <em class="parameter"><code>set_name</code></em>.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>add_child</code></em> ()</span></p></td><td>Adds a child. The <em class="parameter"><code>type</code></em> parameter can be used to differentiate the kind of child. <a class="link" href="GtkContainer.html" title="GtkContainer"><span class="type">GtkContainer</span></a> implements this to add add a child widget to the container, <a class="link" href="GtkNotebook.html" title="GtkNotebook"><span class="type">GtkNotebook</span></a> uses the <em class="parameter"><code>type</code></em> to distinguish between page labels (of type "page-label") and normal children.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>set_buildable_property</code></em> ()</span></p></td><td>Sets a property of a buildable object. It is normally not necessary to implement this, <ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#g-object-set-property"><code class="function">g_object_set_property()</code></a> is used by default. <a class="link" href="GtkWindow.html" title="GtkWindow"><span class="type">GtkWindow</span></a> implements this to delay showing itself (i.e. setting the <a class="link" href="GtkWidget.html#GtkWidget--visible"><span class="type">"visible"</span></a> property) until the whole interface is created.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>construct_child</code></em> ()</span></p></td><td>Constructs a child of a buildable that has been specified as "constructor" in the UI definition. <a class="link" href="GtkUIManager.html" title="GtkUIManager"><span class="type">GtkUIManager</span></a> implements this to reference to a widget created in a <ui> tag which is outside of the normal GtkBuilder UI definition hierarchy. A reference to the constructed object is returned and becomes owned by the caller.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>custom_tag_start</code></em> ()</span></p></td><td>Implement this if the buildable needs to parse content below <child>. To handle an element, the implementation must fill in the <em class="parameter"><code>parser</code></em> structure and <em class="parameter"><code>user_data</code></em> and return <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> implements this to parse keyboard accelerators specified in <accelerator> elements. <a class="link" href="GtkContainer.html" title="GtkContainer"><span class="type">GtkContainer</span></a> implements it to map properties defined via <packing> elements to child properties. Note that <em class="parameter"><code>user_data</code></em> must be freed in <em class="parameter"><code>custom_tag_end</code></em> or <em class="parameter"><code>custom_finished</code></em>.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>custom_tag_end</code></em> ()</span></p></td><td>Called for the end tag of each custom element that is handled by the buildable (see <em class="parameter"><code>custom_tag_start</code></em>).</td></tr><tr><td><p><span class="term"><em class="structfield"><code>custom_finished</code></em> ()</span></p></td><td>Called for each custom tag handled by the buildable when the builder finishes parsing (see <em class="parameter"><code>custom_tag_start</code></em>)</td></tr><tr><td><p><span class="term"><em class="structfield"><code>parser_finished</code></em> ()</span></p></td><td>Called when a builder finishes the parsing of a UI definition. It is normally not necessary to implement this, unless you need to perform special cleanup actions. <a class="link" href="GtkWindow.html" title="GtkWindow"><span class="type">GtkWindow</span></a> sets the <a class="link" href="GtkWidget.html#GtkWidget--visible"><span class="type">"visible"</span></a> property here.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>get_internal_child</code></em> ()</span></p></td><td>Returns an internal child of a buildable. <a class="link" href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> implements this to give access to its <em class="parameter"><code>vbox</code></em>, making it possible to add children to the vbox in a UI definition. Implement this if the buildable has internal children that may need to be accessed from a UI definition.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4450412"></a><h3><a name="gtk-buildable-set-name"></a>gtk_buildable_set_name ()</h3><a class="indexterm" name="id4450427"></a><pre class="programlisting">void gtk_buildable_set_name (<a class="link" href="gtk-gtkbuildable.html#GtkBuildable">GtkBuildable</a> *buildable, const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *name);</pre><p>Sets the name of the <em class="parameter"><code>buildable</code></em> object.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>buildable</code></em> :</span></p></td><td> a <a class="link" href="gtk-gtkbuildable.html#GtkBuildable"><span class="type">GtkBuildable</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td><td> name to set</td></tr></tbody></table></div><p class="since">Since 2.12</p></div><hr><div class="refsect2" lang="en"><a name="id4450521"></a><h3><a name="gtk-buildable-get-name"></a>gtk_buildable_get_name ()</h3><a class="indexterm" name="id4450536"></a><pre class="programlisting">const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a>* gtk_buildable_get_name (<a class="link" href="gtk-gtkbuildable.html#GtkBuildable">GtkBuildable</a> *buildable);</pre><p>Gets the name of the <em class="parameter"><code>buildable</code></em> object. </p><p><a class="link" href="GtkBuilder.html" title="GtkBuilder"><span class="type">GtkBuilder</span></a> sets the name based on the the <a class="link" href="GtkBuilder.html#BUILDER-UI" title="GtkBuilder UI Definitions">GtkBuilder UI definition</a> used to construct the <em class="parameter"><code>buildable</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>buildable</code></em> :</span></p></td><td> a <a class="link" href="gtk-gtkbuildable.html#GtkBuildable"><span class="type">GtkBuildable</span></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the name set with <a class="link" href="gtk-gtkbuildable.html#gtk-buildable-set-name"><code class="function">gtk_buildable_set_name()</code></a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -