]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/combobox.cpp
don't lose fonts underlined flag in ReInit() (bug fix for the change in rev. 1.76)
[wxWidgets.git] / src / motif / combobox.cpp
index ef51038de6fb1f2eb60e9ee4ca0882533a90a8b8..4389cc1f00edc2d0b6415f99e27dbdeb1cb2ded5 100644 (file)
@@ -9,7 +9,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "combobox.h"
 #endif
 
@@ -18,6 +18,7 @@
 #if wxUSE_COMBOBOX
 
 #include "wx/combobox.h"
+#include "wx/arrstr.h"
 
 #ifdef __VMS__
 #pragma message disable nosimpint
@@ -93,6 +94,20 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
     return TRUE;
 }
 
+bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
+                        const wxString& value,
+                        const wxPoint& pos,
+                        const wxSize& size,
+                        const wxArrayString& choices,
+                        long style,
+                        const wxValidator& validator,
+                        const wxString& name)
+{
+    wxCArrayString chs(choices);
+    return Create(parent, id, value, pos, size, chs.GetCount(), 
+                  chs.GetStrings(), style, validator, name);
+}
+
 wxComboBox::~wxComboBox()
 {
     DetachWidget((Widget) m_mainWidget); // Removes event handlers
@@ -145,6 +160,23 @@ int wxComboBox::DoAppend(const wxString& item)
     return GetCount() - 1;
 }
 
+int wxComboBox::DoInsert(const wxString& item, int pos)
+{
+    wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
+    wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -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(int n)
 {
     XmComboBoxDeletePos((Widget) m_mainWidget, n+1);