~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/cairo-dock-emblem.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

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
 
#ifndef __CAIRO_DOCK_EMBLEM__
21
 
#define  __CAIRO_DOCK_EMBLEM__
22
 
 
23
 
#include "cairo-dock-struct.h"
24
 
G_BEGIN_DECLS
25
 
 
26
 
/**
27
 
*@file cairo-dock-emblem.h This class defines Emblems, that are small images superimposed on the icon at a given place.
28
 
*
29
 
* The emblem is drawn directly on the icon, so it modifies its surface/texture itself. Thus, to remove an emblem, you have to set the original image on the icon.
30
 
*
31
 
* Emblems can be placed in the corners of the icon, or in the middle of it.
32
 
*
33
 
* Usage :
34
 
* create an Emblem with \ref cairo_dock_make_emblem
35
 
* set its position with \ref cairo_dock_set_emblem_position
36
 
* you can then render the emblem on the icon with \ref cairo_dock_draw_emblem_on_icon.
37
 
* free the emblem when you're done with \ref cairo_dock_free_emblem
38
 
*
39
 
* An emblem can be used as many times as you want on any icon. The only limitation is that an emblem uses either Cairo or OpenGL, this is decided at the creation time; so the icons you draw the emblem on must be drawn with the same rendering.
40
 
*/
41
 
 
42
 
/// Available position of the emblem on the icon.
43
 
typedef enum {
44
 
        CAIRO_DOCK_EMBLEM_UPPER_LEFT = 0,
45
 
        CAIRO_DOCK_EMBLEM_LOWER_RIGHT,
46
 
        CAIRO_DOCK_EMBLEM_LOWER_LEFT,
47
 
        CAIRO_DOCK_EMBLEM_UPPER_RIGHT,
48
 
        CAIRO_DOCK_EMBLEM_MIDDLE,
49
 
        CAIRO_DOCK_EMBLEM_NB_POSITIONS,
50
 
} CairoEmblemPosition;
51
 
 
52
 
/// Definition of an Emblem. You shouldn't access any of its fields directly.
53
 
struct _CairoEmblem {
54
 
        cairo_surface_t *pSurface;
55
 
        GLuint iTexture;
56
 
        int iWidth;
57
 
        int iHeight;
58
 
        CairoEmblemPosition iPosition;
59
 
};
60
 
 
61
 
/** Create an emblem from an image, that suits the given icon and container. If the image is given by its sole name, it is searched inside the current theme root folder.
62
 
*@param cImageFile an image.
63
 
*@param pIcon an icon.
64
 
*@param pContainer its container.
65
 
*@param pSourceContext a cairo context, not altered by the function.
66
 
*@return the newly allocated emblem.
67
 
*/
68
 
CairoEmblem *cairo_dock_make_emblem (const gchar *cImageFile, Icon *pIcon, CairoContainer *pContainer, cairo_t *pSourceContext);
69
 
 
70
 
/** Create an emblem from an existing surface. The surface is appropriated by the emblem, so if you free it with \ref cairo_dock_free_emblem, it will also free the surface. Use g_free to destroy the emblem if you don't want the surface to be destroyed with.
71
 
*@param pSurface a surface.
72
 
*@param iSurfaceWidth width of the surface, 0 means it has the same width as the icon.
73
 
*@param iSurfaceHeight height of the surface, 0 means it has the same height as the icon.
74
 
*@param pIcon an icon.
75
 
*@param pContainer its container.
76
 
*@return the newly allocated emblem.
77
 
*/
78
 
CairoEmblem *cairo_dock_make_emblem_from_surface (cairo_surface_t *pSurface, int iSurfaceWidth, int iSurfaceHeight, Icon *pIcon, CairoContainer *pContainer);
79
 
 
80
 
/** Create an emblem from an existing texture. The texture is appropriated by the emblem, so if you free it with \ref cairo_dock_free_emblem, it will also free the texture. Use g_free to destroy the emblem if you don't want the texture to be destroyed with.
81
 
*@param iTexture a texture.
82
 
*@param pIcon an icon.
83
 
*@param pContainer its container.
84
 
*@return the newly allocated emblem.
85
 
*/
86
 
CairoEmblem *cairo_dock_make_emblem_from_texture (GLuint iTexture, Icon *pIcon, CairoContainer *pContainer);
87
 
 
88
 
/** Set the position of an emblem.
89
 
*@param pEmblem the emblem
90
 
*@param pos the position (a \ref CairoEmblemPosition)
91
 
*/
92
 
#define cairo_dock_set_emblem_position(pEmblem, pos) pEmblem->iPosition = pos
93
 
 
94
 
/** Destroy an emblem and all its allocated ressources.
95
 
*@param pEmblem the emblem
96
 
*/
97
 
void cairo_dock_free_emblem (CairoEmblem *pEmblem);
98
 
 
99
 
 
100
 
/** Permanently draw an emblem on an icon.
101
 
*@param pEmblem the emblem
102
 
*@param pIcon an icon
103
 
*@param pContainer its container
104
 
*/
105
 
void cairo_dock_draw_emblem_on_icon (CairoEmblem *pEmblem, Icon *pIcon, CairoContainer *pContainer);
106
 
 
107
 
 
108
 
void cairo_dock_draw_subdock_content_on_icon (Icon *pIcon, CairoDock *pDock);
109
 
 
110
 
G_END_DECLS
111
 
#endif