// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma hdrstop
#endif
+#if wxUSE_PROPSHEET
+
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#include "wx/debug.h"
}
wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
+ : wxObject()
{
m_value.string = (wxChar*) NULL;
m_modifiedFlag = FALSE;
m_last = NULL;
m_value.first = NULL;
- wxNode *node = the_list->First();
+ wxNode *node = the_list->GetFirst();
while (node)
{
- wxPropertyValue *expr = (wxPropertyValue *)node->Data();
+ wxPropertyValue *expr = (wxPropertyValue *)node->GetData();
Append(expr);
- node = node->Next();
+ node = node->GetNext();
}
delete the_list;
m_last = NULL;
m_value.first = NULL;
- wxNode *node = the_list->First();
+ wxStringList::Node *node = the_list->GetFirst();
while (node)
{
- char *s = (char *)node->Data();
+ wxChar *s = node->GetData();
Append(new wxPropertyValue(s));
- node = node->Next();
+ node = node->GetNext();
}
delete the_list;
}
expr->WritePropertyType(stream);
expr = expr->m_next;
if (expr)
- stream.Append( wxT(", ") );
+ stream.Append( wxT(", ") );
}
stream.Append( wxT("]") );
}
}
wxProperty::wxProperty(wxProperty& copyFrom)
+ : wxObject()
{
m_value = copyFrom.GetValue();
m_name = copyFrom.GetName();
if (property->GetValidator())
return property->GetValidator();
- wxNode *node = m_validatorRegistryList.First();
+ wxNode *node = m_validatorRegistryList.GetFirst();
while (node)
{
- wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->Data();
+ wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->GetData();
wxPropertyValidator *validator = registry->GetValidator(property->GetRole());
if (validator)
return validator;
- node = node->Next();
+ node = node->GetNext();
}
return NULL;
/*
if (!node)
return NULL;
else
- return (wxProperty *)node->Data();
+ return (wxProperty *)node->GetData();
}
bool wxPropertySheet::SetProperty(const wxString& name, const wxPropertyValue& value)
wxNode *node = m_properties.Find(name);
if(node)
{
- wxProperty *prop = (wxProperty *)node->Data();
- delete prop;
+ wxProperty *prop = (wxProperty *)node->GetData();
+ delete prop;
m_properties.DeleteNode(node);
}
-}
+}
bool wxPropertySheet::HasProperty(const wxString& name) const
{
- return (GetProperty(name)?TRUE:FALSE);
+ return (GetProperty(name)?TRUE:FALSE);
}
// Clear all properties
void wxPropertySheet::Clear(void)
{
- wxNode *node = m_properties.First();
+ wxNode *node = m_properties.GetFirst();
while (node)
{
- wxProperty *prop = (wxProperty *)node->Data();
- wxNode *next = node->Next();
+ wxProperty *prop = (wxProperty *)node->GetData();
+ wxNode *next = node->GetNext();
delete prop;
delete node;
node = next;
// Sets/clears the modified flag for each property value
void wxPropertySheet::SetAllModified(bool flag)
{
- wxNode *node = m_properties.First();
+ wxNode *node = m_properties.GetFirst();
while (node)
{
- wxProperty *prop = (wxProperty *)node->Data();
+ wxProperty *prop = (wxProperty *)node->GetData();
prop->GetValue().SetModified(flag);
- node = node->Next();
+ node = node->GetNext();
}
}
wxNode *node;
while ((node = Next()) != NULL)
{
- delete (wxPropertyValidator *)node->Data();
+ delete (wxPropertyValidator *)node->GetData();
}
}
{}
bool wxPropertyValidator::StringToFloat (wxChar *s, float *number) {
- double num;
- bool ok = StringToDouble (s, &num);
- *number = (float) num;
- return ok;
+ double num;
+ bool ok = StringToDouble (s, &num);
+ *number = (float) num;
+ return ok;
}
bool wxPropertyValidator::StringToDouble (wxChar *s, double *number) {
wxChar *value_ptr;
*number = wxStrtod (s, &value_ptr);
if (value_ptr) {
- int len = wxStrlen (value_ptr);
- for (int i = 0; i < len; i++) {
- ok = (wxIsspace (value_ptr[i]) != 0);
- if (!ok) return FALSE;
- }
+ int len = wxStrlen (value_ptr);
+ for (int i = 0; i < len; i++) {
+ ok = (wxIsspace (value_ptr[i]) != 0);
+ if (!ok) return FALSE;
+ }
}
return ok;
}
bool wxPropertyValidator::StringToInt (wxChar *s, int *number) {
- long num;
- bool ok = StringToLong (s, &num);
- *number = (int) num;
- return ok;
+ long num;
+ bool ok = StringToLong (s, &num);
+ *number = (int) num;
+ return ok;
}
bool wxPropertyValidator::StringToLong (wxChar *s, long *number) {
wxChar *value_ptr;
*number = wxStrtol (s, &value_ptr, 10);
if (value_ptr) {
- int len = wxStrlen (value_ptr);
- for (int i = 0; i < len; i++) {
- ok = (wxIsspace (value_ptr[i]) != 0);
- if (!ok) return FALSE;
- }
+ int len = wxStrlen (value_ptr);
+ for (int i = 0; i < len; i++) {
+ ok = (wxIsspace (value_ptr[i]) != 0);
+ if (!ok) return FALSE;
+ }
}
return ok;
}
wxChar *wxPropertyValidator::FloatToString (float number) {
- static wxChar buf[20];
- wxSprintf (buf, wxT("%.6g"), number);
- return buf;
+ static wxChar buf[20];
+ wxSnprintf (buf, 20, wxT("%.6g"), number);
+ return buf;
}
wxChar *wxPropertyValidator::DoubleToString (double number) {
- static wxChar buf[20];
- wxSprintf (buf, wxT("%.6g"), number);
- return buf;
+ static wxChar buf[20];
+ wxSnprintf (buf, 20, wxT("%.6g"), number);
+ return buf;
}
wxChar *wxPropertyValidator::IntToString (int number) {
- return ::IntToString (number);
+ return ::IntToString (number);
}
wxChar *wxPropertyValidator::LongToString (long number) {
- return ::LongToString (number);
+ return ::LongToString (number);
}
+
+#endif // wxUSE_PROPSHEET