]> git.saurik.com Git - wxWidgets.git/commitdiff
Source cleaning.
authorWłodzimierz Skiba <abx@abx.art.pl>
Sun, 14 May 2006 21:29:12 +0000 (21:29 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Sun, 14 May 2006 21:29:12 +0000 (21:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/combog.cpp
src/generic/odcombo.cpp

index edf2bba3d6300af0c8bad08efa2d6661d2a14121..171dbce0cf61a76833c4bf64e14194ca46f2b69c 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        combog.cpp
+// Name:        src/generic/combog.cpp
 // Purpose:     Generic wxComboControl
 // Author:      Jaakko Salli
 // Modified by:
@@ -25,6 +25,8 @@
 
 #if wxUSE_COMBOCONTROL
 
+#include "wx/combo.h"
+
 #ifndef WX_PRECOMP
     #include "wx/log.h"
     #include "wx/combobox.h"
@@ -34,9 +36,6 @@
 
 #include "wx/dcbuffer.h"
 
-#include "wx/combo.h"
-
-
 // ----------------------------------------------------------------------------
 // Some constant adjustments to make the generic more bearable
 
index fcd94b30119c478c5021dd516152b2807f07661f..6386df709309cbfcd7fe9c403040bd754d6d724c 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        odcombo.cpp
+// Name:        src/generic/odcombo.cpp
 // Purpose:     wxOwnerDrawnComboBox, wxVListBoxComboPopup
 // Author:      Jaakko Salli
 // Modified by:
@@ -25,6 +25,8 @@
 
 #if wxUSE_OWNERDRAWNCOMBOBOX
 
+#include "wx/odcombo.h"
+
 #ifndef WX_PRECOMP
     #include "wx/log.h"
     #include "wx/combobox.h"
@@ -34,8 +36,6 @@
 #endif
 
 #include "wx/combo.h"
-#include "wx/odcombo.h"
-
 
 // ============================================================================
 // implementation
@@ -465,9 +465,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;
 
@@ -683,7 +682,7 @@ void wxOwnerDrawnComboBox::Clear()
 
 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,13 +698,13 @@ 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);
 }
 
@@ -717,7 +716,7 @@ int wxOwnerDrawnComboBox::FindString(const wxString& s) const
 
 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 +750,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);