#include <wx/wxprec.h>
#include <wx/wx.h>
#include "../include/wxdragon.h"
#include "wxd_utils.h"
#include <wx/scrolbar.h>
extern "C" {
WXDRAGON_API wxd_ScrollBar_t*
wxd_ScrollBar_Create(wxd_Window_t* parent, wxd_Id id, wxd_Point pos, wxd_Size size,
wxd_Style_t style, const char* name)
{
if (!parent) {
return nullptr;
}
wxWindow* wx_parent = reinterpret_cast<wxWindow*>(parent);
wxScrollBar* scrollBar = new wxScrollBar(
wx_parent, id, wxd_cpp_utils::to_wx(pos), wxd_cpp_utils::to_wx(size), style,
wxDefaultValidator, wxString::FromUTF8(name ? name : wxScrollBarNameStr) );
return reinterpret_cast<wxd_ScrollBar_t*>(scrollBar);
}
WXDRAGON_API void
wxd_ScrollBar_SetScrollbar(wxd_ScrollBar_t* self, int position, int thumbSize, int range,
int pageSize, bool refresh)
{
wxScrollBar* scrollBar = reinterpret_cast<wxScrollBar*>(self);
if (scrollBar) {
scrollBar->SetScrollbar(position, thumbSize, range, pageSize, refresh);
}
}
WXD_EXPORTED int
wxd_ScrollBar_GetThumbPosition(wxd_ScrollBar_t* self)
{
wxScrollBar* scrollBar = reinterpret_cast<wxScrollBar*>(self);
if (!scrollBar) {
return 0; }
return scrollBar->GetThumbPosition();
}
}