Implement case-insensitive find and read only support for Cocoa combobox.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63484 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -137,11 +137,13 @@ wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxWindowMac* wxpeer,
|
|||||||
wxMenu* menu,
|
wxMenu* menu,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long WXUNUSED(style),
|
long style,
|
||||||
long WXUNUSED(extraStyle))
|
long WXUNUSED(extraStyle))
|
||||||
{
|
{
|
||||||
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
|
||||||
wxNSComboBox* v = [[wxNSComboBox alloc] initWithFrame:r];
|
wxNSComboBox* v = [[wxNSComboBox alloc] initWithFrame:r];
|
||||||
|
if (style & wxCB_READONLY)
|
||||||
|
[v setEditable:NO];
|
||||||
wxNSComboBoxControl* c = new wxNSComboBoxControl( wxpeer, v );
|
wxNSComboBoxControl* c = new wxNSComboBoxControl( wxpeer, v );
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@@ -63,9 +63,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
|
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxASSERT_MSG( !(style & wxCB_READONLY),
|
|
||||||
"wxCB_READONLY not supported, use wxChoice instead" );
|
|
||||||
|
|
||||||
wxASSERT_MSG( !(style & wxCB_SORT),
|
wxASSERT_MSG( !(style & wxCB_SORT),
|
||||||
"wxCB_SORT not currently supported by wxOSX/Cocoa");
|
"wxCB_SORT not currently supported by wxOSX/Cocoa");
|
||||||
|
|
||||||
@@ -173,8 +170,15 @@ void wxComboBox::SetSelection(long from, long to)
|
|||||||
|
|
||||||
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(bCase, "wxComboBox::FindString() doesn't currently support case "
|
if (!bCase)
|
||||||
"insensitive search in wxOSX/Cocoa");
|
{
|
||||||
|
for (int i = 0; i < GetCount(); i++)
|
||||||
|
{
|
||||||
|
if (s.IsSameAs(GetString(i), false))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return wxNOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
return GetComboPeer()->FindString(s);
|
return GetComboPeer()->FindString(s);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user