]> Dogcows Code - chaz/tint2/blob - src/util/area.h
fixed issue 49 and some systray code (not yet)
[chaz/tint2] / src / util / area.h
1 /**************************************************************************
2 * Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr)
3 *
4 * base class for all graphical objects (panel, taskbar, task, systray, clock, ...).
5 * Area is at the begining of each object (&object == &area).
6 *
7 * Area manage the background and border drawing, size and padding.
8 * Each Area have 2 Pixmap (pix and pix_active).
9 *
10 * Area manage the tree of all objects. Parent object drawn before child object.
11 * panel -> taskbars -> tasks
12 * -> systray -> icons
13 * -> clock
14 *
15 * draw_foreground(obj) and resize(obj) are virtual function.
16 *
17 **************************************************************************/
18
19 #ifndef AREA_H
20 #define AREA_H
21
22 #include <glib.h>
23 #include <X11/Xlib.h>
24 #include <cairo.h>
25 #include <cairo-xlib.h>
26
27
28 typedef struct
29 {
30 double color[3];
31 double alpha;
32 int width;
33 int rounded;
34 } Border;
35
36
37 typedef struct
38 {
39 double color[3];
40 double alpha;
41 } Color;
42
43
44 typedef struct
45 {
46 Pixmap pmap;
47 Color back;
48 Border border;
49 } Pmap;
50
51
52 typedef struct {
53 // absolute coordinate in panel
54 int posx, posy;
55 // width and height including border
56 int width, height;
57 Pmap pix;
58 Pmap pix_active;
59
60 // list of child : Area object
61 GSList *list;
62
63 int visible;
64 // need compute position and width
65 int resize;
66 // need redraw Pixmap
67 int redraw;
68 int use_active, is_active;
69 // paddingxlr = horizontal padding left/right
70 // paddingx = horizontal padding between childs
71 int paddingxlr, paddingx, paddingy;
72 // parent Area
73 void *parent;
74 // panel
75 void *panel;
76
77 // each object can overwrite following function
78 void (*_draw_foreground)(void *obj, cairo_t *c, int active);
79 void (*_resize)(void *obj);
80 void (*_add_child)(void *obj);
81 int (*_remove_child)(void *obj);
82 } Area;
83
84
85
86 // draw background and foreground
87 void refresh (Area *a);
88
89 void size (Area *a);
90
91 // set 'redraw' on an area and childs
92 void set_redraw (Area *a);
93
94 // draw pixmap and pixmap_active
95 void draw (Area *a, int active);
96 void draw_background (Area *a, cairo_t *c, int active);
97
98 void remove_area (Area *a);
99 void add_area (Area *a);
100 void free_area (Area *a);
101
102 // draw rounded rectangle
103 void draw_rect(cairo_t *c, double x, double y, double w, double h, double r);
104
105 #endif
106
This page took 0.036381 seconds and 5 git commands to generate.