X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fgis-tile.h;h=b7e912336aee50663daad59a8e91acbff7b2bc2b;hp=dc571ac4bc082c622829d320a1242cba027e0501;hb=f93aa6df36b91a106bd9be7e8dd60b83b0f6a0cb;hpb=72ae2b9bd30e518fa1539424ad0d994aa8d8a6de diff --git a/src/gis-tile.h b/src/gis-tile.h index dc571ac..b7e9123 100644 --- a/src/gis-tile.h +++ b/src/gis-tile.h @@ -19,22 +19,18 @@ #define __GIS_TILE_H__ #include +#include "gis-object.h" -typedef struct _GisTile GisTile; +#define GIS_TYPE_TILE (gis_tile_get_type()) -#define gis_tile_foreach(tile, child) \ - for (int _x = 0; _x < G_N_ELEMENTS(tile->children); _x++) \ - for (int _y = 0; child = tile->children[_x][_y], \ - _y < G_N_ELEMENTS(tile->children[_x]); _y++) \ - -#define gis_tile_foreach_index(tile, x, y) \ - for (x = 0; x < G_N_ELEMENTS(tile->children); x++) \ - for (y = 0; y < G_N_ELEMENTS(tile->children[x]); y++) - -typedef void (*GisTileLoadFunc)(GisTile *tile, gpointer user_data); -typedef void (*GisTileFreeFunc)(GisTile *tile, gpointer user_data); +GOBJECT_HEAD( + GIS, TILE, + Gis, Tile, + gis, tile); struct _GisTile { + GisObject parent_instance; + /* Pointer to the tile data */ gpointer data; @@ -51,7 +47,24 @@ struct _GisTile { time_t atime; }; -/* Path to string table, keep in sync with tile->children */ +struct _GisTileClass { + GisObjectClass parent_class; +}; + +typedef void (*GisTileLoadFunc)(GisTile *tile, gpointer user_data); +typedef void (*GisTileFreeFunc)(GisTile *tile, gpointer user_data); + +/* Forech functions */ +#define gis_tile_foreach(tile, child) \ + for (int _x = 0; _x < G_N_ELEMENTS(tile->children); _x++) \ + for (int _y = 0; child = tile->children[_x][_y], \ + _y < G_N_ELEMENTS(tile->children[_x]); _y++) \ + +#define gis_tile_foreach_index(tile, x, y) \ + for (x = 0; x < G_N_ELEMENTS(tile->children); x++) \ + for (y = 0; y < G_N_ELEMENTS(tile->children[x]); y++) + +/* Path to string table, keep in sync with tile->children */ extern gchar *gis_tile_path_table[2][2]; /* Allocate a new Tile */