+ if( !value.empty() )
+ {
+ m_inSetValue = true;
+ XmComboBoxSetString((Widget)m_mainWidget, value.char_str());
+ m_inSetValue = false;
+ }
+}
+
+void wxComboBox::SetString(unsigned int WXUNUSED(n), const wxString& WXUNUSED(s))
+{
+ wxFAIL_MSG( wxT("wxComboBox::SetString only implemented for Motif 2.0") );
+}
+
+// TODO auto-sorting is not supported by the code
+int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
+ unsigned int pos,
+ void **clientData,
+ wxClientDataType type)
+{
+ const unsigned int numItems = items.GetCount();
+
+ AllocClientData(numItems);
+ for( unsigned int i = 0; i < numItems; ++i, ++pos )
+ {
+ 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 ++;
+ InsertNewItemClientData(pos, clientData, i, type);
+ }
+
+ return pos - 1;
+}
+
+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;
+ }
+ wxControlWithItems::DoDeleteOneItem(n);
+ m_noStrings--;
+}
+
+void wxComboBox::DoClear()
+{
+ XmComboBoxDeleteAllItems((Widget) m_mainWidget);
+ m_stringList.Clear();
+
+ wxControlWithItems::DoClear();
+ m_noStrings = 0;
+}
+
+void wxComboBox::SetSelection (int n)
+{
+ XmComboBoxSelectPos((Widget) m_mainWidget, n+1, False);
+}
+
+int wxComboBox::GetSelection (void) const
+{
+ int sel = XmComboBoxGetSelectedPos((Widget) m_mainWidget);
+ if (sel == 0)
+ return -1;
+ else
+ return sel - 1;
+}
+
+wxString wxComboBox::GetString(unsigned int n) const
+{
+ wxStringList::Node *node = m_stringList.Item(n);
+ if (node)
+ return wxString(node->GetData ());
+ else
+ return wxEmptyString;
+}
+
+int wxComboBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const
+{
+ // FIXME: back to base class for not supported value of bCase
+
+ int *pos_list = NULL;
+ int count = 0;
+ wxXmString text( s );
+ bool found = (XmComboBoxGetMatchPos((Widget) m_mainWidget,
+ text(), &pos_list, &count) != 0);
+
+ if (found && count > 0)
+ {
+ int pos = pos_list[0] - 1;
+ free(pos_list);
+ return pos;
+ }
+
+ return wxNOT_FOUND;