|
|
452870 |
#ifndef GRAPH_H
|
|
|
452870 |
#define GRAPH_H
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
#include "common.h"
|
|
|
452870 |
|
|
|
dbe1a1 |
#include "X11/Xft/Xft.h"
|
|
|
452870 |
|
|
|
061fcf |
|
|
|
061fcf |
|
|
|
452870 |
typedef enum {
|
|
|
dbe1a1 |
GC_WINDOW,
|
|
|
dbe1a1 |
GC_BUTTON_INACTIVE,
|
|
|
37122c |
GC_BUTTON_HIGHTLIGHT,
|
|
|
dbe1a1 |
GC_BUTTON_ACTIVE,
|
|
|
dbe1a1 |
GC_BUTTON_ACTIVE2,
|
|
|
37122c |
GC_TEXT_HIGHTLIGHT,
|
|
|
dbe1a1 |
GC_TEXT_INACTIVE,
|
|
|
dbe1a1 |
GC_TEXT_ACTIVE,
|
|
|
dbe1a1 |
GC_TEXT_ACTIVE2 } GraphStyle;
|
|
|
452870 |
enum {
|
|
|
dbe1a1 |
GC_COUNT = GC_TEXT_ACTIVE2 + 1 };
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
typedef struct Graph {
|
|
|
452870 |
App *app;
|
|
|
dbe1a1 |
XftDraw *draw;
|
|
|
dbe1a1 |
XftFont *fonts[FONT_MAX_SIZES];
|
|
|
dbe1a1 |
int fontsCnt;
|
|
|
dbe1a1 |
XftColor colors[GC_COUNT];
|
|
|
452870 |
} Graph;
|
|
|
452870 |
|
|
|
452870 |
|
|
|
dbe1a1 |
typedef struct TextLayoutSize {
|
|
|
dbe1a1 |
int x, y, w, h;
|
|
|
dbe1a1 |
} TextLayoutSize;
|
|
|
dbe1a1 |
|
|
|
dbe1a1 |
|
|
|
452870 |
typedef struct TextLayout {
|
|
|
452870 |
Graph *g;
|
|
|
dbe1a1 |
int len;
|
|
|
dbe1a1 |
const char *text;
|
|
|
dbe1a1 |
TextLayoutSize sizes[FONT_MAX_SIZES];
|
|
|
452870 |
} TextLayout;
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
int graphInit(Graph *g, App *app);
|
|
|
452870 |
void graphDeinit(Graph *g);
|
|
|
452870 |
void graphResize(Graph *g);
|
|
|
452870 |
void graphDrawBackgound(Graph *g, int x, int y, int w, int h);
|
|
|
37122c |
void graphDrawButton(Graph *g, int x, int y, int w, int h, int active, int highlight);
|
|
|
452870 |
|
|
|
843e7a |
void textLayoutInit(TextLayout *tl, Graph *g, const char *text);
|
|
|
452870 |
void textLayoutDeinit(TextLayout *tl);
|
|
|
37122c |
void textLayoutDraw(TextLayout *tl, int x, int y, int w, int h, int active, int highlight);
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
#endif
|