toytoolkit: Don't draw shadows for maximized windows.
[profile/ivi/weston.git] / shared / cairo-util.h
1 /*
2  * Copyright © 2008 Kristian Høgsberg
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that copyright
7  * notice and this permission notice appear in supporting documentation, and
8  * that the name of the copyright holders not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission.  The copyright holders make no representations
11  * about the suitability of this software for any purpose.  It is provided "as
12  * is" without express or implied warranty.
13  *
14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20  * OF THIS SOFTWARE.
21  */
22
23 #ifndef _CAIRO_UTIL_H
24 #define _CAIRO_UTIL_H
25
26 void
27 surface_flush_device(cairo_surface_t *surface);
28
29 void
30 blur_surface(cairo_surface_t *surface, int margin);
31
32 void
33 tile_mask(cairo_t *cr, cairo_surface_t *surface,
34           int x, int y, int width, int height, int margin, int top_margin);
35
36 void
37 tile_source(cairo_t *cr, cairo_surface_t *surface,
38             int x, int y, int width, int height, int margin, int top_margin);
39
40 void
41 rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius);
42
43 cairo_surface_t *
44 load_cairo_surface(const char *filename);
45
46 struct theme {
47         cairo_surface_t *active_frame;
48         cairo_surface_t *inactive_frame;
49         cairo_surface_t *shadow;
50         int frame_radius;
51         int margin;
52         int width;
53         int titlebar_height;
54 };
55
56 struct theme *
57 theme_create(void);
58 void
59 theme_destroy(struct theme *t);
60
61 enum {
62         THEME_FRAME_ACTIVE = 1,
63         THEME_FRAME_MAXIMIZED,
64 };
65
66 void
67 theme_render_frame(struct theme *t, 
68                    cairo_t *cr, int width, int height,
69                    const char *title, uint32_t flags);
70
71 enum theme_location {
72         THEME_LOCATION_INTERIOR = 0,
73         THEME_LOCATION_RESIZING_TOP = 1,
74         THEME_LOCATION_RESIZING_BOTTOM = 2,
75         THEME_LOCATION_RESIZING_LEFT = 4,
76         THEME_LOCATION_RESIZING_TOP_LEFT = 5,
77         THEME_LOCATION_RESIZING_BOTTOM_LEFT = 6,
78         THEME_LOCATION_RESIZING_RIGHT = 8,
79         THEME_LOCATION_RESIZING_TOP_RIGHT = 9,
80         THEME_LOCATION_RESIZING_BOTTOM_RIGHT = 10,
81         THEME_LOCATION_RESIZING_MASK = 15,
82         THEME_LOCATION_EXTERIOR = 16,
83         THEME_LOCATION_TITLEBAR = 17,
84         THEME_LOCATION_CLIENT_AREA = 18,
85 };
86
87 enum theme_location
88 theme_get_location(struct theme *t, int x, int y, int width, int height, int flags);
89
90 #endif