void wxComboBoxCallback (Widget w, XtPointer clientData,
XmComboBoxSelectionCallbackStruct * cbs);
-IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
-
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
return false;
PreCreation();
- m_noStrings = n;
-
Widget parentWidget = (Widget) parent->GetClientWidget();
Widget buttonWidget = XtVaCreateManagedWidget(name.c_str(),
{
wxXmString str( choices[i] );
XmComboBoxAddItem(buttonWidget, str(), 0);
- m_stringList.Add(choices[i]);
+ m_stringArray.Add(choices[i]);
}
m_mainWidget = (Widget) buttonWidget;
wxWindow::DoSetSize(x, y, width, DoGetBestSize().y, sizeFlags);
}
+#if 0
+// Already defined in include/motif/combobox.h
wxString wxComboBox::GetValue() const
{
char *s = XmComboBoxGetString ((Widget) m_mainWidget);
else
return wxEmptyString;
}
+#endif
void wxComboBox::SetValue(const wxString& value)
{
{
wxXmString str( items[i].c_str() );
XmComboBoxAddItem((Widget) m_mainWidget, str(), GetMotifPosition(pos));
- wxChar* copy = wxStrcpy(new wxChar[items[i].length() + 1], items[i].c_str());
- m_stringList.Insert(pos, copy);
- m_noStrings ++;
+ m_stringArray.Insert(items[i], pos);
InsertNewItemClientData(pos, clientData, i, type);
}
void wxComboBox::DoDeleteOneItem(unsigned int n)
{
XmComboBoxDeletePos((Widget) m_mainWidget, n+1);
- wxStringList::Node *node = m_stringList.Item(n);
- if (node)
- {
- delete[] node->GetData();
- delete node;
- }
+ m_stringArray.RemoveAt(n);
wxControlWithItems::DoDeleteOneItem(n);
- m_noStrings--;
}
-void wxComboBox::DoClear()
+void wxComboBox::Clear()
{
XmComboBoxDeleteAllItems((Widget) m_mainWidget);
- m_stringList.Clear();
+ m_stringArray.Clear();
wxControlWithItems::DoClear();
- m_noStrings = 0;
}
void wxComboBox::SetSelection (int n)
wxString wxComboBox::GetString(unsigned int n) const
{
- wxStringList::Node *node = m_stringList.Item(n);
- if (node)
- return wxString(node->GetData ());
- else
- return wxEmptyString;
+ return m_stringArray[n];
}
int wxComboBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const