X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/143d08f8f4b6281412c03a3fc5a993089fc966b9..04633c190f5a6eafe607a5712647aaa131522b1f:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index e50c2f4405..ae36062d4b 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 @@ -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,12 +709,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 +781,8 @@ void wxListBox::MacDoDoubleClick() */ } +#if !TARGET_API_MAC_OSX + void wxListBox::OnChar(wxKeyEvent& event) { // todo trigger proper events here @@ -882,3 +891,5 @@ void wxListBox::OnChar(wxKeyEvent& event) } } +#endif +