/////////////////////////////////////////////////////////////////////////////
-// Name: combobox.cpp
+// Name: src/mac/carbon/combobox.cpp
// Purpose: wxComboBox class
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "combobox.h"
-#endif
-
#include "wx/wxprec.h"
#include "wx/combobox.h"
#endif
#endif
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
-#endif
// composite combobox implementation by Dan "Bud" Keith bud@otsys.com
event.SetEventObject(def);
def->Command(event);
return ;
- }
+ }
}
return;
};
BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice)
- EVT_CHOICE(-1, wxComboBoxChoice::OnChoice)
+ EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice)
END_EVENT_TABLE()
wxComboBox::~wxComboBox()
{
// we might not be fully constructed yet, therefore watch out...
if ( m_choice )
- m_choice->SetSize(0, 0 , width, -1);
+ m_choice->SetSize(0, 0 , width, wxDefaultCoord);
}
else
{
wxCoord wText = width - POPUPWIDTH - MARGIN;
m_text->SetSize(0, 0, wText, height);
- m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, -1);
+ m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, wxDefaultCoord);
}
#endif
}
else
{
m_text = new wxComboBoxText(this);
- if ( size.y == -1 ) {
+ if ( size.y == wxDefaultCoord ) {
csize.y = m_text->GetSize().y ;
}
}
#endif
}
-int wxComboBox::DoInsert(const wxString& item, int pos)
+int wxComboBox::DoInsert(const wxString& item, unsigned int pos)
{
#if USE_HICOMBOBOX
HIComboBoxInsertTextItemAtIndex( *m_peer, (CFIndex)pos, wxMacCFStringHolder(item, m_font.GetEncoding()) );
#endif
}
-void wxComboBox::DoSetItemClientData(int n, void* clientData)
+void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
{
#if USE_HICOMBOBOX
return; //TODO
#endif
}
-void* wxComboBox::DoGetItemClientData(int n) const
+void* wxComboBox::DoGetItemClientData(unsigned int n) const
{
#if USE_HICOMBOBOX
return NULL; //TODO
#endif
}
-void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData)
+void wxComboBox::DoSetItemClientObject(unsigned int n, wxClientData* clientData)
{
#if USE_HICOMBOBOX
return; //TODO
#endif
}
-wxClientData* wxComboBox::DoGetItemClientObject(int n) const
+wxClientData* wxComboBox::DoGetItemClientObject(unsigned int n) const
{
#if USE_HICOMBOBOX
return NULL;
void wxComboBox::FreeData()
{
- if ( HasClientObjectData() )
+ if (HasClientObjectData())
{
- size_t count = GetCount();
- for ( size_t n = 0; n < count; n++ )
+ unsigned int count = GetCount();
+ for ( unsigned int n = 0; n < count; n++ )
{
SetClientObject( n, NULL );
}
}
}
-int wxComboBox::GetCount() const {
+unsigned int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX
- return (int) HIComboBoxGetItemCount( *m_peer );
+ return (unsigned int) HIComboBoxGetItemCount( *m_peer );
#else
return m_choice->GetCount() ;
#endif
}
-void wxComboBox::Delete(int n)
+void wxComboBox::Delete(unsigned int n)
{
#if USE_HICOMBOBOX
HIComboBoxRemoveItemAtIndex( *m_peer, (CFIndex)n );
if ( m_text != NULL )
{
- m_text->SetValue( GetString( n ) );
+ m_text->SetValue(GetString(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++ )
+ for( unsigned 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
}
-wxString wxComboBox::GetString(int n) const
+wxString wxComboBox::GetString(unsigned int n) const
{
#if USE_HICOMBOBOX
CFStringRef itemText;
return wxMacCFStringHolder(m_peer->GetData<CFStringRef>(kHIComboBoxEditTextPart,kControlEditTextCFStringTag)).AsString() ;
#else
int sel = GetSelection ();
- if (sel > -1)
- return wxString(this->GetString (sel));
+ if (sel != wxNOT_FOUND)
+ return wxString(this->GetString((unsigned int)sel));
else
return wxEmptyString;
#endif
}
-void wxComboBox::SetString(int n, const wxString& s)
+void wxComboBox::SetString(unsigned int n, const wxString& s)
{
#if USE_HICOMBOBOX
verify_noerr ( HIComboBoxInsertTextItemAtIndex( *m_peer, (CFIndex) n,
ProcessCommand(event);
return noErr ;
}
-