]> Dogcows Code - chaz/tint2/blob - src/util/area.h
*add* more task states (normal, active, iconified, urgent), with each an own backgrou...
[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 has one Pixmap (pix).
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 typedef struct
44 {
45 Color back;
46 Border border;
47 } Background;
48
49
50
51 typedef struct {
52 // coordinate relative to panel window
53 int posx, posy;
54 // width and height including border
55 int width, height;
56 Pixmap pix;
57 Background *bg;
58
59 // list of child : Area object
60 GSList *list;
61
62 int on_screen;
63 // need compute position and width
64 int resize;
65 // need redraw Pixmap
66 int redraw;
67 // paddingxlr = horizontal padding left/right
68 // paddingx = horizontal padding between childs
69 int paddingxlr, paddingx, paddingy;
70 // parent Area
71 void *parent;
72 // panel
73 void *panel;
74
75 // each object can overwrite following function
76 void (*_draw_foreground)(void *obj, cairo_t *c);
77 void (*_resize)(void *obj);
78 void (*_add_child)(void *obj);
79 int (*_remove_child)(void *obj);
80 const char* (*_get_tooltip_text)(void *obj);
81 } Area;
82
83
84
85 // draw background and foreground
86 void refresh (Area *a);
87
88 void size (Area *a);
89
90 // set 'redraw' on an area and childs
91 void set_redraw (Area *a);
92
93 // draw pixmap
94 void draw (Area *a);
95 void draw_background (Area *a, cairo_t *c);
96
97 void remove_area (Area *a);
98 void add_area (Area *a);
99 void free_area (Area *a);
100
101 // draw rounded rectangle
102 void draw_rect(cairo_t *c, double x, double y, double w, double h, double r);
103
104 // clear pixmap with transparent color
105 void clear_pixmap(Pixmap p, int x, int y, int w, int h);
106 #endif
107
This page took 0.037416 seconds and 5 git commands to generate.