+ wxStringList slist;
+
+ for (i = 0; i < choice->Number(); i++)
+ slist.Add(choice->GetString(i));
+
+ resource->SetStringValues(slist);
+ }
+ return wxItemPropertyInfo::InstantiateResource(resource);
+}
+
+/*
+ * Choice item
+ */
+
+wxProperty *wxComboBoxPropertyInfo::GetProperty(wxString& name)
+{
+ wxComboBox *choice = (wxComboBox *)m_propertyWindow;
+ if (name == "values")
+ {
+ wxStringList *stringList = new wxStringList;
+ int i;
+ for (i = 0; i < choice->Number(); i++)
+ stringList->Add(choice->GetString(i));
+
+ return new wxProperty(name, stringList, "stringlist");
+ }
+ else if (name == "sort")
+ {
+ bool sort = ((m_propertyWindow->GetWindowStyleFlag() & wxCB_SORT) == wxCB_SORT);
+ return new wxProperty(name, sort, "bool");
+ }
+ else if (name == "style")
+ {
+ wxString styleStr("dropdown");
+ if (m_propertyWindow->GetWindowStyleFlag() & wxCB_SIMPLE)
+ styleStr = "simple";
+ else if (m_propertyWindow->GetWindowStyleFlag() & wxCB_READONLY)
+ styleStr = "readonly";
+ else
+ styleStr = "dropdown";
+
+ return new wxProperty(name, styleStr, "string",
+ new wxStringListValidator(new wxStringList("simple", "dropdown", "readonly",
+ NULL)));
+ }
+ else
+ return wxItemPropertyInfo::GetProperty(name);
+}
+
+bool wxComboBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
+{
+ wxComboBox *choice = (wxComboBox *)m_propertyWindow;
+ if (name == "values")
+ {
+ choice->Clear();
+ wxPropertyValue *expr = property->GetValue().GetFirst();
+ while (expr)
+ {
+ char *s = expr->StringValue();
+ if (s)
+ choice->Append(s);
+ expr = expr->GetNext();
+ }
+ if (choice->Number() > 0)
+ choice->SetSelection(0);
+ return TRUE;
+ }
+ else if (name == "sort")
+ {
+ SetWindowStyle(m_propertyWindow, wxCB_SORT, property->GetValue().BoolValue());
+
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
+
+ m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
+ return TRUE;
+ }
+ else if (name == "style")
+ {
+ SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, FALSE);
+ SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, FALSE);
+ SetWindowStyle(m_propertyWindow, wxCB_READONLY, FALSE);
+
+ wxString styleStr(property->GetValue().StringValue());
+ if (styleStr == "simple")
+ SetWindowStyle(m_propertyWindow, wxCB_SIMPLE, TRUE);
+ else if (styleStr == "dropdown")
+ SetWindowStyle(m_propertyWindow, wxCB_DROPDOWN, TRUE);
+ else if (styleStr == "readonly")
+ SetWindowStyle(m_propertyWindow, wxCB_READONLY, TRUE);
+
+ // Necesary?
+ wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(m_propertyWindow);
+ resource->SetStyle(m_propertyWindow->GetWindowStyleFlag());
+
+ m_propertyWindow = wxResourceManager::GetCurrentResourceManager()->RecreateWindowFromResource(m_propertyWindow, this);
+
+ return TRUE;
+ }
+ else
+ return wxItemPropertyInfo::SetProperty(name, property);
+}
+
+void wxComboBoxPropertyInfo::GetPropertyNames(wxStringList& names)
+{
+ wxItemPropertyInfo::GetPropertyNames(names);
+ names.Add("values");
+ names.Add("style");
+ names.Add("sort");
+}
+
+bool wxComboBoxPropertyInfo::InstantiateResource(wxItemResource *resource)
+{
+ wxComboBox *choice = (wxComboBox *)m_propertyWindow;
+ int i;
+ if (choice->Number() == 0)
+ resource->SetStringValues(NULL);
+ else
+ {
+ wxStringList slist;