26d35e694dae8faeca03e4a0087ab0651118df8d
[framework/uifw/efreet.git] / src / lib / efreet_icon.h
1 /* vim: set sw=4 ts=4 sts=4 et: */
2 #ifndef EFREET_ICON_H
3 #define EFREET_ICON_H
4
5 /**
6  * @file efreet_icon.h
7  * @brief Contains the structures and methods used to support the FDO icon
8  * theme specificiation.
9  * @addtogroup Efreet_Icon Efreet_Icon: The FDO Icon Theme
10  *                  Specification functions and structures
11  *
12  * @{
13  */
14
15 #include <Eina.h>
16
17 /**
18  * The possible contexts for an icon directory
19  */
20 enum Efreet_Icon_Theme_Context
21 {
22     EFREET_ICON_THEME_CONTEXT_NONE,
23     EFREET_ICON_THEME_CONTEXT_ACTIONS,
24     EFREET_ICON_THEME_CONTEXT_DEVICES,
25     EFREET_ICON_THEME_CONTEXT_FILESYSTEMS,
26     EFREET_ICON_THEME_CONTEXT_MIMETYPES
27 };
28
29 /**
30  * Efreet_icon_Theme_Context
31  */
32 typedef enum Efreet_Icon_Theme_Context Efreet_Icon_Theme_Context;
33
34 /**
35  * The possible size types for an icon directory
36  */
37 enum Efreet_Icon_Size_Type
38 {
39     EFREET_ICON_SIZE_TYPE_NONE,
40     EFREET_ICON_SIZE_TYPE_FIXED,
41     EFREET_ICON_SIZE_TYPE_SCALABLE,
42     EFREET_ICON_SIZE_TYPE_THRESHOLD
43 };
44
45 /**
46  * Efreet_Icon_Size_Type
47  */
48 typedef enum Efreet_Icon_Size_Type Efreet_Icon_Size_Type;
49
50 /**
51  * Efreet_Icon_Theme
52  */
53 typedef struct Efreet_Icon_Theme Efreet_Icon_Theme;
54
55 /**
56  * Efreet_Icon_Theme
57  * @brief contains all of the known information about a given theme
58  */
59 struct Efreet_Icon_Theme
60 {
61     struct
62     {
63         const char *internal;   /**< The internal theme name */
64         const char *name;       /**< The user visible name */
65     } name;                     /**< The different names for the theme */
66
67     char *comment;        /**< String describing the theme */
68     char *example_icon;   /**< Icon to use as an example of the theme */
69
70     /* An icon theme can have multiple directories that store it's icons. We
71      * need to be able to find a search each one. */
72
73     Eina_List *paths;          /**< The paths */
74     Eina_List *inherits;       /**< Icon themes we inherit from */
75     Eina_List *directories;    /**< List of subdirectories for this theme */
76
77     double last_cache_check;    /**< Last time the cache was checked */
78
79     unsigned char hidden:1;     /**< Should this theme be hidden from users */
80     unsigned char valid:1;      /**< Have we seen an index for this theme */
81     unsigned char fake:1;       /**< This isnt' a real theme but the user has
82                                         tried to query from it. We create the
83                                         fake one to give us the theme cache. */
84 };
85
86 /**
87  * Efreet_Icon_Theme_Directory
88  */
89 typedef struct Efreet_Icon_Theme_Directory Efreet_Icon_Theme_Directory;
90
91 /**
92  * Efreet_Icon_Theme_Directory
93  * @brief Contains all the information about a sub-directory of a theme
94  */
95 struct Efreet_Icon_Theme_Directory
96 {
97     char *name;               /**< The directory name */
98     Efreet_Icon_Theme_Context context;  /**< The type of icons in the dir */
99     Efreet_Icon_Size_Type type;     /**< The size type for the icons */
100
101     struct
102     {
103         unsigned int normal;        /**< The size for this directory */
104         unsigned int min;           /**< The minimum size for this directory */
105         unsigned int max;           /**< The maximum size for this directory */
106         unsigned int threshold;     /**< Size difference threshold */
107     } size;                         /**< The size settings for the icon theme */
108 };
109
110 /**
111  * Efreet_Icon
112  */
113 typedef struct Efreet_Icon Efreet_Icon;
114
115 /**
116  * Efreet_Icon
117  * @brief Contains all the information about a given icon
118  */
119 struct Efreet_Icon
120 {
121     char *path;       /**< Full path to the icon */
122     char *name;       /**< Translated UTF8 string that can
123                                     be used for the icon name */
124
125     struct
126     {
127         int x0,             /**< x0 position */
128             y0,             /**< y0 position */
129             x1,             /**< x1 position */
130             y1;             /**< y1 position */
131     } embedded_text_rectangle;  /**< Rectangle where text can
132                                         be displayed on the icon */
133
134     Eina_List *attach_points; /**< List of points to be used as anchor
135                                         points for emblems/overlays */
136
137     unsigned int ref_count;    /**< References to this icon */
138     unsigned char has_embedded_text_rectangle:1; /**< Was the embedded
139                                                         rectangle set */
140 };
141
142 /**
143  * Efreet_Point
144  */
145 typedef struct Efreet_Icon_Point Efreet_Icon_Point;
146
147 /**
148  * Efreet_Point
149  * @brief Stores an x, y point.
150  */
151 struct Efreet_Icon_Point
152 {
153     int x;          /**< x coord */
154     int y;          /**< y coord */
155 };
156
157 EAPI const char        *efreet_icon_user_dir_get(void);
158 EAPI void               efreet_icon_extension_add(const char *ext);
159
160 EAPI Eina_List        **efreet_icon_extra_list_get(void);
161 EAPI Eina_List         *efreet_icon_theme_list_get(void);
162 EAPI Efreet_Icon_Theme *efreet_icon_theme_find(const char *theme_name);
163 EAPI Efreet_Icon       *efreet_icon_find(const char *theme_name,
164                                             const char *icon,
165                                             unsigned int size);
166 EAPI char              *efreet_icon_list_find(const char *theme_name,
167                                                 Eina_List *icons,
168                                                 unsigned int size);
169 EAPI char              *efreet_icon_path_find(const char *theme_name,
170                                                 const char *icon,
171                                                 unsigned int size);
172 EAPI void               efreet_icon_free(Efreet_Icon *icon);
173
174 /**
175  * @}
176  */
177
178 #endif