// widgetSplitter.h  -- Splitter widget API
#ifndef WIDGET_SPLITTER_H
#define WIDGET_SPLITTER_H

#include "../core/dvxWidget.h"

typedef struct {
    WidgetT *(*create)(WidgetT *parent, bool vertical);
    void     (*setPos)(WidgetT *w, int32_t pos);
    int32_t  (*getPos)(const WidgetT *w);
} SplitterApiT;

static inline const SplitterApiT *dvxSplitterApi(void) {
    static const SplitterApiT *sApi;
    if (!sApi) { sApi = (const SplitterApiT *)wgtGetApi("splitter"); }
    return sApi;
}

#define wgtSplitter(parent, vertical) dvxSplitterApi()->create(parent, vertical)
#define wgtSplitterSetPos(w, pos)     dvxSplitterApi()->setPos(w, pos)
#define wgtSplitterGetPos(w)          dvxSplitterApi()->getPos(w)

#endif // WIDGET_SPLITTER_H
