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_ICON_SCOPE
00048 #define WINSTL_INCL_WINSTL_WINDOW_HPP_WINDOW_ICON_SCOPE
00049
00050 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00051 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ICON_SCOPE_MAJOR 4
00052 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ICON_SCOPE_MINOR 1
00053 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ICON_SCOPE_REVISION 1
00054 # define WINSTL_VER_WINSTL_WINDOW_HPP_WINDOW_ICON_SCOPE_EDIT 50
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 #ifndef WINSTL_INCL_WINSTL_WINDOW_H_FUNCTIONS
00068 # include <winstl/window/functions.h>
00069 #endif
00070
00071
00072
00073
00074
00075 #ifndef _WINSTL_NO_NAMESPACE
00076 # if defined(_STLSOFT_NO_NAMESPACE) || \
00077 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00078
00079 namespace winstl
00080 {
00081 # else
00082
00083
00084 namespace stlsoft
00085 {
00086
00087 namespace winstl_project
00088 {
00089
00090 # endif
00091 #endif
00092
00093
00094
00095
00096
00097
00105 class window_icon_scope
00106 {
00107 public:
00109 typedef window_icon_scope class_type;
00110
00111
00112 public:
00121 window_icon_scope(HWND wnd, int iconType, HICON hicon)
00122 : m_hwnd(wnd)
00123 , m_iconId(iconType)
00124 , m_hicon(set_window_icon(m_hwnd, iconType, hicon))
00125 {}
00135 window_icon_scope(HWND wnd, int iconType, HINSTANCE hinst, LPCTSTR iconName)
00136 : m_hwnd(wnd)
00137 , m_iconId(iconType)
00138 , m_hicon(set_window_icon(m_hwnd, iconType, hinst, iconName))
00139 {}
00149 window_icon_scope(HWND wnd, int iconType, HINSTANCE hinst, int iconId)
00150 : m_hwnd(wnd)
00151 , m_iconId(iconType)
00152 , m_hicon(set_window_icon(m_hwnd, iconType, hinst, iconId))
00153 {}
00154
00155 #ifdef STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT
00164 template <ss_typename_param_k W>
00165 window_icon_scope(W &wnd, int iconType, HICON hicon)
00166 : m_hwnd(get_HWND(wnd))
00167 , m_iconId(iconType)
00168 , m_hicon(set_window_icon(m_hwnd, iconType, hicon))
00169 {}
00179 template <ss_typename_param_k W>
00180 window_icon_scope(W &wnd, int iconType, HINSTANCE hinst, LPCTSTR iconName)
00181 : m_hwnd(get_HWND(wnd))
00182 , m_iconId(iconType)
00183 , m_hicon(set_window_icon(m_hwnd, iconType, hinst, iconName))
00184 {}
00194 template <ss_typename_param_k W>
00195 window_icon_scope(W &wnd, int iconType, HINSTANCE hinst, int iconId)
00196 : m_hwnd(get_HWND(wnd))
00197 , m_iconId(iconType)
00198 , m_hicon(set_window_icon(m_hwnd, iconType, hinst, iconId))
00199 {}
00200 #endif
00201
00203 ~window_icon_scope() stlsoft_throw_0()
00204 {
00205 #ifdef STLSOFT_CF_USE_RAW_OFFSETOF_IN_STATIC_ASSERT
00206 WINSTL_STATIC_ASSERT(STLSOFT_RAW_OFFSETOF(class_type, m_hwnd) < STLSOFT_RAW_OFFSETOF(class_type, m_hicon));
00207 #endif
00208
00209 set_window_icon(m_hwnd, m_iconId, m_hicon);
00210 }
00211
00212
00213 private:
00214 HWND m_hwnd;
00215 int m_iconId;
00216 HICON m_hicon;
00217
00218
00219 private:
00220 window_icon_scope(class_type const& rhs);
00221 class_type const& operator =(class_type const& rhs);
00222 };
00223
00224
00225
00226 #ifndef _WINSTL_NO_NAMESPACE
00227 # if defined(_STLSOFT_NO_NAMESPACE) || \
00228 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00229 }
00230 # else
00231 }
00232 }
00233 # endif
00234 #endif
00235
00236
00237
00238 #endif
00239
00240