blob: 7b403944664369a8d2a0f492634ffec6ed023323 [file] [log] [blame]
Kristian Høgsbergffd710e2008-12-02 15:15:01 -05001/*
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
Kristian Høgsberg2f2cfae2008-11-08 22:46:30 -050023#ifndef _CAIRO_UTIL_H
24#define _CAIRO_UTIL_H
25
Pekka Paalanen4fbb6532012-11-30 13:37:28 +020026#include <cairo.h>
Kristian Høgsberg6006ecb2012-11-29 12:23:36 -050027
Kristian Høgsberg2f2cfae2008-11-08 22:46:30 -050028void
Benjamin Franzke47eb8f42011-10-07 09:08:56 +020029surface_flush_device(cairo_surface_t *surface);
30
31void
Kristian Høgsbergdcb71b62010-06-15 17:16:35 -040032tile_mask(cairo_t *cr, cairo_surface_t *surface,
Kristian Høgsberg9a686242010-08-18 15:28:04 -040033 int x, int y, int width, int height, int margin, int top_margin);
Kristian Høgsbergdcb71b62010-06-15 17:16:35 -040034
35void
36tile_source(cairo_t *cr, cairo_surface_t *surface,
Kristian Høgsberg9a686242010-08-18 15:28:04 -040037 int x, int y, int width, int height, int margin, int top_margin);
Kristian Høgsbergdcb71b62010-06-15 17:16:35 -040038
Kristian Høgsberg1e164b92011-09-13 14:47:46 -040039void
40rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius);
41
Kristian Høgsberg27d38662011-10-20 13:11:12 -040042cairo_surface_t *
Kristian Høgsbergf02a6492012-03-12 01:05:25 -040043load_cairo_surface(const char *filename);
Kristian Høgsberg27d38662011-10-20 13:11:12 -040044
Kristian Høgsberg42abdf52012-05-15 22:14:27 -040045struct theme {
46 cairo_surface_t *active_frame;
47 cairo_surface_t *inactive_frame;
48 cairo_surface_t *shadow;
49 int frame_radius;
50 int margin;
51 int width;
52 int titlebar_height;
53};
54
Kristian Høgsberg5adb4802012-05-15 22:25:28 -040055struct theme *
56theme_create(void);
Kristian Høgsberg42abdf52012-05-15 22:14:27 -040057void
Kristian Høgsberg5adb4802012-05-15 22:25:28 -040058theme_destroy(struct theme *t);
59
Scott Moreauc6a7e4b2012-09-28 02:45:06 -060060enum {
61 THEME_FRAME_ACTIVE = 1,
62 THEME_FRAME_MAXIMIZED,
63};
Kristian Høgsberg5adb4802012-05-15 22:25:28 -040064
Kristian Høgsberg42abdf52012-05-15 22:14:27 -040065void
Kristian Høgsberg5adb4802012-05-15 22:25:28 -040066theme_render_frame(struct theme *t,
67 cairo_t *cr, int width, int height,
68 const char *title, uint32_t flags);
Kristian Høgsberg42abdf52012-05-15 22:14:27 -040069
Kristian Høgsbergf96e6c02012-05-22 16:38:53 -040070enum theme_location {
71 THEME_LOCATION_INTERIOR = 0,
72 THEME_LOCATION_RESIZING_TOP = 1,
73 THEME_LOCATION_RESIZING_BOTTOM = 2,
74 THEME_LOCATION_RESIZING_LEFT = 4,
75 THEME_LOCATION_RESIZING_TOP_LEFT = 5,
76 THEME_LOCATION_RESIZING_BOTTOM_LEFT = 6,
77 THEME_LOCATION_RESIZING_RIGHT = 8,
78 THEME_LOCATION_RESIZING_TOP_RIGHT = 9,
79 THEME_LOCATION_RESIZING_BOTTOM_RIGHT = 10,
80 THEME_LOCATION_RESIZING_MASK = 15,
81 THEME_LOCATION_EXTERIOR = 16,
82 THEME_LOCATION_TITLEBAR = 17,
83 THEME_LOCATION_CLIENT_AREA = 18,
84};
85
86enum theme_location
Scott Moreauc6a7e4b2012-09-28 02:45:06 -060087theme_get_location(struct theme *t, int x, int y, int width, int height, int flags);
Kristian Høgsbergf96e6c02012-05-22 16:38:53 -040088
Kristian Høgsberg2f2cfae2008-11-08 22:46:30 -050089#endif