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_VISIBLE_SCOPE
00048 #define WINSTL_INCL_WINSTL_WINDOW_HPP_WINDOW_VISIBLE_SCOPE
00049
00050 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00051 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_VISIBLE_SCOPE_MAJOR 4
00052 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_VISIBLE_SCOPE_MINOR 1
00053 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_VISIBLE_SCOPE_REVISION 1
00054 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_VISIBLE_SCOPE_EDIT 39
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_visible_scope
00103 {
00104 public:
00106 typedef window_visible_scope class_type;
00107
00108
00109 public:
00116 ss_explicit_k window_visible_scope(HWND wnd)
00117 : m_hwnd(wnd)
00118 , m_stateOnDtor(::IsWindowVisible(m_hwnd) ? SW_SHOW : SW_HIDE)
00119 {
00120 ::ShowWindow(m_hwnd, (SW_SHOW == m_stateOnDtor) ? SW_HIDE : SW_SHOW);
00121 }
00122
00123 #ifdef STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
00130 template <ss_typename_param_k W>
00131 ss_explicit_k window_visible_scope(W &wnd)
00132 : m_hwnd(get_HWND(wnd))
00133 , m_stateOnDtor(::IsWindowVisible(m_hwnd) ? SW_SHOW : SW_HIDE)
00134 {
00135 ::ShowWindow(m_hwnd, (SW_SHOW == m_stateOnDtor) ? SW_HIDE : SW_SHOW);
00136 }
00137 #endif
00138
00144 window_visible_scope(HWND wnd, ws_int_t stateOnCtor, ws_int_t stateOnDtor)
00145 : m_hwnd(wnd)
00146 , m_stateOnDtor(stateOnDtor)
00147 {
00148 ::ShowWindow(m_hwnd, stateOnCtor);
00149 }
00150 #ifdef STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
00156 template <ss_typename_param_k W>
00157 window_visible_scope(W &wnd, ws_int_t stateOnCtor, ws_int_t stateOnDtor)
00158 : m_hwnd(get_HWND(wnd))
00159 , m_stateOnDtor(stateOnDtor)
00160 {
00161 ::ShowWindow(m_hwnd, stateOnCtor);
00162 }
00163 #endif
00164
00166 ~window_visible_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_stateOnDtor));
00170 #endif
00171
00172 ::ShowWindow(m_hwnd, m_stateOnDtor);
00173 }
00174
00175
00176 private:
00177 HWND const m_hwnd;
00178 ws_int_t const m_stateOnDtor;
00179
00180
00181 private:
00182 window_visible_scope(class_type const& rhs);
00183 class_type const& operator =(class_type const& rhs);
00184 };
00185
00187
00188
00189 #ifdef STLSOFT_UNITTEST
00190 # include "./unittest/window_visible_scope_unittest_.h"
00191 #endif
00192
00193
00194
00195 #ifndef _WINSTL_NO_NAMESPACE
00196 # if defined(_STLSOFT_NO_NAMESPACE) || \
00197 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00198 }
00199 # else
00200 }
00201 }
00202 # endif
00203 #endif
00204
00205
00206
00207 #endif
00208
00209