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

📄 gtkicontheme.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 5 页
字号:
named <code class="literal">hicolor</code> where applications should installtheir icons, but more additional application themes can beinstalled as operating system vendors and users choose.</p><p>Named icons are similar to the <a class="xref" href="gtk-Themeable-Stock-Images.html" title="Themeable Stock Images"><a name="id3220367"></a><span class="refentrytitle">Themeable Stock Images</span>(3)</a>facility, and the distinction between the two may be a bit confusing.A few things to keep in mind:</p><div class="itemizedlist"><ul type="disc"><li><p>Stock images usually are used in conjunction with<a class="xref" href="gtk-Stock-Items.html" title="Stock Items"><a name="id3208400"></a><span class="refentrytitle">Stock Items</span>(3)</a>., such as <a class="link" href="gtk-Stock-Items.html#GTK-STOCK-OK:CAPS"><code class="literal">GTK_STOCK_OK</code></a> or<a class="link" href="gtk-Stock-Items.html#GTK-STOCK-OPEN:CAPS"><code class="literal">GTK_STOCK_OPEN</code></a>. Named icons are easier to set up and thereforeare more useful for new icons that an application wants toadd, such as application icons or window icons.</p></li><li><p>Stock images can only be loaded at the symbolic sizes definedby the <a class="link" href="gtk-Themeable-Stock-Images.html#GtkIconSize"><span class="type">GtkIconSize</span></a> enumeration, or by custom sizes definedby <a class="link" href="gtk-Themeable-Stock-Images.html#gtk-icon-size-register"><code class="function">gtk_icon_size_register()</code></a>, while named icons are more flexibleand any pixel size can be specified.</p></li><li><p>Because stock images are closely tied to stock items, and thusto actions in the user interface, stock images may come inmultiple variants for different widget states or writingdirections. </p></li></ul></div><p>A good rule of thumb is that if there is a stock image for whatyou want to use, use it, otherwise use a named icon. It turnsout that internally stock images are generally defined interms of one or more named icons. (An example of themore than one case is icons that depend on writing direction;GTK_STOCK_GO_FORWARD uses the two themed icons"gtk-stock-go-forward-ltr" and "gtk-stock-go-forward-rtl".)</p><p>In many cases, named themes are used indirectly, via <a class="link" href="GtkImage.html" title="GtkImage"><span class="type">GtkImage</span></a>or stock items, rather than directly, but looking up iconsdirectly is also simple. The <a class="link" href="GtkIconTheme.html" title="GtkIconTheme"><span class="type">GtkIconTheme</span></a> object actsas a database of all the icons in the current theme. Youcan create new <a class="link" href="GtkIconTheme.html" title="GtkIconTheme"><span class="type">GtkIconTheme</span></a> objects, but its much moreefficient to use the standard icon theme for the <ahref="/usr/share/gtk-doc/html/gdk/GdkScreen.html"><span class="type">GdkScreen</span></a>so that the icon information is shared with other peoplelooking up icons. In the case where the default screen isbeing used, looking up an icon can be as simple as:</p><div class="informalexample"><pre class="programlisting">GError *error = NULL;GtkIconTheme *icon_theme;GdkPixbuf *pixbuf;icon_theme = gtk_icon_theme_get_default ();pixbuf = gtk_icon_theme_load_icon (icon_theme,                                   "my-icon-name", /* icon name */                                   48, /* size */                                   0,  /* flags */                                   &amp;error);if (!pixbuf)  {    g_warning ("Couldn't load icon: %s", error-&gt;message);    g_error_free (error);  }else  {    /* Use the pixbuf */    g_object_unref (pixbuf);  }</pre></div></div><div class="refsect1" lang="en"><a name="id3197909"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3197936"></a><h3><a name="GtkIconInfo"></a>GtkIconInfo</h3><a class="indexterm" name="id3197948"></a><pre class="programlisting">typedef struct _GtkIconInfo GtkIconInfo;</pre><p>Contains information found when looking up an icon inan icon theme.</p></div><hr><div class="refsect2" lang="en"><a name="id3197964"></a><h3><a name="GtkIconTheme-struct"></a>GtkIconTheme</h3><a class="indexterm" name="id3197977"></a><pre class="programlisting">typedef struct _GtkIconTheme GtkIconTheme;</pre><p>Acts as a database of information about an icon theme.Normally, you retrieve the icon theme for a particularscreen using <a class="link" href="GtkIconTheme.html#gtk-icon-theme-get-for-screen"><code class="function">gtk_icon_theme_get_for_screen()</code></a> and itwill contain information about current icon theme forthat screen, but you can also create a new <a class="link" href="GtkIconTheme.html" title="GtkIconTheme"><span class="type">GtkIconTheme</span></a>object and set the icon theme name explicitely using<a class="link" href="GtkIconTheme.html#gtk-icon-theme-set-custom-theme"><code class="function">gtk_icon_theme_set_custom_theme()</code></a>.</p></div><hr><div class="refsect2" lang="en"><a name="id3198028"></a><h3><a name="GtkIconLookupFlags"></a>enum GtkIconLookupFlags</h3><a class="indexterm" name="id3198041"></a><pre class="programlisting">typedef enum{  GTK_ICON_LOOKUP_NO_SVG = 1 &lt;&lt; 0,  GTK_ICON_LOOKUP_FORCE_SVG = 1 &lt;&lt; 1,  GTK_ICON_LOOKUP_USE_BUILTIN = 1 &lt;&lt; 2,  GTK_ICON_LOOKUP_GENERIC_FALLBACK = 1 &lt;&lt; 3} GtkIconLookupFlags;</pre><p>Used to specify options for <a class="link" href="GtkIconTheme.html#gtk-icon-theme-lookup-icon"><code class="function">gtk_icon_theme_lookup_icon()</code></a></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GTK-ICON-LOOKUP-NO-SVG:CAPS"></a><code class="literal">GTK_ICON_LOOKUP_NO_SVG</code></span></p></td><td> Never return SVG icons, even if gdk-pixbuf  supports them. Cannot be used together with <a class="link" href="GtkIconTheme.html#GTK-ICON-LOOKUP-FORCE-SVG:CAPS"><code class="literal">GTK_ICON_LOOKUP_FORCE_SVG</code></a>.</td></tr><tr><td><p><span class="term"><a name="GTK-ICON-LOOKUP-FORCE-SVG:CAPS"></a><code class="literal">GTK_ICON_LOOKUP_FORCE_SVG</code></span></p></td><td> Return SVG icons, even if gdk-pixbuf  doesn't support them.  Cannot be used together with <a class="link" href="GtkIconTheme.html#GTK-ICON-LOOKUP-NO-SVG:CAPS"><code class="literal">GTK_ICON_LOOKUP_NO_SVG</code></a>.</td></tr><tr><td><p><span class="term"><a name="GTK-ICON-LOOKUP-USE-BUILTIN:CAPS"></a><code class="literal">GTK_ICON_LOOKUP_USE_BUILTIN</code></span></p></td><td> When passed to  <a class="link" href="GtkIconTheme.html#gtk-icon-theme-lookup-icon"><code class="function">gtk_icon_theme_lookup_icon()</code></a> includes builtin icons  as well as files. For a builtin icon, <a class="link" href="GtkIconTheme.html#gtk-icon-info-get-filename"><code class="function">gtk_icon_info_get_filename()</code></a>  returns <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> and you need to call <a class="link" href="GtkIconTheme.html#gtk-icon-info-get-builtin-pixbuf"><code class="function">gtk_icon_info_get_builtin_pixbuf()</code></a>.</td></tr><tr><td><p><span class="term"><a name="GTK-ICON-LOOKUP-GENERIC-FALLBACK:CAPS"></a><code class="literal">GTK_ICON_LOOKUP_GENERIC_FALLBACK</code></span></p></td><td> Try to shorten icon name at '-'  characters before looking at inherited themes. For more general  fallback, see <a class="link" href="GtkIconTheme.html#gtk-icon-theme-choose-icon"><code class="function">gtk_icon_theme_choose_icon()</code></a>. Since 2.12.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3198256"></a><h3><a name="GTK-ICON-THEME-ERROR:CAPS"></a>GTK_ICON_THEME_ERROR</h3><a class="indexterm" name="id3198269"></a><pre class="programlisting">#define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()</pre><p>The <ahref="/usr/share/gtk-doc/html/glib/glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> used for <a class="link" href="GtkIconTheme.html#GtkIconThemeError"><span class="type">GtkIconThemeError</span></a> errors.</p></div><hr><div class="refsect2" lang="en"><a name="id3198301"></a><h3><a name="GtkIconThemeError"></a>enum GtkIconThemeError</h3><a class="indexterm" name="id3198314"></a><pre class="programlisting">typedef enum {  GTK_ICON_THEME_NOT_FOUND,  GTK_ICON_THEME_FAILED} GtkIconThemeError;</pre><p>Error codes for GtkIconTheme operations.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GTK-ICON-THEME-NOT-FOUND:CAPS"></a><code class="literal">GTK_ICON_THEME_NOT_FOUND</code></span></p></td><td> The icon specified does not exist in the theme</td></tr><tr><td><p><span class="term"><a name="GTK-ICON-THEME-FAILED:CAPS"></a><code class="literal">GTK_ICON_THEME_FAILED</code></span></p></td><td> An unspecified error occurred.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3198383"></a><h3><a name="gtk-icon-theme-new"></a>gtk_icon_theme_new ()</h3><a class="indexterm" name="id3198399"></a><pre class="programlisting"><a class="link" href="GtkIconTheme.html" title="GtkIconTheme">GtkIconTheme</a>*       gtk_icon_theme_new                  (void);</pre><p>Creates a new icon theme object. Icon theme objects are usedto lookup up an icon by name in a particular icon theme.Usually, you'll want to use <a class="link" href="GtkIconTheme.html#gtk-icon-theme-get-default"><code class="function">gtk_icon_theme_get_default()</code></a>or <a class="link" href="GtkIconTheme.html#gtk-icon-theme-get-for-screen"><code class="function">gtk_icon_theme_get_for_screen()</code></a> rather than creatinga new icon theme object for scratch.</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> the newly created <a class="link" href="GtkIconTheme.html" title="GtkIconTheme"><span class="type">GtkIconTheme</span></a> object.</td></tr></tbody></table></div><p class="since">Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3198480"></a><h3><a name="gtk-icon-theme-get-default"></a>gtk_icon_theme_get_default ()</h3><a class="indexterm" name="id3198496"></a><pre class="programlisting"><a class="link" href="GtkIconTheme.html" title="GtkIconTheme">GtkIconTheme</a>*       gtk_icon_theme_get_default          (void);</pre><p>Gets the icon theme for the default screen. See<a class="link" href="GtkIconTheme.html#gtk-icon-theme-get-for-screen"><code class="function">gtk_icon_theme_get_for_screen()</code></a>.</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 unique <a class="link" href="GtkIconTheme.html" title="GtkIconTheme"><span class="type">GtkIconTheme</span></a> associated with the default screen. This icon theme is associated with the screen and can be used as long as the screen is open. Do not ref or unref it.</td></tr></tbody></table></div><p class="since">Since  2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3198564"></a><h3><a name="gtk-icon-theme-get-for-screen"></a>gtk_icon_theme_get_for_screen ()</h3><a class="indexterm" name="id3198580"></a><pre class="programlisting"><a class="link" href="GtkIconTheme.html" title="GtkIconTheme">GtkIconTheme</a>*       gtk_icon_theme_get_for_screen       (<ahref="/usr/share/gtk-doc/html/gdk/GdkScreen.html">GdkScreen</a> *screen);</pre><p>Gets the icon theme object associated with <em class="parameter"><code>screen</code></em>; if thisfunction has not previously been called for the givenscreen, a new icon theme object will be created andassociated with the screen. Icon theme objects arefairly expensive to create, so using this functionis usually a better choice than calling than <a class="link" href="GtkIconTheme.html#gtk-icon-theme-new"><code class="function">gtk_icon_theme_new()</code></a>and setting the screen yourself; by using this functiona single icon theme object will be shared between users.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody>

⌨️ 快捷键说明

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