+ m_inSetValue = true;
+ if( !value.empty() )
+ XmComboBoxSetString( (Widget)m_mainWidget,
+ wxConstCast(value.c_str(), char) );
+ 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") );
+}
+
+int wxComboBox::DoAppend(const wxString& item)
+{
+ wxXmString str( item.c_str() );
+ XmComboBoxAddItem((Widget) m_mainWidget, str(), 0);
+ m_stringList.Add(item);
+ m_noStrings ++;
+
+ return GetCount() - 1;
+}
+
+int wxComboBox::DoInsert(const wxString& item, unsigned int pos)
+{
+ wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
+ wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
+
+ if (pos == GetCount())
+ return DoAppend(item);
+
+ wxXmString str( item.c_str() );
+ XmComboBoxAddItem((Widget) m_mainWidget, str(), pos+1);
+ wxChar* copy = wxStrcpy(new wxChar[item.length() + 1], item.c_str());
+ m_stringList.Insert(pos, copy);
+ m_noStrings ++;
+
+ return pos;
+}
+
+void wxComboBox::Delete(unsigned int n)
+{
+ XmComboBoxDeletePos((Widget) m_mainWidget, n+1);
+ wxStringList::Node *node = m_stringList.Item(n);
+ if (node)
+ {
+ delete[] node->GetData();
+ delete node;
+ }
+ m_clientDataDict.Delete(n, HasClientObjectData());
+ m_noStrings--;
+}
+
+void wxComboBox::Clear()
+{
+ XmComboBoxDeleteAllItems((Widget) m_mainWidget);
+ m_stringList.Clear();
+
+ if ( HasClientObjectData() )
+ m_clientDataDict.DestroyData();
+ 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;