Top |
GtkIconInfo | |
struct | GtkIconTheme |
enum | GtkIconLookupFlags |
#define | GTK_ICON_THEME_ERROR |
enum | GtkIconThemeError |
#define | gtk_icon_theme_set_search_path |
#define | gtk_icon_theme_get_search_path |
#define | gtk_icon_theme_append_search_path |
#define | gtk_icon_theme_prepend_search_path |
#define | gtk_icon_info_get_filename |
GtkIconTheme *
gtk_icon_theme_new (void
);
Creates a new icon theme object. Icon theme objects are used
to lookup up an icon by name in a particular icon theme.
Usually, you'll want to use gtk_icon_theme_get_default()
or gtk_icon_theme_get_for_screen()
rather than creating
a new icon theme object for scratch.
Since: 2.4
GtkIconTheme *
gtk_icon_theme_get_default (void
);
Gets the icon theme for the default screen. See
gtk_icon_theme_get_for_screen()
.
A unique GtkIconTheme 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.
[transfer none]
Since: 2.4
GtkIconTheme *
gtk_icon_theme_get_for_screen (GdkScreen *screen
);
Gets the icon theme object associated with screen
; if this
function has not previously been called for the given
screen, a new icon theme object will be created and
associated with the screen. Icon theme objects are
fairly expensive to create, so using this function
is usually a better choice than calling than gtk_icon_theme_new()
and setting the screen yourself; by using this function
a single icon theme object will be shared between users.
A unique GtkIconTheme associated with the given 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.
[transfer none]
Since: 2.4
void gtk_icon_theme_set_screen (GtkIconTheme *icon_theme
,GdkScreen *screen
);
Sets the screen for an icon theme; the screen is used to track the user's currently configured icon theme, which might be different for different screens.
Since: 2.4
void gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme
,const gchar *theme_name
);
Sets the name of the icon theme that the GtkIconTheme object uses
overriding system configuration. This function cannot be called
on the icon theme objects returned from gtk_icon_theme_get_default()
and gtk_icon_theme_get_for_screen()
.
icon_theme |
||
theme_name |
name of icon theme to use instead of configured theme,
or |
Since: 2.4
gboolean gtk_icon_theme_has_icon (GtkIconTheme *icon_theme
,const gchar *icon_name
);
Checks whether an icon theme includes an icon for a particular name.
Since: 2.4
GtkIconInfo * gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme
,const gchar *icon_name
,gint size
,GtkIconLookupFlags flags
);
Looks up a named icon and returns a structure containing
information such as the filename of the icon. The icon
can then be rendered into a pixbuf using
gtk_icon_info_load_icon()
. (gtk_icon_theme_load_icon()
combines these two steps if all you need is the pixbuf.)
icon_theme |
||
icon_name |
the name of the icon to lookup |
|
size |
desired icon size |
|
flags |
flags modifying the behavior of the icon lookup |
a GtkIconInfo structure containing information
about the icon, or NULL
if the icon wasn't found. Free with
gtk_icon_info_free()
Since: 2.4
GtkIconInfo * gtk_icon_theme_choose_icon (GtkIconTheme *icon_theme
,const gchar *icon_names[]
,gint size
,GtkIconLookupFlags flags
);
Looks up a named icon and returns a structure containing
information such as the filename of the icon. The icon
can then be rendered into a pixbuf using
gtk_icon_info_load_icon()
. (gtk_icon_theme_load_icon()
combines these two steps if all you need is the pixbuf.)
If icon_names
contains more than one name, this function
tries them all in the given order before falling back to
inherited icon themes.
icon_theme |
||
icon_names |
|
[array zero-terminated=1] |
size |
desired icon size |
|
flags |
flags modifying the behavior of the icon lookup |
a GtkIconInfo structure containing information
about the icon, or NULL
if the icon wasn't found. Free with
gtk_icon_info_free()
Since: 2.12
GtkIconInfo * gtk_icon_theme_lookup_by_gicon (GtkIconTheme *icon_theme
,GIcon *icon
,gint size
,GtkIconLookupFlags flags
);
Looks up an icon and returns a structure containing
information such as the filename of the icon.
The icon can then be rendered into a pixbuf using
gtk_icon_info_load_icon()
.
icon_theme |
||
icon |
the GIcon to look up |
|
size |
desired icon size |
|
flags |
flags modifying the behavior of the icon lookup |
a GtkIconInfo structure containing
information about the icon, or NULL
if the icon
wasn't found. Free with gtk_icon_info_free()
Since: 2.14
GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme
,const gchar *icon_name
,gint size
,GtkIconLookupFlags flags
,GError **error
);
Looks up an icon in an icon theme, scales it to the given size
and renders it into a pixbuf. This is a convenience function;
if more details about the icon are needed, use
gtk_icon_theme_lookup_icon()
followed by gtk_icon_info_load_icon()
.
Note that you probably want to listen for icon theme changes and
update the icon. This is usually done by connecting to the
GtkWidget::style-set signal. If for some reason you do not want to
update the icon when the icon theme changes, you should consider
using gdk_pixbuf_copy()
to make a private copy of the pixbuf
returned by this function. Otherwise GTK+ may need to keep the old
icon theme loaded, which would be a waste of memory.
icon_theme |
||
icon_name |
the name of the icon to lookup |
|
size |
the desired icon size. The resulting icon may not be
exactly this size; see |
|
flags |
flags modifying the behavior of the icon lookup |
|
error |
Location to store error information on failure, or |
[allow-none] |
the rendered icon; this may be a newly
created icon or a new reference to an internal icon, so you must not modify
the icon. Use g_object_unref()
to release your reference to the
icon. NULL
if the icon isn't found.
[transfer full]
Since: 2.4
GList *
gtk_icon_theme_list_contexts (GtkIconTheme *icon_theme
);
Gets the list of contexts available within the current hierarchy of icon themes
a GList list holding the names of all the
contexts in the theme. You must first free each element
in the list with g_free()
, then free the list itself
with g_list_free()
.
[element-type utf8][transfer full]
Since: 2.12
GList * gtk_icon_theme_list_icons (GtkIconTheme *icon_theme
,const gchar *context
);
Lists the icons in the current icon theme. Only a subset of the icons can be listed by providing a context string. The set of values for the context string is system dependent, but will typically include such values as "Applications" and "MimeTypes".
icon_theme |
||
context |
a string identifying a particular type of icon,
or |
a GList list
holding the names of all the icons in the theme. You must first
free each element in the list with g_free()
, then free the list
itself with g_list_free()
.
[element-type utf8][transfer full]
Since: 2.4
gint * gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme
,const gchar *icon_name
);
Returns an array of integers describing the sizes at which the icon is available without scaling. A size of -1 means that the icon is available in a scalable format. The array is zero-terminated.
An newly allocated array
describing the sizes at which the icon is available. The array
should be freed with g_free()
when it is no longer needed.
[array zero-terminated=1]
Since: 2.6
char *
gtk_icon_theme_get_example_icon_name (GtkIconTheme *icon_theme
);
Gets the name of an icon that is representative of the current theme (for instance, to use when presenting a list of themes to the user.)
Since: 2.4
gboolean
gtk_icon_theme_rescan_if_needed (GtkIconTheme *icon_theme
);
Checks to see if the icon theme has changed; if it has, any
currently cached information is discarded and will be reloaded
next time icon_theme
is accessed.
Since: 2.4
void gtk_icon_theme_add_builtin_icon (const gchar *icon_name
,gint size
,GdkPixbuf *pixbuf
);
Registers a built-in icon for icon theme lookups. The idea of built-in icons is to allow an application or library that uses themed icons to function requiring files to be present in the file system. For instance, the default images for all of GTK+'s stock icons are registered as built-icons.
In general, if you use gtk_icon_theme_add_builtin_icon()
you should also install the icon in the icon theme, so
that the icon is generally available.
This function will generally be used with pixbufs loaded
via gdk_pixbuf_new_from_inline()
.
icon_name |
the name of the icon to register |
|
size |
the size at which to register the icon (different images can be registered for the same icon name at different sizes.) |
|
pixbuf |
GdkPixbuf that contains the image to use
for |
Since: 2.4
GtkIconInfo *
gtk_icon_info_copy (GtkIconInfo *icon_info
);
Make a copy of a GtkIconInfo.
Since: 2.4
void
gtk_icon_info_free (GtkIconInfo *icon_info
);
Free a GtkIconInfo and associated information
Since: 2.4
GtkIconInfo * gtk_icon_info_new_for_pixbuf (GtkIconTheme *icon_theme
,GdkPixbuf *pixbuf
);
Creates a GtkIconInfo for a GdkPixbuf.
Since: 2.14
gint
gtk_icon_info_get_base_size (GtkIconInfo *icon_info
);
Gets the base size for the icon. The base size is a size for the icon that was specified by the icon theme creator. This may be different than the actual size of image; an example of this is small emblem icons that can be attached to a larger icon. These icons will be given the same base size as the larger icons to which they are attached.
Since: 2.4
GdkPixbuf *
gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info
);
Gets the built-in image for this icon, if any. To allow
GTK+ to use built in icon images, you must pass the
GTK_ICON_LOOKUP_USE_BUILTIN
to
gtk_icon_theme_lookup_icon()
.
the built-in image pixbuf, or NULL
. No
extra reference is added to the returned pixbuf, so if
you want to keep it around, you must use g_object_ref()
.
The returned image must not be modified.
[transfer none]
Since: 2.4
GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info
,GError **error
);
Renders an icon previously looked up in an icon theme using
gtk_icon_theme_lookup_icon()
; the size will be based on the size
passed to gtk_icon_theme_lookup_icon()
. Note that the resulting
pixbuf may not be exactly this size; an icon theme may have icons
that differ slightly from their nominal sizes, and in addition GTK+
will avoid scaling icons that it considers sufficiently close to the
requested size or for which the source image would have to be scaled
up too far. (This maintains sharpness.). This behaviour can be changed
by passing the GTK_ICON_LOOKUP_FORCE_SIZE
flag when obtaining
the GtkIconInfo. If this flag has been specified, the pixbuf
returned by this function will be scaled to the exact size.
icon_info |
a GtkIconInfo structure from |
|
error |
location to store error information on failure,
or |
[allow-none] |
the rendered icon; this may be a newly
created icon or a new reference to an internal icon, so you must
not modify the icon. Use g_object_unref()
to release your reference
to the icon.
[transfer full]
Since: 2.4
void gtk_icon_info_set_raw_coordinates (GtkIconInfo *icon_info
,gboolean raw_coordinates
);
Sets whether the coordinates returned by gtk_icon_info_get_embedded_rect()
and gtk_icon_info_get_attach_points()
should be returned in their
original form as specified in the icon theme, instead of scaled
appropriately for the pixbuf returned by gtk_icon_info_load_icon()
.
Raw coordinates are somewhat strange; they are specified to be with
respect to the unscaled pixmap for PNG and XPM icons, but for SVG
icons, they are in a 1000x1000 coordinate space that is scaled
to the final size of the icon. You can determine if the icon is an SVG
icon by using gtk_icon_info_get_filename()
, and seeing if it is non-NULL
and ends in '.svg'.
This function is provided primarily to allow compatibility wrappers for older API's, and is not expected to be useful for applications.
icon_info |
||
raw_coordinates |
whether the coordinates of embedded rectangles and attached points should be returned in their original (unscaled) form. |
Since: 2.4
gboolean gtk_icon_info_get_embedded_rect (GtkIconInfo *icon_info
,GdkRectangle *rectangle
);
Gets the coordinates of a rectangle within the icon
that can be used for display of information such
as a preview of the contents of a text file.
See gtk_icon_info_set_raw_coordinates()
for further
information about the coordinate system.
icon_info |
||
rectangle |
GdkRectangle in which to store embedded
rectangle coordinates; coordinates are only stored
when this function returns |
[out] |
Since: 2.4
gboolean gtk_icon_info_get_attach_points (GtkIconInfo *icon_info
,GdkPoint **points
,gint *n_points
);
Fetches the set of attach points for an icon. An attach point is a location in the icon that can be used as anchor points for attaching emblems or overlays to the icon.
icon_info |
||
points |
location to store pointer to an array of points, or |
[allow-none][array length=n_points][out] |
n_points |
location to store the number of points in |
[allow-none] |
Since: 2.4
const gchar *
gtk_icon_info_get_display_name (GtkIconInfo *icon_info
);
Gets the display name for an icon. A display name is a string to be used in place of the icon name in a user visible context like a list of icons.
the display name for the icon or NULL
, if
the icon doesn't have a specified display name. This value
is owned icon_info
and must not be modified or free.
Since: 2.4
Used to specify options for gtk_icon_theme_lookup_icon()
Never return SVG icons, even if gdk-pixbuf
supports them. Cannot be used together with |
||
Return SVG icons, even if gdk-pixbuf
doesn't support them.
Cannot be used together with |
||
When passed to
|
||
Try to shorten icon name at '-'
characters before looking at inherited themes. For more general
fallback, see |
||
Always return the icon scaled to the requested size. Since 2.14. |
#define gtk_icon_theme_set_search_path gtk_icon_theme_set_search_path_utf8
Sets the search path for the icon theme object. When looking
for an icon theme, GTK+ will search for a subdirectory of
one or more of the directories in path
with the same name
as the icon theme. (Themes from multiple of the path elements
are combined to allow themes to be extended by adding icons
in the user's home directory.)
In addition if an icon found isn't found either in the current
icon theme or the default icon theme, and an image file with
the right name is found directly in one of the elements of
path
, then that image will be used for the icon name.
(This is legacy feature, and new icons should be put
into the default icon theme, which is called DEFAULT_THEME_NAME,
rather than directly on the icon path.)
icon_theme |
||
path |
array of directories that are searched for icon themes. |
[array length=n_elements][element-type filename] |
n_elements |
number of elements in |
Since: 2.4
#define gtk_icon_theme_get_search_path gtk_icon_theme_get_search_path_utf8
Gets the current search path. See gtk_icon_theme_set_search_path()
.
icon_theme |
||
path |
location to store a list of icon theme path directories or |
[allow-none][array length=n_elements][out] |
n_elements |
location to store number of elements
in |
Since: 2.4
#define gtk_icon_theme_append_search_path gtk_icon_theme_append_search_path_utf8
Appends a directory to the search path.
See gtk_icon_theme_set_search_path()
.
Since: 2.4
#define gtk_icon_theme_prepend_search_path gtk_icon_theme_prepend_search_path_utf8
Prepends a directory to the search path.
See gtk_icon_theme_set_search_path()
.
Since: 2.4
#define gtk_icon_info_get_filename gtk_icon_info_get_filename_utf8
Gets the filename for the icon. If the
GTK_ICON_LOOKUP_USE_BUILTIN
flag was passed
to gtk_icon_theme_lookup_icon()
, there may be
no filename if a builtin icon is returned; in this
case, you should use gtk_icon_info_get_builtin_pixbuf()
.
the filename for the icon, or NULL
if gtk_icon_info_get_builtin_pixbuf()
should
be used instead. The return value is owned by
GTK+ and should not be modified or freed.
Since: 2.4
“changed”
signalvoid user_function (GtkIconTheme *icon_theme, gpointer user_data)
Emitted when the current icon theme is switched or GTK+ detects that a change has occurred in the contents of the current icon theme.
Flags: Run Last