// tabCtrl.h  -- TabControl widget API
#ifndef TABCTRL_H
#define TABCTRL_H

#include "../../../libs/kpunch/libdvx/dvxWgt.h"

typedef struct {
    WidgetT *(*create)(WidgetT *parent);
    WidgetT *(*page)(WidgetT *parent, const char *title);
    void     (*setActive)(WidgetT *w, int32_t idx);
    int32_t  (*getActive)(const WidgetT *w);
} TabControlApiT;

static inline const TabControlApiT *dvxTabControlApi(void) {
    static const TabControlApiT *sApi;
    if (!sApi) { sApi = (const TabControlApiT *)wgtGetApi("tabcontrol"); }
    return sApi;
}

#define wgtTabControl(parent)          dvxTabControlApi()->create(parent)
#define wgtTabPage(parent, title)      dvxTabControlApi()->page(parent, title)
#define wgtTabControlSetActive(w, idx) dvxTabControlApi()->setActive(w, idx)
#define wgtTabControlGetActive(w)      dvxTabControlApi()->getActive(w)

#endif // TABCTRL_H
