#include "wx/window.h"
#include "wx/utils.h"
#include "wx/list.h"
+#include "wx/debug.h"
#include "wx/prop.h"
IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject)
}
case wxPropertyValueStringPtr:
{
+ wxFAIL_MSG( "wxPropertyValue::WritePropertyType( wxPropertyValueStringPtr ) not implemented" );
+ /*
int i;
int len = strlen(*(m_value.stringPtr));
for (i = 0; i < len; i++)
char ch = *(m_value.stringPtr)[i];
}
+ */
break;
}
case wxPropertyValueList:
wxProperty::wxProperty(void)
{
- m_propertyRole = (char *)NULL;
+ m_propertyRole = wxEmptyString;
m_propertyValidator = NULL;
m_propertyWindow = NULL;
m_enabled = TRUE;
}
wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed):
- m_name(nm), m_value(val), m_propertyRole(role)
+ m_value(val), m_name(nm), m_propertyRole(role)
{
m_propertyValidator = ed;
m_propertyWindow = NULL;
IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject)
-wxPropertySheet::wxPropertySheet(void):m_properties(wxKEY_STRING)
+wxPropertySheet::wxPropertySheet(const wxString& name)
+:m_properties(wxKEY_STRING),m_name(name)
{
}
}
// Get property by name
-wxProperty *wxPropertySheet::GetProperty(wxString name)
+wxProperty *wxPropertySheet::GetProperty(const wxString& name) const
{
wxNode *node = m_properties.Find((const char*) name);
if (!node)
return (wxProperty *)node->Data();
}
+bool wxPropertySheet::SetProperty(const wxString& name, const wxPropertyValue& value)
+{
+ wxProperty* prop = GetProperty(name);
+ if(prop){
+ prop->SetValue(value);
+ return TRUE;
+ }else{
+ return FALSE;
+ }
+}
+
+void wxPropertySheet::RemoveProperty(const wxString& name)
+{
+ wxNode *node = m_properties.Find(name);
+ if(node)
+ {
+ wxProperty *prop = (wxProperty *)node->Data();
+ delete prop;
+ m_properties.DeleteNode(node);
+ }
+}
+
+bool wxPropertySheet::HasProperty(const wxString& name) const
+{
+ return (GetProperty(name)?TRUE:FALSE);
+}
+
// Clear all properties
void wxPropertySheet::Clear(void)
{
{
BeginFind();
wxNode *node;
- while (node = Next())
+ while ((node = Next()))
{
delete (wxPropertyValidator *)node->Data();
}