Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12251/include/smartwin/widgets
Modified Files:
WidgetMenu.h WidgetMenuExtended.h WidgetTextBox.h
Log Message:
Added setText to WidgetMenu and setItemText WidgetMenuExtended
Fixed some mingw issues with WidgetTextBox
Index: WidgetMenuExtended.h
===================================================================
RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetMenuExtended.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- WidgetMenuExtended.h 3 Nov 2006 13:30:21 -0000 1.43
+++ WidgetMenuExtended.h 8 Dec 2006 22:15:55 -0000 1.44
@@ -1088,6 +1088,9 @@
/// Returns item text
SmartUtil::tstring getItemText( unsigned itemID );
+ /// Sets item text
+ void setItemText( unsigned itemID, SmartUtil::tstring text );
+
/// Sets color information for the menu
/** The MenuColorInfo declares which colors will be used for drawing the menu (
* items ) <br>
@@ -1494,6 +1497,21 @@
}
template< class EventHandlerClass, class MessageMapPolicy >
+void WidgetMenuExtended< EventHandlerClass, MessageMapPolicy >::setItemText( unsigned itemID, SmartUtil::tstring text )
+{
+ MENUITEMINFO info;
+ memset( & info, 0, sizeof( MENUITEMINFO ) );
+ info.cbSize = sizeof( MENUITEMINFO );
+
+ // set flag
+ info.fMask = MIIM_STRING;
+ info.dwTypeData = (TCHAR*) text.c_str();
+
+ if ( ::SetMenuItemInfo( reinterpret_cast< HMENU >( this->Widget::itsHandle ), itemID, FALSE, & info ) == FALSE )
+ throw xCeption( _T( "Couldn't set item info in setItemText()" ) );
+}
+
+template< class EventHandlerClass, class MessageMapPolicy >
void WidgetMenuExtended< EventHandlerClass, MessageMapPolicy >::setTitle( const SmartUtil::tstring & title, bool drawSidebar /* = false */)
{
this->drawSidebar = drawSidebar;
Index: WidgetTextBox.h
===================================================================
RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetTextBox.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- WidgetTextBox.h 7 Dec 2006 13:45:12 -0000 1.36
+++ WidgetTextBox.h 8 Dec 2006 22:15:56 -0000 1.37
@@ -364,7 +364,7 @@
template< class EventHandlerClass, class MessageMapPolicy, class TextBoxType >
void WidgetTextBox< EventHandlerClass, MessageMapPolicy, TextBoxType >::addText( const SmartUtil::tstring & addtxt )
{
- setSelection( ( long ) getText().size() );
+ setSelection( ( long ) this->getText().size() );
replaceSelection( addtxt );
}
@@ -372,8 +372,8 @@
template< class EventHandlerClass, class MessageMapPolicy, class TextBoxType >
void WidgetTextBox< EventHandlerClass, MessageMapPolicy, TextBoxType >::addTextLines( const SmartUtil::tstring & addtxt )
{
- setSelection( ( long ) getText().size() );
- replaceSelection( replaceEndlWithLfCr( addtxt ) );
+ setSelection( ( long ) this->getText().size() );
+ replaceSelection( this->replaceEndlWithLfCr( addtxt ) );
}
Index: WidgetMenu.h
===================================================================
RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetMenu.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- WidgetMenu.h 30 Nov 2006 00:42:36 -0000 1.30
+++ WidgetMenu.h 8 Dec 2006 22:15:55 -0000 1.31
@@ -400,6 +400,12 @@
*/
SmartUtil::tstring getText( unsigned id );
+ /// Sets the text of a specific menu item
+ /** Which menu item you wish to set the text is defined by the "id"
+ * parameter of the function.
+ */
+ void setText( unsigned id, SmartUtil::tstring text );
+
/// Checks (or uncheck) a specific menu item
/** Which menu item you wish to check ( or uncheck ) is passed in as the "id"
* parameter. <br>
@@ -614,6 +620,21 @@
}
template< class EventHandlerClass, class MessageMapPolicy >
+void WidgetMenu< EventHandlerClass, MessageMapPolicy >::setText( unsigned id, SmartUtil::tstring text )
+{
+ MENUITEMINFO info;
+ memset( & info, 0, sizeof( MENUITEMINFO ) );
+ info.cbSize = sizeof( MENUITEMINFO );
+
+ // set flag
+ info.fMask = MIIM_STRING;
+ info.dwTypeData = (TCHAR*) text.c_str();
+
+ if ( ::SetMenuItemInfo( reinterpret_cast< HMENU >( this->Widget::itsHandle ), id, FALSE, & info ) == FALSE )
+ throw xCeption( _T( "Couldn't set item info in setItemText()" ) );
+}
+
+template< class EventHandlerClass, class MessageMapPolicy >
void WidgetMenu< EventHandlerClass, MessageMapPolicy >::checkItem( unsigned id, bool value )
{
HMENU handle = reinterpret_cast< HMENU >( this->Widget::itsHandle );
|