2016-06-20 21:14:26 -05:00
|
|
|
// 20 june 2016
|
|
|
|
// kept in a separate file for now
|
|
|
|
|
2016-06-25 15:27:29 -05:00
|
|
|
typedef struct uiImage uiImage;
|
|
|
|
|
2016-06-25 16:26:50 -05:00
|
|
|
// TODO use const void * for const correctness
|
2016-06-25 15:27:29 -05:00
|
|
|
_UI_EXTERN uiImage *uiNewImage(double width, double height);
|
|
|
|
_UI_EXTERN void uiFreeImage(uiImage *i);
|
|
|
|
_UI_EXTERN void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int pixelStride);
|
|
|
|
|
2016-06-20 21:14:26 -05:00
|
|
|
typedef struct uiTableModel uiTableModel;
|
|
|
|
typedef struct uiTableModelHandler uiTableModelHandler;
|
|
|
|
|
2016-06-26 14:36:46 -05:00
|
|
|
// TODO actually validate these
|
2016-06-20 21:14:26 -05:00
|
|
|
_UI_ENUM(uiTableModelColumnType) {
|
|
|
|
uiTableModelColumnString,
|
2016-06-25 18:18:25 -05:00
|
|
|
uiTableModelColumnImage,
|
2016-06-26 14:36:46 -05:00
|
|
|
uiTableModelColumnInt,
|
2016-06-23 10:29:43 -05:00
|
|
|
uiTableModelColumnColor,
|
2016-06-20 21:14:26 -05:00
|
|
|
};
|
|
|
|
|
2016-06-26 22:17:34 -05:00
|
|
|
// TODO validate ranges; validate types on each getter/setter call (? table columns only?)
|
2016-06-20 21:14:26 -05:00
|
|
|
struct uiTableModelHandler {
|
2016-06-21 22:58:17 -05:00
|
|
|
int (*NumColumns)(uiTableModelHandler *, uiTableModel *);
|
|
|
|
uiTableModelColumnType (*ColumnType)(uiTableModelHandler *, uiTableModel *, int);
|
|
|
|
int (*NumRows)(uiTableModelHandler *, uiTableModel *);
|
|
|
|
void *(*CellValue)(uiTableModelHandler *, uiTableModel *, int, int);
|
2016-06-25 22:04:49 -05:00
|
|
|
void (*SetCellValue)(uiTableModelHandler *, uiTableModel *, int, int, const void *);
|
2016-06-20 21:14:26 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
_UI_EXTERN void *uiTableModelStrdup(const char *str);
|
2016-06-23 10:29:43 -05:00
|
|
|
// TODO rename the strdup one to this too
|
|
|
|
_UI_EXTERN void *uiTableModelGiveColor(double r, double g, double b, double a);
|
2016-06-26 14:36:46 -05:00
|
|
|
_UI_EXTERN void *uiTableModelGiveInt(int i);
|
2016-06-26 17:19:34 -05:00
|
|
|
// TODO TakeString
|
|
|
|
// TODO add const
|
2016-06-26 14:36:46 -05:00
|
|
|
_UI_EXTERN int uiTableModelTakeInt(void *v);
|
2016-06-20 21:14:26 -05:00
|
|
|
|
|
|
|
_UI_EXTERN uiTableModel *uiNewTableModel(uiTableModelHandler *mh);
|
|
|
|
_UI_EXTERN void uiFreeTableModel(uiTableModel *m);
|
|
|
|
_UI_EXTERN void uiTableModelRowInserted(uiTableModel *m, int newIndex);
|
|
|
|
_UI_EXTERN void uiTableModelRowChanged(uiTableModel *m, int index);
|
|
|
|
_UI_EXTERN void uiTableModelRowDeleted(uiTableModel *m, int oldIndex);
|
2016-06-21 22:58:17 -05:00
|
|
|
// TODO reordering/moving
|
2016-06-20 21:14:26 -05:00
|
|
|
|
2016-06-21 21:07:39 -05:00
|
|
|
typedef struct uiTableColumn uiTableColumn;
|
2016-06-20 21:14:26 -05:00
|
|
|
|
2016-06-23 08:56:24 -05:00
|
|
|
_UI_EXTERN void uiTableColumnAppendTextPart(uiTableColumn *c, int modelColumn, int expand);
|
2016-06-25 18:18:25 -05:00
|
|
|
// TODO images shouldn't expand...
|
|
|
|
_UI_EXTERN void uiTableColumnAppendImagePart(uiTableColumn *c, int modelColumn, int expand);
|
2016-06-26 12:06:33 -05:00
|
|
|
_UI_EXTERN void uiTableColumnAppendButtonPart(uiTableColumn *c, int modelColumn, int expand);
|
2016-06-26 14:36:46 -05:00
|
|
|
// TODO should these have labels?
|
|
|
|
_UI_EXTERN void uiTableColumnAppendCheckboxPart(uiTableColumn *c, int modelColumn, int expand);
|
2016-06-26 17:19:34 -05:00
|
|
|
_UI_EXTERN void uiTableColumnAppendProgressBarPart(uiTableColumn *c, int modelColumn, int expand);
|
2016-06-25 22:04:49 -05:00
|
|
|
// TODO Editable?
|
|
|
|
_UI_EXTERN void uiTableColumnPartSetEditable(uiTableColumn *c, int part, int editable);
|
2016-06-23 21:16:25 -05:00
|
|
|
_UI_EXTERN void uiTableColumnPartSetTextColor(uiTableColumn *c, int part, int modelColumn);
|
2016-06-20 21:14:26 -05:00
|
|
|
|
|
|
|
typedef struct uiTable uiTable;
|
|
|
|
#define uiTable(this) ((uiTable *) (this))
|
2016-06-21 21:07:39 -05:00
|
|
|
_UI_EXTERN uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name);
|
|
|
|
_UI_EXTERN uiTableColumn *uiTableAppendTextColumn(uiTable *t, const char *name, int modelColumn);
|
2016-06-23 10:29:43 -05:00
|
|
|
// TODO getter?
|
|
|
|
_UI_EXTERN void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn);
|
2016-06-20 21:14:26 -05:00
|
|
|
_UI_EXTERN uiTable *uiNewTable(uiTableModel *model);
|