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

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-emblem.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
#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
        double fScale;
 
60
};
 
61
 
 
62
/** 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.
 
63
*@param cImageFile an image.
 
64
*@param pIcon an icon.
 
65
*@param pContainer its container, or NULL if the icon is not yet inside a container.
 
66
*@return the newly allocated emblem.
 
67
*/
 
68
CairoEmblem *cairo_dock_make_emblem (const gchar *cImageFile, Icon *pIcon, CairoContainer *pContainer);
 
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, or NULL if the icon is not yet inside a 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, or NULL if the icon is not yet inside a 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
void _cairo_dock_apply_emblem_texture (CairoEmblem *pEmblem, int w, int h);
 
101
void _cairo_dock_apply_emblem_surface (CairoEmblem *pEmblem, int w, int h, cairo_t *pCairoContext);
 
102
 
 
103
/** Permanently draw an emblem on an icon.
 
104
*@param pEmblem the emblem
 
105
*@param pIcon an icon
 
106
*@param pContainer its container, or NULL if the icon is not yet inside a container
 
107
*/
 
108
void cairo_dock_draw_emblem_on_icon (CairoEmblem *pEmblem, Icon *pIcon, CairoContainer *pContainer);
 
109
 
 
110
 
 
111
G_END_DECLS
 
112
#endif