~ubuntu-branches/ubuntu/maverick/cairo-dock/maverick

« back to all changes in this revision

Viewing changes to src/cairo-dock-draw.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_DRAW__
22
 
#define  __CAIRO_DOCK_DRAW__
23
 
 
24
 
#include <glib.h>
25
 
 
26
 
#include "cairo-dock-struct.h"
27
 
G_BEGIN_DECLS
28
 
 
29
 
 
30
 
/**
31
 
*@file cairo-dock-draw.h This class provides some useful functions to draw with libcairo.
32
 
*/
33
 
 
34
 
  ///////////////
35
 
 /// CONTEXT ///
36
 
///////////////
37
 
/** Create a generic drawing context, to be used as a source context (for instance, for creating a surface).
38
 
*@param pContainer a container.
39
 
*@return the context on which to draw. Is never NULL, test it with cairo_status() before use it, and destroy it with cairo_destroy() when you're done with it.
40
 
*/
41
 
cairo_t * cairo_dock_create_drawing_context_generic (CairoContainer *pContainer);
42
 
#define cairo_dock_create_context_from_window cairo_dock_create_drawing_context_generic
43
 
#define cairo_dock_create_context_from_container cairo_dock_create_drawing_context_generic
44
 
 
45
 
/** Create a drawing context to draw on a container. It handles fake transparency.
46
 
*@param pContainer the container on which you want to draw.
47
 
*@return the newly allocated context, to be destroyed with 'cairo_destroy'.
48
 
*/
49
 
cairo_t *cairo_dock_create_drawing_context_on_container (CairoContainer *pContainer);
50
 
#define cairo_dock_create_drawing_context cairo_dock_create_drawing_context_on_container
51
 
 
52
 
/** Create a drawing context to draw on a part of a container. It handles fake transparency.
53
 
*@param pContainer the container on which you want to draw
54
 
*@param pArea part of the container to draw.
55
 
*@param fBgColor background color (rgba) to fill the area with, or NULL to let it transparent.
56
 
*@return the newly allocated context, with a clip corresponding to the area, to be destroyed with 'cairo_destroy'.
57
 
*/
58
 
cairo_t *cairo_dock_create_drawing_context_on_area (CairoContainer *pContainer, GdkRectangle *pArea, double *fBgColor);
59
 
 
60
 
 
61
 
 
62
 
double cairo_dock_calculate_extra_width_for_trapeze (double fFrameHeight, double fInclination, double fRadius, double fLineWidth);
63
 
 
64
 
/** Compute the path of a rectangle with rounded corners. It doesn't stroke it, use cairo_stroke or cairo_fill to draw the line or the inside.
65
 
*@param pCairoContext a drawing context; the current matrix is not altered, but the current path is.
66
 
*@param fRadius radius if the corners.
67
 
*@param fLineWidth width of the line.
68
 
*@param fFrameWidth width of the rectangle, without the corners.
69
 
*@param fFrameHeight height of the rectangle, including the corners.
70
 
*/
71
 
void cairo_dock_draw_rounded_rectangle (cairo_t *pCairoContext, double fRadius, double fLineWidth, double fFrameWidth, double fFrameHeight);
72
 
 
73
 
/* Trace sur the context un contour trapezoidale aux coins arrondis. Le contour n'est pas dessine, mais peut l'etre a posteriori, et peut servir de cadre pour y dessiner des choses dedans.
74
 
*@param pCairoContext the context du dessin, contenant le cadre a la fin de la fonction.
75
 
*@param fRadius le rayon en pixels des coins.
76
 
*@param fLineWidth l'epaisseur en pixels du contour.
77
 
*@param fFrameWidth la largeur de la plus petite base du trapeze.
78
 
*@param fFrameHeight la hauteur du trapeze.
79
 
*@param fDockOffsetX un decalage, dans le sens de la largeur du dock, a partir duquel commencer a tracer la plus petite base du trapeze.
80
 
*@param fDockOffsetY un decalage, dans le sens de la hauteur du dock, a partir duquel commencer a tracer la plus petite base du trapeze.
81
 
*@param sens 1 pour un tracer dans le sens des aiguilles d'une montre (indirect), -1 sinon.
82
 
*@param fInclination tangente de l'angle d'inclinaison des cotes du trapeze par rapport a la vertical. 0 pour tracer un rectangle.
83
 
*@param bHorizontal CAIRO_DOCK_HORIZONTAL ou CAIRO_DOCK_VERTICAL suivant l'horizontalité du dock.
84
 
*/
85
 
double cairo_dock_draw_frame (cairo_t *pCairoContext, double fRadius, double fLineWidth, double fFrameWidth, double fFrameHeight, double fDockOffsetX, double fDockOffsetY, int sens, double fInclination, gboolean bHorizontal);
86
 
 
87
 
/* Dessine les decorations d'un dock a l'interieur d'un cadre prealablement trace sur the context.
88
 
*@param pCairoContext the context du dessin, est laisse intact par la fonction.
89
 
*@param pDock le dock sur lequel appliquer les decorations.
90
 
*@param fOffsetY position du coin haut gauche du cadre, dans le sens de la hauteur du dock.
91
 
*@param fOffsetX position du coin haut gauche du cadre, dans le sens de la largeur du dock.
92
 
*@param fWidth largeur du cadre (et donc des decorations)
93
 
*/
94
 
void cairo_dock_render_decorations_in_frame (cairo_t *pCairoContext, CairoDock *pDock, double fOffsetY, double fOffsetX, double fWidth);
95
 
 
96
 
 
97
 
void cairo_dock_set_icon_scale_on_context (cairo_t *pCairoContext, Icon *icon, gboolean bIsHorizontal, double fRatio, gboolean bDirectionUp);
98
 
 
99
 
/** Draw an icon and its reflect on a dock. Only draw the icon's image and reflect, and nothing else.
100
 
*@param icon the icon to draw.
101
 
*@param pDock the dock containing the icon.
102
 
*@param pCairoContext a context on the dock, not altered by the function.
103
 
*/
104
 
void cairo_dock_draw_icon_cairo (Icon *icon, CairoDock *pDock, cairo_t *pCairoContext);
105
 
 
106
 
gboolean cairo_dock_render_icon_notification (gpointer pUserData, Icon *pIcon, CairoDock *pDock, gboolean *bHasBeenRendered, cairo_t *pCairoContext);
107
 
 
108
 
/** Draw an icon, according to its current parameters : position, transparency, reflect, rotation, stretching. Also draws its indicators, label, and quick-info. It generates a CAIRO_DOCK_RENDER_ICON notification.
109
 
*@param icon the icon to draw.
110
 
*@param pDock the dock containing the icon.
111
 
*@param pCairoContext a context on the dock, it is altered by the function.
112
 
*@param fDockMagnitude current magnitude of the dock.
113
 
*@param bUseText TRUE to draw the labels.
114
 
*/
115
 
void cairo_dock_render_one_icon (Icon *icon, CairoDock *pDock, cairo_t *pCairoContext, double fDockMagnitude, gboolean bUseText);
116
 
void cairo_dock_render_icons_linear (cairo_t *pCairoContext, CairoDock *pDock);
117
 
 
118
 
void cairo_dock_render_one_icon_in_desklet (Icon *icon, cairo_t *pCairoContext, gboolean bUseReflect, gboolean bUseText, int iWidth);
119
 
 
120
 
 
121
 
/** Draw a string linking the center of all the icons of a dock.
122
 
*@param pCairoContext a context on the dock, not altered by the function.
123
 
*@param pDock the dock.
124
 
*@param fStringLineWidth width of the line.
125
 
*@param bIsLoop TRUE to loop (link the last icon to the first one).
126
 
*@param bForceConstantSeparator TRUE to consider separators having a constant size.
127
 
*/
128
 
void cairo_dock_draw_string (cairo_t *pCairoContext, CairoDock *pDock, double fStringLineWidth, gboolean bIsLoop, gboolean bForceConstantSeparator);
129
 
 
130
 
 
131
 
void cairo_dock_draw_surface (cairo_t *pCairoContext, cairo_surface_t *pSurface, int iWidth, int iHeight, gboolean bDirectionUp, gboolean bHorizontal, gdouble fAlpha);
132
 
 
133
 
/** Erase a drawing context, making it fully transparent. You don't need to erase a newly created context.
134
 
*@param pCairoContext a drawing context.
135
 
*/
136
 
#define cairo_dock_erase_cairo_context(pCairoContext) do {\
137
 
        cairo_set_source_rgba (pCairoContext, 0.0, 0.0, 0.0, 0.0);\
138
 
        cairo_set_operator (pCairoContext, CAIRO_OPERATOR_SOURCE);\
139
 
        cairo_paint (pCairoContext);\
140
 
        cairo_set_operator (pCairoContext, CAIRO_OPERATOR_OVER); } while (0)
141
 
 
142
 
 
143
 
void cairo_dock_render_hidden_dock (cairo_t *pCairoContext, CairoDock *pDock);
144
 
 
145
 
 
146
 
/*#define _cairo_dock_extend_area(area, x, y, w, h) do {\
147
 
        int xmin = MIN (area.x, x);
148
 
        int ymin = MIN (area.y, y);
149
 
        area.width = MAX (area.x + area.width, x + w) - xmin;\
150
 
        area.height = MAX (area.y + area.height, y + h) - ymin;\
151
 
        area.x = MIN (area.x, x);\
152
 
        area.y = MIN (area.y, y); } while (0)
153
 
#define _cairo_dock_compute_areas_bounded_box(area, area_) _cairo_dock_extend_area (area, area_.x, area_.y, area_.width, area_.height)
154
 
 
155
 
#define cairo_dock_damage_container_area(pContainer, area) _cairo_dock_compute_areas_bounded_box (pContainer->damageArea, area)
156
 
 
157
 
#define cairo_dock_damage_icon(pIcon, pContainer) do {\
158
 
        GdkRectangle area;\
159
 
        cairo_dock_compute_icon_area (icon, pContainer, &area);\
160
 
        cairo_dock_damage_container_area(pContainer, area); } while (0)
161
 
        
162
 
#define cairo_dock_damage_container(pContainer) do {\
163
 
        pContainer->damageArea.x = 0;\
164
 
        pContainer->damageArea.y = 0;\
165
 
        if (pContainer->bHorizontal) {\
166
 
                pContainer->damageArea.width = pContainer->iWidth;\
167
 
                pContainer->damageArea.height = pContainer->iHeight; }\
168
 
        else {\
169
 
                pContainer->damageArea.width = pContainer->iHeight;\
170
 
                pContainer->damageArea.height = pContainer->iWidth; }\
171
 
        } while (0)*/
172
 
 
173
 
 
174
 
G_END_DECLS
175
 
#endif