mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 17:02:51 +08:00
Implement subitem for wxGenericListCtrl::HitTest()
This commit is contained in:
@@ -905,9 +905,10 @@ public:
|
||||
|
||||
If @a ptrSubItem is not @NULL and the wxListCtrl is in the report
|
||||
mode the subitem (or column) number will also be provided.
|
||||
This feature is only available in version 2.7.0 or higher and is currently only
|
||||
implemented under wxMSW and requires at least comctl32.dll of version 4.70 on
|
||||
the host system or the value stored in @a ptrSubItem will be always -1.
|
||||
This feature is available since version 3.2.7 in the generic control;
|
||||
in earlier versions the value stored in @a ptrSubItem will be always -1.
|
||||
Under wxMSW, the feature is available since version 2.7.0, and requires
|
||||
at least comctl32.dll of version 4.70 on the host system.
|
||||
To compile this feature into wxWidgets library you need to have access to
|
||||
commctrl.h of version 4.70 that is provided by Microsoft.
|
||||
|
||||
|
||||
@@ -5482,9 +5482,26 @@ long wxGenericListCtrl::FindItem( long WXUNUSED(start), const wxPoint& pt,
|
||||
|
||||
long wxGenericListCtrl::HitTest(const wxPoint& point, int& flags, long *col) const
|
||||
{
|
||||
// TODO: sub item hit testing
|
||||
if ( col )
|
||||
{
|
||||
*col = -1;
|
||||
if ( InReportView() )
|
||||
{
|
||||
const wxPoint unscrolled = CalcUnscrolledPosition( point );
|
||||
|
||||
for ( int c = 0, wsum = 0, cols = GetColumnCount();
|
||||
c < cols;
|
||||
++c )
|
||||
{
|
||||
wsum += GetColumnWidth(c);
|
||||
if ( wsum > unscrolled.x )
|
||||
{
|
||||
*col = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_mainWin->HitTest( (int)point.x, (int)point.y, flags );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user