#include <wx/wxprec.h>
#include <wx/wx.h>
#include "wxdragon.h"
#include "wx/dialog.h"
extern "C" {
wxd_Dialog_t* wxd_Dialog_Create(wxd_Window_t* parent, const char* title, wxd_Style_t style, int x, int y, int width, int height) {
wxWindow* wx_parent = (wxWindow*)parent;
wxString wx_title = wxString::FromUTF8(title ? title : "");
wxPoint pos = (x == -1 && y == -1) ? wxDefaultPosition : wxPoint(x, y);
wxSize size = (width == -1 && height == -1) ? wxDefaultSize : wxSize(width, height);
wxDialog* dialog = new wxDialog();
if (!dialog->Create(wx_parent, wxID_ANY, wx_title, pos, size, style)) {
delete dialog;
return nullptr;
}
return (wxd_Dialog_t*)dialog;
}
int wxd_Dialog_ShowModal(wxd_Dialog* self) {
if (!self) return wxID_NONE; return ((wxDialog*)self)->ShowModal();
}
void wxd_Dialog_EndModal(wxd_Dialog* self, int retCode) {
if (!self) return;
((wxDialog*)self)->EndModal(retCode);
}
}