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