~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric-201106091216

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-icons.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100809232612-yp4c6ig3jt1bzpdv
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614624)
* Fixed a few bugs on LP:
 - LP: #518453: Dock appears under all windows
                 (Compiz - fullscreen window)
 - LP: #521369: Separator are not removed when closing
                 grouped windows
 - LP: #521762: Some sentences are not correct
 - LP: #526466: Icons of apps with same class shouldn't
                 be stacked by default
 - LP: #535083: Dialogues looks ugly when a lot of them
                 appears at the same time
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - Man pages are now included in the source code
* debian/copyright:
 - Updated with the new pathes and new files
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev as Build-deps
 - Bump Standard-Version to 3.9.1
* debian/cairo-dock-core.install:
 - Man pages are now included in the source code
 - All sonames are now installed into lib32 or lib64
* debian/cairo-dock-dev.install:
 - pkgconfig is now installed into lib32 or lib64

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
21
#ifndef __CAIRO_DOCK_ICONS__
 
22
#define  __CAIRO_DOCK_ICONS__
 
23
 
 
24
#include <glib.h>
 
25
 
 
26
#include "cairo-dock-struct.h"
 
27
#include "cairo-dock-modules.h"
 
28
G_BEGIN_DECLS
 
29
 
 
30
 
 
31
/**
 
32
*@file cairo-dock-icons.h This class defines the items contained in containers : Icons.
 
33
* An Icon is an union of 3 parts : a launcher, an appli, and an applet. It can be all of them at the same time.
 
34
* - a launcher is any icon having a command or pointing to a sub-dock.
 
35
* - an appli is an icon representing an X window.
 
36
* - an applet is an icon holding a module instance.
 
37
* - an icon being none of them is a separator.
 
38
*
 
39
* The type of an icon is dynamic (for instance a launcher can become an application).
 
40
*
 
41
* Icons are sorted by the (group, order) pair; the group is also the initial type of the icon.
 
42
*/
 
43
 
 
44
/// Definition of the groups of icons.
 
45
typedef enum {
 
46
        CAIRO_DOCK_LAUNCHER = 0,
 
47
        CAIRO_DOCK_SEPARATOR12,
 
48
        CAIRO_DOCK_APPLI,
 
49
        CAIRO_DOCK_SEPARATOR23,
 
50
        CAIRO_DOCK_APPLET,
 
51
        CAIRO_DOCK_NB_TYPES
 
52
        } CairoDockIconType;
 
53
 
 
54
/// Definition of the type of icons.
 
55
typedef enum {
 
56
        CAIRO_DOCK_ICON_TYPE_LAUNCHER = 0,
 
57
        CAIRO_DOCK_ICON_TYPE_FILE,
 
58
        CAIRO_DOCK_ICON_TYPE_CONTAINER,
 
59
        CAIRO_DOCK_ICON_TYPE_SEPARATOR,
 
60
        CAIRO_DOCK_ICON_TYPE_CLASS_CONTAINER,
 
61
        CAIRO_DOCK_ICON_TYPE_APPLI,
 
62
        CAIRO_DOCK_ICON_TYPE_APPLET,
 
63
        CAIRO_DOCK_ICON_TYPE_OTHER,
 
64
        CAIRO_DOCK_NB_ICON_TYPES
 
65
        } CairoDockIconTrueType;
 
66
 
 
67
/// Animation state of an icon, sorted by priority.
 
68
typedef enum {
 
69
        CAIRO_DOCK_STATE_REST = 0,
 
70
        CAIRO_DOCK_STATE_MOUSE_HOVERED,
 
71
        CAIRO_DOCK_STATE_CLICKED,
 
72
        CAIRO_DOCK_STATE_AVOID_MOUSE,
 
73
        CAIRO_DOCK_STATE_FOLLOW_MOUSE,
 
74
        CAIRO_DOCK_STATE_REMOVE_INSERT,
 
75
        CAIRO_DOCK_NB_STATES
 
76
        } CairoDockAnimationState;
 
77
 
 
78
/// Icon's interface
 
79
struct _IconInterface {
 
80
        /// function that loads the icon surface (and optionnally texture).
 
81
        void (*load_image) (Icon *icon);
 
82
        /// function called when the icon is deleted from the current theme.
 
83
        gboolean (*on_delete) (Icon *icon);
 
84
        /// function called when the user drag something over the icon for more than 500ms.
 
85
        void (*action_on_drag_hover) (Icon *icon);
 
86
        };
 
87
 
 
88
 
 
89
/// Definition of an Icon.
 
90
struct _Icon {
 
91
        //\____________ Definition.
 
92
        /// group of the icon.
 
93
        CairoDockIconType iType;
 
94
        IconInterface iface;
 
95
        GPtrArray *pNotificationsTab;
 
96
        gpointer pDataSlot[CAIRO_DOCK_NB_DATA_SLOT];
 
97
        
 
98
        //\____________ properties.
 
99
        // generic.
 
100
        /// Name of the icon.
 
101
        gchar *cName;
 
102
        /// Short info displayed on the icon (few characters).
 
103
        gchar *cQuickInfo;
 
104
        /// name or path of an image displayed on the icon.
 
105
        gchar *cFileName;
 
106
        /// Class of application the icon will be bound to.
 
107
        gchar *cClass;
 
108
        /// name of the dock the icon belongs to (NULL means it's not currently inside a dock).
 
109
        gchar *cParentDockName;
 
110
        /// Sub-dock the icon is pointing to.
 
111
        CairoDock *pSubDock;
 
112
        /// Order of the icon amongst the other icons of its group.
 
113
        gdouble fOrder;
 
114
        
 
115
        gint iSpecificDesktop;
 
116
        gint iSubdockViewType;
 
117
        /// a hint to indicate the icon should be kept static (no animation like bouncing).
 
118
        gboolean bStatic;
 
119
        /// a flag that allows the icon to be always visible, even with the dock is hidden.
 
120
        gboolean bAlwaysVisible;
 
121
        gboolean bIsDemandingAttention;
 
122
        
 
123
        CairoDataRenderer *pDataRenderer;
 
124
        CairoDockTransition *pTransition;
 
125
        
 
126
        CairoDockAnimationState iAnimationState;
 
127
        /// Whether the icon is currently pointed or not.
 
128
        gboolean bPointed;
 
129
        gdouble fInsertRemoveFactor;
 
130
        
 
131
        // Launcher.
 
132
        gchar *cDesktopFileName;  // nom (et non pas chemin) du fichier .desktop
 
133
        gchar *cCommand;
 
134
        gchar *cWorkingDirectory;
 
135
        gchar *cBaseURI;
 
136
        gint iVolumeID;
 
137
        
 
138
        // Appli.
 
139
        Window Xid;
 
140
        gboolean bIsHidden;
 
141
        gboolean bIsFullScreen;
 
142
        gboolean bIsMaximized;
 
143
        gboolean bHasIndicator;
 
144
        GtkAllocation windowGeometry;
 
145
        gint iNumDesktop;
 
146
        gint iViewPortX, iViewPortY;
 
147
        gint iStackOrder;
 
148
        gint iLastCheckTime;
 
149
        gchar *cInitialName;
 
150
        gchar *cLastAttentionDemand;
 
151
        Pixmap iBackingPixmap;
 
152
        //Damage iDamageHandle;
 
153
        
 
154
        // Applet.
 
155
        CairoDockModuleInstance *pModuleInstance;
 
156
        CairoDockModuleInstance *pLinkedApplet;
 
157
        
 
158
        //\____________ Buffers.
 
159
        gdouble fWidth, fHeight;  // taille dans le container.
 
160
        gint iImageWidth, iImageHeight;  // taille de la surface/texture telle qu'elle a ete creee.
 
161
        cairo_surface_t* pIconBuffer;
 
162
        GLuint iIconTexture;
 
163
        cairo_surface_t* pReflectionBuffer;
 
164
        
 
165
        gint iTextWidth, iTextHeight;
 
166
        cairo_surface_t* pTextBuffer;
 
167
        GLuint iLabelTexture;
 
168
        
 
169
        gint iQuickInfoWidth, iQuickInfoHeight;
 
170
        cairo_surface_t* pQuickInfoBuffer;
 
171
        GLuint iQuickInfoTexture;
 
172
        
 
173
        //\____________ Parametres de dessin, definis par la vue/les animations.
 
174
        gdouble fXMin, fXMax;  // Abscisse extremale gauche/droite que the icon atteindra (variable avec la vague).
 
175
        gdouble fXAtRest;  // Abscisse de the icon au repos.
 
176
        gdouble fPhase;  // Phase de the icon (entre -pi et piconi).
 
177
        gdouble fX, fY;  // Abscisse/Ordonnee temporaire du bord haut-gauche de l'image de the icon.
 
178
        
 
179
        gdouble fScale;
 
180
        gdouble fDrawX, fDrawY;
 
181
        gdouble fWidthFactor, fHeightFactor;
 
182
        gdouble fAlpha;
 
183
        gdouble fDeltaYReflection;  // Decalage en ordonnees du reflet (rebond).
 
184
        gdouble fOrientation;  // par rapport a la verticale Oz
 
185
        gint iRotationX;  // Rotation autour de l'axe Ox
 
186
        gint iRotationY;  // Rotation autour de l'axe Oy
 
187
        gdouble fReflectShading;
 
188
        
 
189
        gdouble fGlideOffset;  // decalage pour le glissement des icons.
 
190
        gint iGlideDirection;  // direction dans laquelle glisse the icon.
 
191
        gdouble fGlideScale;  // echelle d'adaptation au glissement.
 
192
        
 
193
        gboolean bBeingRemovedByCairo;  // devrait etre dans pDataSlot...
 
194
        
 
195
        guint iSidRedrawSubdockContent;
 
196
        guint iSidLoadImage;
 
197
        CairoContainer *pContainerForLoad;
 
198
        
 
199
        CairoDockIconTrueType iTrueType;
 
200
        gpointer reserved[3];
 
201
};
 
202
 
 
203
/// Definition of a function that runs through all icons.
 
204
typedef void (* CairoDockForeachIconFunc) (Icon *icon, CairoContainer *pContainer, gpointer data);
 
205
 
 
206
 
 
207
#define CAIRO_DOCK_ICON_TYPE_IS_LAUNCHER(icon) (icon != NULL && (icon)->iTrueType == CAIRO_DOCK_ICON_TYPE_LAUNCHER)
 
208
#define CAIRO_DOCK_ICON_TYPE_IS_FILE(icon) (icon != NULL && (icon)->iTrueType == CAIRO_DOCK_ICON_TYPE_FILE)
 
209
#define CAIRO_DOCK_ICON_TYPE_IS_CONTAINER(icon) (icon != NULL && (icon)->iTrueType == CAIRO_DOCK_ICON_TYPE_CONTAINER)
 
210
#define CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR(icon) (icon != NULL && (icon)->iTrueType == CAIRO_DOCK_ICON_TYPE_SEPARATOR)
 
211
#define CAIRO_DOCK_ICON_TYPE_IS_CLASS_CONTAINER(icon) (icon != NULL && (icon)->iTrueType == CAIRO_DOCK_ICON_TYPE_CLASS_CONTAINER)
 
212
#define CAIRO_DOCK_ICON_TYPE_IS_APPLI(icon) (icon != NULL && (icon)->iTrueType == CAIRO_DOCK_ICON_TYPE_APPLI)
 
213
#define CAIRO_DOCK_ICON_TYPE_IS_APPLET(icon) (icon != NULL && (icon)->iTrueType == CAIRO_DOCK_ICON_TYPE_APPLET)
 
214
 
 
215
/** TRUE if the icon is a launcher (a real launcher with a command or an URI, or a container icon, or even a fake launcher).
 
216
*@param icon an icon.
 
217
*/
 
218
#define CAIRO_DOCK_IS_LAUNCHER(icon) (icon != NULL && ((icon)->cCommand != NULL || (icon)->cBaseURI != NULL || ((icon)->pSubDock != NULL && (icon)->pModuleInstance == NULL)))
 
219
 
 
220
/** TRUE if the icon is an icon of appli.
 
221
*@param icon an icon.
 
222
*/
 
223
#define CAIRO_DOCK_IS_APPLI(icon) (icon != NULL && (icon)->Xid != 0)
 
224
 
 
225
/** TRUE if the icon is an icon of applet.
 
226
*@param icon an icon.
 
227
*/
 
228
#define CAIRO_DOCK_IS_APPLET(icon) (icon != NULL && (icon)->pModuleInstance != NULL)
 
229
 
 
230
/** TRUE if the icon is an icon of separator.
 
231
*@param icon an icon.
 
232
*/
 
233
#define CAIRO_DOCK_IS_SEPARATOR(icon) (icon != NULL && (icon)->pModuleInstance == NULL && (icon)->Xid == 0 && (icon)->pSubDock == NULL && (icon)->cCommand == NULL && (icon)->cBaseURI == NULL)
 
234
 
 
235
/** TRUE if the icon is an icon of launcher launching something.
 
236
*@param icon an icon.
 
237
*/
 
238
#define CAIRO_DOCK_IS_NORMAL_LAUNCHER(icon) (CAIRO_DOCK_IS_LAUNCHER (icon) && (icon)->cCommand != NULL)
 
239
 
 
240
/** TRUE if the icon is an icon of launcher defined by a .desktop file.
 
241
*@param icon an icon.
 
242
*/
 
243
#define CAIRO_DOCK_IS_STORED_LAUNCHER(icon) (CAIRO_DOCK_IS_LAUNCHER (icon) && (icon)->cDesktopFileName != NULL)
 
244
 
 
245
/** TRUE if the icon is an icon representing an URI.
 
246
*@param icon an icon.
 
247
*/
 
248
#define CAIRO_DOCK_IS_URI_LAUNCHER(icon) (CAIRO_DOCK_IS_LAUNCHER (icon) && (icon)->cBaseURI != NULL)
 
249
 
 
250
/** TRUE if the icon is a fake icon (for class groupment).
 
251
*@param icon an icon.
 
252
*/
 
253
#define CAIRO_DOCK_IS_FAKE_LAUNCHER(icon) (icon != NULL && (icon)->cCommand == NULL && (icon)->cClass != NULL && (icon)->pModuleInstance == NULL && (icon)->pSubDock != NULL && (icon)->cDesktopFileName == NULL)
 
254
 
 
255
/** TRUE if the icon is a container icon.
 
256
*@param icon an icon.
 
257
*/
 
258
#define CAIRO_DOCK_IS_CONTAINER_LAUNCHER(icon) (CAIRO_DOCK_IS_LAUNCHER (icon) && (icon)->cCommand == NULL && (icon)->cBaseURI == NULL && icon->cClass == NULL)
 
259
 
 
260
/** TRUE if the icon is an icon pointing on the sub-dock of a class.
 
261
*@param icon an icon.
 
262
*/
 
263
#define CAIRO_DOCK_IS_MULTI_APPLI(icon) (CAIRO_DOCK_IS_LAUNCHER (icon) && icon->pSubDock != NULL && icon->pSubDock->icons != NULL && icon->cClass != NULL)
 
264
 
 
265
/** TRUE if the icon is an icon of automatic separator.
 
266
*@param icon an icon.
 
267
*/
 
268
#define CAIRO_DOCK_IS_AUTOMATIC_SEPARATOR(icon) (CAIRO_DOCK_IS_SEPARATOR (icon) && (icon)->cDesktopFileName == NULL)
 
269
 
 
270
/** TRUE if the icon is an icon of separator added by the user.
 
271
*@param icon an icon.
 
272
*/
 
273
#define CAIRO_DOCK_IS_USER_SEPARATOR(icon) (CAIRO_DOCK_IS_SEPARATOR (icon) && (icon)->cDesktopFileName != NULL)
 
274
/**
 
275
*TRUE if the icon is an icon d'appli seulement.
 
276
*@param icon an icon.
 
277
*/
 
278
#define CAIRO_DOCK_IS_NORMAL_APPLI(icon) (CAIRO_DOCK_IS_APPLI (icon) && CAIRO_DOCK_ICON_TYPE_IS_APPLI (icon))
 
279
/**
 
280
*TRUE if the icon is an icon d'applet detachable en desklet.
 
281
*@param icon an icon.
 
282
*/
 
283
#define CAIRO_DOCK_IS_DETACHABLE_APPLET(icon) (CAIRO_DOCK_IS_APPLET (icon) && (icon)->pModuleInstance->bCanDetach)
 
284
 
 
285
 
 
286
/** Destroy an icon, freeing all allocated ressources. Ths sub-dock is not unreferenced, this must be done beforehand. It also deactivate the icon before (dialog, class, Xid, module) if necessary.
 
287
*@param icon the icon to free.
 
288
*/
 
289
void cairo_dock_free_icon (Icon *icon);
 
290
 
 
291
 
 
292
/** Say whether an icon is currently being inserted.
 
293
*/
 
294
#define cairo_dock_icon_is_being_inserted(icon) ((icon)->fInsertRemoveFactor < 0)
 
295
/** Say whether an icon is currently being removed.
 
296
*/
 
297
#define cairo_dock_icon_is_being_removed(icon) ((icon)->fInsertRemoveFactor > 0)
 
298
#define cairo_dock_icon_is_being_inserted_or_removed(icon) ((icon)->fInsertRemoveFactor != 0)
 
299
 
 
300
 
 
301
#define cairo_dock_get_group_order(iType) (iType < CAIRO_DOCK_NB_TYPES ? myIcons.tIconTypeOrder[iType] : iType)
 
302
/** Get the group order of an icon. 3 groups are available by default : launchers, applis, and applets, and each group has an order.
 
303
*/
 
304
#define cairo_dock_get_icon_order(icon) cairo_dock_get_group_order ((icon)->iType)
 
305
 
 
306
/** Get the type of an icon according to its content (launcher, appli, applet). This can be different from its group.
 
307
*@param icon the icon.
 
308
*/
 
309
CairoDockIconType cairo_dock_get_icon_type (Icon *icon);
 
310
/** Compare 2 icons with the order relation on (group order, icon order).
 
311
*@param icon1 an icon.
 
312
*@param icon2 another icon.
 
313
*@return -1 if icon1 < icon2, 1 if icon1 > icon2, 0 if icon1 = icon2.
 
314
*/
 
315
int cairo_dock_compare_icons_order (Icon *icon1, Icon *icon2);
 
316
 
 
317
/** Compare 2 icons with the order relation on the name (case unsensitive alphabetical order).
 
318
*@param icon1 an icon.
 
319
*@param icon2 another icon.
 
320
*@return -1 if icon1 < icon2, 1 if icon1 > icon2, 0 if icon1 = icon2.
 
321
*/
 
322
int cairo_dock_compare_icons_name (Icon *icon1, Icon *icon2);
 
323
 
 
324
/**
 
325
*Compare 2 icons with the order relation on the extension of their URIs (case unsensitive alphabetical order).
 
326
*@param icon1 an icon.
 
327
*@param icon2 another icon.
 
328
*@return -1 if icon1 < icon2, 1 if icon1 > icon2, 0 if icon1 = icon2.
 
329
*/
 
330
int cairo_dock_compare_icons_extension (Icon *icon1, Icon *icon2);
 
331
 
 
332
/** Sort a list with the order relation on (group order, icon order).
 
333
*@param pIconList a list of icons.
 
334
*@return the sorted list. Elements are the same as the initial list, only their order has changed.
 
335
*/
 
336
GList *cairo_dock_sort_icons_by_order (GList *pIconList);
 
337
 
 
338
/** Sort a list with the alphabetical order on the icons' name.
 
339
*@param pIconList a list of icons.
 
340
*@return the sorted list. Elements are the same as the initial list, only their order has changed. Icon's orders are updated to reflect the new order.
 
341
*/
 
342
GList *cairo_dock_sort_icons_by_name (GList *pIconList);
 
343
 
 
344
/** Get the first icon of a list of icons.
 
345
*@param pIconList a list of icons.
 
346
*@return the first icon, or NULL if the list is empty.
 
347
*/
 
348
Icon *cairo_dock_get_first_icon (GList *pIconList);
 
349
 
 
350
/** Get the last icon of a list of icons.
 
351
*@param pIconList a list of icons.
 
352
*@return the last icon, or NULL if the list is empty.
 
353
*/
 
354
Icon *cairo_dock_get_last_icon (GList *pIconList);
 
355
 
 
356
/*
 
357
*Renvoie la 1ere icon a etre dessinee dans un dock (qui n'est pas forcement la 1ere icon de la liste, si l'utilisateur a scrolle).
 
358
*@param pDock le dock.
 
359
*@return la 1ere icon a etre dessinee, ou NULL si la liste is vide.
 
360
*/
 
361
Icon *cairo_dock_get_first_drawn_icon (CairoDock *pDock);
 
362
 
 
363
/*
 
364
*Renvoie la derniere icon a etre dessinee dans un dock (qui n'est pas forcement la derniere icon de la liste, si l'utilisateur a scrolle).
 
365
*@param pDock le dock.
 
366
*@return la derniere icon a etre dessinee, ou NULL si la liste is vide.
 
367
*/
 
368
Icon *cairo_dock_get_last_drawn_icon (CairoDock *pDock);
 
369
 
 
370
/** Get the first icon of a given group.
 
371
*@param pIconList a list of icons.
 
372
*@param iType the group of icon.
 
373
*@return the first found icon with this group, or NULL if none matches.
 
374
*/
 
375
Icon *cairo_dock_get_first_icon_of_group (GList *pIconList, CairoDockIconType iType);
 
376
#define cairo_dock_get_first_icon_of_type cairo_dock_get_first_icon_of_group
 
377
 
 
378
/** Get the last icon of a given group.
 
379
*@param pIconList a list of icons.
 
380
*@param iType the group of icon.
 
381
*@return the last found icon with this group, or NULL if none matches.
 
382
*/
 
383
Icon *cairo_dock_get_last_icon_of_group (GList *pIconList, CairoDockIconType iType);
 
384
#define cairo_dock_get_last_icon_of_type cairo_dock_get_last_icon_of_group
 
385
 
 
386
/** Get the first icon whose group has the same order as a given one.
 
387
*@param pIconList a list of icons.
 
388
*@param iType a type of icon.
 
389
*@return the first found icon, or NULL if none matches.
 
390
*/
 
391
Icon* cairo_dock_get_first_icon_of_order (GList *pIconList, CairoDockIconType iType);
 
392
 
 
393
/** Get the last icon whose group has the same order as a given one.
 
394
*@param pIconList a list of icons.
 
395
*@param iType a type of icon.
 
396
*@return the last found icon, or NULL if none matches.
 
397
*/
 
398
Icon* cairo_dock_get_last_icon_of_order (GList *pIconList, CairoDockIconType iType);
 
399
 
 
400
Icon* cairo_dock_get_last_icon_until_order (GList *pIconList, CairoDockIconType iType);
 
401
 
 
402
/** Get the currently pointed icon in a list of icons.
 
403
*@param pIconList a list of icons.
 
404
*@return the icon whose field 'bPointed' is TRUE, or NULL if none is pointed.
 
405
*/
 
406
Icon *cairo_dock_get_pointed_icon (GList *pIconList);
 
407
 
 
408
/** Get the icon next to a given one. The cost is O(n).
 
409
*@param pIconList a list of icons.
 
410
*@param pIcon an icon in the list.
 
411
*@return the icon whose left neighboor is pIcon, or NULL if the list is empty or if pIcon is the last icon.
 
412
*/
 
413
Icon *cairo_dock_get_next_icon (GList *pIconList, Icon *pIcon);
 
414
 
 
415
/** Get the icon previous to a given one. The cost is O(n).
 
416
*@param pIconList a list of icons.
 
417
*@param pIcon an icon in the list.
 
418
*@return the icon whose right neighboor is pIcon, or NULL if the list is empty or if pIcon is the first icon.
 
419
*/
 
420
Icon *cairo_dock_get_previous_icon (GList *pIconList, Icon *pIcon);
 
421
 
 
422
/** Get the next element in a list, looping if necessary..
 
423
*@param ic the current element.
 
424
*@param list a list.
 
425
*@return the next element, or the first element of the list if 'ic' is the last one.
 
426
*/
 
427
#define cairo_dock_get_next_element(ic, list) (ic == NULL || ic->next == NULL ? list : ic->next)
 
428
 
 
429
/** Get the previous element in a list, looping if necessary..
 
430
*@param ic the current element.
 
431
*@param list a list.
 
432
*@return the previous element, or the last element of the list if 'ic' is the first one.
 
433
*/
 
434
#define cairo_dock_get_previous_element(ic, list) (ic == NULL || ic->prev == NULL ? g_list_last (list) : ic->prev)
 
435
 
 
436
/** Search an icon with a given command in a list of icons.
 
437
*@param pIconList a list of icons.
 
438
*@param cCommand the command.
 
439
*@return the first icon whose field 'cCommand' is identical to the given command, or NULL if no icon matches.
 
440
*/
 
441
Icon *cairo_dock_get_icon_with_command (GList *pIconList, const gchar *cCommand);
 
442
 
 
443
/** Search an icon with a given URI in a list of icons.
 
444
*@param pIconList a list of icons.
 
445
*@param cBaseURI the URI.
 
446
*@return the first icon whose field 'cURI' is identical to the given URI, or NULL if no icon matches.
 
447
*/
 
448
Icon *cairo_dock_get_icon_with_base_uri (GList *pIconList, const gchar *cBaseURI);
 
449
 
 
450
/** Search an icon with a given name in a list of icons.
 
451
*@param pIconList a list of icons.
 
452
*@param cName the name.
 
453
*@return the first icon whose field 'cName' is identical to the given name, or NULL if no icon matches.
 
454
*/
 
455
Icon *cairo_dock_get_icon_with_name (GList *pIconList, const gchar *cName);
 
456
 
 
457
/** Search the icon pointing on a given sub-dock in a list of icons.
 
458
*@param pIconList a list of icons.
 
459
*@param pSubDock a sub-dock.
 
460
*@return the first icon whose field 'pSubDock' is equal to the given sub-dock, or NULL if no icon matches.
 
461
*/
 
462
Icon *cairo_dock_get_icon_with_subdock (GList *pIconList, CairoDock *pSubDock);
 
463
 
 
464
/** Search the icon of a given module in a list of icons.
 
465
*@param pIconList a list of icons.
 
466
*@param pModule the module.
 
467
*@return the first icon which has an instance of the given module, or NULL if no icon matches.
 
468
*/
 
469
Icon *cairo_dock_get_icon_with_module (GList *pIconList, CairoDockModule *pModule);
 
470
 
 
471
#define cairo_dock_get_first_launcher(pIconList) cairo_dock_get_first_icon_of_group (pIconList, CAIRO_DOCK_LAUNCHER)
 
472
#define cairo_dock_get_last_launcher(pIconList) cairo_dock_get_last_icon_of_group (pIconList, CAIRO_DOCK_LAUNCHER)
 
473
#define cairo_dock_get_first_appli(pIconList) cairo_dock_get_first_icon_of_group (pIconList, CAIRO_DOCK_APPLI)
 
474
#define cairo_dock_get_last_appli(pIconList) cairo_dock_get_last_icon_of_group (pIconList, CAIRO_DOCK_APPLI)
 
475
 
 
476
/** Get the dimension allocated to the surface/texture of an icon.
 
477
@param pIcon the icon.
 
478
@param pContainer its container.
 
479
@param iWidth pointer to the width.
 
480
@param iHeight pointer to the height.
 
481
*/
 
482
void cairo_dock_get_icon_extent (Icon *pIcon, CairoContainer *pContainer, int *iWidth, int *iHeight);
 
483
 
 
484
/** Get the current size of an icon as it is seen on the screen (taking into account the zoom and the ratio).
 
485
@param pIcon the icon
 
486
@param pContainer its container
 
487
@param fSizeX pointer to the X size (horizontal)
 
488
@param fSizeY pointer to the Y size (vertical)
 
489
*/
 
490
void cairo_dock_get_current_icon_size (Icon *pIcon, CairoContainer *pContainer, double *fSizeX, double *fSizeY);
 
491
 
 
492
/** Get the total zone used by an icon on its container (taking into account reflect, gap to reflect, zoom and stretching).
 
493
@param icon the icon
 
494
@param pContainer its container
 
495
@param pArea a rectangle filled with the zone used by the icon on its container.
 
496
*/
 
497
void cairo_dock_compute_icon_area (Icon *icon, CairoContainer *pContainer, GdkRectangle *pArea);
 
498
 
 
499
 
 
500
 
 
501
void cairo_dock_normalize_icons_order (GList *pIconList, CairoDockIconType iType);
 
502
 
 
503
void cairo_dock_move_icon_after_icon (CairoDock *pDock, Icon *icon1, Icon *icon2);
 
504
 
 
505
/** Run an action on all the icons of a given group. The action can even destroy or remove the icon from the list.
 
506
*@param pIconList a list of icons.
 
507
*@param iType the group.
 
508
*@param pFuntion the callback.
 
509
*@param data data passed as a parameter of the callback.
 
510
*@return the first automatic separator with another group, or NULL if there is none.
 
511
*/
 
512
Icon *cairo_dock_foreach_icons_of_type (GList *pIconList, CairoDockIconType iType, CairoDockForeachIconFunc pFuntion, gpointer data);
 
513
 
 
514
/** Update the container's name of an icon with the name of a dock. In the case of a launcher or an applet, the conf file is updated too.
 
515
*@param icon an icon.
 
516
*@param cNewParentDockName the name of its new dock.
 
517
*/
 
518
void cairo_dock_update_icon_s_container_name (Icon *icon, const gchar *cNewParentDockName);
 
519
 
 
520
/** Make an icon static. Static icon are not animated when mouse hovers them.
 
521
*@param icon an icon.
 
522
*/
 
523
#define cairo_dock_set_icon_static(icon) ((icon)->bStatic = TRUE)
 
524
 
 
525
/** Make an icon always visible, even when the dock is hidden.
 
526
*@param icon an icon.
 
527
*@param bAlwaysVisible whether the icon is always visible or not.
 
528
*/
 
529
#define cairo_dock_set_icon_always_visible(icon, bAlwaysVisible) ((bAlwaysVisible)->bStatic = bAlwaysVisible)
 
530
 
 
531
/** Set the label of an icon. If it has a sub-dock, it is renamed (the name is possibly altered to stay unique). The label buffer is updated too.
 
532
*@param cIconName the new label of the icon. You can even pass pIcon->cName.
 
533
*@param pIcon the icon.
 
534
*@param pContainer the container of the icon.
 
535
*/
 
536
void cairo_dock_set_icon_name (const gchar *cIconName, Icon *pIcon, CairoContainer *pContainer);
 
537
 
 
538
/** Same as above, but takes a printf-like format string.
 
539
*@param pIcon the icon.
 
540
*@param pContainer the container of the icon.
 
541
*@param cIconNameFormat the new label of the icon, in a 'printf' way.
 
542
*@param ... data to be inserted into the string.
 
543
*/
 
544
void cairo_dock_set_icon_name_printf (Icon *pIcon, CairoContainer *pContainer, const gchar *cIconNameFormat, ...) G_GNUC_PRINTF (3, 4);
 
545
 
 
546
/** Set the quick-info of an icon. This is a small text (a few characters) that is superimposed on the icon.
 
547
*@param pIcon the icon.
 
548
*@param pContainer the container of the icon.
 
549
*@param cQuickInfo the text of the quick-info.
 
550
*/
 
551
void cairo_dock_set_quick_info (Icon *pIcon, CairoContainer *pContainer, const gchar *cQuickInfo);
 
552
 
 
553
/** Same as above, but takes a printf-like format string.
 
554
*@param pIcon the icon.
 
555
*@param pContainer the container of the icon.
 
556
*@param cQuickInfoFormat the text of the quick-info, in a 'printf' way.
 
557
*@param ... data to be inserted into the string.
 
558
*/
 
559
void cairo_dock_set_quick_info_printf (Icon *pIcon, CairoContainer *pContainer, const gchar *cQuickInfoFormat, ...) G_GNUC_PRINTF (3, 4);
 
560
 
 
561
/** Clear the quick-info of an icon.
 
562
*@param pIcon the icon.
 
563
*/
 
564
#define cairo_dock_remove_quick_info(pIcon) cairo_dock_set_quick_info (pIcon, NULL, NULL)
 
565
 
 
566
/** Updates which launcher is attached/detached to/from the dock, according to the current desktop.
 
567
*@param pDock the dock whose icons are to be considered.
 
568
*/
 
569
void cairo_dock_hide_show_launchers_on_other_desktops (CairoDock *pDock);
 
570
 
 
571
G_END_DECLS
 
572
#endif
 
573