]> Dogcows Code - chaz/tint2/blob - src/util/area.h
big change : panel_monitor = all will draw one panel per monitor, panel_size accept...
[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 also manage the tree of visible objects. Parent object drawn before child object.
11 * panel -> taskbars -> tasks
12 * -> systray -> icons
13 * -> clock
14 *
15 * draw_foreground(obj) is virtual function.
16 *
17 * TODO :
18 * resize_width(obj, width) = 0 : fonction virtuelle à redéfinir
19 * recalcule la largeur de l'objet (car la hauteur est fixe)
20 * - taille systray calculée à partir de la liste des icones
21 * - taille clock calculée à partir de l'heure
22 * - taille d'une tache calculée à partir de la taskbar (ajout, suppression, taille)
23 * - taille d'une taskbar calculée à partir de la taille du panel et des autres objets
24 *
25 * voir resize_taskbar(), resize_clock() et resize_tasks()
26 * voir config(obj) configure un objet (définie les positions verticales)
27 *
28 **************************************************************************/
29
30 #ifndef AREA_H
31 #define AREA_H
32
33 #include <glib.h>
34 #include <X11/Xlib.h>
35 #include <cairo.h>
36 #include <cairo-xlib.h>
37
38
39 typedef struct
40 {
41 double color[3];
42 double alpha;
43 int width;
44 int rounded;
45 } Border;
46
47
48 typedef struct
49 {
50 double color[3];
51 double alpha;
52 } Color;
53
54
55 typedef struct
56 {
57 Pixmap pmap;
58 Color back;
59 Border border;
60 } Pmap;
61
62
63 // TODO: isoler 'draw' de 'refresh'
64 // TODO: isoler les données locales des données communes aux freres
65 typedef struct {
66 // absolute coordinate in panel
67 int posx, posy;
68 int width, height;
69 Pmap pix;
70 Pmap pix_active;
71
72 // list of child : Area object
73 GSList *list;
74
75 // need redraw Pixmap
76 int redraw;
77 int use_active, is_active;
78 // paddingxlr = horizontal padding left/right
79 // paddingx = horizontal padding between childs
80 int paddingxlr, paddingx, paddingy;
81 // parent Area
82 void *parent;
83 // panel
84 void *panel;
85
86 // each object can overwrite following function
87 void (*draw_foreground)(void *obj, cairo_t *c, int active);
88 void (*add_child)(void *obj);
89 int (*remove_child)(void *obj);
90 } Area;
91
92
93
94 // draw background and foreground
95 void refresh (Area *a);
96
97 // set 'redraw' on an area and childs
98 void set_redraw (Area *a);
99
100 // draw pixmap and pixmap_active
101 void draw (Area *a, int active);
102 void draw_background (Area *a, cairo_t *c, int active);
103
104 void remove_area (Area *a);
105 void add_area (Area *a);
106 void free_area (Area *a);
107
108 // draw rounded rectangle
109 void draw_rect(cairo_t *c, double x, double y, double w, double h, double r);
110
111 #endif
112
This page took 0.042057 seconds and 5 git commands to generate.