]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/combobox.cpp
rename wxFileList to wxFileListCtrl
[wxWidgets.git] / src / univ / combobox.cpp
index 89130b4e3cc35fd1360f6d8758c712c4a53c70c9..dadd741eae889a9430c775abd5dd15ad479bb94f 100644 (file)
@@ -92,6 +92,8 @@ protected:
     void OnLeftUp(wxMouseEvent& event);
 
 private:
+    friend class wxComboBox; // it accesses our DoGetItemClientData()
+
     DECLARE_EVENT_TABLE()
 };
 
@@ -122,8 +124,8 @@ bool wxComboListBox::Create(wxWindow* parent)
     if ( !wxListBox::Create(parent, wxID_ANY,
                             wxDefaultPosition, wxDefaultSize,
                             0, NULL,
-                            wxBORDER_SIMPLE | wxLB_INT_HEIGHT |
-                            m_combo->GetWindowStyle() & wxCB_SORT ? wxLB_SORT : 0) )
+                            wxBORDER_SIMPLE |
+                            ( m_combo->GetWindowStyle() & wxCB_SORT ? wxLB_SORT : 0 ) ) )
         return false;
 
     // we don't react to the mouse events outside the window at all
@@ -344,13 +346,13 @@ void wxComboBox::SetEditable(bool editable)
 // wxComboBox methods forwarded to wxListBox
 // ----------------------------------------------------------------------------
 
-void wxComboBox::Clear()
+void wxComboBox::DoClear()
 {
     GetLBox()->Clear();
     if ( GetTextCtrl() ) GetTextCtrl()->SetValue(wxEmptyString);
 }
 
-void wxComboBox::Delete(unsigned int n)
+void wxComboBox::DoDeleteOneItem(unsigned int n)
 {
     wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Delete") );
 
@@ -389,8 +391,12 @@ void wxComboBox::SetSelection(int n)
     wxCHECK_RET( (n == wxNOT_FOUND || IsValid(n)), _T("invalid index in wxComboBox::Select") );
 
     GetLBox()->SetSelection(n);
-    if ( GetTextCtrl() )
-        GetTextCtrl()->SetValue(GetLBox()->GetString(n));
+
+    wxString str;
+    if ( n != wxNOT_FOUND )
+        str = GetLBox()->GetString(n);
+
+    SetText(str);
 }
 
 int wxComboBox::GetSelection() const
@@ -406,41 +412,26 @@ int wxComboBox::GetSelection() const
 #endif
 }
 
-int wxComboBox::DoAppend(const wxString& item)
+void wxComboBox::SetClientDataType(wxClientDataType clientDataItemsType)
 {
-    return GetLBox()->Append(item);
+    GetLBox()->SetClientDataType(clientDataItemsType);
 }
 
-int wxComboBox::DoInsert(const wxString& item, unsigned int pos)
+int wxComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
+                              unsigned int pos,
+                              void **clientData, wxClientDataType type)
 {
-    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);
-
-    GetLBox()->Insert(item, pos);
-    return pos;
+    return GetLBox()->DoInsertItems(items, pos, clientData, type);
 }
 
 void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
 {
-    GetLBox()->SetClientData(n, clientData);
+    GetLBox()->DoSetItemClientData(n, clientData);
 }
 
 void *wxComboBox::DoGetItemClientData(unsigned int n) const
 {
-    return GetLBox()->GetClientData(n);
-}
-
-void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData)
-{
-    GetLBox()->SetClientObject(n, clientData);
-}
-
-wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const
-{
-    return GetLBox()->GetClientObject(n);
+    return GetLBox()->DoGetItemClientData(n);
 }
 
 bool wxComboBox::IsEditable() const