X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c74caa095c12410bd6a555df248699cb35821a8d..b2c13097deb7736a86a278c02d0b3f7cd9873750:/contrib/src/deprecated/prop.cpp diff --git a/contrib/src/deprecated/prop.cpp b/contrib/src/deprecated/prop.cpp index b1af196e36..dbd1fac104 100644 --- a/contrib/src/deprecated/prop.cpp +++ b/contrib/src/deprecated/prop.cpp @@ -35,8 +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) @@ -47,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); @@ -71,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; @@ -82,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; @@ -91,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; @@ -100,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; @@ -109,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; @@ -119,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; @@ -130,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; @@ -139,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; @@ -148,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; @@ -157,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(); @@ -176,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(); } @@ -226,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; @@ -237,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; @@ -278,7 +280,7 @@ void wxPropertyValue::Delete(wxPropertyValue *node) else m_last = NULL; } - m_modifiedFlag = TRUE; + m_modifiedFlag = true; delete expr; } @@ -288,7 +290,7 @@ void wxPropertyValue::ClearList(void) { wxPropertyValue *val = GetFirst(); if (val) - m_modifiedFlag = TRUE; + m_modifiedFlag = true; while (val) { @@ -381,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; @@ -392,7 +394,7 @@ void wxPropertyValue::Copy(wxPropertyValue& copyFrom) #endif // if 0 (*this) = (bool)(s != 0); - + return ; } @@ -475,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) @@ -484,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") ); } @@ -589,7 +591,7 @@ wxString wxPropertyValue::GetStringRepresentation(void) void wxPropertyValue::operator=(const wxPropertyValue& val) { - m_modifiedFlag = TRUE; + m_modifiedFlag = true; Copy((wxPropertyValue&)val); } @@ -598,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) @@ -641,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; @@ -667,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; @@ -689,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; @@ -715,7 +717,7 @@ void wxPropertyValue::operator=(const wxChar **val) m_value.string = NULL; } - m_modifiedFlag = TRUE; + m_modifiedFlag = true; m_type = wxPropertyValueStringPtr; if (val) @@ -730,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; @@ -739,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; @@ -748,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; @@ -803,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 @@ -835,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) @@ -853,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): @@ -861,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) @@ -943,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(); @@ -989,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 @@ -1001,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; @@ -1040,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(); @@ -1078,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(); @@ -1109,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; @@ -1130,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;