From: Thomas H. <pol...@us...> - 2006-01-03 11:38:59
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12981/include/smartwin Modified Files: SmartWin.h Added Files: Cursor.h Log Message: Index: SmartWin.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/SmartWin.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- SmartWin.h 6 Dec 2005 04:02:29 -0000 1.9 +++ SmartWin.h 3 Jan 2006 11:38:50 -0000 1.10 @@ -86,6 +86,7 @@ #include "Threads.h" #include "LibraryLoader.h" #include "Bitmap.h" +#include "Cursor.h" namespace sw = SmartWin; --- NEW FILE: Cursor.h --- /* Copyright (c) 2005, Thomas Hansen All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the SmartWin++ nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef Cursor_h #define Cursor_h #include "WindowsHeaders.h" #include "boost.h" namespace SmartWin { /// Class for manipulating the mouse cursor /** Use getCursor and store the returned object until you wish to change back to the previous cursor */ class Cursor { class Implementation { HCURSOR itsOld; public: Implementation( HCURSOR old ) : itsOld( old ) {} ~Implementation() { ::SetCursor( itsOld ); } }; boost::shared_ptr<Implementation> itsImplementation; Cursor( boost::shared_ptr<Implementation> implementation ) : itsImplementation( implementation ) {} public: /// Returns a wait cursor /** Store the returned object and when object goes out of scope or is freed old cursor will be set again */ static Cursor getWaitCursor() { boost::shared_ptr<Implementation> implementation( new Implementation( ::SetCursor( ::LoadCursor( 0, IDC_WAIT ) ) ) ); return Cursor( implementation ); } }; } #endif |