X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/469d8d5dbbb7511033189562b10c14644554530e..3c5487b14442ddbc6e43ee2f4475b5a6ba251fb1:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index b6d64e7087..50e9f4445f 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -27,7 +27,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) BEGIN_EVENT_TABLE(wxListBox, wxControl) -#if !TARGET_API_MAC_OSX +#if !__WXMAC_OSX__ EVT_SIZE( wxListBox::OnSize ) EVT_CHAR( wxListBox::OnChar ) #endif @@ -36,6 +36,8 @@ END_EVENT_TABLE() #include "wx/mac/uma.h" +const short kTextColumnId = 1024 ; + // new databrowserbased version // Listbox item @@ -104,7 +106,9 @@ static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrow event.SetString( list->GetString(i) ); event.SetInt(i) ; event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : TRUE ); - list->GetEventHandler()->ProcessEvent(event) ; + wxPostEvent( list->GetEventHandler() , event ) ; + // direct notification is not always having the listbox GetSelection() having in synch with event + // list->GetEventHandler()->ProcessEvent(event) ; } break ; } @@ -123,7 +127,7 @@ static pascal OSStatus ListBoxGetSetItemData(ControlRef browser, switch (property) { - case 1024: + case kTextColumnId: { long ref = GetControlReference( browser ) ; if ( ref ) @@ -208,7 +212,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 +250,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, Append( choices[i] ) ; } + SetBestSize(size); // Needed because it is a wxControlWithItems + return TRUE; } @@ -705,12 +711,15 @@ 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 ) ) ; } +#if !TARGET_API_MAC_OSX void wxListBox::OnSize( wxSizeEvent &event) { } +#endif void wxListBox::MacSetRedraw( bool doDraw ) { @@ -774,6 +783,8 @@ void wxListBox::MacDoDoubleClick() */ } +#if !TARGET_API_MAC_OSX + void wxListBox::OnChar(wxKeyEvent& event) { // todo trigger proper events here @@ -882,3 +893,5 @@ void wxListBox::OnChar(wxKeyEvent& event) } } +#endif +