Blob Blame Raw
#ifndef GRAPH_H
#define GRAPH_H


#include "common.h"


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


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


typedef struct TextLayout {
  Graph *g;
  int x, y;
  const char *text;
} 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 textLayoutInit(TextLayout *tl, Graph *g, int cx, int cy, const char *text);
void textLayoutDeinit(TextLayout *tl);
void textLayoutDraw(TextLayout *tl, int active);


#endif