#include <math.h>
#include <string.h>
+#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)
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);
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;
wxPropertyValue::wxPropertyValue(long the_integer)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueInteger;
m_value.integer = the_integer;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(bool val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValuebool;
m_value.integer = val;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(float the_real)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueReal;
m_value.real = the_real;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(double the_real)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueReal;
m_value.real = (float)the_real;
m_clientData = NULL;
// 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;
wxPropertyValue::wxPropertyValue(long *val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueIntegerPtr;
m_value.integerPtr = val;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(bool *val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueboolPtr;
m_value.boolPtr = val;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(float *val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueRealPtr;
m_value.realPtr = val;
m_clientData = NULL;
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();
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();
}
void wxPropertyValue::Append(wxPropertyValue *expr)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (!m_value.first)
m_value.first = expr;
void wxPropertyValue::Insert(wxPropertyValue *expr)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
expr->m_next = m_value.first;
m_value.first = expr;
else
m_last = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
delete expr;
}
{
wxPropertyValue *val = GetFirst();
if (val)
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
while (val)
{
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;
#endif // if 0
(*this) = (bool)(s != 0);
-
+
return ;
}
node->WritePropertyType(stream);
stream.Append( wxT("(") );
node = node->m_next;
- bool first = TRUE;
+ bool first = true;
while (node)
{
if (!first)
node = node->m_next;
if (node)
stream.Append( wxT(",\n" ) );
- first = FALSE;
+ first = false;
}
stream.Append( wxT(").\n\n") );
}
void wxPropertyValue::operator=(const wxPropertyValue& val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
Copy((wxPropertyValue&)val);
}
{
const wxChar *val = (const wxChar *)val1;
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
wxPropertyValueType oldType = m_type;
if (oldType == wxPropertyValueString)
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueInteger;
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValuebool;
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueReal;
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueStringPtr;
if (val)
void wxPropertyValue::operator=(const long *val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueIntegerPtr;
m_value.integerPtr = (long *)val;
m_clientData = NULL;
void wxPropertyValue::operator=(const bool *val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueboolPtr;
m_value.boolPtr = (bool *)val;
m_clientData = NULL;
void wxPropertyValue::operator=(const float *val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueRealPtr;
m_value.realPtr = (float *)val;
m_clientData = NULL;
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
m_propertyRole = wxEmptyString;
m_propertyValidator = NULL;
m_propertyWindow = NULL;
- m_enabled = TRUE;
+ m_enabled = true;
}
wxProperty::wxProperty(wxProperty& copyFrom)
{
m_propertyValidator = ed;
m_propertyWindow = NULL;
- m_enabled = TRUE;
+ m_enabled = true;
}
wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed):
{
m_propertyValidator = ed;
m_propertyWindow = NULL;
- m_enabled = TRUE;
+ m_enabled = true;
}
wxProperty::~wxProperty(void)
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();
// 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
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;
// 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();
void wxPropertyValidatorRegistry::ClearRegistry(void)
{
BeginFind();
- wxNode *node;
+ wxHashTable::Node *node;
while ((node = Next()) != NULL)
{
delete (wxPropertyValidator *)node->GetData();
}
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;
}
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;