X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4a11fe85cb632368ba8426204598806460b7679..3863c5ebd92650ba88f29db4f5f8d794ec11bf80:/src/mac/carbon/listbox.cpp diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index fb80168fcc..ee803cb958 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -82,6 +82,7 @@ bool wxListBox::Create( return false; wxMacDataBrowserListControl* control = new wxMacDataBrowserListControl( this, pos, size, style ); + // TODO CHECK control->SetClientDataType( m_clientDataItemsType ); m_peer = control; MacPostControlCreate( pos, size ); @@ -217,52 +218,17 @@ wxSize wxListBox::DoGetBestSize() const int wLine; { -#if wxMAC_USE_CORE_GRAPHICS wxClientDC dc(const_cast(this)); dc.SetFont(GetFont()); -#else - wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef)MacGetTopLevelWindowRef() ) ); - // TODO: clean this up - if ( m_font.Ok() ) - { - ::TextFont( m_font.MacGetFontNum() ); - ::TextSize( m_font.MacGetFontSize() ); - ::TextFace( m_font.MacGetFontStyle() ); - } - else - { - ::TextFont( kFontIDMonaco ); - ::TextSize( 9 ); - ::TextFace( 0 ); - } -#endif // Find the widest line for (unsigned int i = 0; i < GetCount(); i++) { wxString str( GetString( i ) ); -#if wxMAC_USE_CORE_GRAPHICS + wxCoord width, height ; dc.GetTextExtent( str , &width, &height); wLine = width ; -#else -#if wxUSE_UNICODE - Point bounds = {0, 0}; - SInt16 baseline; - - // NB: what if m_font.Ok() == false ??? - ::GetThemeTextDimensions( - wxMacCFStringHolder( str, m_font.GetEncoding() ), - kThemeCurrentPortFont, - kThemeStateActive, - false, - &bounds, - &baseline ); - wLine = bounds.h; -#else - wLine = ::TextWidth( str.c_str(), 0, str.length() ); -#endif -#endif lbWidth = wxMax( lbWidth, wLine ); } @@ -271,13 +237,10 @@ wxSize wxListBox::DoGetBestSize() const // And just a bit more int cy = 12; -#if wxMAC_USE_CORE_GRAPHICS + wxCoord width, height ; dc.GetTextExtent( wxT("XX") , &width, &height); int cx = width ; -#else - int cx = ::TextWidth( "XX", 0, 1 ); -#endif lbWidth += cx; // don't make the listbox too tall (limit height to around 10 items) @@ -325,12 +288,6 @@ int wxListBox::DoListHitTest(const wxPoint& inpoint) const wxPoint point = inpoint; - // interestingly enough 10.2 (and below?) have GetDataBrowserItemPartBounds - // giving root window coordinates but 10.3 and above give client coordinates - // so we only compare using root window coordinates on 10.3 and up - if ( UMAGetSystemVersion() < 0x1030 ) - MacClientToRootWindow(&point.x, &point.y); - // get column property ID (req. for call to itempartbounds) DataBrowserTableViewColumnID colId = 0; err = GetDataBrowserTableViewColumnProperty(m_peer->GetControlRef(), 0, &colId); @@ -435,7 +392,7 @@ wxMacListBoxItem::~wxMacListBoxItem() void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner , DataBrowserItemNotification message, - DataBrowserItemDataRef itemData ) const + DataBrowserItemDataRef WXUNUSED(itemData) ) const { wxMacDataBrowserListControl *lb = wxDynamicCast(owner,wxMacDataBrowserListControl); @@ -490,7 +447,7 @@ void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner , // direct notification is not always having the listbox GetSelection() // having in synch with event, so use wxPostEvent instead - // list->GetEventHandler()->ProcessEvent(event); + // list->HandleWindowEvent(event); wxPostEvent( list->GetEventHandler(), event ); } @@ -541,9 +498,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const columnDesc.propertyDesc.propertyID = kTextColumnId; columnDesc.propertyDesc.propertyType = kDataBrowserTextType; columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn; -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; -#endif verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) ); @@ -552,9 +507,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const columnDesc.propertyDesc.propertyID = kNumericOrderColumnId; columnDesc.propertyDesc.propertyType = kDataBrowserPropertyRelevanceRankPart; columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn; -#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; -#endif verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) ); @@ -622,8 +575,7 @@ static pascal void ListBoxDrawProc( // TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor // is incorporated Panther DB starts using kThemeBrushSecondaryHighlightColor // for inactive browser highlighting - Gestalt( gestaltSystemVersion, &systemVersion ); - if ( (systemVersion >= 0x00001030) && !IsControlActive( browser ) ) + if ( !IsControlActive( browser ) ) colorBrushID = kThemeBrushSecondaryHighlightColor; else colorBrushID = kThemeBrushPrimaryHighlightColor;