23 lines
748 B
C
23 lines
748 B
C
// checkbox.h -- Checkbox widget API
|
|
#ifndef CHECKBOX_H
|
|
#define CHECKBOX_H
|
|
|
|
#include "../../core/dvxWgt.h"
|
|
|
|
typedef struct {
|
|
WidgetT *(*create)(WidgetT *parent, const char *text);
|
|
bool (*isChecked)(const WidgetT *w);
|
|
void (*setChecked)(WidgetT *w, bool checked);
|
|
} CheckboxApiT;
|
|
|
|
static inline const CheckboxApiT *dvxCheckboxApi(void) {
|
|
static const CheckboxApiT *sApi;
|
|
if (!sApi) { sApi = (const CheckboxApiT *)wgtGetApi("checkbox"); }
|
|
return sApi;
|
|
}
|
|
|
|
#define wgtCheckbox(parent, text) dvxCheckboxApi()->create(parent, text)
|
|
#define wgtCheckboxIsChecked(w) dvxCheckboxApi()->isChecked(w)
|
|
#define wgtCheckboxSetChecked(w, checked) dvxCheckboxApi()->setChecked(w, checked)
|
|
|
|
#endif // CHECKBOX_H
|