2008-10-02 18:47:02 +00:00
|
|
|
/**************************************************************************
|
2008-10-30 15:39:24 +00:00
|
|
|
* Copyright (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr)
|
2009-01-17 14:07:56 +00:00
|
|
|
*
|
2008-10-30 15:39:24 +00:00
|
|
|
* base class for all graphical objects (panel, taskbar, task, systray, clock, ...).
|
2009-01-17 14:07:56 +00:00
|
|
|
* Area is at the begining of each object (&object == &area).
|
|
|
|
*
|
2008-10-30 15:39:24 +00:00
|
|
|
* Area manage the background and border drawing, size and padding.
|
2009-01-17 14:07:56 +00:00
|
|
|
* Each Area have 2 Pixmap (pix and pix_active).
|
|
|
|
*
|
|
|
|
* Area also manage the tree of visible objects. Parent object drawn before child object.
|
2008-10-30 15:39:24 +00:00
|
|
|
* panel -> taskbars -> tasks
|
|
|
|
* -> systray -> icons
|
2008-11-08 20:23:42 +00:00
|
|
|
* -> clock
|
2009-01-17 14:07:56 +00:00
|
|
|
*
|
|
|
|
* draw_foreground(obj) is virtual function.
|
|
|
|
*
|
|
|
|
* TODO :
|
2009-01-05 21:01:05 +00:00
|
|
|
* resize_width(obj, width) = 0 : fonction virtuelle à redéfinir
|
2008-10-02 18:47:02 +00:00
|
|
|
* recalcule la largeur de l'objet (car la hauteur est fixe)
|
|
|
|
* - taille systray calculée à partir de la liste des icones
|
|
|
|
* - taille clock calculée à partir de l'heure
|
|
|
|
* - taille d'une tache calculée à partir de la taskbar (ajout, suppression, taille)
|
|
|
|
* - taille d'une taskbar calculée à partir de la taille du panel et des autres objets
|
2009-01-17 14:07:56 +00:00
|
|
|
*
|
2008-10-02 18:47:02 +00:00
|
|
|
* voir resize_taskbar(), resize_clock() et resize_tasks()
|
2009-01-05 21:01:05 +00:00
|
|
|
* voir config(obj) configure un objet (définie les positions verticales)
|
2008-10-02 18:47:02 +00:00
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef AREA_H
|
|
|
|
#define AREA_H
|
|
|
|
|
2009-01-18 22:12:41 +00:00
|
|
|
#include <glib.h>
|
2008-10-02 18:47:02 +00:00
|
|
|
#include <X11/Xlib.h>
|
2009-01-18 22:12:41 +00:00
|
|
|
#include <cairo.h>
|
|
|
|
#include <cairo-xlib.h>
|
2008-10-02 18:47:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double color[3];
|
|
|
|
double alpha;
|
|
|
|
int width;
|
|
|
|
int rounded;
|
|
|
|
} Border;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
double color[3];
|
|
|
|
double alpha;
|
|
|
|
} Color;
|
|
|
|
|
|
|
|
|
2009-01-17 14:07:56 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Pixmap pmap;
|
|
|
|
Color back;
|
|
|
|
Border border;
|
|
|
|
} Pmap;
|
|
|
|
|
|
|
|
|
2008-10-02 18:47:02 +00:00
|
|
|
typedef struct {
|
2009-01-05 21:01:05 +00:00
|
|
|
// absolute coordinate in panel
|
|
|
|
int posx, posy;
|
2008-10-02 18:47:02 +00:00
|
|
|
int width, height;
|
2009-01-17 14:07:56 +00:00
|
|
|
Pmap pix;
|
|
|
|
Pmap pix_active;
|
2009-01-05 21:01:05 +00:00
|
|
|
|
|
|
|
// list of child : Area object
|
|
|
|
GSList *list;
|
2009-01-17 14:07:56 +00:00
|
|
|
|
2009-02-10 23:16:10 +00:00
|
|
|
// need compute position and width
|
|
|
|
int resize;
|
2009-01-05 21:01:05 +00:00
|
|
|
// need redraw Pixmap
|
2009-01-17 14:07:56 +00:00
|
|
|
int redraw;
|
|
|
|
int use_active, is_active;
|
2009-01-20 21:16:54 +00:00
|
|
|
// paddingxlr = horizontal padding left/right
|
|
|
|
// paddingx = horizontal padding between childs
|
|
|
|
int paddingxlr, paddingx, paddingy;
|
2009-01-05 21:01:05 +00:00
|
|
|
// parent Area
|
|
|
|
void *parent;
|
2009-02-07 23:28:13 +00:00
|
|
|
// panel
|
|
|
|
void *panel;
|
2009-01-17 14:07:56 +00:00
|
|
|
|
2009-01-05 21:01:05 +00:00
|
|
|
// each object can overwrite following function
|
2009-02-10 23:16:10 +00:00
|
|
|
void (*_draw_foreground)(void *obj, cairo_t *c, int active);
|
|
|
|
void (*_resize)(void *obj);
|
|
|
|
void (*_add_child)(void *obj);
|
|
|
|
int (*_remove_child)(void *obj);
|
2008-10-02 18:47:02 +00:00
|
|
|
} Area;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// draw background and foreground
|
2009-01-05 21:01:05 +00:00
|
|
|
void refresh (Area *a);
|
|
|
|
|
|
|
|
// set 'redraw' on an area and childs
|
|
|
|
void set_redraw (Area *a);
|
2009-01-17 14:07:56 +00:00
|
|
|
|
|
|
|
// draw pixmap and pixmap_active
|
|
|
|
void draw (Area *a, int active);
|
|
|
|
void draw_background (Area *a, cairo_t *c, int active);
|
2008-10-02 18:47:02 +00:00
|
|
|
|
|
|
|
void remove_area (Area *a);
|
|
|
|
void add_area (Area *a);
|
2008-11-08 20:23:42 +00:00
|
|
|
void free_area (Area *a);
|
2008-10-02 18:47:02 +00:00
|
|
|
|
2009-01-18 22:12:41 +00:00
|
|
|
// draw rounded rectangle
|
|
|
|
void draw_rect(cairo_t *c, double x, double y, double w, double h, double r);
|
|
|
|
|
2008-10-02 18:47:02 +00:00
|
|
|
#endif
|
|
|
|
|