]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/odcombo.cpp
use "event-after" signal to send thumb release event
[wxWidgets.git] / src / generic / odcombo.cpp
index fcd94b30119c478c5021dd516152b2807f07661f..f19b8309d04391eab992de737e88e9f5a6a5bf62 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        odcombo.cpp
+// Name:        src/generic/odcombo.cpp
 // Purpose:     wxOwnerDrawnComboBox, wxVListBoxComboPopup
 // Author:      Jaakko Salli
 // Modified by:
@@ -23,7 +23,9 @@
     #pragma hdrstop
 #endif
 
-#if wxUSE_OWNERDRAWNCOMBOBOX
+#if wxUSE_ODCOMBOBOX
+
+#include "wx/odcombo.h"
 
 #ifndef WX_PRECOMP
     #include "wx/log.h"
@@ -34,8 +36,6 @@
 #endif
 
 #include "wx/combo.h"
-#include "wx/odcombo.h"
-
 
 // ============================================================================
 // implementation
@@ -384,6 +384,8 @@ void wxVListBoxComboPopup::Clear()
 
     ClearClientDatas();
 
+    m_value = wxNOT_FOUND;
+
     if ( IsCreated() )
         wxVListBox::SetItemCount(0);
 }
@@ -436,9 +438,9 @@ void wxVListBoxComboPopup::Delete( unsigned int item )
         wxVListBox::SetItemCount( wxVListBox::GetItemCount()-1 );
 }
 
-int wxVListBoxComboPopup::FindString(const wxString& s) const
+int wxVListBoxComboPopup::FindString(const wxString& s, bool bCase) const
 {
-    return m_strings.Index(s);
+    return m_strings.Index(s, bCase);
 }
 
 unsigned int wxVListBoxComboPopup::GetCount() const
@@ -465,9 +467,8 @@ wxString wxVListBoxComboPopup::GetStringValue() const
 
 void wxVListBoxComboPopup::SetSelection( int item )
 {
-    // This seems to be necessary (2.5.3 w/ MingW atleast)
-    if ( item < -1 || item >= (int)m_strings.GetCount() )
-        item = -1;
+    wxCHECK_RET( item == wxNOT_FOUND || ((unsigned int)item < GetCount()),
+                 wxT("invalid index in wxVListBoxComboPopup::SetSelection") );
 
     m_value = item;
 
@@ -558,11 +559,11 @@ void wxVListBoxComboPopup::Populate( const wxArrayString& choices )
 // ----------------------------------------------------------------------------
 
 
-BEGIN_EVENT_TABLE(wxOwnerDrawnComboBox, wxComboControl)
+BEGIN_EVENT_TABLE(wxOwnerDrawnComboBox, wxComboCtrl)
 END_EVENT_TABLE()
 
 
-IMPLEMENT_DYNAMIC_CLASS2(wxOwnerDrawnComboBox, wxComboControl, wxControlWithItems)
+IMPLEMENT_DYNAMIC_CLASS2(wxOwnerDrawnComboBox, wxComboCtrl, wxControlWithItems)
 
 void wxOwnerDrawnComboBox::Init()
 {
@@ -578,7 +579,7 @@ bool wxOwnerDrawnComboBox::Create(wxWindow *parent,
                                   const wxValidator& validator,
                                   const wxString& name)
 {
-    return wxComboControl::Create(parent,id,value,pos,size,style,validator,name);
+    return wxComboCtrl::Create(parent,id,value,pos,size,style,validator,name);
 }
 
 wxOwnerDrawnComboBox::wxOwnerDrawnComboBox(wxWindow *parent,
@@ -590,7 +591,7 @@ wxOwnerDrawnComboBox::wxOwnerDrawnComboBox(wxWindow *parent,
                                            long style,
                                            const wxValidator& validator,
                                            const wxString& name)
-    : wxComboControl()
+    : wxComboCtrl()
 {
     Init();
 
@@ -654,7 +655,7 @@ void wxOwnerDrawnComboBox::SetPopupControl( wxComboPopup* popup )
         popup = new wxVListBoxComboPopup();
     }
 
-    wxComboControl::SetPopupControl(popup);
+    wxComboCtrl::SetPopupControl(popup);
 
     wxASSERT(popup);
     m_popupInterface = (wxVListBoxComboPopup*) popup;
@@ -678,12 +679,12 @@ void wxOwnerDrawnComboBox::Clear()
 
     m_popupInterface->Clear();
 
-    GetTextCtrl()->SetValue(wxEmptyString);
+    SetValue(wxEmptyString);
 }
 
 void wxOwnerDrawnComboBox::Delete(unsigned int n)
 {
-    wxCHECK_RET( n < GetCount(), _T("invalid index in wxOwnerDrawnComboBox::Delete") );
+    wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Delete") );
 
     if ( GetSelection() == (int) n )
         SetValue(wxEmptyString);
@@ -699,25 +700,25 @@ unsigned int wxOwnerDrawnComboBox::GetCount() const
 
 wxString wxOwnerDrawnComboBox::GetString(unsigned int n) const
 {
-    wxCHECK_MSG( n < GetCount(), wxEmptyString, _T("invalid index in wxOwnerDrawnComboBox::GetString") );
+    wxCHECK_MSG( IsValid(n), wxEmptyString, _T("invalid index in wxOwnerDrawnComboBox::GetString") );
     return m_popupInterface->GetString(n);
 }
 
 void wxOwnerDrawnComboBox::SetString(unsigned int n, const wxString& s)
 {
-    wxCHECK_RET( n < GetCount(), _T("invalid index in wxOwnerDrawnComboBox::SetString") );
+    wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::SetString") );
     m_popupInterface->SetString(n,s);
 }
 
-int wxOwnerDrawnComboBox::FindString(const wxString& s) const
+int wxOwnerDrawnComboBox::FindString(const wxString& s, bool bCase) const
 {
     wxASSERT_MSG( m_popupInterface, wxT("no popup interface") );
-    return m_popupInterface->FindString(s);
+    return m_popupInterface->FindString(s, bCase);
 }
 
 void wxOwnerDrawnComboBox::Select(int n)
 {
-    wxCHECK_RET( (n >= -1) && (n < (int)GetCount()), _T("invalid index in wxOwnerDrawnComboBox::Select") );
+    wxCHECK_RET( (n == wxNOT_FOUND) || IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Select") );
     EnsurePopupControl();
 
     m_popupInterface->SetSelection(n);
@@ -751,7 +752,7 @@ int wxOwnerDrawnComboBox::DoAppend(const wxString& item)
 int wxOwnerDrawnComboBox::DoInsert(const wxString& item, unsigned int pos)
 {
     wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
-    wxCHECK_MSG(pos<=GetCount(), -1, wxT("invalid index"));
+    wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
 
     EnsurePopupControl();
     m_popupInterface->Insert(item,pos);
@@ -781,4 +782,4 @@ wxClientData* wxOwnerDrawnComboBox::DoGetItemClientObject(unsigned int n) const
     return (wxClientData*) DoGetItemClientData(n);
 }
 
-#endif // wxUSE_OWNERDRAWNCOMBOBOX
+#endif // wxUSE_ODCOMBOBOX