X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8ca97ad03c980fa2978a770e228dba6389c5fcac..dd360466a517259013e9874b32b2a0bfc7affb57:/src/generic/prop.cpp diff --git a/src/generic/prop.cpp b/src/generic/prop.cpp index ad6d3b521e..49889e8afc 100644 --- a/src/generic/prop.cpp +++ b/src/generic/prop.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -20,8 +20,9 @@ #pragma hdrstop #endif +#if wxUSE_PROPSHEET + #ifndef WX_PRECOMP -#include "wx/wx.h" #endif #include "wx/debug.h" @@ -46,6 +47,7 @@ wxPropertyValue::wxPropertyValue(void) } wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) + : wxObject() { m_value.string = (wxChar*) NULL; m_modifiedFlag = FALSE; @@ -157,12 +159,12 @@ wxPropertyValue::wxPropertyValue(wxList *the_list) 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; @@ -176,12 +178,12 @@ wxPropertyValue::wxPropertyValue(wxStringList *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; } @@ -564,7 +566,7 @@ void wxPropertyValue::WritePropertyType(wxString& stream) // Write as any oth expr->WritePropertyType(stream); expr = expr->m_next; if (expr) - stream.Append( wxT(", ") ); + stream.Append( wxT(", ") ); } stream.Append( wxT("]") ); } @@ -833,6 +835,7 @@ wxProperty::wxProperty(void) } wxProperty::wxProperty(wxProperty& copyFrom) + : wxObject() { m_value = copyFrom.GetValue(); m_name = copyFrom.GetName(); @@ -936,14 +939,14 @@ wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property) 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; /* @@ -986,7 +989,7 @@ wxProperty *wxPropertySheet::GetProperty(const wxString& name) const if (!node) return NULL; else - return (wxProperty *)node->Data(); + return (wxProperty *)node->GetData(); } bool wxPropertySheet::SetProperty(const wxString& name, const wxPropertyValue& value) @@ -1005,25 +1008,25 @@ void wxPropertySheet::RemoveProperty(const wxString& name) 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; @@ -1033,12 +1036,12 @@ void wxPropertySheet::Clear(void) // 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(); } } @@ -1074,7 +1077,7 @@ void wxPropertyValidatorRegistry::ClearRegistry(void) wxNode *node; while ((node = Next()) != NULL) { - delete (wxPropertyValidator *)node->Data(); + delete (wxPropertyValidator *)node->GetData(); } } @@ -1095,10 +1098,10 @@ wxPropertyValidator::~wxPropertyValidator(void) {} 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) { @@ -1106,20 +1109,20 @@ 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) { @@ -1127,31 +1130,33 @@ 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