X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7cd7bc23d574ea5ec62f1abea73eb363a9ea8126..4e1fd51de7349097a30b3b994e5c6e9b074de77c:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index faf519d08a..54717cfb18 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -16,15 +16,12 @@ #include "wx/listbox.h" #ifndef WX_PRECOMP - #include "wx/dynarray.h" #include "wx/log.h" #include "wx/intl.h" - #include "wx/app.h" #include "wx/utils.h" - #include "wx/button.h" #include "wx/settings.h" #include "wx/arrstr.h" - #include "wx/toplevel.h" + #include "wx/dcclient.h" #endif IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) @@ -33,7 +30,6 @@ BEGIN_EVENT_TABLE(wxListBox, wxControl) END_EVENT_TABLE() #include "wx/mac/uma.h" -#include "wx/dynarray.h" // ============================================================================ // list box control implementation @@ -62,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( @@ -93,7 +90,7 @@ bool wxListBox::Create( InsertItems( n, choices, 0 ); // Needed because it is a wxControlWithItems - SetBestSize( size ); + SetInitialSize( size ); return true; } @@ -249,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() ) ); @@ -291,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 @@ -303,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; @@ -467,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 @@ -526,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 ) { @@ -541,7 +540,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const } else if ( style & wxLB_EXTENDED ) { - // default behaviour + options |= kDataBrowserCmdTogglesSelection; } else {