aboutsummaryrefslogtreecommitdiff
path: root/src/draw.h
blob: f68b4ab10b1e2c3fec54188676022a2d1127b472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef COMET_DRAW_H
#define COMET_DRAW_H

#include <glib.h>
#include <pango/pango-font.h>
#include <pango/pangocairo.h>

#include "window.h"

typedef struct {
    double r, g, b, a;
} Color;

// The one who draws ('o')7

typedef struct {
    PangoFontDescription *desc;
    int height;
    int left_pad;
    int right_pad;
    int top_pad;
    Color background;
    GList *layouts;
} Drawer;

typedef struct {
    struct Button *btn;
    int x, y;
    int width, height;
    int text_w, text_h;
    int x_pad, y_pad;
    int line_w;
    PangoLayout *pl;
    GList *children;
} Layout;

Drawer *draw_create(const char *font, int height, int left_pad, int right_pad, int top_pad);

void draw_compute_layout(Drawer *draw, Window *win, GList *btns);

void draw_paint(Drawer *draw, Window *win);

void draw_set_background(Drawer *draw, Color background);

void draw_destroy(Drawer *draw);

#endif

// vim: ts=4 sw=4 et