X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/143d08f8f4b6281412c03a3fc5a993089fc966b9..5f254b1f3cf48ea4483aa9a728d1addb0b1f1e23:/src/mac/carbon/listbox.cpp?ds=inline diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index e50c2f4405..39304e0c31 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -36,6 +36,8 @@ END_EVENT_TABLE() #include "wx/mac/uma.h" +const short kTextColumnId = 1024 ; + // new databrowserbased version // Listbox item @@ -71,7 +73,7 @@ static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrow long ref = GetControlReference( browser ) ; if ( ref ) { - wxListBox* list = wxDynamicCast( ref , wxListBox ) ; + wxListBox* list = wxDynamicCast( (wxObject*) ref , wxListBox ) ; for ( size_t i = 0 ; i < list->m_idArray.GetCount() ; ++i ) if ( list->m_idArray[i] == (long) itemID ) { @@ -123,12 +125,12 @@ static pascal OSStatus ListBoxGetSetItemData(ControlRef browser, switch (property) { - case 1024: + case kTextColumnId: { long ref = GetControlReference( browser ) ; if ( ref ) { - wxListBox* list = wxDynamicCast( ref , wxListBox ) ; + wxListBox* list = wxDynamicCast( (wxObject*) ref , wxListBox ) ; for ( size_t i = 0 ; i < list->m_idArray.GetCount() ; ++i ) if ( list->m_idArray[i] == (long) itemID ) { @@ -208,7 +210,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, columnDesc.headerBtnDesc.btnFontStyle.style = normal; columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" ); - columnDesc.propertyDesc.propertyID = 1024; + columnDesc.propertyDesc.propertyID = kTextColumnId; columnDesc.propertyDesc.propertyType = kDataBrowserTextType; columnDesc.propertyDesc.propertyFlags = #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 @@ -246,6 +248,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, Append( choices[i] ) ; } + SetBestSize(size); // Needed because it is a wxControlWithItems + return TRUE; } @@ -705,7 +709,8 @@ void wxListBox::MacSet( int n , const wxString& text ) void wxListBox::MacScrollTo( int n ) { - // TODO implement scrolling + UInt32 id = m_idArray[n] ; + verify_noerr( ::RevealDataBrowserItem((ControlRef) m_macControl , id , kTextColumnId , kDataBrowserRevealWithoutSelecting ) ) ; } void wxListBox::OnSize( wxSizeEvent &event)