]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/combobox_native.cpp
wxGTK1 : wx/private/eventloopsourcesmanager.h was missing in evtloop.cpp
[wxWidgets.git] / src / motif / combobox_native.cpp
index 4bb234346a7115f9ff868c0ebff23131f8ea88ba..16630bf7477ff54200aa7abe70c22ec953eb225e 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Julian Smart, Ian Brown
 // Modified by:
 // Created:     01/02/03
-// RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -67,8 +66,6 @@ static Widget GetXmText( const wxComboBox* cb )
 void  wxComboBoxCallback (Widget w, XtPointer clientData,
                           XmComboBoxCallbackStruct * cbs);
 
-IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
-
 bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
                         const wxString& value,
                         const wxPoint& pos,
@@ -203,7 +200,7 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
         wxXmString str( items[i].c_str() );
         XmComboBoxAddItem((Widget) m_mainWidget, str(),
                           GetMotifPosition(pos), False);
-        m_noStrings ++;
+
         InsertNewItemClientData(pos, clientData, i, type);
     }
 
@@ -221,25 +218,27 @@ void wxComboBox::DoDeleteOneItem(unsigned int n)
 #endif
 
     wxControlWithItems::DoDeleteOneItem(n);
-    m_noStrings--;
+    m_stringArray.RemoveAt(size_t(n));
 
     AdjustDropDownListSize();
 }
 
-void wxComboBox::DoClear()
+void wxComboBox::Clear()
 {
 #ifdef LESSTIF_VERSION
     XmListDeleteAllItems (GetXmList(this));
 #else
-    while(m_noStrings > 0)
+    size_t n = m_stringArray.GetCount();
+    while(n > 0)
     {
-        XmComboBoxDeletePos((Widget) m_mainWidget, m_noStrings--);
+        XmComboBoxDeletePos((Widget) m_mainWidget, n--);
     }
 #endif
 
-    wxControlWithItems::DoClear();
-    m_noStrings = 0;
+    m_stringArray.Clear();
     AdjustDropDownListSize();
+
+    wxTextEntry::Clear();
 }
 
 void wxComboBox::SetSelection (int n)
@@ -262,7 +261,7 @@ void wxComboBox::SetSelection (int n)
     m_inSetSelection = false;
 }
 
-int wxComboBox::GetSelection (void) const
+int wxComboBox::GetSelection() const
 {
     return wxDoGetSelectionInList( GetXmList( this ) );
 }
@@ -279,11 +278,6 @@ int wxComboBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const
     return wxDoFindStringInList( GetXmList( this ), s );
 }
 
-void wxComboBox::SetEditable(bool WXUNUSED(editable))
-{
-    // TODO
-}
-
 void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
                           XmComboBoxCallbackStruct * cbs)
 {
@@ -299,7 +293,7 @@ void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
     case XmCR_BROWSE_SELECT:
 #endif
         {
-            wxCommandEvent event (wxEVT_COMMAND_COMBOBOX_SELECTED,
+            wxCommandEvent event (wxEVT_COMBOBOX,
                                   item->GetId());
             int idx = cbs->item_position;
             event.SetInt(idx);
@@ -310,17 +304,17 @@ void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
                 event.SetClientData( item->GetClientData(idx) );
             event.SetExtraLong(true);
             event.SetEventObject(item);
-            item->GetEventHandler()->ProcessEvent(event);
+            item->HandleWindowEvent(event);
             break;
         }
     case XmCR_VALUE_CHANGED:
         {
-            wxCommandEvent event (wxEVT_COMMAND_TEXT_UPDATED, item->GetId());
+            wxCommandEvent event (wxEVT_TEXT, item->GetId());
             event.SetInt(-1);
             event.SetString( item->GetValue() );
             event.SetExtraLong(true);
             event.SetEventObject(item);
-            item->GetEventHandler()->ProcessEvent(event);
+            item->HandleWindowEvent(event);
             break;
         }
     default:
@@ -330,7 +324,7 @@ void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
 
 void wxComboBox::ChangeFont(bool keepOriginalSize)
 {
-    if( m_font.Ok() && m_mainWidget != NULL )
+    if( m_font.IsOk() && m_mainWidget != NULL )
     {
         wxDoChangeFont( GetXmText(this), m_font );
         wxDoChangeFont( GetXmList(this), m_font );