You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1041) |
Sep
(746) |
Oct
(46) |
Nov
(89) |
Dec
(117) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(21) |
Feb
(236) |
Mar
(316) |
Apr
(166) |
May
(114) |
Jun
(18) |
Jul
(23) |
Aug
(10) |
Sep
(35) |
Oct
(8) |
Nov
(44) |
Dec
(54) |
| 2007 |
Jan
(7) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
|
Jun
(78) |
Jul
(9) |
Aug
(12) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: andrew7 <bd...@us...> - 2006-11-30 00:42:41
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv20958/include/smartwin/widgets Modified Files: WidgetMenu.h Log Message: Change to keep these out of itsChildren so WidgetModalDialog works. Index: WidgetMenu.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetMenu.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- WidgetMenu.h 5 May 2006 17:14:42 -0000 1.29 +++ WidgetMenu.h 30 Nov 2006 00:42:36 -0000 1.30 @@ -268,7 +268,11 @@ WidgetMenuPtr appendPopup( const SmartUtil::tstring & name ) { HMENU handle = reinterpret_cast< HMENU >( this->Widget::itsHandle ); - WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenu< EventHandlerClass, MessageMapPolicy >( this->Widget::itsParent ) ); + +// WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenu< EventHandlerClass, MessageMapPolicy >( this->Widget::itsParent ) ); +// Should it be the below instead ? + WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenu< EventHandlerClass, MessageMapPolicy >( this ) ); + retVal->create(); ::AppendMenu( handle, MF_POPUP, reinterpret_cast< unsigned int >( retVal->handle() ), name.c_str() ); itsChildren.push_back( retVal ); @@ -668,13 +672,17 @@ template< class EventHandlerClass, class MessageMapPolicy > WidgetMenu< EventHandlerClass, MessageMapPolicy >::WidgetMenu( SmartWin::Widget * parent ) - : Widget( parent ) + : Widget( 0 ) , isSysMenu( false ) { - // Can't have a text box without a parent... + // We construct Widget(0) so that the WidgetMenu is not placed in parent->itsChildren + // (If a WidgetMenu is in parent->Children then WidgetModalDialog crashs during cleanup. xAssert( parent, _T( "Can't have a Menu without a parent..." ) ); + this->Widget::itsParent= parent; // But eventually we do want to know its parent. } + + // end namespace SmartWin } |
|
From: andrew7 <bd...@us...> - 2006-11-30 00:39:10
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/aspects In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19806/include/smartwin/aspects Modified Files: AspectText.h Log Message: Support unicode Index: AspectText.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/aspects/AspectText.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- AspectText.h 5 Nov 2006 17:55:12 -0000 1.17 +++ AspectText.h 30 Nov 2006 00:39:07 -0000 1.18 @@ -181,7 +181,7 @@ std::string::size_type pos= txtEndl.find( '\n', 0 ); while ( std::string::npos != pos ) { - txtEndl.replace( pos, 1, "\r\n" ); + txtEndl.replace( pos, 1, _T("\r\n") ); pos += 2; // Don't find the replacement \n. pos= txtEndl.find( '\n', pos ); } |
|
From: andrew7 <bd...@us...> - 2006-11-30 00:38:33
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/aspects In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19377/include/smartwin/aspects Modified Files: AspectSizable.h Log Message: Update doc to reflect change in API Index: AspectSizable.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/aspects/AspectSizable.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- AspectSizable.h 10 Sep 2006 11:38:15 -0000 1.25 +++ AspectSizable.h 30 Nov 2006 00:38:30 -0000 1.26 @@ -222,6 +222,10 @@ * The pos member of the Rectangle is the position and the size member is the * size. <br> * So a call to this function will (probably) also MOVE your Widget too. + * + * For a top-level window, the position and dimensions are relative to the + * upper-left corner of the screen. For a child window, they are relative + * to the upper-left corner of the parent window's client area. */ void setBounds( const Rectangle & rect, bool updateWindow = true ); @@ -317,12 +321,15 @@ */ Point getSize() const; - /// Returns the position of the window. - /** Note that this is in screen coordinates meaning the position returned is - * relative to the upper left corner of the desktop screen. - */ + /// Returns the position of the window relative to the parent window. + /** Note that this is in client coordinates. + */ Point getPosition() const; + /// Returns the screen position of the window. + Point getScreenPosition() const; + + /// Returns the size of the client area of the window. /** This differs from getSize because it disregards the border and headers, this * function only returns the client area of the Widget meaning the area which it @@ -542,6 +549,17 @@ return Point( rc.pos.x, rc.pos.y ); } + +template< class EventHandlerClass, class WidgetType, class MessageMapType > +Point AspectSizable< EventHandlerClass, WidgetType, MessageMapType >::getScreenPosition() const +{ + RECT rc; + ::GetWindowRect( const_cast < WidgetType * >( static_cast< const WidgetType * >( this ) )->handle(), & rc ); + return Point( rc.left, rc.top ); +} + + + template< class EventHandlerClass, class WidgetType, class MessageMapType > Point AspectSizable< EventHandlerClass, WidgetType, MessageMapType >::getClientAreaSize() const { |
|
From: andrew7 <bd...@us...> - 2006-11-30 00:36:54
|
Update of /cvsroot/smartwin/SmartWin/include/io In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18446/include/io Modified Files: InDialogClasses.h Log Message: Add unicode support Index: InDialogClasses.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/io/InDialogClasses.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- InDialogClasses.h 9 Oct 2006 01:11:05 -0000 1.5 +++ InDialogClasses.h 30 Nov 2006 00:36:49 -0000 1.6 @@ -192,7 +192,7 @@ } SmartUtil::tstring parent = pathFile.substr( 0, slashDex ); if ( string::npos == parent.find( '\\' ) ) { - parent += "\\"; // Set "c:\" from c: + parent += _T("\\"); // Set "c:\" from c: } return parent; } |
|
From: andrew7 <bd...@us...> - 2006-11-30 00:32:55
|
Update of /cvsroot/smartwin/SmartWin/include/io In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv16440/include/io Modified Files: InDialog.h html_get.h html_put.h textbox_stream.h Log Message: Add unicode support Index: textbox_stream.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/io/textbox_stream.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- textbox_stream.h 5 May 2006 17:14:40 -0000 1.5 +++ textbox_stream.h 30 Nov 2006 00:32:51 -0000 1.6 @@ -83,10 +83,8 @@ itsBuff[0] = getAsyncKey(); n = 1; - itsTextBox->setSelection( ( long ) itsTextBox->getText().size() ); - SmartUtil::tstring addstr( ( char * ) itsBuff, 1 ); - adjustLineTerm( addstr ); - itsTextBox->replaceSelection( addstr ); + std::string addstr( itsBuff, 1 ); + appendTextBox( addstr ); } else { @@ -127,7 +125,19 @@ return c; } - void adjustLineTerm( SmartUtil::tstring & str ) + + // Output of data to text box. + virtual std::streamsize xsputn( int_type * data, std::streamsize _Count ) + { + std::string addstr( (char *)data, _Count ); + appendTextBox( addstr ); + + return( _Count ); // Number of characters copied. + } + + private: + + void adjustLineTerm( std::string & str ) { size_t pos_n = str.find( '\n' ); if ( - 1 != pos_n ) @@ -143,21 +153,17 @@ } } - // Output of data to text box. - virtual std::streamsize xsputn( int_type * data, std::streamsize _Count ) - { - itsTextBox->setSelection( ( long ) itsTextBox->getText().size() ); - SmartUtil::tstring addstr( ( char * ) data, _Count ); + void appendTextBox( std::string & addstr ) + { adjustLineTerm( addstr ); - itsTextBox->replaceSelection( addstr ); + SmartUtil::tstring tadd= SmartUtil::Ascii2CurrentBuild::doConvert( addstr, SmartUtil::ConversionCodepage::UTF8 ); + itsTextBox->setSelection( ( long ) itsTextBox->getText().size() ); + itsTextBox->replaceSelection( tadd ); itsTextBox->showCaret(); - - return( _Count ); // Number of characters copied. } - private: char getAsyncKey() { Index: html_put.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/io/html_put.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- html_put.h 9 Oct 2006 01:11:05 -0000 1.9 +++ html_put.h 30 Nov 2006 00:32:51 -0000 1.10 @@ -49,20 +49,20 @@ class html_put { private: - iostream & itsIo; + SmartUtil::tiostream & itsIo; public: - html_put( iostream & io ) + html_put( SmartUtil::tiostream & io ) : itsIo( io ) { - itsIo << "<html> <head> <title> </title> </head>\n<body> <form>\n"; + itsIo << _T("<html> <head> <title> </title> </head>\n<body> <form>\n"); } //------------------------------------------------------------------------- ~html_put() { - itsIo << "\n</form> </body>\n</html>\n"; + itsIo << _T("\n</form> </body>\n</html>\n"); } //------------------------------------------------------------------------- @@ -72,7 +72,7 @@ // void string_put( SmartUtil::tstring txt ) { - itsIo << "<p>" << endl << txt << endl << "</p>" << endl; + itsIo << _T("<p>") << endl << txt << endl << _T("</p>") << endl; } //------------------------------------------------------------------------- @@ -102,8 +102,8 @@ // void putTaggedText( const SmartUtil::tstring & tag, SmartUtil::tstring & taggedValue ) { - itsIo << "<input type=text name=\"" << tag << "\"" - << " value=\"" << taggedValue << "\" >\n"; + itsIo << _T("<input type=text name=\"") << tag << _T("\"") + << _T(" value=\"") << taggedValue << _T("\" >\n"); } //------------------------------------------------------------------------- Index: html_get.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/io/html_get.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- html_get.h 9 Oct 2006 01:11:05 -0000 1.10 +++ html_get.h 30 Nov 2006 00:32:51 -0000 1.11 @@ -53,22 +53,22 @@ class html_get { private: - iostream & itsIo; + SmartUtil::tiostream & itsIo; public: // Constructor parses until it finds a <form> tag. // - html_get( iostream & io, bool & ok ) + html_get( SmartUtil::tiostream & io, bool & ok ) : itsIo( io ) { ok = false; - string tag; + SmartUtil::tstring tag; do { itsIo >> tag; if ( 0 == tag.size() ) return; - } while ( "<form>" != tag ); + } while ( _T("<form>") != tag ); ok = true; } @@ -79,11 +79,11 @@ // bool get_string( SmartUtil::tstring & text ) { - string tag; + SmartUtil::tstring tag; itsIo >> tag; - if ( "<p>" != tag ) return false; + if ( _T("<p>") != tag ) return false; - return( parse_until( "</p>", text ) ); + return( parse_until( _T("</p>"), text ) ); } //------------------------------------------------------------------------- @@ -119,16 +119,16 @@ // bool getTaggedText( const SmartUtil::tstring & tagExpected, SmartUtil::tstring & value ) { - string tag, checkname; + SmartUtil::tstring tag, checkname; itsIo >> tag; - if ( "<input" != tag ) return false; + if ( _T("<input") != tag ) return false; itsIo >> tag; - if ( "type=text" != tag ) return false; + if ( _T("type=text") != tag ) return false; itsIo >> tag; - SmartUtil::tstring taglabel= "name=\""; - taglabel += tagExpected; taglabel += "\""; + SmartUtil::tstring taglabel= _T("name=\""); + taglabel += tagExpected; taglabel += _T("\""); if ( taglabel != tag ) return false; @@ -136,7 +136,7 @@ if ( ! parse_quoted_string_value( tag, value ) ) return false; - itsIo >> tag; if ( ">" != tag ) return false; + itsIo >> tag; if ( _T(">") != tag ) return false; return true; } @@ -150,18 +150,18 @@ // bool get_val_of_text( int & value ) { - string tag, checkname; + SmartUtil::tstring tag, checkname; itsIo >> tag; - if ( "<input" != tag ) return false; + if ( _T("<input") != tag ) return false; itsIo >> tag; - if ( "type=text" != tag ) return false; + if ( _T("type=text") != tag ) return false; itsIo >> tag; // value="43" if ( ! parse_quoted_numeric_value( tag, value ) ) return false; - itsIo >> tag; if ( ">" != tag ) return false; + itsIo >> tag; if ( _T(">") != tag ) return false; return true; } @@ -206,33 +206,33 @@ template< class Parent, class MessageMapPolicy > bool get( SmartWin::WidgetComboBox< Parent, MessageMapPolicy > * inComboBox ) { - string tag, value; + SmartUtil::tstring tag, value; itsIo >> tag; - if ( "<select>" != tag ) return false; + if ( _T("<select>") != tag ) return false; inComboBox->removeAllItems(); int dex = 0; bool selected = false; itsIo >> tag; - while ( "</select>" != tag ) + while ( _T("</select>") != tag ) { - if ( "<option" != tag ) return false; + if ( _T("<option") != tag ) return false; // Skip until > itsIo >> value >> tag; - if ( ">" != tag ) + if ( _T(">") != tag ) { - if ( "selected" == tag ) + if ( _T("selected") == tag ) { selected = true; // Remember this index was selected. itsIo >> tag; - if ( ">" != tag ) return false; + if ( _T(">") != tag ) return false; } else return false; // wanted ">" or "selected" } - if ( ! parse_until( "</option>", value ) ) + if ( ! parse_until( _T("</option>"), value ) ) return false; // Add the data string to the ComboBox @@ -258,21 +258,21 @@ template< class Parent, class MessageMapPolicy > bool get( SmartWin::WidgetCheckBox< Parent, MessageMapPolicy > * inCheckBox ) { - string tag, checkname; + SmartUtil::tstring tag, checkname; itsIo >> tag; - if ( "<input" != tag ) return false; + if ( _T("<input") != tag ) return false; itsIo >> tag; - if ( "type=checkbox" != tag ) return false; + if ( _T("type=checkbox") != tag ) return false; itsIo >> tag; - if ( "value=" == tag ) + if ( _T("value=") == tag ) { inCheckBox->setChecked( false ); } else { - if ( "checked" == tag ) + if ( _T("checked") == tag ) { inCheckBox->setChecked(); } @@ -280,10 +280,10 @@ return false; // wanted "value=" or "checked" } - if ( ! parse_until( ">", checkname ) ) //Discard until > + if ( ! parse_until( _T(">"), checkname ) ) //Discard until > return false; - if ( ! parse_until( "</input>", checkname ) ) // grab until </input> + if ( ! parse_until( _T("</input>"), checkname ) ) // grab until </input> return false; inCheckBox->setText( checkname ); @@ -297,9 +297,9 @@ template< class Parent, class MessageMapPolicy > bool get( SmartWin::WidgetDataGrid< Parent, MessageMapPolicy > * inWidgetDataGrid ) { - string tag; + SmartUtil::tstring tag; itsIo >> tag; - if ( "<table>" != tag ) return false; + if ( _T("<table>") != tag ) return false; bool end_table; vector< SmartUtil::tstring > colnames, rowvals; @@ -331,9 +331,9 @@ template< class Parent, class MessageMapPolicy > bool get( SmartWin::WidgetTreeView< Parent, MessageMapPolicy > * wtv ) { - string tag; + SmartUtil::tstring tag; itsIo >> tag; - if ( "<ul>" != tag ) return false; + if ( _T("<ul>") != tag ) return false; wtv->DeleteAllItems(); @@ -382,31 +382,31 @@ { end_table = false; - string tag, data, token, endtag; + SmartUtil::tstring tag, data, token, endtag; itsIo >> tag; - if ( tag != "<tr>" ) + if ( tag != _T("<tr>") ) { - end_table = tag == "</table>"; + end_table = tag == _T("</table>"); return( false ); } while ( true ) { itsIo >> tag; - if ( ( tag != "<td>" ) && ( tag != "<th>" ) ) + if ( ( tag != _T("<td>") ) && ( tag != _T("<th>") ) ) { - return ( tag == "</tr>" ); + return ( tag == _T("</tr>") ); } itsIo >> data; - if ( data == "</td>" ) + if ( data == _T("</td>") ) { - data = ""; + data = _T(""); } else { itsIo >> endtag; - while ( ( endtag != "</td>" ) && ( endtag != "</th>" ) ) + while ( ( endtag != _T("</td>") ) && ( endtag != _T("</th>") ) ) { data += _T( " " ); data += endtag; @@ -427,18 +427,18 @@ bool html_get_treenode( SmartWin::WidgetTreeView< Parent, MessageMapPolicy > * wtv, TreeViewNode node, int & dex ) { - string tag; + SmartUtil::tstring tag; TreeViewNode childnode; do { itsIo >> tag; - if ( "<li>" == tag ) + if ( _T("<li>") == tag ) { // Parse data in: <li> data </li> - string data; - if ( ! parse_until( "</li>", data ) ) + SmartUtil::tstring data; + if ( ! parse_until( _T("</li>"), data ) ) { return false; } @@ -448,7 +448,7 @@ continue; } - if ( "<ul>" == tag ) + if ( _T("<ul>") == tag ) { if ( html_get_treenode( wtv, childnode, dex ) ) { @@ -460,7 +460,7 @@ } } - if ( "</ul>" == tag ) + if ( _T("</ul>") == tag ) { break; } @@ -476,10 +476,10 @@ // Parses whitespace seperated text until the endtag occurs. // arbitrary whitespace is represented by one space. // - bool parse_until( string endtag, string & data ) + bool parse_until( SmartUtil::tstring endtag, SmartUtil::tstring & data ) { data.clear(); - string moredata; + SmartUtil::tstring moredata; while ( true ) { itsIo >> moredata; @@ -506,7 +506,7 @@ // Given a valstr of: value="valstring" // set inquotes to be: valstring // - bool parse_quoted_string_value( const string & valstr, string & inquotes ) + bool parse_quoted_string_value( const SmartUtil::tstring & valstr, SmartUtil::tstring & inquotes ) { string::size_type first_num = valstr.find( '"' ); if ( first_num == string::npos ) return false; @@ -523,13 +523,13 @@ // Extract the number from a string: value="12" // - bool parse_quoted_numeric_value( const string & valstr, int & val ) + bool parse_quoted_numeric_value( const SmartUtil::tstring & valstr, int & val ) { - string inquotes; + SmartUtil::tstring inquotes; bool ok= parse_quoted_string_value( valstr, inquotes ); if ( ! ok ) return false; - stringstream ss( inquotes ); + SmartUtil::tstringstream ss( inquotes ); ss >> val; return true; } Index: InDialog.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/io/InDialog.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- InDialog.h 9 Oct 2006 01:11:05 -0000 1.11 +++ InDialog.h 30 Nov 2006 00:32:51 -0000 1.12 @@ -62,7 +62,7 @@ bool bool1= true; COLORREF background= RGB( 20, 40, 80 ); - ChoiceString cs( "scissors|rock|paper", 2 ); + ChoiceString cs( _T("scissors|rock|paper"), 2 ); FileString loadFs( "C:\\path\\gumbo.txt" ); loadFs.addFilter( "JPG files", "*.jpg" ); @@ -446,8 +446,10 @@ // Catch failure to pass in a supported type // so that itsPrompts and itsVariables stay coherent. + // Although type().name() is a mem leak, this is a fatal error anyhow. + // SmartUtil::tstring msg( _T("InDialog unsupported type: ") ); - msg += itsVariables.at( b ).type().name(); + appendTo( msg, itsVariables.at( b ).type().name() ); addPromptAndText( itsPrompts.at( b ), msg, 0 ); } @@ -646,10 +648,10 @@ float fract = maxLabel.x / (float)(maxLabel.x + maxInputArea.x); int rowWidth= 2 * pos_size.size.x; pos_sizeLabel= pos_size; - pos_sizeLabel.size.x= rowWidth * fract; + pos_sizeLabel.size.x= (long)(rowWidth * fract); pos_sizeInput= pos_size; - pos_sizeInput.size.x= rowWidth * (1.0 - fract); + pos_sizeInput.size.x= (long) (rowWidth * (1.0 - fract)); } // Allocate space for each widget in the dialog @@ -749,6 +751,17 @@ return valid; } + + void appendTo( SmartUtil::tstring & dest, const char * zeroTermTxt ) + { + const char * beg= zeroTermTxt; + const char * end= zeroTermTxt + strlen(zeroTermTxt); + dest += SmartUtil::tstring( beg, end ); + } + + + + // The OK button has been pressed, so transfer all the values back into the // variables. But don't exit the dialog until all rows satisfy their // constraints. |
|
From: andrew7 <bd...@us...> - 2006-11-30 00:31:26
|
Update of /cvsroot/smartwin/SmartWin/doxygenIn/html In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15882/doxygenIn/html Modified Files: msvc71.html Log Message: Add link already defined error help Index: msvc71.html =================================================================== RCS file: /cvsroot/smartwin/SmartWin/doxygenIn/html/msvc71.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- msvc71.html 19 Sep 2005 00:46:55 -0000 1.5 +++ msvc71.html 30 Nov 2006 00:31:20 -0000 1.6 @@ -67,6 +67,12 @@ Put the SmartWin lib directory into Tools | Options | Projects | Directories | linker </LI> + + <li> SmartWinU.lib(Application.obj) : error LNK2005: "... already defined in smartwin.lib(Application.obj) <br> + Perhaps you are mixing a MBS compiled smartwin.lib with a unicode application. + + </li> + </ul> <ul> <h4>Runtime Errors @@ -77,6 +83,8 @@ <br> One source: You have a widget under a tab, and you did not do a "widg->setEventHandler( this );".</li> + + </ul> </body> </html> |
|
From: andrew7 <bd...@us...> - 2006-11-30 00:30:50
|
Update of /cvsroot/smartwin/SmartWin/doxygenIn/html In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15452/doxygenIn/html Modified Files: guide.html Log Message: Change size of minimal app. Index: guide.html =================================================================== RCS file: /cvsroot/smartwin/SmartWin/doxygenIn/html/guide.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- guide.html 4 Jun 2006 16:36:59 -0000 1.9 +++ guide.html 30 Nov 2006 00:30:47 -0000 1.10 @@ -7,7 +7,7 @@ </h2> <p>SmartWin.lib is a C++ GUI and SOAP library.<BR> <a href="samplecode1.html">A Hello World (GUI) executable with buttons and check - boxes</a> takes 155 KB and have no additional DLL dependencies!<br> + boxes</a> takes 212 KB and have no additional DLL dependencies!<br> This is vital since SmartWin is a static library by default meaning less pain in versioning and upgrades of software.<br> The SOAP parts and the GUI parts is not in any ways dependant upon eachother |
|
From: andrew7 <bd...@us...> - 2006-11-30 00:28:58
|
Update of /cvsroot/smartwin/SmartWin/doxygenIn/html In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv14411/doxygenIn/html Modified Files: layout.html Log Message: -Add Anchor info. Index: layout.html =================================================================== RCS file: /cvsroot/smartwin/SmartWin/doxygenIn/html/layout.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- layout.html 14 Sep 2005 19:53:46 -0000 1.4 +++ layout.html 30 Nov 2006 00:28:54 -0000 1.5 @@ -1,7 +1,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> - <title>SmartWin++ Guide</title></head> + <title>SmartWin++ Layout</title></head> <body> <P>You must set the position and size of each widget after its created, or it won't be visible. The simplest runtime approach is to set the position and size of @@ -13,7 +13,7 @@ the position and size of a widget at runtime as most of the samples do. ( All widgets derive from AspectSizable. ) Or you may be able to use the emerging Sally IDE which has the ability to generate SmartWin++ - windows. + windows. A new alternative is to use the Anchors class. </P> <H3>Why do Layout at runtime?</H3> <P> @@ -88,7 +88,16 @@ crowd out the rest of the widgets) <LI> Partition the available space to each widget present.</LI></OL> - <H3> </H3> + <H3>Anchors class</H3> + <p> + The Anchors class approach is to specify fixed sizes of various widgets, + insert them into Anchor instance with <br> + "void addAnchored( SmartWin::Widget* widget, int anchors )" + and then just call "void resizeAnchored()" in the onSized() handler. + You can specify anchors such as AnchoredItem::left or AnchoredItem::top to + make the widgets stick to the parent's window according to the anchors. + </p> + <H3>How to divide up a window into different areas </H3> <P>You divide the Rectangle by generating smaller Rectangles using Rectangle |
|
From: Thomas H. <pol...@us...> - 2006-11-29 09:12:06
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/aspects In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv20709/include/smartwin/aspects Modified Files: AspectThreads.h Log Message: Index: AspectThreads.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/aspects/AspectThreads.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AspectThreads.h 5 May 2006 17:14:38 -0000 1.7 +++ AspectThreads.h 29 Nov 2006 09:11:56 -0000 1.8 @@ -216,7 +216,6 @@ NULL ) ); } - template< class Param > Utilities::Thread fork( unsigned long ( * threadProc )( EventHandlerClass * ) ) { ThreadParamGlobal< int > * parameter = new ThreadParamGlobal< int >( 0, threadProc, static_cast< EventHandlerClass * >( this ) ); |
|
From: andrew7 <bd...@us...> - 2006-11-20 03:45:50
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27939/include/smartwin Added Files: Anchors.h Log Message: First version of an alternate positioning system for fixed size widgets. --- NEW FILE: Anchors.h --- /* Copyright (c) 2006 - Carmi Grushko (ven...@us...) * Implements behaviour similar to Delphi's Control.Anchor * Permission to use under the BSD license */ #ifndef ANCHORS_H #define ANCHORS_H #include <vector> #include "SmartWin.h" #include <windows.h> using std::vector; struct AnchoredItem { enum {top=1, bottom=2, left=4, right=8}; // Attach to that side. enum { box = (top | bottom | left | right) }; // Attach to all sides; ie adjust to shape of parent. enum { dialog = (bottom | right) }; // Adjust from lower right corner enum { row = (left | right) }; // Span across the parent in a row. enum { col = (top | bottom) }; // Span as a column on the parent. //Widget* widget; HWND wnd; HWND parent; int anchors; ::RECT edgeDistances; }; /// Anchor fixed sized widgets to the sides of their parent window. /** * A helper class to do some auto-resizings of widgets in SmartWin++. * * Take for example the common dialog Open File. * Whenever resized, the "Open" and "Cancel" buttons remain in the same location relative * to the lower-right corner of the dialog. On the other hand, the control that lists all * the files in the current directory, grows or shrinks according to the size of the dialog. * * That's what my class does. After widgets were created, you add them to a special list, * and in the event handler of OnSize (of your WidgetWindow), you call a special method that * resizes all the widgets you've added before. * * Supposed to be simple. * An example project (working with the Sally IDE & with a mingw32 makefile) is available online. * * (The anchors-sample.zip contains everything needed to compile, including the anchors source, and a compiled exe. * * http://t2.technion.ac.il/~scg/anchors-sample.zip * http://t2.technion.ac.il/~scg/anchors-source.zip * By: Carmi Grushko (venndigram) - 2006-10-02 20:38 * */ class AnchorManager { public: /// Adds a widget to the vector of "anchored" widgets, according to the anchors bitmap. /** The addAnchored() function measures and stores the distances from the sides of * the widget's parent. It also stores the anchors bitmap which specifies which sides * of the parent should be used in resizing the widget later on. <br> * IN: anchors: a combination of AnchoredItem::left, AnchoredItem::right, AnchoredItem::top, AnchoredItem::bottom * Specifing "AnchoredItem::right" will ensure that the widget will always be the * same distance from its parent's right edge. Specifing "AnchoredItem::row" will cause the widget to go * from the left to the right side of the parent, keeping its original size. * See the AnchoredItem structure above. */ void addAnchored( SmartWin::Widget* widget, int anchors ) { if( widget == NULL || widget->handle() == 0 || widget->getParent() == NULL || widget->getParent()->handle() == 0 ) throw std::runtime_error( "AnchorManager: Invalid widget" ); AnchoredItem item; item.wnd = widget->handle(); item.parent = widget->getParent()->handle(); item.anchors = anchors; // Calculating edgeDistances ::RECT r1, r2; ::POINT p1, p2; GetWindowRect( item.wnd, &r1 ); GetClientRect( item.parent, &r2 ); p1.x = r2.left; p1.y = r2.top; p2.x = r2.right; p2.y = r2.bottom; ClientToScreen( item.parent, &p1 ); ClientToScreen( item.parent, &p2 ); r2.left = p1.x; r2.top = p1.y; r2.right = p2.x; r2.bottom = p2.y; item.edgeDistances.top = r1.top - r2.top; item.edgeDistances.left = r1.left - r2.left; item.edgeDistances.bottom = r2.bottom - r1.bottom; item.edgeDistances.right = r2.right - r1.right; anchored.push_back( item ); } /// Resizes each Widget according to the new size of its parent window. /** The addAnchored() function measures and stores the distances from the sides of * the widget's parent. It also stores the anchors bitmap which specifies which sides * of the parent should be used in resizing the widget later on. <br> * IN: anchors: a combination of AnchoredItem::left, AnchoredItem::right, AnchoredItem::top, AnchoredItem::bottom * See the AnchoredItem structure above for AnchoredItem::box and AnchoredItem::dialog */ void AnchorManager::resizeAnchored() { for( vector<AnchoredItem>::const_iterator i = anchored.begin(); i != anchored.end(); ++i ) { resizeAnchoredItem( *i ); } } private: vector<AnchoredItem> anchored; void resizeAnchoredItem( const AnchoredItem& item ) { ::RECT r1, r2, newR; ::POINT p1; int flags = SWP_NOZORDER; if( ( (item.anchors & (AnchoredItem::left | AnchoredItem::right) ) == 0) && ( (item.anchors & (AnchoredItem::top | AnchoredItem::bottom) ) == 0) ) flags |= SWP_NOSIZE; if( (item.anchors & AnchoredItem::left) && (item.anchors & AnchoredItem::top) ) flags |= SWP_NOMOVE; if( (flags & SWP_NOSIZE) && (flags & SWP_NOMOVE) ) return; // Nothing to do GetClientRect( item.parent, &r1 ); GetWindowRect( item.wnd, &r2 ); r2.right -= r2.left; r2.bottom -= r2.top; if( item.anchors & AnchoredItem::left ) { if( item.anchors & AnchoredItem::right ) { newR.left = item.edgeDistances.left; newR.right = r1.right - item.edgeDistances.right - item.edgeDistances.left; } else { newR.left = item.edgeDistances.left; newR.right = r2.right; } } else { if( item.anchors & AnchoredItem::right ) { newR.left = r1.right - item.edgeDistances.right - r2.right; newR.right = r2.right; } else { } } if( item.anchors & AnchoredItem::top ) { if( item.anchors & AnchoredItem::bottom ) { newR.top = item.edgeDistances.top; newR.bottom = r1.bottom - item.edgeDistances.bottom - item.edgeDistances.top; } else { newR.top = item.edgeDistances.top; newR.bottom = r2.bottom; } } else { if( item.anchors & AnchoredItem::bottom ) { newR.top = r1.bottom - item.edgeDistances.bottom - r2.bottom; newR.bottom = r2.bottom; } else { } } SetWindowPos( item.wnd, 0, newR.left, newR.top, newR.right, newR.bottom, flags ); } }; #endif //region SallyIDE Text Editor Settings //Caret=(0,0) //endregion |
|
From: andrew7 <bd...@us...> - 2006-11-19 22:17:59
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15398/include/smartwin/widgets Modified Files: WidgetWindow.h Log Message: Allow WidgetWindows to handle double clicks.. Index: WidgetWindow.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetWindow.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- WidgetWindow.h 5 May 2006 17:14:42 -0000 1.27 +++ WidgetWindow.h 19 Nov 2006 22:17:55 -0000 1.28 @@ -227,7 +227,7 @@ ws.cbSize = sizeof( SMARTWIN_WNDCLASSEX ); #endif //! WINCE // This are window class styles, not window styles ... - ws.style = 0; + ws.style = CS_DBLCLKS; // Allow double click messages ws.lpfnWndProc = MessageMapPolicy::mainWndProc_; ws.cbClsExtra = 0; ws.cbWndExtra = 0; |
|
From: andrew7 <bd...@us...> - 2006-11-19 17:57:36
|
Update of /cvsroot/smartwin/SmartWin/tests/Canvas In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4111/tests/Canvas Modified Files: canvas_all.cpp Log Message: Add demonstration of Double clicking. Index: canvas_all.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/Canvas/canvas_all.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- canvas_all.cpp 5 May 2006 17:21:43 -0000 1.9 +++ canvas_all.cpp 19 Nov 2006 17:57:28 -0000 1.10 @@ -23,7 +23,7 @@ #include "encircle.h" // Remove the comment part below to use GdiPlus and view an Image in addition to the other cool stuff you see... ;) -//#define UseGdiPlus 1 +// #define UseGdiPlus 1 #ifdef UseGdiPlus #include <gdiplus.h> using namespace Gdiplus; @@ -38,7 +38,9 @@ public: void init() { - createWindow(); + WidgetWindow::Seed cs; + // Note: Class style should have CS_DBLCLKS; + createWindow( cs ); setText( _T( "Samples for PaintCanvas, UpdateCanvas, Mouse and Keyboard events" ) ); onSized( & CanvasWidget::isResized ); @@ -60,6 +62,9 @@ onLeftMouseDown( & CanvasWidget::PixelColorMousePosition ); onRightMouseDown( & CanvasWidget::PixelColorMousePosition ); onMiddleMouseDown( & CanvasWidget::PixelColorMousePosition ); + onLeftMouseDblClick( & CanvasWidget::doubleClick ); + onRightMouseDblClick( & CanvasWidget::doubleClick ); + onMouseMove( & CanvasWidget::MouseMoveResponse ); onKeyPressed( & CanvasWidget::KeyPressed ); @@ -259,6 +264,20 @@ uc.extTextOut( msg, mouse.pos.x + 10, mouse.pos.y ); } + // Respond to a mouse double click by displaying "Left Double Click at x,y". + void doubleClick( const SmartWin::MouseEventResult & mouse ) + { + std::basic_stringstream< TCHAR > ss; + switch( mouse.ButtonPressed ) { + case mouse.LEFT: ss << "Left "; break; + case mouse.RIGHT: ss << "Right "; break; + } + ss << _T( "Double click at " ) << mouse.pos.x << _T( "," ) << mouse.pos.y; + if ( mouse.isShiftPressed ) ss << _T( " shifted" ); + MessageAtLeftTop( SmartUtil::tstring( ss.str() ) ); + } + + // Respond to Mouse movement by showing "Mouse moved to x,y" void MouseMoveResponse( const SmartWin::MouseEventResult & mouse ) { @@ -268,6 +287,7 @@ MessageAtLeftTop( SmartUtil::tstring( ss.str() ) ); } + // We are sending this message outside of a onPainting response function. // So we are using an UpdateCanvas void MessageAtLeftTop( const SmartUtil::tstring & msg ) |
|
From: andrew7 <bd...@us...> - 2006-11-19 17:55:23
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/aspects In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv3349/include/smartwin/aspects Modified Files: AspectMouseClicks.h Log Message: Add onLeftMouseDblClick and onRightMouseDblClick functions. Index: AspectMouseClicks.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/aspects/AspectMouseClicks.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- AspectMouseClicks.h 5 May 2006 17:14:38 -0000 1.13 +++ AspectMouseClicks.h 19 Nov 2006 17:55:16 -0000 1.14 @@ -186,6 +186,28 @@ void onMiddleMouseDown( typename MessageMapType::voidFunctionTakingMouseEventResult eventHandler ); void onMiddleMouseDown( typename MessageMapType::itsVoidFunctionTakingMouseEventResult eventHandler ); + + + /// Left mouse button double-clicked event handler setter + /** If supplied, function will be called when user double clicks the Left mouse button + * in the client area of the widget. <br> + * The parameter passed is const MouseEventResult & which contains the state of + * the mouse. + */ + void onLeftMouseDblClick( typename MessageMapType::itsVoidFunctionTakingMouseEventResult eventHandler ); + void onLeftMouseDblClick( typename MessageMapType::voidFunctionTakingMouseEventResult eventHandler ); + + /// Right mouse button double-clicked event handler setter + /** If supplied, function will be called when user double clicks the Right mouse button + * in the client area of the widget. <br> + * The parameter passed is const MouseEventResult & which contains the state of + * the mouse. + */ + void onRightMouseDblClick( typename MessageMapType::itsVoidFunctionTakingMouseEventResult eventHandler ); + void onRightMouseDblClick( typename MessageMapType::voidFunctionTakingMouseEventResult eventHandler ); + + + /// \ingroup EventHandlersAspectMouseClicks /// Mouse moved event handler setter /** If supplied, function will be called when user moves the mouse. <br> @@ -219,6 +241,7 @@ ); } + template< class EventHandlerClass, class WidgetType, class MessageMapType > void AspectMouseClicks< EventHandlerClass, WidgetType, MessageMapType >::onLeftMouseUp( typename MessageMapType::voidFunctionTakingMouseEventResult eventHandler ) { @@ -409,6 +432,80 @@ ); } + + + +template< class EventHandlerClass, class WidgetType, class MessageMapType > +void AspectMouseClicks< EventHandlerClass, WidgetType, MessageMapType >::onLeftMouseDblClick( typename MessageMapType::itsVoidFunctionTakingMouseEventResult eventHandler ) +{ + MessageMapType * ptrThis = boost::polymorphic_cast< MessageMapType * >( this ); + ptrThis->addNewSignal( + typename MessageMapType::SignalTupleType( + private_::SignalContent( + Message( WM_LBUTTONDBLCLK ), + reinterpret_cast< itsVoidFunction >( eventHandler ), + ptrThis + ), + typename MessageMapType::SignalType( typename MessageMapType::SignalType::SlotType( & Dispatcher::dispatchThis ) ) + ) + ); +} + +template< class EventHandlerClass, class WidgetType, class MessageMapType > +void AspectMouseClicks< EventHandlerClass, WidgetType, MessageMapType >::onLeftMouseDblClick( typename MessageMapType::voidFunctionTakingMouseEventResult eventHandler ) +{ + MessageMapType * ptrThis = boost::polymorphic_cast< MessageMapType * >( this ); + ptrThis->addNewSignal( + typename MessageMapType::SignalTupleType( + private_::SignalContent( + Message( WM_LBUTTONDBLCLK ), + reinterpret_cast< private_::SignalContent::voidFunctionTakingVoid >( eventHandler ), + ptrThis + ), + typename MessageMapType::SignalType( + MessageMapType::SignalType::SlotType( & Dispatcher::dispatch ) + ) + ) + ); +} + + +template< class EventHandlerClass, class WidgetType, class MessageMapType > +void AspectMouseClicks< EventHandlerClass, WidgetType, MessageMapType >::onRightMouseDblClick( typename MessageMapType::itsVoidFunctionTakingMouseEventResult eventHandler ) +{ + MessageMapType * ptrThis = boost::polymorphic_cast< MessageMapType * >( this ); + ptrThis->addNewSignal( + typename MessageMapType::SignalTupleType( + private_::SignalContent( + Message( WM_RBUTTONDBLCLK ), + reinterpret_cast< itsVoidFunction >( eventHandler ), + ptrThis + ), + typename MessageMapType::SignalType( typename MessageMapType::SignalType::SlotType( & Dispatcher::dispatchThis ) ) + ) + ); +} + +template< class EventHandlerClass, class WidgetType, class MessageMapType > +void AspectMouseClicks< EventHandlerClass, WidgetType, MessageMapType >::onRightMouseDblClick( typename MessageMapType::voidFunctionTakingMouseEventResult eventHandler ) +{ + MessageMapType * ptrThis = boost::polymorphic_cast< MessageMapType * >( this ); + ptrThis->addNewSignal( + typename MessageMapType::SignalTupleType( + private_::SignalContent( + Message( WM_RBUTTONDBLCLK ), + reinterpret_cast< private_::SignalContent::voidFunctionTakingVoid >( eventHandler ), + ptrThis + ), + typename MessageMapType::SignalType( + MessageMapType::SignalType::SlotType( & Dispatcher::dispatch ) + ) + ) + ); +} + + + // Mouse Movement template< class EventHandlerClass, class WidgetType, class MessageMapType > void AspectMouseClicks< EventHandlerClass, WidgetType, MessageMapType >::onMouseMove( typename MessageMapType::itsVoidFunctionTakingMouseEventResult eventHandler ) |
|
From: andrew7 <bd...@us...> - 2006-11-14 14:58:43
|
Update of /cvsroot/smartwin/SmartWin/tests/WidgetModalDialog In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv6868/tests/WidgetModalDialog Modified Files: NumDialog.h Log Message: test for Context menu bug Index: NumDialog.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/WidgetModalDialog/NumDialog.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- NumDialog.h 21 Aug 2006 12:57:01 -0000 1.10 +++ NumDialog.h 14 Nov 2006 14:58:33 -0000 1.11 @@ -149,6 +149,9 @@ //----------------------------------------------------------- +// Uncomment thhis to see a bug +// #define TRY_CONTEXT + /* PURE modal dialog does without resource files. USAGE: @@ -197,6 +200,10 @@ WidgetButtonPtr itsCancelButton; WidgetButtonPtr itsAnotherModalButton; +#ifdef TRY_CONTEXT + WidgetMenuPtr mainMenu, recentFiles; +#endif + SmartUtil::tstring itsPromptTxt; SmartUtil::tstring itsResultTxt; @@ -228,6 +235,34 @@ itsTextBox->setText( itsResultTxt ); itsTextBox->setFocus(); + +#ifdef TRY_CONTEXT + // Create POP up menu too + ::SetWindowLong( this->handle(), GWL_USERDATA, 0x1111 ); + + mainMenu = createMenu(); + WidgetMenuPtr file = mainMenu->appendPopup( _T( "&Popup" ) ); + ::SetWindowLong( file->handle(), GWL_USERDATA, 0x5555 ); + + // Creating another popup UNDERNEATH mainMenu + recentFiles = file->appendPopup( _T( "Popup II" ) ); + ::SetWindowLong( recentFiles->handle(), GWL_USERDATA, 0x5555 ); + recentFiles->appendItem( 3, _T( "alpha" ), & PureNumDialog::menuEventHandler ); + recentFiles->appendItem( 4, _T( "beta" ), & PureNumDialog::menuEventHandler ); + onRightMouseDown( & PureNumDialog::popupMenuViaRightClick ); + { + HWND hw= this->handle(); + long ud= ::GetWindowLong( hw, GWL_USERDATA ); + int sz= itsChildren.size(); + for ( int c=0; c < sz; c++ ) { + hw= itsChildren[c]->handle(); + ud= ::GetWindowLong( hw, GWL_USERDATA ); + } + } + +#endif + + // A layout approach to positioning the controls. // itsPrompt textbox // @@ -251,6 +286,33 @@ void ok_clicked( WidgetButtonPtr btn ) { + + + long ud; + HWND hw; + int count= 0; + stringstream ss; + + // A dialog doesn't clean up after itself when destroyed... Don't know why... + for ( std::vector < Widget * >::iterator idx = itsChildren.begin(); + idx != itsChildren.end(); + ++idx ) + { + count++; + + hw= ( * idx )->handle(); + ud= ::GetWindowLong( hw, GWL_USERDATA ); + if ( 0x5555 == ud ) { + continue; + } + ss << hex << "Child " << hw << ", userdat= " << ud << endl; + + } + + string msg= ss.str(); + + + itsResultTxt = itsTextBox->getText(); endDialog( IDOK ); // IDOK or IDCANCEL or any other value. } @@ -260,6 +322,20 @@ endDialog( IDCANCEL ); // IDOK or IDCANCEL or any other value. } +#ifdef TRY_CONTEXT + void popupMenuViaRightClick( const SmartWin::MouseEventResult & mouse ) + { + recentFiles->trackPopupMenu( this ); + } +#endif + + void menuEventHandler( WidgetMenuPtr menu, unsigned item ) + { + createMessageBox().show( menu->getText( item ) ); + } + + + // Tests use of ModalDialog from another ModalDialog and // demonstrates the general purpose dialog class InDialog. // which can build a dialog at runtime with variable types. |
|
From: andrew7 <bd...@us...> - 2006-11-05 20:23:20
|
Update of /cvsroot/smartwin/SmartWin/tests/WidgetTextBox In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32585/tests/WidgetTextBox Modified Files: Main.cpp Log Message: Show why setTextLines is useful. Index: Main.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/WidgetTextBox/Main.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Main.cpp 10 Sep 2006 08:42:40 -0000 1.14 +++ Main.cpp 5 Nov 2006 20:23:12 -0000 1.15 @@ -114,8 +114,8 @@ // Show how you can control the line formatting in textboxes std::stringstream ss; ss << "\"first\" << endl" << std::endl << "<< \"second\""; - textBoxs[5]->setText( ss.str() ); // setText does not handle endl. - // textBoxs[5]->setTextLines( ss.str() ); // setTextLines does. + // textBoxs[5]->setText( ss.str() ); // setText does not handle endl. + textBoxs[5]->setTextLines( ss.str() ); // setTextLines does. } // Discard all chars except 0-9, '-' and '.' |
|
From: andrew7 <bd...@us...> - 2006-11-05 19:49:36
|
Update of /cvsroot/smartwin/SmartWin/tests/OpenGLSample1 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19043/tests/OpenGLSample1 Added Files: OpenGLSample1.dev Log Message: Add .dev file for dev.cpp --- NEW FILE: OpenGLSample1.dev --- [Project] FileName=OpenGLSample1.dev Name=OpenGLSample1 UnitCount=1 Type=0 Ver=1 ObjFiles= Includes=.\..\..\include Libs= PrivateResource= ResourceIncludes= MakeIncludes= Compiler= CppCompiler= Linker=../../lib/libSmartWin.a_@@_-lcomctl32_@@_-lglu32 -lglaux -lopengl32_@@_ IsCpp=1 Icon= ExeOutput= ObjectOutput= OverrideOutput=0 OverrideOutputName=OpenGLSample1.exe HostApplication= Folders= CommandLine= UseCustomMakefile=0 CustomMakefile= IncludeVersionInfo=0 SupportXPThemes=0 CompilerSet=0 CompilerSettings=0000000000000000000000 [Unit1] FileName=Main.cpp CompileCpp=1 Folder=OpenGLSample1 Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [VersionInfo] Major=0 Minor=1 Release=1 Build=1 LanguageID=1033 CharsetID=1252 CompanyName= FileVersion= FileDescription=Developed using the Dev-C++ IDE InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion= AutoIncBuildNr=0 |
|
From: andrew7 <bd...@us...> - 2006-11-05 18:39:52
|
Update of /cvsroot/smartwin/SmartWin/tests/DragAndDrop In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24108/tests/DragAndDrop Added Files: DragAndDrop.dev Log Message: --- NEW FILE: DragAndDrop.dev --- [Project] FileName=DragAndDrop.dev Name=DragAndDrop UnitCount=1 Type=0 Ver=1 ObjFiles= Includes=.\..\..\include Libs= PrivateResource= ResourceIncludes= MakeIncludes= Compiler= CppCompiler= Linker=../../lib/libSmartWin.a_@@_-lcomctl32_@@_ IsCpp=1 Icon= ExeOutput= ObjectOutput= OverrideOutput=0 OverrideOutputName=DragAndDrop.exe HostApplication= Folders= CommandLine= UseCustomMakefile=0 CustomMakefile= IncludeVersionInfo=0 SupportXPThemes=0 CompilerSet=0 CompilerSettings=0000000000000000000000 [Unit1] FileName=Main.cpp CompileCpp=1 Folder=DragAndDrop Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 BuildCmd= [VersionInfo] Major=0 Minor=1 Release=1 Build=1 LanguageID=1033 CharsetID=1252 CompanyName= FileVersion= FileDescription=Developed using the Dev-C++ IDE InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion= AutoIncBuildNr=0 |
|
From: andrew7 <bd...@us...> - 2006-11-05 17:55:42
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7949/include/smartwin/widgets Modified Files: WidgetTextBox.h Log Message: Put setTextLines in the aspect. Index: WidgetTextBox.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetTextBox.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- WidgetTextBox.h 3 Nov 2006 13:31:56 -0000 1.33 +++ WidgetTextBox.h 5 Nov 2006 17:55:39 -0000 1.34 @@ -151,13 +151,6 @@ // Contract needed by AspectBackgroundColor Aspect class static inline Message & getBackgroundColorMessage(); - /// Sets the text in the Edit Control so that endl causes a new line. - /** Just the same as setText except that CR are expanded to LF CR - * Replaces \n with \r\n so that Windows textbox understands "endl" - */ - void setTextLines( const SmartUtil::tstring & txt ); - - /// Sets the current selection of the Edit Control /** Start means the offset of where the current selection shall start, if it is * omitted it defaults to 0. <br> @@ -329,22 +322,6 @@ } -template< class EventHandlerClass, class MessageMapPolicy, class TextBoxType > -void WidgetTextBox< EventHandlerClass, MessageMapPolicy, TextBoxType >::setTextLines( const SmartUtil::tstring & inTxt ) -{ - // Replaces \n with \r\n so that Windows textbox understands "endl" - SmartUtil::tstring txtEndl= inTxt; - - std::string::size_type pos= txtEndl.find( '\n', 0 ); - while ( std::string::npos != pos ) { - txtEndl.replace( pos, 1, "\r\n" ); - pos += 2; // Don't find the replacement \n. - pos= txtEndl.find( '\n', pos ); - } - setText( txtEndl ); -} - - template< class EventHandlerClass, class MessageMapPolicy, class TextBoxType > void WidgetTextBox< EventHandlerClass, MessageMapPolicy, TextBoxType >::setSelection( long start, long end ) |
|
From: andrew7 <bd...@us...> - 2006-11-05 17:55:15
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/aspects In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7894/include/smartwin/aspects Modified Files: AspectText.h Log Message: Put setTextLines in the aspect. Index: AspectText.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/aspects/AspectText.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- AspectText.h 5 May 2006 17:14:38 -0000 1.16 +++ AspectText.h 5 Nov 2006 17:55:12 -0000 1.17 @@ -137,6 +137,13 @@ */ void setText( const SmartUtil::tstring & txt ); + /// Sets the text in the Edit Control so that endl causes a new line. + /** Just the same as setText except that CR are expanded to LF CR + * Replaces \n with \r\n so that Windows textbox understands "endl" + */ + void setTextLines( const SmartUtil::tstring & txt ); + + /// Gets the text of the AspectText realizing class /** The Return value is the text of the realizing class. */ @@ -165,6 +172,24 @@ ::SendMessage( static_cast< WidgetType * >( this )->handle(), WM_SETTEXT, ( WPARAM ) 0, ( LPARAM ) txt.c_str() ); } + +template< class EventHandlerClass, class WidgetType, class MessageMapType > +void AspectText< EventHandlerClass, WidgetType, MessageMapType >::setTextLines( const SmartUtil::tstring & inTxt ) +{ + // Replaces \n with \r\n so that Windows textbox understands "endl" + SmartUtil::tstring txtEndl= inTxt; + + std::string::size_type pos= txtEndl.find( '\n', 0 ); + while ( std::string::npos != pos ) { + txtEndl.replace( pos, 1, "\r\n" ); + pos += 2; // Don't find the replacement \n. + pos= txtEndl.find( '\n', pos ); + } + setText( txtEndl ); +} + + + template< class EventHandlerClass, class WidgetType, class MessageMapType > SmartUtil::tstring AspectText< EventHandlerClass, WidgetType, MessageMapType >::getText() const { |
|
From: andrew7 <bd...@us...> - 2006-11-03 13:34:46
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30272/include/smartwin Modified Files: VCDesktopHeaders.h Log Message: Remove #undef of min() and max() Index: VCDesktopHeaders.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/VCDesktopHeaders.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- VCDesktopHeaders.h 10 Sep 2006 08:11:01 -0000 1.5 +++ VCDesktopHeaders.h 3 Nov 2006 13:34:41 -0000 1.6 @@ -46,6 +46,7 @@ #include <commctrl.h> #include <assert.h> +/* No longer needed because we replaced std:min() with (std:min)() #ifdef max #undef max #endif @@ -53,7 +54,8 @@ #ifdef min #undef min #endif - #pragma comment( lib, "Comdlg32.lib" ) +*/ +#pragma comment( lib, "Comdlg32.lib" ) #pragma comment( lib, "comctl32.lib" ) #ifdef _DEBUG #ifdef _UNICODE |
|
From: andrew7 <bd...@us...> - 2006-11-03 13:32:00
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28595/include/smartwin/widgets Modified Files: WidgetTextBox.h Log Message: Add setTextLines Index: WidgetTextBox.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetTextBox.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- WidgetTextBox.h 13 Oct 2006 00:45:56 -0000 1.32 +++ WidgetTextBox.h 3 Nov 2006 13:31:56 -0000 1.33 @@ -151,6 +151,13 @@ // Contract needed by AspectBackgroundColor Aspect class static inline Message & getBackgroundColorMessage(); + /// Sets the text in the Edit Control so that endl causes a new line. + /** Just the same as setText except that CR are expanded to LF CR + * Replaces \n with \r\n so that Windows textbox understands "endl" + */ + void setTextLines( const SmartUtil::tstring & txt ); + + /// Sets the current selection of the Edit Control /** Start means the offset of where the current selection shall start, if it is * omitted it defaults to 0. <br> @@ -321,6 +328,24 @@ return retVal; } + +template< class EventHandlerClass, class MessageMapPolicy, class TextBoxType > +void WidgetTextBox< EventHandlerClass, MessageMapPolicy, TextBoxType >::setTextLines( const SmartUtil::tstring & inTxt ) +{ + // Replaces \n with \r\n so that Windows textbox understands "endl" + SmartUtil::tstring txtEndl= inTxt; + + std::string::size_type pos= txtEndl.find( '\n', 0 ); + while ( std::string::npos != pos ) { + txtEndl.replace( pos, 1, "\r\n" ); + pos += 2; // Don't find the replacement \n. + pos= txtEndl.find( '\n', pos ); + } + setText( txtEndl ); +} + + + template< class EventHandlerClass, class MessageMapPolicy, class TextBoxType > void WidgetTextBox< EventHandlerClass, MessageMapPolicy, TextBoxType >::setSelection( long start, long end ) { |
|
From: andrew7 <bd...@us...> - 2006-11-03 13:30:33
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27951/include/smartwin/widgets Modified Files: WidgetMenuExtended.h Log Message: std::min to (std::min) to prevent macro min problem Index: WidgetMenuExtended.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetMenuExtended.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- WidgetMenuExtended.h 13 Oct 2006 00:45:56 -0000 1.42 +++ WidgetMenuExtended.h 3 Nov 2006 13:30:21 -0000 1.43 @@ -272,21 +272,21 @@ : Bitmap::getBitmapSize( info.hbmpChecked ); // take the maximum of all available images or set default image size - imageSize.x = std::max( imageSize.x, checkImageSize.x ); - imageSize.y = std::max( imageSize.y, checkImageSize.y ); + imageSize.x = (std::max)( imageSize.x, checkImageSize.x ); + imageSize.y = (std::max)( imageSize.y, checkImageSize.y ); bool hasImage = ( imageSize.x != 0 ) && ( imageSize.y != 0 ); // set default image size if no image is available if ( !hasImage ) { - imageSize.x = std::max( defaultImageSize.x, std::max( imageSize.x, checkImageSize.x ) ); - imageSize.y = std::max( defaultImageSize.y, std::max( imageSize.y, checkImageSize.y ) ); + imageSize.x = (std::max)( defaultImageSize.x, (std::max)( imageSize.x, checkImageSize.x ) ); + imageSize.y = (std::max)( defaultImageSize.y, (std::max)( imageSize.y, checkImageSize.y ) ); } // adjust default image size - defaultImageSize.x = std::max( defaultImageSize.x, imageSize.x ); - defaultImageSize.y = std::max( defaultImageSize.y, imageSize.y ); + defaultImageSize.x = (std::max)( defaultImageSize.x, imageSize.x ); + defaultImageSize.y = (std::max)( defaultImageSize.y, imageSize.y ); // adjust width if ( !isMenuBar || // if not menu bar item @@ -296,12 +296,12 @@ itemWidth += imageSize.x + textIconGap + pointerGap; // adjust item height - itemHeight = std::max( itemHeight, ( UINT ) imageSize.y + borderGap ); + itemHeight = (std::max)( itemHeight, ( UINT ) imageSize.y + borderGap ); } // adjust width for system menu items if ( menu->isSysMenu ) - itemWidth = std::max( ( UINT ) minSysMenuItemWidth, itemWidth ); + itemWidth = (std::max)( ( UINT ) minSysMenuItemWidth, itemWidth ); // adjust width for sidebar if ( menu->drawSidebar ) @@ -316,7 +316,7 @@ } // adjust item height - itemHeight = std::max( itemHeight, ( UINT )::GetSystemMetrics( SM_CYMENU ) ); + itemHeight = (std::max)( itemHeight, ( UINT )::GetSystemMetrics( SM_CYMENU ) ); return true; } |
|
From: andrew7 <bd...@us...> - 2006-11-03 13:26:24
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25997/include/smartwin/widgets Modified Files: WidgetModalDialog.h Log Message: Add Application::instance().registerWidget( this ); Index: WidgetModalDialog.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetModalDialog.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- WidgetModalDialog.h 18 Aug 2006 19:08:11 -0000 1.19 +++ WidgetModalDialog.h 3 Nov 2006 13:26:17 -0000 1.20 @@ -226,6 +226,9 @@ template< class EventHandlerClass, class MessageMapPolicy > int WidgetModalDialog< EventHandlerClass, MessageMapPolicy >::createDialog() { + // Must register the widget in order not to close app when this closes...! + Application::instance().registerWidget( this ); + // Arrange so the DLGTEMPLATE is followed by 0000 for menu, winclass and title. unsigned char dlg_menu_winclass_title[ sizeof( DLGTEMPLATE ) + 30 ]; memset( dlg_menu_winclass_title, 0, sizeof( dlg_menu_winclass_title ) ); |
|
From: andrew7 <bd...@us...> - 2006-11-03 13:22:33
|
Update of /cvsroot/smartwin/SmartWin/tests/WidgetSlider In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23517/tests/WidgetSlider Modified Files: Main.cpp Log Message: replaced std:min( ) with (std:min) ( ) to allow min to be a macro. Index: Main.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/WidgetSlider/Main.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Main.cpp 20 Apr 2006 05:03:40 -0000 1.14 +++ Main.cpp 3 Nov 2006 13:22:25 -0000 1.15 @@ -1,5 +1,5 @@ // $Revision$ -// Unit test for WidgetTextBox, tries to instantiate all different forms of WidgetTextBox and also tries to use all functions +// Unit test for WidgetSlider, tries to instantiate all different forms of WidgetSlider and also tries to use all functions #include "SmartWin.h" #include "resource.h" @@ -71,7 +71,7 @@ { for ( int y = rc.pos.y; y < rc.pos.y + rc.size.y; ++y ) { - COLORREF color = ColorUtilities::alphaBlend( canvas.getPixel( x, y ), RGB( std::min( 255, x * 2 ), 255 - std::min( 255, y ), std::min( 255, y ) ) ); + COLORREF color = ColorUtilities::alphaBlend( canvas.getPixel( x, y ), RGB( (std::min)( 255, x * 2 ), 255 - (std::min)( 255, y ), (std::min)( 255, y ) ) ); canvas.setPixel( x, y, color ); } } |
|
From: andrew7 <bd...@us...> - 2006-10-15 14:35:35
|
Update of /cvsroot/smartwin/SmartWin/tests/WidgetDialog In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv14219/tests/WidgetDialog Added Files: Main.cpp WidgetDialog.rc WidgetDialog.vcproj resource.h Log Message: Test modeless dialog. --- NEW FILE: WidgetDialog.rc --- // Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE BEGIN "resource.h\0" END 2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_HEXDIALOG DIALOGEX 0, 0, 200, 60 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,128,36,50,14 PUSHBUTTON "Cancel",IDCANCEL,7,36,50,14 EDITTEXT IDC_HEXEDIT,7,7,171,17,ES_AUTOHSCROLL END IDD_HEXDIALOGTWO DIALOGEX 0, 0, 200, 60 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Modeless Popup WidgetDialog" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,128,36,50,14 PUSHBUTTON "Cancel",IDCANCEL,7,36,50,14 EDITTEXT IDC_HEXEDIT,7,7,171,17,ES_AUTOHSCROLL,WS_EX_DLGMODALFRAME END ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN IDD_HEXDIALOG, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 178 TOPMARGIN, 7 BOTTOMMARGIN, 50 END END #endif // APSTUDIO_INVOKED #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED --- NEW FILE: Main.cpp --- // $Revision: 1.1 $ /* Copyright (c) 2006 - Thomas Hansen * Part of the SmartWin++ library example code * Permission to use under the same terms as the actual library * The license to the library can be found at http://smartwinlib.org * License for library is Open Source and BSD NOTES: The WidgetDialog class can be used either as a modeless dialog window that is independent from a parent window, or it may be used as part of another window. The difference is in the styles used to create the dialog. The dialogs are defined in a resource, but also could be created entirely with SmartWin++ code. This sample demonstrates using a series of dialogs in a WidgetTabSheet. For simplicity, all five dialogs in the TabSheet are based on the same class, as is a dialog intended to be used as its own window. The difference between the dialogs comes from the different dialog resource id passed in the dialog constructor. Communication between the dialog and its parent takes place through member functions. The dialog can be hosted by multiple parent classes because the dialog class is a template with a parameter of the class of the parent. The closing of the dialog requires some care: The attached dialogs must be closed manually when the parent window is closed. The POPUP dialog must tell the parent when its closed so that the parent won;t try to use it by mistake. A.Webb July 22, 2006. */ #include "SmartWin.h" using namespace SmartWin; //------------------------------------------------------- /* HexDialog IN: Class needs to be constructed with a dialog resource ID that contains: Two buttons: IDOK and IDCANCEL, and one textbox: IDC_HEXEDIT The resource can be configuerd for a embedded window or a modeless dialog. depending on the child and popup properties. */ #include "resource.h" template< typename ParentClass > class HexDialog : public SmartWin::WidgetFactory< SmartWin::WidgetDialog, HexDialog<ParentClass>, SmartWin::MessageMapPolicyDialogWidget > { private: WidgetTextBoxPtr itsHexTxt; ParentClass * itsParent; public: // Constructor HexDialog( ParentClass * main, SmartUtil::tstring label, int iddDialog ) : Widget( main ), itsParent( main ) { createDialog( iddDialog ); WidgetButtonPtr btnOk = subclassButton( IDOK ); WidgetButtonPtr btnCancel = subclassButton( IDCANCEL ); itsHexTxt = subclassTextBox( IDC_HEXEDIT ); itsHexTxt->setTextLimit(32); itsHexTxt->setFocus(); itsHexTxt->setText( label ); onClosing( & HexDialog::closing ); btnCancel->onClicked( & HexDialog::cancelClicked ); btnOk->onClicked( & HexDialog::OkClicked ); } void OkClicked( WidgetButtonPtr btn ) { itsParent->dataFromDialog( itsHexTxt->getText() ); } void cancelClicked( WidgetButtonPtr btn ) { itsParent->dataFromDialog( _T( "Cancel" ) ); } bool closing() { itsParent->dataFromDialog( _T( "Closed" ) ); itsParent->closingDialog( this ); return true; } }; //------------------------------------------------------- class DialogTestClass : public WidgetFactory< WidgetWindow, DialogTestClass > { private: WidgetTabSheetPtr itsTabSheet; std::vector< HexDialog<DialogTestClass> * > itsHexDialogs; int itsLastSelectedIndex; WidgetTextBoxPtr itsText; boost::shared_ptr< sw::Brush > itsBgBrush; // For a modeless popup dialog WidgetButtonPtr itsButton; HexDialog<DialogTestClass> * itsPopupDialog; public: // Creation of a window that uses WidgetDialog classes. // void initAndCreate() { createWindow(); setText( _T( "SmartWin Dialog Sample" ) ); // Title SmartWin::Rectangle desktop( getDesktopSize() ); setBounds( desktop.top( 0.2 ).left( 0.3 ) ); itsTabSheet = createTabSheet(); itsTabSheet->onSelectionChanged( & DialogTestClass::tabSelectionChanged ); itsTabSheet->setTabsAtBottom( false ); itsTabSheet->setButtonStyle( false ); itsTabSheet->setHotTrack(); std::stringstream ss; for ( int i=0; i < 5; i++ ) { ss << "Page " << i; itsTabSheet->addPage( ss.str(), i ); ss.str( "" ); ss << "Dialog " << i; itsHexDialogs.push_back( new HexDialog<DialogTestClass>( this, ss.str(), IDD_HEXDIALOG ) ); ss.str( "" ); itsHexDialogs[i]->setVisible( false ); } itsLastSelectedIndex= 0; itsHexDialogs[itsLastSelectedIndex]->setVisible( true ); itsText= createTextBox(); itsText->onBackgroundColor( & DialogTestClass::backgroundColor ); itsButton= createButton(); itsButton->setText( _T("Start dialog") ); itsButton->onClicked( & DialogTestClass::buttonClicked ); itsPopupDialog= NULL; layout(); onSized( & DialogTestClass::isResized ); onClosing( & DialogTestClass::closing ); } // Handle a new tab request by hiding the old dialog, // and revealing the selected dialog. // void tabSelectionChanged( WidgetTabSheetPtr sheet ) { itsHexDialogs[itsLastSelectedIndex]->setVisible( false ); itsLastSelectedIndex= sheet->getSelectedIndex(); itsHexDialogs[itsLastSelectedIndex]->setVisible( true ); itsHexDialogs[itsLastSelectedIndex]->setFocus(); layout(); } // Receive some data from either type of dialog and diaplay it. // void dataFromDialog( SmartUtil::tstring data ) { itsText->setText( data ); } // When the POPUP dialog closes, we need to remember that fact. // void closingDialog( HexDialog<DialogTestClass> * PopupDialog ) { if ( PopupDialog == itsPopupDialog ) { itsPopupDialog= NULL; } } void isResized( const WidgetSizedEventResult & sz ) { layout(); } // Put the tabs in the top 80% // And the textbox and the button in the bottom 18% // void layout() { SmartWin::Rectangle newRect( getClientAreaSize() ); SmartWin::Rectangle tabRect= newRect.top( 0.8 ); SmartWin::Rectangle otherRect= newRect.bottom( 0.18 ); itsTabSheet->setBounds( tabRect ); SmartWin::Rectangle dialogRect = itsTabSheet->getUsableArea(); itsHexDialogs[itsLastSelectedIndex]->setBounds( dialogRect ); SmartWin::Rectangle textRect= otherRect.left( 0.5 ); SmartWin::Rectangle butRect= otherRect.right( 0.5 ); itsText->setBounds( textRect ); itsButton->setBounds( butRect ); } // When this window closes ... // bool closing() { // Close all my attached dialogs. for ( unsigned int i=0; i < itsHexDialogs.size(); i++ ) { itsHexDialogs[i]->close(); } // Note I don't need to close the POPUP dialog. return true; } // Just some coloring to make the window more beautiful // boost::shared_ptr< sw::Brush > backgroundColor( WidgetTextBoxPtr widg, sw::Canvas & canvas ) { canvas.setBkMode( true ); itsBgBrush = boost::shared_ptr< sw::Brush >( new SmartWin::Brush( canvas, RGB( 200, 200, 250 ) ) ); return itsBgBrush; } // Launch the POPUP dialog, // or just make it visible again if its already created. // void buttonClicked( WidgetButtonPtr button ) { if ( NULL == itsPopupDialog ) { itsPopupDialog = new HexDialog<DialogTestClass>( this, "Modeless dialog as POPUP", IDD_HEXDIALOGTWO ); itsPopupDialog->setVisible( true ); // } else { itsPopupDialog->setFocus(); } } }; int SmartWinMain( Application & app ) { DialogTestClass * testHello = new DialogTestClass; testHello->initAndCreate(); return app.run(); } --- NEW FILE: resource.h --- //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by WidgetDialog.rc // #define IDD_HEXDIALOG 101 #define IDD_HEXDIALOGTWO 102 #define IDC_HEXEDIT 1001 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1002 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif --- NEW FILE: WidgetDialog.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="8.00" Name="WidgetDialog" ProjectGUID="{649906BA-83EE-4265-8F8F-B614153EA637}" RootNamespace="WidgetDialog" Keyword="Win32Proj" > <Platforms> <Platform Name="Win32" /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="1" CharacterSet="2" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" LinkIncremental="2" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="1" CharacterSet="2" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="0" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLinkerTool" LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1" /> <Tool Name="VCALinkTool" /> <Tool Name="VCManifestTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCWebDeploymentTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File RelativePath=".\Main.cpp" > </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File RelativePath=".\resource.h" > </File> </Filter> <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" > <File RelativePath=".\WidgetDialog.rc" > </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> |