DVX_GUI/widgets/widgetSpinner.h

27 lines
1.1 KiB
C

// widgetSpinner.h -- Spinner widget API
#ifndef WIDGET_SPINNER_H
#define WIDGET_SPINNER_H
#include "../core/dvxWidget.h"
typedef struct {
WidgetT *(*create)(WidgetT *parent, int32_t minVal, int32_t maxVal, int32_t step);
void (*setValue)(WidgetT *w, int32_t value);
int32_t (*getValue)(const WidgetT *w);
void (*setRange)(WidgetT *w, int32_t minVal, int32_t maxVal);
void (*setStep)(WidgetT *w, int32_t step);
} SpinnerApiT;
static inline const SpinnerApiT *dvxSpinnerApi(void) {
static const SpinnerApiT *sApi;
if (!sApi) { sApi = (const SpinnerApiT *)wgtGetApi("spinner"); }
return sApi;
}
#define wgtSpinner(parent, minVal, maxVal, step) dvxSpinnerApi()->create(parent, minVal, maxVal, step)
#define wgtSpinnerSetValue(w, value) dvxSpinnerApi()->setValue(w, value)
#define wgtSpinnerGetValue(w) dvxSpinnerApi()->getValue(w)
#define wgtSpinnerSetRange(w, minVal, maxVal) dvxSpinnerApi()->setRange(w, minVal, maxVal)
#define wgtSpinnerSetStep(w, step) dvxSpinnerApi()->setStep(w, step)
#endif // WIDGET_SPINNER_H