aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui/_wip/table/ui.h
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-09-09 02:30:51 +0200
committerStapleButter <thetotalworm@gmail.com>2017-09-09 02:30:51 +0200
commit70e4841d311d68689724768157cc9cbfbde7a9fc (patch)
treeba9499f77d1258530a7e60aa6e1732c41d98161c /src/libui_sdl/libui/_wip/table/ui.h
parent81747d6c34eb159481a6ca3f283d065fa3568617 (diff)
another UI attempt, I guess.
sorry.
Diffstat (limited to 'src/libui_sdl/libui/_wip/table/ui.h')
-rw-r--r--src/libui_sdl/libui/_wip/table/ui.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/libui_sdl/libui/_wip/table/ui.h b/src/libui_sdl/libui/_wip/table/ui.h
new file mode 100644
index 0000000..a5c30c8
--- /dev/null
+++ b/src/libui_sdl/libui/_wip/table/ui.h
@@ -0,0 +1,46 @@
+typedef struct uiTable uiTable;
+typedef struct uiTableModel uiTableModel;
+typedef struct uiTableModelSpec uiTableModelSpec;
+typedef struct uiTableColumnParams uiTableColumnParams;
+typedef enum uiTableColumnType uiTableColumnType;
+typedef enum uiTableNotification uiTableNotification;
+
+_UI_EXTERN uintmax_t uiTableType(void);
+#define uiTable(this) ((uiTable *) uiIsA((this), uiTableType(), 1))
+_UI_EXTERN void uiTableSetModel(uiTable *t, uiTableModel *m);
+_UI_EXTERN void uiTableAppendColumn(uiTable *t, uiTableColumnParams *p);
+_UI_EXTERN uiTable *uiNewTable(void);
+
+enum uiTableColumnType {
+ uiTableColumnText,
+//TODO uiTableColumnImage,
+ uiTableColumnCheckbox,
+};
+
+struct uiTableModelSpec {
+ intmax_t (*NumRows)(uiTableModel *m, void *mData);
+ void *(*CellValue)(uiTableModel *m, void *mData, intmax_t row, intmax_t column);
+ void (*SetCellValue)(uiTableModel *m, void *mData, intmax_t row, intmax_t column, void *value);
+};
+
+enum uiTableNotification {
+ uiTableRowInserted,
+ uiTableRowDeleted,
+ uiTableCellChanged,
+};
+
+_UI_EXTERN uiTableModel *uiNewTableModel(uintmax_t nCols, uiTableColumnType *types, uiTableModelSpec *spec, void *mData);
+_UI_EXTERN void uiFreeTableModel(uiTableModel *m);
+_UI_EXTERN void uiTableModelNotify(uiTableModel *m, uiTableNotification notification, intmax_t row, intmax_t column);
+
+#define uiTableModelFromBool(b) ((void *) ((intptr_t) (b)))
+_UI_EXTERN void *uiTableModelFromString(const char *str);
+
+struct uiTableColumnParams {
+ const char *Name;
+ // TODO make this unnecessary
+ uiTableColumnType Type;
+ int Mutable; // TODO move to the model?
+ intmax_t ValueColumn;
+ // TODO background color
+};