X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a3bdee6a979146c426cd058e9bfe6b58135b124..b2c13097deb7736a86a278c02d0b3f7cd9873750:/contrib/src/deprecated/prop.cpp diff --git a/contrib/src/deprecated/prop.cpp b/contrib/src/deprecated/prop.cpp index 75bfa145b2..dbd1fac104 100644 --- a/contrib/src/deprecated/prop.cpp +++ b/contrib/src/deprecated/prop.cpp @@ -35,6 +35,10 @@ #include #include +#if !WXWIN_COMPATIBILITY_2_4 +static inline wxChar* copystring(const wxChar* s) + { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); } +#endif IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject) @@ -45,20 +49,20 @@ wxPropertyValue::wxPropertyValue(void) m_last = NULL; m_value.first = NULL; m_clientData = NULL; - m_modifiedFlag = FALSE; + m_modifiedFlag = false; } wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) : wxObject() { m_value.string = (wxChar*) NULL; - m_modifiedFlag = FALSE; + m_modifiedFlag = false; Copy((wxPropertyValue& )copyFrom); } wxPropertyValue::wxPropertyValue(const wxChar *val) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueString; m_value.string = copystring(val); @@ -69,10 +73,10 @@ wxPropertyValue::wxPropertyValue(const wxChar *val) wxPropertyValue::wxPropertyValue(const wxString& val) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueString; - m_value.string = copystring((const wxChar *)val); + m_value.string = copystring(val.c_str()); m_clientData = NULL; m_next = NULL; m_last = NULL; @@ -80,7 +84,7 @@ wxPropertyValue::wxPropertyValue(const wxString& val) wxPropertyValue::wxPropertyValue(long the_integer) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueInteger; m_value.integer = the_integer; m_clientData = NULL; @@ -89,7 +93,7 @@ wxPropertyValue::wxPropertyValue(long the_integer) wxPropertyValue::wxPropertyValue(bool val) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValuebool; m_value.integer = val; m_clientData = NULL; @@ -98,7 +102,7 @@ wxPropertyValue::wxPropertyValue(bool val) wxPropertyValue::wxPropertyValue(float the_real) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueReal; m_value.real = the_real; m_clientData = NULL; @@ -107,7 +111,7 @@ wxPropertyValue::wxPropertyValue(float the_real) wxPropertyValue::wxPropertyValue(double the_real) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueReal; m_value.real = (float)the_real; m_clientData = NULL; @@ -117,7 +121,7 @@ wxPropertyValue::wxPropertyValue(double the_real) // Pointer versions: we have a pointer to the real C++ value. wxPropertyValue::wxPropertyValue(wxChar **val) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueStringPtr; m_value.stringPtr = val; @@ -128,7 +132,7 @@ wxPropertyValue::wxPropertyValue(wxChar **val) wxPropertyValue::wxPropertyValue(long *val) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueIntegerPtr; m_value.integerPtr = val; m_clientData = NULL; @@ -137,7 +141,7 @@ wxPropertyValue::wxPropertyValue(long *val) wxPropertyValue::wxPropertyValue(bool *val) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueboolPtr; m_value.boolPtr = val; m_clientData = NULL; @@ -146,7 +150,7 @@ wxPropertyValue::wxPropertyValue(bool *val) wxPropertyValue::wxPropertyValue(float *val) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueRealPtr; m_value.realPtr = val; m_clientData = NULL; @@ -155,13 +159,13 @@ wxPropertyValue::wxPropertyValue(float *val) wxPropertyValue::wxPropertyValue(wxList *the_list) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueList; m_clientData = NULL; m_last = NULL; m_value.first = NULL; - wxNode *node = the_list->GetFirst(); + wxObjectList::compatibility_iterator node = the_list->GetFirst(); while (node) { wxPropertyValue *expr = (wxPropertyValue *)node->GetData(); @@ -174,16 +178,16 @@ wxPropertyValue::wxPropertyValue(wxList *the_list) wxPropertyValue::wxPropertyValue(wxStringList *the_list) { - m_modifiedFlag = FALSE; + m_modifiedFlag = false; m_type = wxPropertyValueList; m_clientData = NULL; m_last = NULL; m_value.first = NULL; - wxStringList::Node *node = the_list->GetFirst(); + wxStringList::compatibility_iterator node = the_list->GetFirst(); while (node) { - wxChar *s = node->GetData(); + wxString s = node->GetData(); Append(new wxPropertyValue(s)); node = node->GetNext(); } @@ -224,7 +228,7 @@ wxPropertyValue::~wxPropertyValue(void) void wxPropertyValue::Append(wxPropertyValue *expr) { - m_modifiedFlag = TRUE; + m_modifiedFlag = true; if (!m_value.first) m_value.first = expr; @@ -235,7 +239,7 @@ void wxPropertyValue::Append(wxPropertyValue *expr) void wxPropertyValue::Insert(wxPropertyValue *expr) { - m_modifiedFlag = TRUE; + m_modifiedFlag = true; expr->m_next = m_value.first; m_value.first = expr; @@ -276,7 +280,7 @@ void wxPropertyValue::Delete(wxPropertyValue *node) else m_last = NULL; } - m_modifiedFlag = TRUE; + m_modifiedFlag = true; delete expr; } @@ -286,7 +290,7 @@ void wxPropertyValue::ClearList(void) { wxPropertyValue *val = GetFirst(); if (val) - m_modifiedFlag = TRUE; + m_modifiedFlag = true; while (val) { @@ -379,8 +383,8 @@ void wxPropertyValue::Copy(wxPropertyValue& copyFrom) case wxPropertyValueStringPtr: { wxChar** s = copyFrom.StringValuePtr(); - -#if 0 + +#if 0 // what is this? are you trying to assign a bool or a string? VA can't figure it out.. #if defined(__VISAGECPP__) || defined( __VISUALC__ ) (*this) = s; @@ -390,7 +394,7 @@ void wxPropertyValue::Copy(wxPropertyValue& copyFrom) #endif // if 0 (*this) = (bool)(s != 0); - + return ; } @@ -473,7 +477,7 @@ void wxPropertyValue::WritePropertyClause(wxString& stream) // Write this expre node->WritePropertyType(stream); stream.Append( wxT("(") ); node = node->m_next; - bool first = TRUE; + bool first = true; while (node) { if (!first) @@ -482,7 +486,7 @@ void wxPropertyValue::WritePropertyClause(wxString& stream) // Write this expre node = node->m_next; if (node) stream.Append( wxT(",\n" ) ); - first = FALSE; + first = false; } stream.Append( wxT(").\n\n") ); } @@ -587,7 +591,7 @@ wxString wxPropertyValue::GetStringRepresentation(void) void wxPropertyValue::operator=(const wxPropertyValue& val) { - m_modifiedFlag = TRUE; + m_modifiedFlag = true; Copy((wxPropertyValue&)val); } @@ -596,7 +600,7 @@ void wxPropertyValue::operator=(const wxString& val1) { const wxChar *val = (const wxChar *)val1; - m_modifiedFlag = TRUE; + m_modifiedFlag = true; wxPropertyValueType oldType = m_type; if (oldType == wxPropertyValueString) @@ -639,7 +643,7 @@ void wxPropertyValue::operator=(const long val) m_value.string = NULL; } - m_modifiedFlag = TRUE; + m_modifiedFlag = true; if (m_type == wxPropertyValueNull) m_type = wxPropertyValueInteger; @@ -665,7 +669,7 @@ void wxPropertyValue::operator=(const bool val) m_value.string = NULL; } - m_modifiedFlag = TRUE; + m_modifiedFlag = true; if (m_type == wxPropertyValueNull) m_type = wxPropertyValuebool; @@ -687,7 +691,7 @@ void wxPropertyValue::operator=(const float val) m_value.string = NULL; } - m_modifiedFlag = TRUE; + m_modifiedFlag = true; if (m_type == wxPropertyValueNull) m_type = wxPropertyValueReal; @@ -713,7 +717,7 @@ void wxPropertyValue::operator=(const wxChar **val) m_value.string = NULL; } - m_modifiedFlag = TRUE; + m_modifiedFlag = true; m_type = wxPropertyValueStringPtr; if (val) @@ -728,7 +732,7 @@ void wxPropertyValue::operator=(const wxChar **val) void wxPropertyValue::operator=(const long *val) { - m_modifiedFlag = TRUE; + m_modifiedFlag = true; m_type = wxPropertyValueIntegerPtr; m_value.integerPtr = (long *)val; m_clientData = NULL; @@ -737,7 +741,7 @@ void wxPropertyValue::operator=(const long *val) void wxPropertyValue::operator=(const bool *val) { - m_modifiedFlag = TRUE; + m_modifiedFlag = true; m_type = wxPropertyValueboolPtr; m_value.boolPtr = (bool *)val; m_clientData = NULL; @@ -746,7 +750,7 @@ void wxPropertyValue::operator=(const bool *val) void wxPropertyValue::operator=(const float *val) { - m_modifiedFlag = TRUE; + m_modifiedFlag = true; m_type = wxPropertyValueRealPtr; m_value.realPtr = (float *)val; m_clientData = NULL; @@ -801,7 +805,7 @@ bool wxPropertyValue::BoolValue(void) const { return (m_value.integer != 0); else if (m_type == wxPropertyValueboolPtr) return (*(m_value.boolPtr) != 0); - else return FALSE; + else return false; } bool *wxPropertyValue::BoolValuePtr(void) const @@ -833,7 +837,7 @@ wxProperty::wxProperty(void) m_propertyRole = wxEmptyString; m_propertyValidator = NULL; m_propertyWindow = NULL; - m_enabled = TRUE; + m_enabled = true; } wxProperty::wxProperty(wxProperty& copyFrom) @@ -851,7 +855,7 @@ wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):m_na { m_propertyValidator = ed; m_propertyWindow = NULL; - m_enabled = TRUE; + m_enabled = true; } wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed): @@ -859,7 +863,7 @@ wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, w { m_propertyValidator = ed; m_propertyWindow = NULL; - m_enabled = TRUE; + m_enabled = true; } wxProperty::~wxProperty(void) @@ -941,7 +945,7 @@ wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property) if (property->GetValidator()) return property->GetValidator(); - wxNode *node = m_validatorRegistryList.GetFirst(); + wxObjectList::compatibility_iterator node = m_validatorRegistryList.GetFirst(); while (node) { wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->GetData(); @@ -987,7 +991,7 @@ void wxPropertySheet::AddProperty(wxProperty *property) // Get property by name wxProperty *wxPropertySheet::GetProperty(const wxString& name) const { - wxNode *node = m_properties.Find((const wxChar*) name); + wxObjectList::compatibility_iterator node = m_properties.Find((const wxChar*) name); if (!node) return NULL; else @@ -999,36 +1003,36 @@ bool wxPropertySheet::SetProperty(const wxString& name, const wxPropertyValue& v wxProperty* prop = GetProperty(name); if(prop){ prop->SetValue(value); - return TRUE; + return true; }else{ - return FALSE; + return false; } } void wxPropertySheet::RemoveProperty(const wxString& name) { - wxNode *node = m_properties.Find(name); + wxObjectList::compatibility_iterator node = m_properties.Find(name); if(node) { wxProperty *prop = (wxProperty *)node->GetData(); delete prop; - m_properties.DeleteNode(node); + m_properties.Erase(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.GetFirst(); + wxObjectList::compatibility_iterator node = m_properties.GetFirst(); while (node) { wxProperty *prop = (wxProperty *)node->GetData(); - wxNode *next = node->GetNext(); + wxObjectList::compatibility_iterator next = node->GetNext(); delete prop; delete node; node = next; @@ -1038,7 +1042,7 @@ void wxPropertySheet::Clear(void) // Sets/clears the modified flag for each property value void wxPropertySheet::SetAllModified(bool flag) { - wxNode *node = m_properties.GetFirst(); + wxObjectList::compatibility_iterator node = m_properties.GetFirst(); while (node) { wxProperty *prop = (wxProperty *)node->GetData(); @@ -1076,7 +1080,7 @@ wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(const wxString& t void wxPropertyValidatorRegistry::ClearRegistry(void) { BeginFind(); - wxNode *node; + wxHashTable::Node *node; while ((node = Next()) != NULL) { delete (wxPropertyValidator *)node->GetData(); @@ -1107,14 +1111,14 @@ bool wxPropertyValidator::StringToFloat (wxChar *s, float *number) { } bool wxPropertyValidator::StringToDouble (wxChar *s, double *number) { - bool ok = TRUE; + bool ok = true; 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; + if (!ok) return false; } } return ok; @@ -1128,14 +1132,14 @@ bool wxPropertyValidator::StringToInt (wxChar *s, int *number) { } bool wxPropertyValidator::StringToLong (wxChar *s, long *number) { - bool ok = TRUE; + bool ok = true; 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; + if (!ok) return false; } } return ok; @@ -1154,11 +1158,17 @@ wxChar *wxPropertyValidator::DoubleToString (double number) { } wxChar *wxPropertyValidator::IntToString (int number) { - return ::IntToString (number); + static wxChar buf[20]; + + wxSprintf (buf, wxT("%d"), number); + return buf; } wxChar *wxPropertyValidator::LongToString (long number) { - return ::LongToString (number); - } + static wxChar buf[20]; + + wxSprintf (buf, wxT("%ld"), number); + return buf; +} #endif // wxUSE_PROPSHEET