X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e75491071dbefcada61175e3eb89ce4edf335983..15b83243e809f9bca9516fad201f40dff40a80e6:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 3b9c54ce77..ae89e0bcab 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -21,13 +21,11 @@ #include "wx/utils.h" #include "extldef.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) BEGIN_EVENT_TABLE(wxListBox, wxControl) EVT_SIZE( wxListBox::OnSize ) END_EVENT_TABLE() -#endif #include @@ -156,7 +154,6 @@ void wxListBox::Delete(int N) m_noItems --; MacDelete( N ) ; - SetHorizontalExtent(""); } int wxListBox::DoAppend(const wxString& item) @@ -171,8 +168,6 @@ int wxListBox::DoAppend(const wxString& item) m_noItems ++; MacAppend( item ) ; - SetHorizontalExtent(item); - return index ; } @@ -260,7 +255,6 @@ void wxListBox::Clear() m_stringArray.Empty() ; m_dataArray.Empty() ; MacClear() ; - SetHorizontalExtent(); } void wxListBox::SetSelection(int N, bool select) @@ -286,6 +280,11 @@ void *wxListBox::DoGetItemClientData(int N) const return (void *)m_dataArray[N]; } +wxClientData *wxListBox::DoGetItemClientObject(int N) const +{ + return (wxClientData *) DoGetItemClientData( N ) ; +} + void wxListBox::DoSetItemClientData(int N, void *Client_data) { wxCHECK_RET( N >= 0 && N < m_noItems, @@ -375,6 +374,37 @@ wxSize wxListBox::DoGetBestSize() return wxSize(100, 100); } +int wxListBox::GetCount() const +{ + return m_noItems; +} + +void wxListBox::SetupColours() +{ + SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW)); + SetForegroundColour(GetParent()->GetForegroundColour()); +} + +#if wxUSE_OWNER_DRAWN + +class wxListBoxItem : public wxOwnerDrawn +{ +public: + wxListBoxItem(const wxString& str = ""); +}; + +wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE) +{ + // no bitmaps/checkmarks + SetMarginWidth(0); +} + +wxOwnerDrawn *wxListBox::CreateItem(size_t n) +{ + return new wxListBoxItem(); +} + +#endif //USE_OWNER_DRAWN // ============================================================================ // list box control implementation @@ -530,8 +560,8 @@ void wxListBox::MacDoClick() int n, count = GetSelections(aSelections); if ( count > 0 ) { - event.m_commandInt = aSelections[0] ; - if ( HasClientObjectData() ) + n = aSelections[0]; + if ( HasClientObjectData() ) event.SetClientObject( GetClientObject(n) ); else if ( HasClientUntypedData() ) event.SetClientData( GetClientData(n) );