2003-07-02 22:44:09 +00:00
|
|
|
/* GtkIconTheme - a loader for icon themes
|
|
|
|
* gtk-icon-loader.h Copyright (C) 2002, 2003 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2003-07-02 22:44:09 +00:00
|
|
|
*/
|
|
|
|
|
2012-12-28 14:57:34 +00:00
|
|
|
#ifndef __GTK_ICON_THEME_H__
|
|
|
|
#define __GTK_ICON_THEME_H__
|
|
|
|
|
2009-10-21 18:30:04 +00:00
|
|
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
2008-05-28 15:07:04 +00:00
|
|
|
#error "Only <gtk/gtk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2008-04-18 14:56:23 +00:00
|
|
|
#include <gdk/gdk.h>
|
2020-02-02 00:13:27 +00:00
|
|
|
#include <gtk/gtkenums.h>
|
2003-07-02 22:44:09 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2020-02-04 16:19:22 +00:00
|
|
|
#define GTK_TYPE_ICON_PAINTABLE (gtk_icon_paintable_get_type ())
|
|
|
|
#define GTK_ICON_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_PAINTABLE, GtkIconPaintable))
|
|
|
|
#define GTK_IS_ICON_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_PAINTABLE))
|
2003-07-02 22:44:09 +00:00
|
|
|
|
2020-01-28 14:43:51 +00:00
|
|
|
#define GTK_TYPE_ICON_THEME (gtk_icon_theme_get_type ())
|
|
|
|
#define GTK_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_THEME, GtkIconTheme))
|
|
|
|
#define GTK_IS_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_THEME))
|
2003-07-02 22:44:09 +00:00
|
|
|
|
2020-02-04 16:19:22 +00:00
|
|
|
typedef struct _GtkIconPaintable GtkIconPaintable;
|
|
|
|
typedef struct _GtkIconTheme GtkIconTheme;
|
2003-07-02 22:44:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkIconLookupFlags:
|
2014-05-11 00:30:50 +00:00
|
|
|
* @GTK_ICON_LOOKUP_FORCE_REGULAR: Try to always load regular icons, even
|
2018-06-25 23:21:08 +00:00
|
|
|
* when symbolic icon names are given
|
2014-05-11 00:30:50 +00:00
|
|
|
* @GTK_ICON_LOOKUP_FORCE_SYMBOLIC: Try to always load symbolic icons, even
|
2018-06-25 23:21:08 +00:00
|
|
|
* when regular icon names are given
|
2020-02-07 16:25:18 +00:00
|
|
|
* @GTK_ICON_LOOKUP_LOAD_IN_THREAD: Starts loading the texture in the background
|
|
|
|
* so it is ready when later needed.
|
2019-08-29 15:07:45 +00:00
|
|
|
*
|
2003-07-02 22:44:09 +00:00
|
|
|
* Used to specify options for gtk_icon_theme_lookup_icon()
|
2014-01-21 03:57:10 +00:00
|
|
|
*/
|
2003-07-02 22:44:09 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
IconTheme: Simplify icon scaling
We had a pretty complex setup where we tried to avoid scaling up themes from dirs
that specified a size. However, not only was it very complex, but it didn't quite
work with window scales, because when using e.g. a size 32 directory for 16@2x
the dir size is wrong anyway. Additionally it turns out most code either picks
an existing icon size, or uses the FORCE_SIZE flags, so it doesn't seem
like a useful behaviour.
This change drops the FORCE_SIZE flags, and always scales
icons. Additionally it moves the scaling of the icon to rendering,
which seems more modern, and allows us to (later) share icons loaded
for different sizes that happened to use the same source file (at
different scales).
Note that this changes the behaviour of
gtk_icon_paintable_download_texture() is it now returns the unscaled
source icon. However, ignore thats, as I plan to remove this function
and replace it with a way to render a paintable to a cairo-surface
instead.
2020-02-05 14:47:23 +00:00
|
|
|
GTK_ICON_LOOKUP_FORCE_REGULAR = 1 << 0,
|
2020-02-07 16:25:18 +00:00
|
|
|
GTK_ICON_LOOKUP_FORCE_SYMBOLIC = 1 << 1,
|
|
|
|
GTK_ICON_LOOKUP_LOAD_IN_THREAD = 1 << 2,
|
2003-07-02 22:44:09 +00:00
|
|
|
} GtkIconLookupFlags;
|
|
|
|
|
2011-04-14 21:07:29 +00:00
|
|
|
/**
|
|
|
|
* GTK_ICON_THEME_ERROR:
|
|
|
|
*
|
|
|
|
* The #GQuark used for #GtkIconThemeError errors.
|
|
|
|
*/
|
2003-07-02 22:44:09 +00:00
|
|
|
#define GTK_ICON_THEME_ERROR gtk_icon_theme_error_quark ()
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkIconThemeError:
|
|
|
|
* @GTK_ICON_THEME_NOT_FOUND: The icon specified does not exist in the theme
|
|
|
|
* @GTK_ICON_THEME_FAILED: An unspecified error occurred.
|
2019-08-29 15:07:45 +00:00
|
|
|
*
|
2003-07-02 22:44:09 +00:00
|
|
|
* Error codes for GtkIconTheme operations.
|
|
|
|
**/
|
|
|
|
typedef enum {
|
|
|
|
GTK_ICON_THEME_NOT_FOUND,
|
|
|
|
GTK_ICON_THEME_FAILED
|
|
|
|
} GtkIconThemeError;
|
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2004-11-23 20:02:15 +00:00
|
|
|
GQuark gtk_icon_theme_error_quark (void);
|
2003-07-02 22:44:09 +00:00
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
GType gtk_icon_theme_get_type (void) G_GNUC_CONST;
|
2003-07-02 22:44:09 +00:00
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
GtkIconTheme *gtk_icon_theme_new (void);
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
GtkIconTheme *gtk_icon_theme_get_for_display (GdkDisplay *display);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
void gtk_icon_theme_set_display (GtkIconTheme *self,
|
|
|
|
GdkDisplay *display);
|
2003-07-02 22:44:09 +00:00
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
void gtk_icon_theme_set_search_path (GtkIconTheme *self,
|
|
|
|
const gchar *path[],
|
|
|
|
gint n_elements);
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
void gtk_icon_theme_get_search_path (GtkIconTheme *self,
|
|
|
|
gchar **path[],
|
|
|
|
gint *n_elements);
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
void gtk_icon_theme_append_search_path (GtkIconTheme *self,
|
|
|
|
const gchar *path);
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
void gtk_icon_theme_prepend_search_path (GtkIconTheme *self,
|
|
|
|
const gchar *path);
|
2003-07-02 22:44:09 +00:00
|
|
|
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
void gtk_icon_theme_add_resource_path (GtkIconTheme *self,
|
|
|
|
const gchar *path);
|
2014-06-20 04:46:09 +00:00
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
void gtk_icon_theme_set_custom_theme (GtkIconTheme *self,
|
|
|
|
const gchar *theme_name);
|
2003-07-02 22:44:09 +00:00
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
gboolean gtk_icon_theme_has_icon (GtkIconTheme *self,
|
|
|
|
const gchar *icon_name);
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
gint *gtk_icon_theme_get_icon_sizes (GtkIconTheme *self,
|
|
|
|
const gchar *icon_name);
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
GtkIconPaintable *gtk_icon_theme_lookup_icon (GtkIconTheme *self,
|
|
|
|
const char *icon_name,
|
|
|
|
const char *fallbacks[],
|
|
|
|
gint size,
|
|
|
|
gint scale,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkIconLookupFlags flags);
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
GtkIconPaintable *gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
|
|
|
|
GIcon *icon,
|
|
|
|
gint size,
|
|
|
|
gint scale,
|
|
|
|
GtkTextDirection direction,
|
|
|
|
GtkIconLookupFlags flags);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
GList * gtk_icon_theme_list_icons (GtkIconTheme *self);
|
2020-01-28 14:43:51 +00:00
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-04 16:19:22 +00:00
|
|
|
GType gtk_icon_paintable_get_type (void) G_GNUC_CONST;
|
2008-05-29 14:33:49 +00:00
|
|
|
|
2013-03-20 22:17:32 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-06 16:33:19 +00:00
|
|
|
const gchar * gtk_icon_paintable_get_filename (GtkIconPaintable *self);
|
2018-02-05 19:13:20 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-06 16:33:19 +00:00
|
|
|
const gchar * gtk_icon_paintable_get_resource_path (GtkIconPaintable *self);
|
2020-02-06 16:28:19 +00:00
|
|
|
GDK_AVAILABLE_IN_ALL
|
2020-02-06 16:33:19 +00:00
|
|
|
const gchar * gtk_icon_paintable_get_icon_name (GtkIconPaintable *self);
|
|
|
|
GDK_AVAILABLE_IN_ALL
|
|
|
|
gboolean gtk_icon_paintable_is_symbolic (GtkIconPaintable *self);
|
2016-10-05 16:35:06 +00:00
|
|
|
|
2003-07-02 22:44:09 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_ICON_THEME_H__ */
|