From: Stephan <ste...@us...> - 2006-09-09 19:19:53
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24860 Modified Files: WidgetDataGrid.h Log Message: Add setItemIcon function Index: WidgetDataGrid.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetDataGrid.h,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- WidgetDataGrid.h 22 Jul 2006 02:29:24 -0000 1.36 +++ WidgetDataGrid.h 9 Sep 2006 19:19:49 -0000 1.37 @@ -583,6 +583,11 @@ */ void setCellText( unsigned column, unsigned row, const SmartUtil::tstring & newVal ); + /// Change the current icon of an item + /** Sets a new icon for a given item + */ + void setItemIcon( unsigned row, int newIconIndex ); + /// Returns a boolean indicating if the Grid is in "read only" mode or not /** If the return value is true the Grid is in "read only" mode and cannot be * updated ( except programmatically ) <br> @@ -1254,6 +1259,29 @@ } template< class EventHandlerClass, class MessageMapPolicy > +void WidgetDataGrid< EventHandlerClass, MessageMapPolicy >::setItemIcon( unsigned row, int newIconIndex ) +{ + LVITEM it; + ZeroMemory( & it, sizeof( LVITEM ) ); + it.iItem = row; + it.mask = LVIF_IMAGE; + //Get item + if(ListView_GetItem( this->Widget::itsHandle, &it) != TRUE) + { + xCeption err( _T( "Something went wrong while trying to receive the selected item of the ListView" ) ); + throw err; + } + //Modify item + it.iImage = newIconIndex; + //Set item + if(ListView_SetItem( this->Widget::itsHandle, &it) != TRUE) + { + xCeption err( _T( "Something went wrong while trying to change the selected item of the ListView" ) ); + throw err; + } +} + +template< class EventHandlerClass, class MessageMapPolicy > bool WidgetDataGrid< EventHandlerClass, MessageMapPolicy >::getReadOnly() { return isReadOnly; |