Blob Blame Raw
#ifndef GRAPH_H
#define GRAPH_H


#include "common.h"


#define TL_MAXLEN 32


typedef enum {
  GS_WINDOW,
  GS_BUTTON_INACTIVE,
  GS_BUTTON_ACTIVE,
  GS_BUTTON_ACTIVE2,
  GS_TEXT_INACTIVE,
  GS_TEXT_ACTIVE,
  GS_TEXT_ACTIVE2 } GraphStyle;
enum {
  GS_COUNT = GS_TEXT_ACTIVE2 + 1 };


typedef struct Graph {
  App *app;
  xcb_colormap_t cm;
  xcb_font_t font;
  xcb_gcontext_t gc[GS_COUNT];
} Graph;


typedef struct TextLayout {
  Graph *g;
  int x, y, len;
  xcb_char2b_t text[TL_MAXLEN];
} 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);

void textLayoutInit(TextLayout *tl, Graph *g, const char *text);
void textLayoutDeinit(TextLayout *tl);
void textLayoutDraw(TextLayout *tl, int x, int y, int active);


#endif