// 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); void (*setRealMode)(WidgetT *w, bool enable); double (*getRealValue)(const WidgetT *w); void (*setRealValue)(WidgetT *w, double value); void (*setRealRange)(WidgetT *w, double minVal, double maxVal); void (*setRealStep)(WidgetT *w, double step); void (*setDecimals)(WidgetT *w, int32_t decimals); } 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) #define wgtSpinnerSetRealMode(w, enable) dvxSpinnerApi()->setRealMode(w, enable) #define wgtSpinnerGetRealValue(w) dvxSpinnerApi()->getRealValue(w) #define wgtSpinnerSetRealValue(w, value) dvxSpinnerApi()->setRealValue(w, value) #define wgtSpinnerSetRealRange(w, minVal, maxVal) dvxSpinnerApi()->setRealRange(w, minVal, maxVal) #define wgtSpinnerSetRealStep(w, step) dvxSpinnerApi()->setRealStep(w, step) #define wgtSpinnerSetDecimals(w, decimals) dvxSpinnerApi()->setDecimals(w, decimals) #endif // WIDGET_SPINNER_H