Planned a new system for transferring data between tables and models, based on uiAttribute.
This commit is contained in:
parent
9c519f1bfa
commit
705bf2d9bf
39
uitable.h
39
uitable.h
|
@ -8,24 +8,43 @@ _UI_EXTERN uiImage *uiNewImage(double width, double height);
|
||||||
_UI_EXTERN void uiFreeImage(uiImage *i);
|
_UI_EXTERN void uiFreeImage(uiImage *i);
|
||||||
_UI_EXTERN void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int pixelStride);
|
_UI_EXTERN void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int pixelStride);
|
||||||
|
|
||||||
typedef struct uiTableModel uiTableModel;
|
typedef struct uiTableData uiTableData;
|
||||||
typedef struct uiTableModelHandler uiTableModelHandler;
|
|
||||||
|
_UI_EXTERN void uiFreeTableData(uiTableData *d);
|
||||||
|
|
||||||
// TODO actually validate these
|
// TODO actually validate these
|
||||||
_UI_ENUM(uiTableModelColumnType) {
|
_UI_ENUM(uiTableDataType) {
|
||||||
uiTableModelColumnString,
|
uiTableDataTypeString,
|
||||||
uiTableModelColumnImage,
|
uiTableDataTypeImage,
|
||||||
uiTableModelColumnInt,
|
uiTableDataTypeInt,
|
||||||
uiTableModelColumnColor,
|
uiTableDataTypeColor,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO I don't like this name
|
||||||
|
_UI_EXTERN uiTableDataType uiTableDataGetType(const uiTableData *d);
|
||||||
|
|
||||||
|
_UI_EXTERN uiTableData *uiNewTableDataString(const char *str);
|
||||||
|
_UI_EXTERN const char *uiTableDataString(const uiTableData *d);
|
||||||
|
|
||||||
|
_UI_EXTERN uiTableData *uiNewTableDataImage(uiImage *img);
|
||||||
|
_UI_EXTERN uiImage *uiTableDataImage(const uiTableData *d);
|
||||||
|
|
||||||
|
_UI_EXTERN uiTableData *uiNewTableDataInt(int i);
|
||||||
|
_UI_EXTERN int uiTableDataInt(const uiTableData *d);
|
||||||
|
|
||||||
|
_UI_EXTERN uiTableData *uiNewTableDataColor(double r, double g, double b, double a);
|
||||||
|
_UI_EXTERN void uiTableDataColor(const uiTableData *d, double *r, double *g, double *b, double *a);
|
||||||
|
|
||||||
|
typedef struct uiTableModel uiTableModel;
|
||||||
|
typedef struct uiTableModelHandler uiTableModelHandler;
|
||||||
|
|
||||||
// TODO validate ranges; validate types on each getter/setter call (? table columns only?)
|
// TODO validate ranges; validate types on each getter/setter call (? table columns only?)
|
||||||
struct uiTableModelHandler {
|
struct uiTableModelHandler {
|
||||||
int (*NumColumns)(uiTableModelHandler *, uiTableModel *);
|
int (*NumColumns)(uiTableModelHandler *, uiTableModel *);
|
||||||
uiTableModelColumnType (*ColumnType)(uiTableModelHandler *, uiTableModel *, int);
|
uiTableDataType (*ColumnType)(uiTableModelHandler *, uiTableModel *, int);
|
||||||
int (*NumRows)(uiTableModelHandler *, uiTableModel *);
|
int (*NumRows)(uiTableModelHandler *, uiTableModel *);
|
||||||
void *(*CellValue)(uiTableModelHandler *, uiTableModel *, int, int);
|
uiTableData *(*CellValue)(uiTableModelHandler *, uiTableModel *, int, int);
|
||||||
void (*SetCellValue)(uiTableModelHandler *, uiTableModel *, int, int, const void *);
|
void (*SetCellValue)(uiTableModelHandler *, uiTableModel *, int, int, const uiTableData *);
|
||||||
};
|
};
|
||||||
|
|
||||||
_UI_EXTERN void *uiTableModelStrdup(const char *str);
|
_UI_EXTERN void *uiTableModelStrdup(const char *str);
|
||||||
|
|
Loading…
Reference in New Issue