Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv10186/include/smartwin/widgets
Modified Files:
WidgetDataGrid.h
Log Message:
Add getSubItemHit so that the cell of a 2D dataGrid can be found from a mouse position.
Index: WidgetDataGrid.h
===================================================================
RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetDataGrid.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- WidgetDataGrid.h 11 Dec 2006 23:54:03 -0000 1.38
+++ WidgetDataGrid.h 18 Mar 2007 23:18:52 -0000 1.39
@@ -628,6 +628,16 @@
*/
SmartUtil::tstring getColumnName( unsigned col );
+
+ /// Returns the cell of the item from the mouse position.
+ /** pos has the mouse position.
+ * ret.x has the column, ret.y has the row. both starting at 0.
+ * If either return is -1, then the pos was not in a cell.
+ */
+ SmartWin::Point getSubItemHit( SmartWin::Point pos );
+
+
+
/// Returns the checked state of the given row
/** A list view can have checkboxes in each row, if the checkbox for the given
* row is CHECKED this funtion returns true.
@@ -1330,6 +1340,21 @@
return colInfo.pszText;
}
+
+
+template< class EventHandlerClass, class MessageMapPolicy >
+SmartWin::Point WidgetDataGrid< EventHandlerClass, MessageMapPolicy >::getSubItemHit( SmartWin::Point pos )
+{
+ LVHITTESTINFO info;
+ info.pt.x = pos.x; info.pt.y = pos.y;
+ ListView_SubItemHitTest( this->Widget::itsHandle, & info );
+
+ SmartWin::Point retval( info.iSubItem, info.iItem );
+ return retval;
+}
+
+
+
template< class EventHandlerClass, class MessageMapPolicy >
bool WidgetDataGrid< EventHandlerClass, MessageMapPolicy >::getIsRowChecked( unsigned row )
{
|