00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00047 #ifndef WINSTL_INCL_WINSTL_WINDOW_HPP_WINDOW_ENABLE_SCOPE
00048 #define WINSTL_INCL_WINSTL_WINDOW_HPP_WINDOW_ENABLE_SCOPE
00049 
00050 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00051 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ENABLE_SCOPE_MAJOR    4
00052 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ENABLE_SCOPE_MINOR    1
00053 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ENABLE_SCOPE_REVISION 1
00054 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ENABLE_SCOPE_EDIT     90
00055 #endif 
00056 
00057 
00058 
00059 
00060 
00061 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00062 # include <winstl/winstl.h>
00063 #endif 
00064 #ifndef WINSTL_INCL_SHIMS_ATTRIBUTE_HPP_GET_HWND
00065 # include <winstl/shims/attribute/get_HWND.hpp>
00066 #endif 
00067 
00068 
00069 
00070 
00071 
00072 #ifndef _WINSTL_NO_NAMESPACE
00073 # if defined(_STLSOFT_NO_NAMESPACE) || \
00074      defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00075 
00076 namespace winstl
00077 {
00078 # else
00079 
00080 
00081 namespace stlsoft
00082 {
00083 
00084 namespace winstl_project
00085 {
00086 
00087 # endif 
00088 #endif 
00089 
00090 
00091 
00092 
00093 
00094 
00102 class window_enable_scope
00103 {
00104 public:
00106     typedef window_enable_scope class_type;
00107 
00108 
00109 public:
00116     ss_explicit_k window_enable_scope(HWND wnd)
00117         : m_hwnd(wnd)
00118         , m_bEnableOnDtor(::IsWindowEnabled(m_hwnd) != false)
00119     {
00120         ::EnableWindow(m_hwnd, !m_bEnableOnDtor);
00121     }
00122 
00123 #ifdef STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
00130     template <ss_typename_param_k W>
00131     ss_explicit_k window_enable_scope(W &wnd)
00132         : m_hwnd(get_HWND(wnd))
00133         , m_bEnableOnDtor(::IsWindowEnabled(m_hwnd) != false)
00134     {
00135         ::EnableWindow(m_hwnd, !m_bEnableOnDtor);
00136     }
00137 #endif 
00138 
00144     window_enable_scope(HWND wnd, ws_bool_t bEnableOnCtor, ws_bool_t bEnableOnDtor)
00145         : m_hwnd(wnd)
00146         , m_bEnableOnDtor(bEnableOnDtor)
00147     {
00148         ::EnableWindow(m_hwnd, bEnableOnCtor);
00149     }
00150 #ifdef STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
00156     template <ss_typename_param_k W>
00157     window_enable_scope(W &wnd, ws_bool_t bEnableOnCtor, ws_bool_t bEnableOnDtor)
00158         : m_hwnd(get_HWND(wnd))
00159         , m_bEnableOnDtor(bEnableOnDtor)
00160     {
00161         ::EnableWindow(m_hwnd, bEnableOnCtor);
00162     }
00163 #endif 
00164 
00166     ~window_enable_scope() stlsoft_throw_0()
00167     {
00168 #ifdef STLSOFT_CF_USE_RAW_OFFSETOF_IN_STATIC_ASSERT
00169         WINSTL_STATIC_ASSERT(STLSOFT_RAW_OFFSETOF(class_type, m_hwnd) < STLSOFT_RAW_OFFSETOF(class_type, m_bEnableOnDtor));
00170 #endif 
00171 
00172         ::EnableWindow(m_hwnd, m_bEnableOnDtor);
00173     }
00174 
00175 
00176 private:
00177     HWND        m_hwnd;
00178     ws_bool_t   m_bEnableOnDtor;
00179 
00180 
00181 private:
00182     window_enable_scope(class_type const& rhs);
00183     class_type const& operator =(class_type const& rhs);
00184 };
00185 
00186 
00187 
00188 #ifndef _WINSTL_NO_NAMESPACE
00189 # if defined(_STLSOFT_NO_NAMESPACE) || \
00190      defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00191 } 
00192 # else
00193 } 
00194 } 
00195 # endif 
00196 #endif 
00197 
00198 
00199 
00200 #endif 
00201 
00202