⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtkentrycompletion.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</pre></div><div class="refsect1" lang="en"><a name="id3533708"></a><h2>Signals</h2><pre class="synopsis">  "<a class="link" href="GtkEntryCompletion.html#GtkEntryCompletion-action-activated">action-activated</a>"                               : Run Last  "<a class="link" href="GtkEntryCompletion.html#GtkEntryCompletion-cursor-on-match">cursor-on-match</a>"                                : Run Last  "<a class="link" href="GtkEntryCompletion.html#GtkEntryCompletion-insert-prefix">insert-prefix</a>"                                  : Run Last  "<a class="link" href="GtkEntryCompletion.html#GtkEntryCompletion-match-selected">match-selected</a>"                                 : Run Last</pre></div><div class="refsect1" lang="en"><a name="id3533767"></a><h2>Description</h2><p><a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a> is an auxiliary object to be used in conjunction with<a class="link" href="GtkEntry.html" title="GtkEntry"><span class="type">GtkEntry</span></a> to provide the completion functionality. It implements the<a class="link" href="GtkCellLayout.html" title="GtkCellLayout"><span class="type">GtkCellLayout</span></a> interface, to allow the user to add extra cells to the <a class="link" href="GtkTreeView.html" title="GtkTreeView"><span class="type">GtkTreeView</span></a> with completion matches. </p><p>"Completion functionality" means that when the user modifies the text in the entry, <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a> checks which rows in the model match the current content of the entry, and displays a list of matches.By default, the matching is done by comparing the entry text case-insensitively against the text column of the model (see <a class="link" href="GtkEntryCompletion.html#gtk-entry-completion-set-text-column"><code class="function">gtk_entry_completion_set_text_column()</code></a>), but this can be overridden with a custom match function (see <a class="link" href="GtkEntryCompletion.html#gtk-entry-completion-set-match-func"><code class="function">gtk_entry_completion_set_match_func()</code></a>).</p><p>When the user selects a completion, the content of the entry is updated. By default, the content of the entry is replaced by the text column of the model, but this can be overridden by connecting to the ::match-selected signaland updating the entry in the signal handler. Note that you should return <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from the signal handler to suppress the default behaviour.</p><p>To add completion functionality to an entry, use <a class="link" href="GtkEntry.html#gtk-entry-set-completion"><code class="function">gtk_entry_set_completion()</code></a>.</p><p>In addition to regular completion matches, which will be inserted into theentry when they are selected, <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a> also allows to display "actions" in the popup window. Their appearance is similar to menuitems, to differentiate them clearly from completion strings. When an action is selected, the ::action-activated signal is emitted.</p></div><div class="refsect1" lang="en"><a name="id3533909"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3533920"></a><h3><a name="GtkEntryCompletion-struct"></a>GtkEntryCompletion</h3><a class="indexterm" name="id3533933"></a><pre class="programlisting">typedef struct _GtkEntryCompletion GtkEntryCompletion;</pre><p>The GtkEntryCompletion struct contains only private data.</p></div><hr><div class="refsect2" lang="en"><a name="id3533950"></a><h3><a name="GtkEntryCompletionMatchFunc"></a>GtkEntryCompletionMatchFunc ()</h3><a class="indexterm" name="id3533962"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a>            (*GtkEntryCompletionMatchFunc)      (<a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion">GtkEntryCompletion</a> *completion,                                                         const <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar">gchar</a> *key,                                                         <a class="link" href="GtkTreeModel.html#GtkTreeIter">GtkTreeIter</a> *iter,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>A function which decides whether the row indicated by <em class="parameter"><code>iter</code></em> matches a given <em class="parameter"><code>key</code></em>, and should be displayed as a possible completion for <em class="parameter"><code>key</code></em>. Note that<em class="parameter"><code>key</code></em> is normalized and case-folded (see <ahref="/usr/share/gtk-doc/html/glib/glib-Unicode-Manipulation.html#g-utf8-normalize"><code class="function">g_utf8_normalize()</code></a> and <ahref="/usr/share/gtk-doc/html/glib/glib-Unicode-Manipulation.html#g-utf8-casefold"><code class="function">g_utf8_casefold()</code></a>). If this is not appropriate, match functions have accessto the unmodified key via <code class="literal">gtk_entry_get_text (GTK_ENTRY (gtk_entry_completion_get_entry ()))</code>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>completion</code></em>&#160;:</span></p></td><td>the <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></p></td><td>the string to match, normalized and case-folded</td></tr><tr><td><p><span class="term"><em class="parameter"><code>iter</code></em>&#160;:</span></p></td><td>a <a class="link" href="GtkTreeModel.html#GtkTreeIter"><span class="type">GtkTreeIter</span></a> indicating the row to match</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></p></td><td>user data given to <a class="link" href="GtkEntryCompletion.html#gtk-entry-completion-set-match-func"><code class="function">gtk_entry_completion_set_match_func()</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td><ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>iter</code></em> should be displayed as a possible completion for <em class="parameter"><code>key</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3534195"></a><h3><a name="gtk-entry-completion-new"></a>gtk_entry_completion_new ()</h3><a class="indexterm" name="id3534210"></a><pre class="programlisting"><a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion">GtkEntryCompletion</a>* gtk_entry_completion_new            (void);</pre><p>Creates a new <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a> object.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> A newly created <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a> object.</td></tr></tbody></table></div><p class="since">Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3534273"></a><h3><a name="gtk-entry-completion-get-entry"></a>gtk_entry_completion_get_entry ()</h3><a class="indexterm" name="id3534288"></a><pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>*          gtk_entry_completion_get_entry      (<a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion">GtkEntryCompletion</a> *completion);</pre><p>Gets the entry <em class="parameter"><code>completion</code></em> has been attached to.</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>completion</code></em>&#160;:</span></p></td><td> A <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> The entry <em class="parameter"><code>completion</code></em> has been attached to.</td></tr></tbody></table></div><p class="since">Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3534376"></a><h3><a name="gtk-entry-completion-set-model"></a>gtk_entry_completion_set_model ()</h3><a class="indexterm" name="id3534392"></a><pre class="programlisting">void                gtk_entry_completion_set_model      (<a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion">GtkEntryCompletion</a> *completion,                                                         <a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a> *model);</pre><p>Sets the model for a <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a>. If <em class="parameter"><code>completion</code></em> already hasa model set, it will remove it before setting the new model.If model is <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>, then it will unset the model.</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>completion</code></em>&#160;:</span></p></td><td> A <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></p></td><td> The <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a>.</td></tr></tbody></table></div><p class="since">Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3534514"></a><h3><a name="gtk-entry-completion-get-model"></a>gtk_entry_completion_get_model ()</h3><a class="indexterm" name="id3534530"></a><pre class="programlisting"><a class="link" href="GtkTreeModel.html" title="GtkTreeModel">GtkTreeModel</a>*       gtk_entry_completion_get_model      (<a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion">GtkEntryCompletion</a> *completion);</pre><p>Returns the model the <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a> is using as data source.Returns <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if the model is unset.</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>completion</code></em>&#160;:</span></p></td><td> A <a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion"><span class="type">GtkEntryCompletion</span></a>.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td> A <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a>, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if none is currently being used.</td></tr></tbody></table></div><p class="since">Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3534644"></a><h3><a name="gtk-entry-completion-set-match-func"></a>gtk_entry_completion_set_match_func ()</h3><a class="indexterm" name="id3534660"></a><pre class="programlisting">void                gtk_entry_completion_set_match_func (<a class="link" href="GtkEntryCompletion.html" title="GtkEntryCompletion">GtkEntryCompletion</a> *completion,                                                         <a class="link" href="GtkEntryCompletion.html#GtkEntryCompletionMatchFunc">GtkEntryCompletionMatchFunc</a> func,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> func_data,                                                         <ahref="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> func_notify);</pre><p>Sets the match function for <em class="parameter"><code>completion</code></em> to be <em class="parameter"><code>func</code></em>. The match functionis used to determine if a row should or should not be in the completionlist.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -