// scrlPane.h  -- ScrollPane widget API
#ifndef SCRLPANE_H
#define SCRLPANE_H

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

typedef struct {
    WidgetT *(*create)(WidgetT *parent);
    void     (*scrollToChild)(WidgetT *sp, const WidgetT *child);
    void     (*setNoBorder)(WidgetT *w, bool noBorder);
    void     (*scrollToTop)(WidgetT *w);
} ScrollPaneApiT;

static inline const ScrollPaneApiT *dvxScrollPaneApi(void) {
    static const ScrollPaneApiT *sApi;
    if (!sApi) { sApi = (const ScrollPaneApiT *)wgtGetApi("scrollpane"); }
    return sApi;
}

#define wgtScrollPane(parent) dvxScrollPaneApi()->create(parent)
#define wgtScrollPaneScrollToChild(sp, child)  dvxScrollPaneApi()->scrollToChild((sp), (child))
#define wgtScrollPaneSetNoBorder(w, noBorder) dvxScrollPaneApi()->setNoBorder((w), (noBorder))
#define wgtScrollPaneScrollToTop(w)          dvxScrollPaneApi()->scrollToTop(w)

#endif // SCRLPANE_H
