return control;
}
-int wxListBox::DoListHitTest(const wxPoint& inpoint) const
+int wxMacDataBrowserListControl::DoListHitTest(const wxPoint& inpoint) const
{
OSStatus err;
// get column property ID (req. for call to itempartbounds)
DataBrowserTableViewColumnID colId = 0;
- err = GetDataBrowserTableViewColumnProperty(m_peer->GetControlRef(), 0, &colId);
+ err = GetDataBrowserTableViewColumnProperty(GetControlRef(), 0, &colId);
wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewColumnProperty"));
// OK, first we need to find the first visible item we have -
// until we find a visible item, but we can do a cheap calculation
// via the row height to speed things up a bit
UInt32 scrollx, scrolly;
- err = GetDataBrowserScrollPosition(m_peer->GetControlRef(), &scrollx, &scrolly);
+ err = GetDataBrowserScrollPosition(GetControlRef(), &scrollx, &scrolly);
wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserScrollPosition"));
UInt16 height;
- err = GetDataBrowserTableViewRowHeight(m_peer->GetControlRef(), &height);
+ err = GetDataBrowserTableViewRowHeight(GetControlRef(), &height);
wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewRowHeight"));
+ wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox );
+
// these indices are 0-based, as usual, so we need to add 1 to them when
// passing them to data browser functions which use 1-based indices
int low = scrolly / height,
- high = GetCount() - 1;
+ high = list->GetCount() - 1;
// search for the first visible item (note that the scroll guess above
// is the low bounds of where the item might lie so we only use that as a
{
Rect bounds;
err = GetDataBrowserItemPartBounds(
- m_peer->GetControlRef(), low + 1, colId,
+ GetControlRef(), low + 1, colId,
kDataBrowserPropertyEnclosingPart,
&bounds); // note +1 to translate to Mac ID
if ( err == noErr )
Rect bounds;
err = GetDataBrowserItemPartBounds(
- m_peer->GetControlRef(), mid + 1, colId,
+ GetControlRef(), mid + 1, colId,
kDataBrowserPropertyEnclosingPart,
&bounds); //note +1 to trans to mac id
wxCHECK_MSG( err == noErr || err == errDataBrowserItemNotFound,
}
if ( point.y < bounds.top )
- // index(bounds) greater then key(point)
+ // index(bounds) greater than key(point)
high = mid - 1;
else
- // index(bounds) less then key(point)
+ // index(bounds) less than key(point)
low = mid + 1;
}
}
err = SetHasScrollBars( (style & wxHSCROLL) != 0 , true );
#if 0
// shouldn't be necessary anymore under 10.2
- m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean)false );
- m_peer->SetNeedsFocusRect( true );
+ GetPeer()->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean)false );
+ GetPeer()->SetNeedsFocusRect( true );
#endif
}
// TODO: Why is m_font not defined when we enter wxLC_LIST mode, but is
// defined for other modes?
wxFontEncoding enc;
- if ( m_font.Ok() )
+ if ( m_font.IsOk() )
enc = m_font.GetEncoding();
else
enc = wxLocale::GetSystemEncoding();