#include <wx/wxprec.h>
#include <wx/wx.h>
#include "../include/wxdragon.h"
#include <wx/spinctrl.h>
#include <wx/string.h>
#include <wx/gdicmn.h>
#include <wx/window.h>
WXD_EXPORTED wxd_SpinCtrlDouble_t*
wxd_SpinCtrlDouble_Create(wxd_Window_t* parent, int id, const char* value_str, int x, int y, int w,
int h, int64_t style, double min_val, double max_val, double initial_val,
double inc)
{
wxWindow* p = (wxWindow*)parent;
wxPoint pos = (x == -1 && y == -1) ? wxDefaultPosition : wxPoint(x, y);
wxSize size = (w == -1 && h == -1) ? wxDefaultSize : wxSize(w, h);
wxString wx_value_str = wxString::FromUTF8(value_str ? value_str : "");
int64_t actual_style = style;
if (style == 0) { actual_style = wxSP_ARROW_KEYS;
}
wxSpinCtrlDouble* ctrl = new wxSpinCtrlDouble(p, id, wx_value_str, pos, size, actual_style,
min_val, max_val, initial_val, inc);
return (wxd_SpinCtrlDouble_t*)ctrl;
}
WXD_EXPORTED double
wxd_SpinCtrlDouble_GetValue(wxd_SpinCtrlDouble_t* self)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return 0.0; return ctrl->GetValue();
}
WXD_EXPORTED void
wxd_SpinCtrlDouble_SetValue(wxd_SpinCtrlDouble_t* self, double value)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return;
ctrl->SetValue(value);
}
WXD_EXPORTED void
wxd_SpinCtrlDouble_SetRange(wxd_SpinCtrlDouble_t* self, double min_val, double max_val)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return;
ctrl->SetRange(min_val, max_val);
}
WXD_EXPORTED double
wxd_SpinCtrlDouble_GetMin(wxd_SpinCtrlDouble_t* self)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return 0.0;
return ctrl->GetMin();
}
WXD_EXPORTED double
wxd_SpinCtrlDouble_GetMax(wxd_SpinCtrlDouble_t* self)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return 0.0;
return ctrl->GetMax();
}
WXD_EXPORTED void
wxd_SpinCtrlDouble_SetIncrements(wxd_SpinCtrlDouble_t* self, double inc)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return;
ctrl->SetIncrement(
inc); }
WXD_EXPORTED double
wxd_SpinCtrlDouble_GetIncrement(wxd_SpinCtrlDouble_t* self)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return 0.0;
return ctrl->GetIncrement();
}
WXD_EXPORTED void
wxd_SpinCtrlDouble_SetDigits(wxd_SpinCtrlDouble_t* self, unsigned int digits)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return;
ctrl->SetDigits(digits);
}
WXD_EXPORTED unsigned int
wxd_SpinCtrlDouble_GetDigits(wxd_SpinCtrlDouble_t* self)
{
wxSpinCtrlDouble* ctrl = (wxSpinCtrlDouble*)self;
if (!ctrl)
return 0; return ctrl->GetDigits();
}