2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
21
#ifndef __CAIRO_DOCK_ICON_LOADER__
22
#define __CAIRO_DOCK_ICON_LOADER__
26
#include "cairo-dock-struct.h"
27
#include "cairo-dock-surface-factory.h"
31
*@file cairo-dock-icon-loader.h This class loads the icons and manages the associated ressources.
35
/** Search the path of an icon into the defined icons themes. It also handles the '~' caracter in paths.
36
* @param cFileName name of the icon file.
37
* @return the complete path of the icon, or NULL if not found.
39
gchar *cairo_dock_search_icon_s_path (const gchar *cFileName);
41
/* Cree la surface de reflection d'une icone (pour cairo).
42
*@param pIcon l'icone.
43
*@param pContainer le container de l'icone.
45
void cairo_dock_add_reflection_to_icon (Icon *pIcon, CairoContainer *pContainer);
47
void cairo_dock_set_icon_size (CairoContainer *pContainer, Icon *icon);
49
/**Fill the image buffer (surface & texture) of a given icon, according to its type. Set its size if necessary, and fills the reflection buffer for cairo.
50
*@param icon the icon.
51
*@param pContainer its container.
53
void cairo_dock_load_icon_image (Icon *icon, CairoContainer *pContainer);
55
/**Cut an UTF-8 or ASCII string to n characters, and add '...' to the end in cas it was effectively cut. If n is negative, it will remove the last |n| characters. It manages correctly UTF-8 strings.
56
*@param cString the string.
57
*@param iNbCaracters the maximum number of characters wished, or the number of characters to remove if negative.
58
*@return the newly allocated string.
60
gchar *cairo_dock_cut_string (const gchar *cString, int iNbCaracters);
62
/**Fill the label buffer (surface & texture) of a given icon, according to a text description.
63
*@param icon the icon.
64
*@param pTextDescription desctiption of the text rendering.
66
void cairo_dock_load_icon_text (Icon *icon, CairoDockLabelDescription *pTextDescription);
68
/**Fill the quick-info buffer (surface & texture) of a given icon, according to a text description.
69
*@param icon the icon.
70
*@param pTextDescription desctiption of the text rendering.
71
*@param fMaxScale maximum zoom.
73
void cairo_dock_load_icon_quickinfo (Icon *icon, CairoDockLabelDescription *pTextDescription, double fMaxScale);
75
/** Fill all the buffers (surfaces & textures) of a given icon, according to its type. Set its size accordingly, and fills the reflection buffer for cairo. Label and quick-info are loaded with the current global text description.
76
*@param pIcon the icon.
77
*@param pContainer its container.
79
void cairo_dock_load_icon_buffers (Icon *pIcon, CairoContainer *pContainer);
81
void cairo_dock_trigger_load_icon_buffers (Icon *pIcon, CairoContainer *pContainer);
83
void cairo_dock_reload_buffers_in_dock (gchar *cDockName, CairoDock *pDock, gpointer data);
84
#define cairo_dock_load_buffers_in_one_dock(pDock) cairo_dock_reload_buffers_in_dock (NULL, pDock, GINT_TO_POINTER (TRUE))
86
void cairo_dock_reload_icon_image (Icon *icon, CairoContainer *pContainer);
90
void cairo_dock_load_icons_background_surface (const gchar *cImagePath, double fMaxScale);
92
/**void cairo_dock_load_task_indicator (const gchar *cIndicatorImagePath, double fMaxScale, double fIndicatorRatio);
94
void cairo_dock_load_active_window_indicator (const gchar *cImagePath, double fMaxScale, double fCornerRadius, double fLineWidth, double *fActiveColor);
96
void cairo_dock_load_class_indicator (const gchar *cIndicatorImagePath, double fMaxScale);*/
99
void cairo_dock_init_icon_manager (void);
101
void cairo_dock_load_icon_textures (void);
103
void cairo_dock_unload_icon_textures (void);
106
void cairo_dock_draw_subdock_content_on_icon (Icon *pIcon, CairoDock *pDock);
110
typedef void (*CairoIconContainerLoadFunc) (void);
111
typedef void (*CairoIconContainerUnloadFunc) (void);
112
typedef void (*CairoIconContainerRenderFunc) (Icon *pIcon, CairoContainer *pContainer, int w, int h, cairo_t *pCairoContext);
113
typedef void (*CairoIconContainerRenderOpenGLFunc) (Icon *pIcon, CairoContainer *pContainer, int w, int h);
115
struct _CairoIconContainerRenderer {
116
CairoIconContainerLoadFunc load;
117
CairoIconContainerUnloadFunc unload;
118
CairoIconContainerRenderFunc render;
119
CairoIconContainerRenderOpenGLFunc render_opengl;