wxItemContainerImmutable::FindString unified.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: cocoa/choice.mm
|
||||
// Name: src/cocoa/choice.mm
|
||||
// Purpose: wxChoice
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/16
|
||||
// RCS-ID: $Id:
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWidgets licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -173,8 +173,9 @@ void wxChoice::SetString(int n, const wxString& title)
|
||||
[item setTitle:wxNSStringWithWxString(title)];
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& title) const
|
||||
int wxChoice::FindString(const wxString& title, bool bCase) const
|
||||
{
|
||||
// FIXME: use wxItemContainerImmutable::FindString for bCase parameter
|
||||
return [(NSPopUpButton*)m_cocoaNSView indexOfItemWithTitle:
|
||||
wxNSStringWithWxString(title)];
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: cocoa/combobox.mm
|
||||
// Name: src/cocoa/combobox.mm
|
||||
// Purpose: wxComboBox
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
@@ -9,8 +9,6 @@
|
||||
// Licence: wxWidgets licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// #include "wx/wxprec.h"
|
||||
|
||||
//
|
||||
// Impl notes:
|
||||
// There is no custom data source because doing so unnecessarily sacrifices
|
||||
@@ -68,17 +66,6 @@
|
||||
}
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: cocoa/NSComboBox.mm
|
||||
// Purpose: wxCocoaNSComboBox
|
||||
// Author: Ryan Norton
|
||||
// Modified by:
|
||||
// Created: 2005/02/16
|
||||
// RCS-ID: $Id:
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWidgets licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
@@ -279,7 +266,9 @@ int wxComboBox::GetCount() const
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetString(int nIndex) const
|
||||
{ return wxStringWithNSString([GetNSComboBox() itemObjectValueAtIndex:nIndex]); }
|
||||
{
|
||||
return wxStringWithNSString([GetNSComboBox() itemObjectValueAtIndex:nIndex]);
|
||||
}
|
||||
|
||||
void wxComboBox::SetString(int nIndex, const wxString& szString)
|
||||
{
|
||||
@@ -290,11 +279,16 @@ void wxComboBox::SetString(int nIndex, const wxString& szString)
|
||||
[GetNSComboBox() insertItemWithObjectValue:wxNSStringWithWxString(szString) atIndex:nIndex];
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& szItem) const
|
||||
{ return [GetNSComboBox() indexOfItemWithObjectValue:wxNSStringWithWxString(szItem)]; }
|
||||
int wxComboBox::FindString(const wxString& szItem, bool bCase) const
|
||||
{
|
||||
// FIXME: use wxItemContainerImmutable::FindString for bCase parameter
|
||||
return [GetNSComboBox() indexOfItemWithObjectValue:wxNSStringWithWxString(szItem)];
|
||||
}
|
||||
|
||||
int wxComboBox::GetSelection() const
|
||||
{ return [GetNSComboBox() indexOfSelectedItem]; }
|
||||
{
|
||||
return [GetNSComboBox() indexOfSelectedItem];
|
||||
}
|
||||
|
||||
int wxComboBox::DoAppend(const wxString& szItem)
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Author: David Elliott
|
||||
// Modified by:
|
||||
// Created: 2003/03/18
|
||||
// RCS-ID: $Id:
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWidgets licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -242,8 +242,9 @@ void wxListBox::SetString(int n, const wxString& s)
|
||||
[GetNSTableView() reloadData];
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
int wxListBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
// FIXME: use wxItemContainerImmutable::FindString for bCase parameter
|
||||
wxAutoNSAutoreleasePool pool;
|
||||
return [m_cocoaItems indexOfObject:wxNSStringWithWxString(s)];
|
||||
}
|
||||
|
@@ -34,18 +34,6 @@
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
int wxRadioBoxBase::FindString(const wxString& s) const
|
||||
{
|
||||
int count = GetCount();
|
||||
for ( int n = 0; n < count; n++ )
|
||||
{
|
||||
if ( GetString(n) == s )
|
||||
return n;
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const
|
||||
{
|
||||
int count = GetCount(),
|
||||
@@ -176,4 +164,3 @@ void wxRadioBoxBase::SetLabel(int n, const wxString& label)
|
||||
#endif // WXWIN_COMPATIBILITY_2_2
|
||||
|
||||
#endif // wxUSE_RADIOBOX
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/gtk/choice.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -334,9 +334,9 @@ void wxChoice::Delete( int n )
|
||||
}
|
||||
}
|
||||
|
||||
int wxChoice::FindString( const wxString &string ) const
|
||||
int wxChoice::FindString( const wxString &string, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );
|
||||
|
||||
// If you read this code once and you think you understand
|
||||
// it, then you are very wrong. Robert Roebling.
|
||||
@@ -360,7 +360,7 @@ int wxChoice::FindString( const wxString &string ) const
|
||||
#else
|
||||
wxString tmp( label->label );
|
||||
#endif
|
||||
if (string == tmp)
|
||||
if (string.IsSameAs( tmp, bCase ))
|
||||
return count;
|
||||
|
||||
child = child->next;
|
||||
@@ -372,7 +372,7 @@ int wxChoice::FindString( const wxString &string ) const
|
||||
|
||||
int wxChoice::GetSelection() const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );
|
||||
|
||||
return m_selection_hack;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox.cpp
|
||||
// Name: src/gtk/combobox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -527,7 +527,7 @@ void wxComboBox::SetString(int n, const wxString &text)
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
int wxComboBox::FindString( const wxString &item ) const
|
||||
int wxComboBox::FindString( const wxString &item, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
|
||||
|
||||
@@ -544,7 +544,7 @@ int wxComboBox::FindString( const wxString &item ) const
|
||||
#else
|
||||
wxString str( label->label );
|
||||
#endif
|
||||
if (item == str)
|
||||
if (item.IsSameAs( str , bCase ) )
|
||||
return count;
|
||||
|
||||
count++;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listbox.cpp
|
||||
// Name: src/gtk/listbox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -931,7 +931,7 @@ void wxListBox::SetString( int n, const wxString &string )
|
||||
|
||||
wxString wxListBox::GetString( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_list != NULL, wxT(""), wxT("invalid listbox") );
|
||||
wxCHECK_MSG( m_list != NULL, wxEmptyString, wxT("invalid listbox") );
|
||||
|
||||
GList *child = g_list_nth( m_list->children, n );
|
||||
if (child)
|
||||
@@ -941,7 +941,7 @@ wxString wxListBox::GetString( int n ) const
|
||||
|
||||
wxFAIL_MSG(wxT("wrong listbox index"));
|
||||
|
||||
return wxT("");
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
int wxListBox::GetCount() const
|
||||
@@ -952,15 +952,15 @@ int wxListBox::GetCount() const
|
||||
return g_list_length(children);
|
||||
}
|
||||
|
||||
int wxListBox::FindString( const wxString &item ) const
|
||||
int wxListBox::FindString( const wxString &item, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_list != NULL, -1, wxT("invalid listbox") );
|
||||
wxCHECK_MSG( m_list != NULL, wxNOT_FOUND, wxT("invalid listbox") );
|
||||
|
||||
GList *child = m_list->children;
|
||||
int count = 0;
|
||||
while (child)
|
||||
{
|
||||
if ( GetRealLabel(child) == item )
|
||||
if ( item.IsSameAs( GetRealLabel(child), bCase ) )
|
||||
return count;
|
||||
|
||||
count++;
|
||||
@@ -1262,4 +1262,3 @@ wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
||||
}
|
||||
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: radiobox.cpp
|
||||
// Name: src/gtk/radiobox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -328,7 +328,7 @@ bool wxRadioBox::Show( bool show )
|
||||
return true;
|
||||
}
|
||||
|
||||
int wxRadioBox::FindString( const wxString &find ) const
|
||||
int wxRadioBox::FindString( const wxString &find, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid radiobox") );
|
||||
|
||||
@@ -343,7 +343,7 @@ int wxRadioBox::FindString( const wxString &find ) const
|
||||
#else
|
||||
wxString str( label->label );
|
||||
#endif
|
||||
if (find == str)
|
||||
if (find.IsSameAs( str, bCase ))
|
||||
return count;
|
||||
|
||||
count++;
|
||||
@@ -678,4 +678,3 @@ void wxRadioBox::SetLabel( int item, const wxString& label )
|
||||
#endif // WXWIN_COMPATIBILITY_2_2
|
||||
|
||||
#endif // wxUSE_RADIOBOX
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/gtk/choice.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -334,9 +334,9 @@ void wxChoice::Delete( int n )
|
||||
}
|
||||
}
|
||||
|
||||
int wxChoice::FindString( const wxString &string ) const
|
||||
int wxChoice::FindString( const wxString &string, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );
|
||||
|
||||
// If you read this code once and you think you understand
|
||||
// it, then you are very wrong. Robert Roebling.
|
||||
@@ -360,7 +360,7 @@ int wxChoice::FindString( const wxString &string ) const
|
||||
#else
|
||||
wxString tmp( label->label );
|
||||
#endif
|
||||
if (string == tmp)
|
||||
if (string.IsSameAs( tmp, bCase ))
|
||||
return count;
|
||||
|
||||
child = child->next;
|
||||
@@ -372,7 +372,7 @@ int wxChoice::FindString( const wxString &string ) const
|
||||
|
||||
int wxChoice::GetSelection() const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid choice") );
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );
|
||||
|
||||
return m_selection_hack;
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox.cpp
|
||||
// Name: src/gtk/combobox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -527,7 +527,7 @@ void wxComboBox::SetString(int n, const wxString &text)
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
int wxComboBox::FindString( const wxString &item ) const
|
||||
int wxComboBox::FindString( const wxString &item, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
|
||||
|
||||
@@ -544,7 +544,7 @@ int wxComboBox::FindString( const wxString &item ) const
|
||||
#else
|
||||
wxString str( label->label );
|
||||
#endif
|
||||
if (item == str)
|
||||
if (item.IsSameAs( str , bCase ) )
|
||||
return count;
|
||||
|
||||
count++;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listbox.cpp
|
||||
// Name: src/gtk/listbox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -931,7 +931,7 @@ void wxListBox::SetString( int n, const wxString &string )
|
||||
|
||||
wxString wxListBox::GetString( int n ) const
|
||||
{
|
||||
wxCHECK_MSG( m_list != NULL, wxT(""), wxT("invalid listbox") );
|
||||
wxCHECK_MSG( m_list != NULL, wxEmptyString, wxT("invalid listbox") );
|
||||
|
||||
GList *child = g_list_nth( m_list->children, n );
|
||||
if (child)
|
||||
@@ -941,7 +941,7 @@ wxString wxListBox::GetString( int n ) const
|
||||
|
||||
wxFAIL_MSG(wxT("wrong listbox index"));
|
||||
|
||||
return wxT("");
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
int wxListBox::GetCount() const
|
||||
@@ -952,15 +952,15 @@ int wxListBox::GetCount() const
|
||||
return g_list_length(children);
|
||||
}
|
||||
|
||||
int wxListBox::FindString( const wxString &item ) const
|
||||
int wxListBox::FindString( const wxString &item, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_list != NULL, -1, wxT("invalid listbox") );
|
||||
wxCHECK_MSG( m_list != NULL, wxNOT_FOUND, wxT("invalid listbox") );
|
||||
|
||||
GList *child = m_list->children;
|
||||
int count = 0;
|
||||
while (child)
|
||||
{
|
||||
if ( GetRealLabel(child) == item )
|
||||
if ( item.IsSameAs( GetRealLabel(child), bCase ) )
|
||||
return count;
|
||||
|
||||
count++;
|
||||
@@ -1262,4 +1262,3 @@ wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
||||
}
|
||||
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: radiobox.cpp
|
||||
// Name: src/gtk/radiobox.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
@@ -328,7 +328,7 @@ bool wxRadioBox::Show( bool show )
|
||||
return true;
|
||||
}
|
||||
|
||||
int wxRadioBox::FindString( const wxString &find ) const
|
||||
int wxRadioBox::FindString( const wxString &find, bool bCase ) const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid radiobox") );
|
||||
|
||||
@@ -343,7 +343,7 @@ int wxRadioBox::FindString( const wxString &find ) const
|
||||
#else
|
||||
wxString str( label->label );
|
||||
#endif
|
||||
if (find == str)
|
||||
if (find.IsSameAs( str, bCase ))
|
||||
return count;
|
||||
|
||||
count++;
|
||||
@@ -678,4 +678,3 @@ void wxRadioBox::SetLabel( int item, const wxString& label )
|
||||
#endif // WXWIN_COMPATIBILITY_2_2
|
||||
|
||||
#endif // wxUSE_RADIOBOX
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/mac/carbon/choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@@ -195,9 +195,9 @@ int wxChoice::GetCount() const
|
||||
return m_strings.GetCount() ;
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& s) const
|
||||
int wxChoice::FindString(const wxString& s, bool bCase ) const
|
||||
{
|
||||
return m_strings.Index( s , true , false) ;
|
||||
return m_strings.Index( s , bCase ) ;
|
||||
}
|
||||
|
||||
void wxChoice::SetString(int n, const wxString& s)
|
||||
@@ -209,7 +209,7 @@ void wxChoice::SetString(int n, const wxString& s)
|
||||
|
||||
wxString wxChoice::GetString(int n) const
|
||||
{
|
||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_strings.GetCount(), _T(""),
|
||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_strings.GetCount(), wxEmptyString,
|
||||
_T("wxChoice::GetString(): invalid index") );
|
||||
|
||||
return m_strings[n] ;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox.cpp
|
||||
// Name: src/mac/carbon/combobox.cpp
|
||||
// Purpose: wxComboBox class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@@ -568,9 +568,9 @@ void wxComboBox::SetSelection(int n)
|
||||
}
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
return m_choice->FindString( s );
|
||||
return m_choice->FindString( s, bCase );
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetString(int n) const
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox.cpp
|
||||
// Name: src/mac/carbon/combobox.cpp
|
||||
// Purpose: wxComboBox class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@@ -677,17 +677,17 @@ void wxComboBox::SetSelection(int n)
|
||||
#endif
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
#if USE_HICOMBOBOX
|
||||
for( int i = 0 ; i < GetCount() ; i++ )
|
||||
{
|
||||
if ( GetString( i ).IsSameAs(s, false) )
|
||||
if ( GetString( i ).IsSameAs(s, bCase) )
|
||||
return i ;
|
||||
}
|
||||
return wxNOT_FOUND ;
|
||||
#else
|
||||
return m_choice->FindString( s );
|
||||
return m_choice->FindString( s, bCase );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listbox.cpp
|
||||
// Name: src/mac/carbon/listbox.cpp
|
||||
// Purpose: wxListBox
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@@ -380,9 +380,8 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
||||
}
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
int wxListBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
|
||||
if ( s.Right(1) == wxT("*") )
|
||||
{
|
||||
wxString search = s.Left( s.Length() - 1 ) ;
|
||||
@@ -394,7 +393,7 @@ int wxListBox::FindString(const wxString& s) const
|
||||
{
|
||||
wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
|
||||
|
||||
if ( EqualString( s1 , s2 , false , false ) )
|
||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||
return i ;
|
||||
}
|
||||
if ( s.Left(1) == wxT("*") && s.Length() > 1 )
|
||||
@@ -419,11 +418,11 @@ int wxListBox::FindString(const wxString& s) const
|
||||
{
|
||||
wxMacStringToPascal( m_stringArray[i] , s1 ) ;
|
||||
|
||||
if ( EqualString( s1 , s2 , false , false ) )
|
||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||
return i ;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
void wxListBox::Clear()
|
||||
@@ -872,4 +871,3 @@ void wxListBox::OnChar(wxKeyEvent& event)
|
||||
#endif // !TARGET_API_MAC_OSX
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/mac/classic/choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@@ -171,16 +171,6 @@ int wxChoice::GetCount() const
|
||||
return m_strings.GetCount() ;
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& s) const
|
||||
{
|
||||
for( int i = 0 ; i < GetCount() ; i++ )
|
||||
{
|
||||
if ( GetString( i ).IsSameAs(s, false) )
|
||||
return i ;
|
||||
}
|
||||
return wxNOT_FOUND ;
|
||||
}
|
||||
|
||||
void wxChoice::SetString(int n, const wxString& s)
|
||||
{
|
||||
wxFAIL_MSG(wxT("wxChoice::SetString() not yet implemented"));
|
||||
@@ -192,7 +182,7 @@ void wxChoice::SetString(int n, const wxString& s)
|
||||
|
||||
wxString wxChoice::GetString(int n) const
|
||||
{
|
||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_strings.GetCount(), _T(""),
|
||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_strings.GetCount(), wxEmptyString,
|
||||
_T("wxChoice::GetString(): invalid index") );
|
||||
|
||||
return m_strings[n] ;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox.cpp
|
||||
// Name: src/mac/classic/combobox.cpp
|
||||
// Purpose: wxComboBox class
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@@ -486,9 +486,9 @@ void wxComboBox::SetSelection(int n)
|
||||
}
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
int wxComboBox::FindString(const wxString& s, bool bCase ) const
|
||||
{
|
||||
return m_choice->FindString( s );
|
||||
return m_choice->FindString( s , bCase );
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetString(int n) const
|
||||
@@ -581,4 +581,3 @@ void wxComboBox::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 WXU
|
||||
event.SetString(GetStringSelection());
|
||||
ProcessCommand(event);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listbox.cpp
|
||||
// Name: src/mac/classic/listbox.cpp
|
||||
// Purpose: wxListBox
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@@ -454,9 +454,8 @@ bool wxListBox::HasMultipleSelection() const
|
||||
return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
int wxListBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
|
||||
if ( s.Right(1) == wxT("*") )
|
||||
{
|
||||
wxString search = s.Left( s.Length() - 1 ) ;
|
||||
@@ -468,7 +467,7 @@ int wxListBox::FindString(const wxString& s) const
|
||||
{
|
||||
wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
|
||||
|
||||
if ( EqualString( s1 , s2 , false , false ) )
|
||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||
return i ;
|
||||
}
|
||||
if ( s.Left(1) == wxT("*") && s.Length() > 1 )
|
||||
@@ -493,11 +492,12 @@ int wxListBox::FindString(const wxString& s) const
|
||||
{
|
||||
wxMacStringToPascal( m_stringArray[i] , s1 ) ;
|
||||
|
||||
if ( EqualString( s1 , s2 , false , false ) )
|
||||
if ( EqualString( s1 , s2 , bCase , false ) )
|
||||
return i ;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
void wxListBox::Clear()
|
||||
@@ -689,7 +689,7 @@ void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
||||
class wxListBoxItem : public wxOwnerDrawn
|
||||
{
|
||||
public:
|
||||
wxListBoxItem(const wxString& str = "");
|
||||
wxListBoxItem(const wxString& str = wxEmptyString);
|
||||
};
|
||||
|
||||
wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE)
|
||||
@@ -858,7 +858,6 @@ void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart ,
|
||||
void wxListBox::MacSetRedraw( bool doDraw )
|
||||
{
|
||||
LSetDrawingMode( doDraw , (ListHandle)m_macList ) ;
|
||||
|
||||
}
|
||||
|
||||
void wxListBox::MacDoClick()
|
||||
@@ -1018,4 +1017,3 @@ void wxListBox::OnChar(wxKeyEvent& event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: checklst.cpp
|
||||
// Name: src/motif/checklst.cpp
|
||||
// Purpose: implementation of wxCheckListBox class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -156,10 +156,10 @@ int wxCheckListBox::DoAppend(const wxString& item)
|
||||
return wxListBox::DoAppend( Prefix(false) + item );
|
||||
}
|
||||
|
||||
int wxCheckListBox::FindString(const wxString& s) const
|
||||
int wxCheckListBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
int n1 = wxListBox::FindString(Prefix(false) + s);
|
||||
int n2 = wxListBox::FindString(Prefix(true) + s);
|
||||
int n1 = wxListBox::FindString(Prefix(false) + s, bCase);
|
||||
int n2 = wxListBox::FindString(Prefix(true) + s, bCase);
|
||||
int min = wxMin(n1, n2), max = wxMax(n1, n2);
|
||||
|
||||
// why this works:
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/motif/choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -278,7 +278,7 @@ int wxChoice::GetSelection() const
|
||||
wxXmString freeMe(text);
|
||||
wxString s = wxXmStringToString( text );
|
||||
|
||||
if (!s.IsEmpty())
|
||||
if (!s.empty())
|
||||
{
|
||||
int i = 0;
|
||||
for (wxStringList::compatibility_iterator node = m_stringList.GetFirst ();
|
||||
@@ -329,21 +329,6 @@ void wxChoice::SetSelection(int n)
|
||||
m_inSetValue = false;
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& s) const
|
||||
{
|
||||
int i = 0;
|
||||
for (wxStringList::compatibility_iterator node = m_stringList.GetFirst();
|
||||
node; node = node->GetNext ())
|
||||
{
|
||||
if (s == node->GetData())
|
||||
return i;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
wxString wxChoice::GetString(int n) const
|
||||
{
|
||||
wxStringList::compatibility_iterator node = m_stringList.Item(n);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox.cpp
|
||||
// Name: src/motif/combobox.cpp
|
||||
// Purpose: wxComboBox class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -222,8 +222,10 @@ wxString wxComboBox::GetString(int n) const
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
// FIXME: back to base class for not supported value of bCase
|
||||
|
||||
int *pos_list = NULL;
|
||||
int count = 0;
|
||||
wxXmString text( s );
|
||||
@@ -237,7 +239,7 @@ int wxComboBox::FindString(const wxString& s) const
|
||||
return pos;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
// Clipboard operations
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox_native.cpp
|
||||
// Name: src/motif/combobox_native.cpp
|
||||
// Purpose: wxComboBox class
|
||||
// Author: Julian Smart, Ian Brown
|
||||
// Modified by:
|
||||
@@ -292,8 +292,10 @@ wxString wxComboBox::GetString(int n) const
|
||||
return wxDoGetStringInList( GetXmList(this), n );
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
// FIXME: back to base class for not supported value of bCase
|
||||
|
||||
return wxDoFindStringInList( GetXmList( this ), s );
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listbox.cpp
|
||||
// Name: src/motif/listbox.cpp
|
||||
// Purpose: wxListBox
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -306,8 +306,10 @@ int wxDoFindStringInList(Widget w, const wxString& s)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
int wxListBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
// FIXME: back to base class for not supported value of bCase
|
||||
|
||||
return wxDoFindStringInList( (Widget)m_mainWidget, s );
|
||||
}
|
||||
|
||||
@@ -712,4 +714,3 @@ wxSize wxListBox::DoGetBestSize() const
|
||||
{
|
||||
return wxDoGetListBoxBestSize( (Widget)m_mainWidget, this );
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: radiobox.cpp
|
||||
// Name: src/motif/radiobox.cpp
|
||||
// Purpose: wxRadioBox
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
@@ -192,15 +192,6 @@ void wxRadioBox::SetString(int item, const wxString& label)
|
||||
}
|
||||
}
|
||||
|
||||
int wxRadioBox::FindString(const wxString& s) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
if (s == m_radioButtonLabels[i])
|
||||
return i;
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
void wxRadioBox::SetSelection(int n)
|
||||
{
|
||||
if (!IsValid(n))
|
||||
@@ -434,4 +425,3 @@ void wxRadioBoxCallback (Widget w, XtPointer clientData,
|
||||
event.SetEventObject(item);
|
||||
item->ProcessCommand (event);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/msw/choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: Julian Smart
|
||||
// Modified by: Vadim Zeitlin to derive from wxChoiceBase
|
||||
@@ -331,7 +331,7 @@ int wxChoice::GetCount() const
|
||||
return (int)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0);
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& s) const
|
||||
int wxChoice::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
#if defined(__WATCOMC__) && defined(__WIN386__)
|
||||
// For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message.
|
||||
@@ -340,7 +340,7 @@ int wxChoice::FindString(const wxString& s) const
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
// as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too
|
||||
if ( GetString(i).IsSameAs(s, false) )
|
||||
if ( GetString(i).IsSameAs(s, bCase) )
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -359,6 +359,11 @@ int wxChoice::FindString(const wxString& s) const
|
||||
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
else if (bCase)
|
||||
{
|
||||
// back to base class search for not native search type
|
||||
return wxItemContainerImmutable::FindString( s, bCase );
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT,
|
||||
@@ -675,4 +680,3 @@ WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd)
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__)
|
||||
|
||||
|
@@ -348,8 +348,12 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
||||
InvalidateBestSize();
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
int wxListBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
// back to base class search for not native search type
|
||||
if (bCase)
|
||||
return wxItemContainerImmutable::FindString( s, bCase );
|
||||
|
||||
int pos = ListBox_FindStringExact(GetHwnd(), (WPARAM)-1, s);
|
||||
if (pos == LB_ERR)
|
||||
return wxNOT_FOUND;
|
||||
|
@@ -223,7 +223,7 @@ bool wxChoice::CreateAndInit(wxWindow *parent,
|
||||
if ( style & wxSP_WRAP )
|
||||
spiner_style |= UDS_WRAP;
|
||||
|
||||
if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, _T(""), 0) )
|
||||
if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, wxEmptyString, 0) )
|
||||
return false;
|
||||
|
||||
// subclass the text ctrl to be able to intercept some events
|
||||
@@ -414,8 +414,12 @@ int wxChoice::GetCount() const
|
||||
return (int)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0);
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& s) const
|
||||
int wxChoice::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
// back to base class search for not native search type
|
||||
if (bCase)
|
||||
return wxItemContainerImmutable::FindString( s, bCase );
|
||||
|
||||
int pos = (int)::SendMessage(GetBuddyHwnd(), LB_FINDSTRINGEXACT,
|
||||
(WPARAM)-1, (LPARAM)s.c_str());
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Name: src/os2/choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
@@ -201,35 +201,7 @@ int wxChoice::GetCount() const
|
||||
return((int)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMCOUNT, (MPARAM)0, (MPARAM)0)));
|
||||
} // end of wxChoice::GetCount
|
||||
|
||||
int wxChoice::FindString(
|
||||
const wxString& rsStr
|
||||
) const
|
||||
{
|
||||
int nPos;
|
||||
int nTextLength;
|
||||
PSZ zStr;
|
||||
int nItemCount;
|
||||
|
||||
nItemCount = (int)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMCOUNT, (MPARAM)0, (MPARAM)0));
|
||||
for (nPos = 0; nPos < nItemCount; nPos++)
|
||||
{
|
||||
nTextLength = (int)LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)nPos, (MPARAM)0));
|
||||
zStr = new char[nTextLength + 1];
|
||||
::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT((SHORT)nPos, (SHORT)nTextLength), (MPARAM)zStr);
|
||||
if (rsStr == (wxChar*)zStr)
|
||||
{
|
||||
delete [] zStr;
|
||||
break;
|
||||
}
|
||||
delete [] zStr;
|
||||
}
|
||||
return nPos;
|
||||
} // end of wxChoice::FindString
|
||||
|
||||
void wxChoice::SetString(
|
||||
int n
|
||||
, const wxString& rsStr
|
||||
)
|
||||
void wxChoice::SetString( int n, const wxString& rsStr )
|
||||
{
|
||||
LONG nIndexType = 0;
|
||||
void* pData;
|
||||
@@ -263,9 +235,7 @@ void wxChoice::SetString(
|
||||
}
|
||||
} // end of wxChoice::SetString
|
||||
|
||||
wxString wxChoice::GetString(
|
||||
int n
|
||||
) const
|
||||
wxString wxChoice::GetString(int n) const
|
||||
{
|
||||
int nLen = 0;
|
||||
wxString sStr = wxEmptyString;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listbox.cpp
|
||||
// Name: src/os2/listbox.cpp
|
||||
// Purpose: wxListBox
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
@@ -364,30 +364,6 @@ void wxListBox::DoSetItems(
|
||||
::WinShowWindow(GetHwnd(), TRUE);
|
||||
} // end of wxListBox::DoSetItems
|
||||
|
||||
int wxListBox::FindString(
|
||||
const wxString& rsString
|
||||
) const
|
||||
{
|
||||
int nPos;
|
||||
LONG lTextLength;
|
||||
PSZ zStr;
|
||||
|
||||
|
||||
for (nPos = 0; nPos < m_nNumItems; nPos++)
|
||||
{
|
||||
lTextLength = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)nPos, (MPARAM)0));
|
||||
zStr = new char[lTextLength + 1];
|
||||
::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT(nPos, (SHORT)lTextLength), (MPARAM)zStr);
|
||||
if (rsString == (wxChar*)zStr)
|
||||
{
|
||||
delete [] zStr;
|
||||
break;
|
||||
}
|
||||
delete [] zStr;
|
||||
}
|
||||
return nPos;
|
||||
} // end of wxListBox::FindString
|
||||
|
||||
void wxListBox::Clear()
|
||||
{
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: radiobox.cpp
|
||||
// Name: src/os2/radiobox.cpp
|
||||
// Purpose: wxRadioBox
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
@@ -686,18 +686,6 @@ bool wxRadioBox::Enable(
|
||||
return true;
|
||||
} // end of wxRadioBox::Enable
|
||||
|
||||
int wxRadioBox::FindString(
|
||||
const wxString& rsStr
|
||||
) const
|
||||
{
|
||||
for (int i = 0; i < m_nNoItems; i++)
|
||||
{
|
||||
if (rsStr == wxGetWindowText(m_ahRadioButtons[i]) )
|
||||
return i;
|
||||
}
|
||||
return wxNOT_FOUND;
|
||||
} // end of wxRadioBox::FindString
|
||||
|
||||
int wxRadioBox::GetColumnCount() const
|
||||
{
|
||||
return GetNumHor();
|
||||
@@ -708,9 +696,7 @@ int wxRadioBox::GetCount() const
|
||||
return m_nNoItems;
|
||||
} // end of wxRadioBox::GetCount
|
||||
|
||||
wxString wxRadioBox::GetLabel(
|
||||
int nItem
|
||||
) const
|
||||
wxString wxRadioBox::GetLabel(int nItem) const
|
||||
{
|
||||
wxCHECK_MSG( IsValid(nItem), wxEmptyString, wxT("invalid radiobox index") );
|
||||
|
||||
@@ -1051,9 +1037,7 @@ void wxRadioBox::SetString(
|
||||
::WinSetWindowText((HWND)m_ahRadioButtons[nItem], (PSZ)rsLabel.c_str());
|
||||
} // end of wxRadioBox::SetString
|
||||
|
||||
bool wxRadioBox::SetStringSelection(
|
||||
const wxString& rsStr
|
||||
)
|
||||
bool wxRadioBox::SetStringSelection(const wxString& rsStr)
|
||||
{
|
||||
int nSel = FindString(rsStr);
|
||||
|
||||
|
@@ -193,11 +193,6 @@ int wxChoice::GetCount() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& s) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxChoice::SetString(int n, const wxString& s)
|
||||
{
|
||||
}
|
||||
|
@@ -190,11 +190,6 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
||||
{
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
{
|
||||
return wxNOT_FOUND;
|
||||
}
|
||||
|
||||
void wxListBox::Clear()
|
||||
{
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: univ/combobox.cpp
|
||||
// Name: src/univ/combobox.cpp
|
||||
// Purpose: wxComboControl and wxComboBox implementation
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
@@ -825,9 +825,9 @@ void wxComboBox::SetString(int n, const wxString& s)
|
||||
GetLBox()->SetString(n, s);
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
||||
{
|
||||
return GetLBox()->FindString(s);
|
||||
return GetLBox()->FindString(s, bCase);
|
||||
}
|
||||
|
||||
void wxComboBox::SetSelection(int n)
|
||||
|
Reference in New Issue
Block a user