X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad0023978e7a61369f3180241f217df283308388..3b5d20079c81e0106b3dead7cd8d7337bf3f36f4:/src/mac/carbon/listbox.cpp?ds=sidebyside diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index 69027b5391..54717cfb18 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -58,7 +58,8 @@ bool wxListBox::Create( wxMacListControl* wxListBox::GetPeer() const { - return dynamic_cast(m_peer); + wxMacDataBrowserListControl *lb = wxDynamicCast(m_peer,wxMacDataBrowserListControl); + return lb ? wx_static_cast(wxMacListControl*,lb) : 0 ; } bool wxListBox::Create( @@ -89,7 +90,7 @@ bool wxListBox::Create( InsertItems( n, choices, 0 ); // Needed because it is a wxControlWithItems - SetBestSize( size ); + SetInitialSize( size ); return true; } @@ -245,6 +246,7 @@ wxSize wxListBox::DoGetBestSize() const { #if wxMAC_USE_CORE_GRAPHICS wxClientDC dc(const_cast(this)); + dc.SetFont(GetFont()); #else wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef)MacGetTopLevelWindowRef() ) ); @@ -287,9 +289,8 @@ wxSize wxListBox::DoGetBestSize() const #else wLine = ::TextWidth( str.c_str(), 0, str.length() ); #endif - - lbWidth = wxMax( lbWidth, wLine ); #endif + lbWidth = wxMax( lbWidth, wLine ); } // Add room for the scrollbar @@ -299,10 +300,10 @@ wxSize wxListBox::DoGetBestSize() const int cy = 12; #if wxMAC_USE_CORE_GRAPHICS wxCoord width, height ; - dc.GetTextExtent( wxT("X") , &width, &height); + dc.GetTextExtent( wxT("XX") , &width, &height); int cx = width ; #else - int cx = ::TextWidth( "X", 0, 1 ); + int cx = ::TextWidth( "XX", 0, 1 ); #endif lbWidth += cx; @@ -463,7 +464,7 @@ void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner , DataBrowserItemNotification message, DataBrowserItemDataRef itemData ) const { - wxMacDataBrowserListControl *lb = dynamic_cast(owner); + wxMacDataBrowserListControl *lb = wxDynamicCast(owner,wxMacDataBrowserListControl); // we want to depend on as little as possible to make sure tear-down of controls is safe @@ -522,6 +523,8 @@ void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner , } } +IMPLEMENT_DYNAMIC_CLASS( wxMacDataBrowserListControl , wxMacDataItemBrowserControl ) + wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style) : wxMacDataItemBrowserControl( peer, pos, size, style ) { @@ -537,7 +540,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const } else if ( style & wxLB_EXTENDED ) { - // default behaviour + options |= kDataBrowserCmdTogglesSelection; } else {