|
|
|
|
|
|
|
|
|
|
|
|||||||
00001 /* 00002 * File: winstl_setfocus_scope.h 00003 * 00004 * Purpose: Cursor scoping class. 00005 * 00006 * Created: 4th May 2003 00007 * Updated: 11th September 2004 00008 * 00009 * Home: http://stlsoft.org/ 00010 * 00011 * Copyright (c) 2003-2004, Matthew Wilson and Synesis Software 00012 * All rights reserved. 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions are met: 00016 * 00017 * - Redistributions of source code must retain the above copyright notice, this 00018 * list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of 00023 * any contributors may be used to endorse or promote products derived from 00024 * this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00029 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00030 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00031 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00032 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00033 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00034 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00035 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * 00039 00040 00044 00045 #ifndef WINSTL_INCL_H_WINSTL_SETFOCUS_SCOPE 00046 #define WINSTL_INCL_H_WINSTL_SETFOCUS_SCOPE 00047 00048 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION 00049 # define WINSTL_VER_H_WINSTL_SETFOCUS_SCOPE_MAJOR 2 00050 # define WINSTL_VER_H_WINSTL_SETFOCUS_SCOPE_MINOR 0 00051 # define WINSTL_VER_H_WINSTL_SETFOCUS_SCOPE_REVISION 1 00052 # define WINSTL_VER_H_WINSTL_SETFOCUS_SCOPE_EDIT 15 00053 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */ 00054 00055 /* 00056 * Includes 00057 */ 00058 00059 #ifndef WINSTL_INCL_H_WINSTL 00060 # include "winstl.h" // Include the WinSTL root header 00061 #endif /* WINSTL_INCL_H_WINSTL */ 00062 #ifndef STLSOFT_INCL_H_STLSOFT_STRING_ACCESS 00063 # include "stlsoft_string_access.h" // stlsoft::c_str_ptr 00064 #endif /* !STLSOFT_INCL_H_STLSOFT_STRING_ACCESS */ 00065 #ifndef WINSTL_INCL_H_WINSTL_STRING_ACCESS 00066 # include "winstl_string_access.h" // stlsoft::c_str_ptr 00067 #endif /* !WINSTL_INCL_H_WINSTL_STRING_ACCESS */ 00068 00069 /* 00070 * Namespace 00071 */ 00072 00073 #ifndef _WINSTL_NO_NAMESPACE 00074 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00075 defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION) 00076 /* There is no stlsoft namespace, so must define ::winstl */ 00077 namespace winstl 00078 { 00079 # else 00080 /* Define stlsoft::winstl_project */ 00081 00082 namespace stlsoft 00083 { 00084 00085 namespace winstl_project 00086 { 00087 00088 # endif /* _STLSOFT_NO_NAMESPACE */ 00089 #endif /* !_WINSTL_NO_NAMESPACE */ 00090 00091 #if !defined(__STLSOFT_COMPILER_IS_MWERKS) 00092 stlsoft_ns_using(c_str_ptr) 00093 #endif /* compiler */ 00094 00095 /* 00096 00099 00103 00108 00109 /* 00110 * Classes 00111 */ 00112 00113 // setfocus_scope 00118 00119 class setfocus_scope 00120 { 00121 public: 00122 typedef setfocus_scope class_type; 00123 00124 public: 00126 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT 00127 template <ss_typename_param_k W> 00128 ss_explicit_k setfocus_scope(W &wnd) 00129 : m_hwndFocus(::SetFocus(get_hwnd(wnd))) 00130 #else 00131 ss_explicit_k setfocus_scope(HWND wnd) 00132 : m_hwndFocus(::SetFocus(wnd)) 00133 #endif /* __STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT */ 00134 {} 00136 setfocus_scope() 00137 : m_hwndFocus(::GetFocus()) 00138 {} 00140 ~setfocus_scope() 00141 { 00142 ::SetFocus(m_hwndFocus); 00143 } 00144 00146 private: 00147 HWND m_hwndFocus; 00148 00150 private: 00151 setfocus_scope(setfocus_scope const &); 00152 setfocus_scope &operator =(setfocus_scope const &); 00153 }; 00154 00155 /* 00156 00158 00159 /* 00160 00161 #ifndef _WINSTL_NO_NAMESPACE 00162 # if defined(_STLSOFT_NO_NAMESPACE) || \ 00163 defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION) 00164 } // namespace winstl 00165 # else 00166 } // namespace winstl_project 00167 } // namespace stlsoft 00168 # endif /* _STLSOFT_NO_NAMESPACE */ 00169 #endif /* !_WINSTL_NO_NAMESPACE */ 00170 00171 /* 00172 00173 #endif /* WINSTL_INCL_H_WINSTL_SETFOCUS_SCOPE */ 00174 00175 /*
|
|
| STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004 |