50 lines
915 B
C
50 lines
915 B
C
#ifndef THING_H
|
|
#define THING_H
|
|
/*
|
|
#include <libpng.h>
|
|
#include <pango.h>
|
|
#include <cairo/cairo.h>
|
|
#include <cairo/cairo-xcb.h>
|
|
#include <xcb/xcb.h>
|
|
#include <X11/Xlib.h>
|
|
#include <X11/Xatom.h>
|
|
*/
|
|
#include <stdint.h>
|
|
|
|
typedef struct thing thing_t;
|
|
typedef uint64_t thing_id_t;
|
|
|
|
thing_id_t thing_id(const thing_t *);
|
|
|
|
typedef struct {
|
|
int x;
|
|
int y;
|
|
int w;
|
|
int h;
|
|
} thing_geom;
|
|
|
|
struct put_event;
|
|
|
|
struct link {
|
|
thing_id_t from;
|
|
thing_id_t to;
|
|
uint32_t type;
|
|
};
|
|
|
|
typedef struct {
|
|
void (*draw)(thing_t *self, void *render_ctx);
|
|
int (*hit)(thing_t *self, int x, int y);
|
|
void (*event)(thing_t *self, const struct put_event *ev);
|
|
} thing_ops;
|
|
|
|
thing_t *thing_create(const thing_ops *ops, void *userdata, thing_geom geom);
|
|
|
|
void thing_set_geom(thing_t *t, thing_geom g);
|
|
thing_geom thing_get_geom(const thing_t *t);
|
|
|
|
void *thing_userdata(const thing_t *t);
|
|
|
|
void thing_destroy(thing_t *t);
|
|
|
|
#endif /* THING_H */
|