#include "wx/wx.h"
#endif
+#include "wx/propform.h"
+
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
-#if wxUSE_IOSTREAMH
-#if defined(__WXMSW__) && !defined(__GNUWIN32__)
-#include <strstrea.h>
-#else
-#include <strstream.h>
-#endif
-#else
-#include <strstream>
-#endif
-
-#include "wx/window.h"
-#include "wx/utils.h"
-#include "wx/list.h"
-#include "wx/propform.h"
/*
* Property view
while (node)
{
wxWindow *win = (wxWindow *)node->Data();
- if (win->GetName() != "")
+ if (win->GetName() != _T(""))
{
wxProperty *prop = m_propertySheet->GetProperty(win->GetName());
if (prop)
if (!m_propertySheet)
return;
- if (win.GetName() == "")
+ if (win.GetName() == _T(""))
return;
- if (strcmp(win.GetName(), "ok") == 0)
+ if (wxStrcmp(win.GetName(), _T("ok")) == 0)
OnOk(event);
- else if (strcmp(win.GetName(), "cancel") == 0)
+ else if (wxStrcmp(win.GetName(), _T("cancel")) == 0)
OnCancel(event);
- else if (strcmp(win.GetName(), "help") == 0)
+ else if (wxStrcmp(win.GetName(), _T("help")) == 0)
OnHelp(event);
- else if (strcmp(win.GetName(), "update") == 0)
+ else if (wxStrcmp(win.GetName(), _T("update")) == 0)
OnUpdate(event);
- else if (strcmp(win.GetName(), "revert") == 0)
+ else if (wxStrcmp(win.GetName(), _T("revert")) == 0)
OnRevert(event);
else
{
IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog)
+BEGIN_EVENT_TABLE(wxPropertyFormDialog, wxDialog)
+ EVT_CLOSE(wxPropertyFormDialog::OnCloseWindow)
+END_EVENT_TABLE()
+
wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
// SetAutoLayout(TRUE);
}
-bool wxPropertyFormDialog::OnClose(void)
+void wxPropertyFormDialog::OnCloseWindow(wxCloseEvent& event)
{
if (m_view)
{
m_view->OnClose();
m_view = NULL;
- return TRUE;
+ this->Destroy();
}
else
- return FALSE;
+ event.Veto();
}
void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame)
-bool wxPropertyFormFrame::OnClose(void)
+BEGIN_EVENT_TABLE(wxPropertyFormFrame, wxFrame)
+ EVT_CLOSE(wxPropertyFormFrame::OnCloseWindow)
+END_EVENT_TABLE()
+
+void wxPropertyFormFrame::OnCloseWindow(wxCloseEvent& event)
{
- if (m_view)
- return m_view->OnClose();
+ if (m_view && m_view->OnClose())
+ this->Destroy();
else
- return FALSE;
+ event.Veto();
}
wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v)
float val = 0.0;
if (!StringToFloat(WXSTRINGCAST value, &val))
{
- char buf[200];
- sprintf(buf, "Value %s is not a valid real number!", (const char *)value);
- wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
+ wxChar buf[200];
+ wxSprintf(buf, _T("Value %s is not a valid real number!"), (const wxChar *)value);
+ wxMessageBox(buf, _T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
if (val < m_realMin || val > m_realMax)
{
- char buf[200];
- sprintf(buf, "Value must be a real number between %.2f and %.2f!", m_realMin, m_realMax);
- wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
+ wxChar buf[200];
+ wxSprintf(buf, _T("Value must be a real number between %.2f and %.2f!"), m_realMin, m_realMax);
+ wxMessageBox(buf, _T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
return TRUE;
if (value.Length() == 0)
return FALSE;
- float f = (float)atof((const char *)value);
+ float f = (float)wxAtof((const wxChar *)value);
property->GetValue() = f;
return TRUE;
}
if (!StringToLong(WXSTRINGCAST value, &val))
{
- char buf[200];
- sprintf(buf, "Value %s is not a valid integer!", (const char *)value);
- wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
+ wxChar buf[200];
+ wxSprintf(buf, _T("Value %s is not a valid integer!"), (const wxChar *)value);
+ wxMessageBox(buf, _T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
}
if (value.Length() == 0)
return FALSE;
- long i = atol((const char *)value);
+ long i = wxAtol((const wxChar *)value);
property->GetValue() = i;
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))