1 /*
2 * This file is a part of the Cairo-Dock project
3 *
4 * Copyright : (C) see the 'copyright' file.
5 * E-mail    : see the 'copyright' file.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef __CAIRO_DOCK_ICON_MANAGER__
21 #define  __CAIRO_DOCK_ICON_MANAGER__
22 
23 #include <glib.h>
24 
25 #include "cairo-dock-struct.h"
26 #include "cairo-dock-manager.h"
27 #include "cairo-dock-style-facility.h"  // GldiTextDescription
28 #include "cairo-dock-icon-factory.h"  // CairoDockIconGroup
29 G_BEGIN_DECLS
30 
31 /**
32 *@file cairo-dock-icon-manager.h This class manages the icons parameters and their associated ressources.
33 *
34 * Specialized Icons are handled by the corresponding manager.
35 */
36 
37 // manager
38 typedef struct _CairoIconsParam CairoIconsParam;
39 
40 #ifndef _MANAGER_DEF_
41 extern CairoIconsParam myIconsParam;
42 extern GldiManager myIconsMgr;
43 extern GldiObjectManager myIconObjectMgr;
44 #endif
45 
46 #define CAIRO_DOCK_DEFAULT_ICON_SIZE 128
47 
48 // params
49 typedef enum {
50 	CAIRO_DOCK_NORMAL_SEPARATOR,
51 	CAIRO_DOCK_FLAT_SEPARATOR,
52 	CAIRO_DOCK_PHYSICAL_SEPARATOR,
53 	CAIRO_DOCK_NB_SEPARATOR_TYPES
54 	} CairoDockSeparatorType;
55 
56 struct _CairoIconsParam {
57 	// icons
58 	CairoDockIconGroup tIconTypeOrder[CAIRO_DOCK_NB_GROUPS];
59 	gdouble fReflectHeightRatio;
60 	gdouble fAlbedo;
61 	gdouble fAmplitude;
62 	gint iSinusoidWidth;
63 	gint iIconGap;
64 	gint iStringLineWidth;
65 	gdouble fStringColor[4];
66 	gdouble fAlphaAtRest;
67 	///gdouble fReflectSize;
68 	gchar *cIconTheme;
69 	gchar *cBackgroundImagePath;
70 	gint iIconWidth;  // default icon size
71 	gint iIconHeight;
72 	// separators
73 	CairoDockSeparatorType iSeparatorType;
74 	gint iSeparatorWidth;
75 	gint iSeparatorHeight;
76 	gchar *cSeparatorImage;
77 	gboolean bRevolveSeparator;
78 	gboolean bConstantSeparatorSize;
79 	gboolean bSeparatorUseDefaultColors;
80 	GldiColor fSeparatorColor;
81 	// labels
82 	GldiTextDescription iconTextDescription;
83 	GldiTextDescription quickInfoTextDescription;
84 	gboolean bLabelForPointedIconOnly;
85 	gint iLabelSize;  // taille des etiquettes des icones, en prenant en compte le contour et la marge.
86 	gdouble fLabelAlphaThreshold;
87 	};
88 
89 /// signals
90 typedef enum {
91 	/// notification called when an icon's sub-dock is starting to (un)fold. data : {Icon}
92 	NOTIFICATION_UNFOLD_SUBDOCK = NB_NOTIFICATIONS_OBJECT,
93 	/// notification called when an icon is updated in the fast rendering loop.
94 	NOTIFICATION_UPDATE_ICON,
95 	/// notification called when an icon is updated in the slow rendering loop.
96 	NOTIFICATION_UPDATE_ICON_SLOW,
97 	/// notification called when the background of an icon is rendered.
98 	NOTIFICATION_PRE_RENDER_ICON,
99 	/// notification called when an icon is rendered.
100 	NOTIFICATION_RENDER_ICON,
101 	/// notification called when an icon is stopped, for instance before it is removed.
102 	NOTIFICATION_STOP_ICON,
103 	/// notification called when someone asks for an animation for a given icon.
104 	NOTIFICATION_REQUEST_ICON_ANIMATION,
105 	///
106 	NB_NOTIFICATIONS_ICON
107 	} CairoIconNotifications;
108 
109 
110 
111 /** Execute an action on all icons.
112 *@param pFunction the action.
113 *@param pUserData data passed to the callback.
114 */
115 void gldi_icons_foreach (GldiIconFunc pFunction, gpointer pUserData);
116 
117 
118 void cairo_dock_hide_show_launchers_on_other_desktops (void);
119 
120 void cairo_dock_set_specified_desktop_for_icon (Icon *pIcon, int iSpecificDesktop);
121 
122 /** Search the icon size of a GtkIconSize.
123  * @param iIconSize a GtkIconSize
124  * @return the maximum between the width and the height of the icon size in pixel (or 128 if there is a problem)
125  */
126 gint cairo_dock_search_icon_size (GtkIconSize iIconSize);
127 
128 /** Search the path of an icon into the defined icons themes. It also handles the '~' caracter in paths.
129  * @param cFileName name of the icon file.
130  * @param iDesiredIconSize desired icon size if we use icons from user icons theme.
131  * @return the complete path of the icon, or NULL if not found.
132  */
133 gchar *cairo_dock_search_icon_s_path (const gchar *cFileName, gint iDesiredIconSize);
134 
135 void cairo_dock_add_path_to_icon_theme (const gchar *cPath);
136 
137 void cairo_dock_remove_path_from_icon_theme (const gchar *cPath);
138 
139 
140 void gldi_register_icons_manager (void);
141 
142 G_END_DECLS
143 #endif
144