25 lines
1.1 KiB
C
25 lines
1.1 KiB
C
// widgetImageButton.h -- ImageButton widget API
|
|
#ifndef WIDGET_IMAGEBUTTON_H
|
|
#define WIDGET_IMAGEBUTTON_H
|
|
|
|
#include "../core/dvxWidget.h"
|
|
|
|
typedef struct {
|
|
WidgetT *(*create)(WidgetT *parent, uint8_t *data, int32_t w, int32_t h, int32_t pitch);
|
|
WidgetT *(*fromFile)(WidgetT *parent, const char *path);
|
|
void (*setData)(WidgetT *w, uint8_t *data, int32_t imgW, int32_t imgH, int32_t pitch);
|
|
void (*loadFile)(WidgetT *w, const char *path);
|
|
} ImageButtonApiT;
|
|
|
|
static inline const ImageButtonApiT *dvxImageButtonApi(void) {
|
|
static const ImageButtonApiT *sApi;
|
|
if (!sApi) { sApi = (const ImageButtonApiT *)wgtGetApi("imagebutton"); }
|
|
return sApi;
|
|
}
|
|
|
|
#define wgtImageButton(parent, data, w, h, pitch) dvxImageButtonApi()->create(parent, data, w, h, pitch)
|
|
#define wgtImageButtonFromFile(parent, path) dvxImageButtonApi()->fromFile(parent, path)
|
|
#define wgtImageButtonSetData(w, data, imgW, imgH, pitch) dvxImageButtonApi()->setData(w, data, imgW, imgH, pitch)
|
|
#define wgtImageButtonLoadFile(w, path) dvxImageButtonApi()->loadFile(w, path)
|
|
|
|
#endif // WIDGET_IMAGEBUTTON_H
|