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
00048 #ifndef ATLSTL_INCL_ATLSTL_WINDOW_HPP_ENHANCED_WINDOW
00049 #define ATLSTL_INCL_ATLSTL_WINDOW_HPP_ENHANCED_WINDOW
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ENHANCED_WINDOW_MAJOR 4
00053 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ENHANCED_WINDOW_MINOR 0
00054 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ENHANCED_WINDOW_REVISION 2
00055 # define ATLSTL_VER_ATLSTL_WINDOW_HPP_ENHANCED_WINDOW_EDIT 29
00056 #endif
00057
00058
00059
00060
00061
00062 #ifndef ATLSTL_INCL_ATLSTL_HPP_ATLSTL
00063 # include <atlstl/atlstl.hpp>
00064 #endif
00065 #ifndef ATLSTL_INCL_ATLSTL_SHIMS_ACCESS_HPP_STRING
00066 # include <atlstl/shims/access/string.hpp>
00067 #endif
00068
00069
00070
00071
00072
00073 #ifndef _ATLSTL_NO_NAMESPACE
00074 # if defined(_STLSOFT_NO_NAMESPACE) || \
00075 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00076
00077 namespace atlstl
00078 {
00079 # else
00080
00081
00082 namespace stlsoft
00083 {
00084
00085 namespace atlstl_project
00086 {
00087
00088 # endif
00089 #endif
00090
00091
00092
00093
00094
00100
00101 template <ss_typename_param_k D>
00102 class EnhancedWindow
00103 {
00106 public:
00107 typedef D dialog_window_type;
00108 typedef EnhancedWindow<D> class_type;
00110
00113 public:
00115 int GetDlgItemTextLength(int idChild)
00116 {
00117 HWND hwndChild = GetDlgItem_(idChild);
00118
00119 ATLSTL_ASSERT(::IsWindow(hwndChild));
00120
00121 return ::GetWindowTextLength(hwndChild);
00122 }
00123
00125 BOOL EnableDlgItem(int idChild, BOOL bEnable)
00126 {
00127 HWND hwndChild = GetDlgItem_(idChild);
00128
00129 ATLSTL_ASSERT(::IsWindow(hwndChild));
00130
00131 return ::EnableWindow(hwndChild, bEnable);
00132 }
00133
00135 BOOL IsDlgItemEnabled(int idChild)
00136 {
00137 HWND hwndChild = GetDlgItem_(idChild);
00138
00139 ATLSTL_ASSERT(::IsWindow(hwndChild));
00140
00141 return ::IsWindowEnabled(hwndChild);
00142 }
00143
00145 BOOL ShowDlgItem(int idChild, BOOL bShow)
00146 {
00147 HWND hwndChild = GetDlgItem_(idChild);
00148
00149 ATLSTL_ASSERT(::IsWindow(hwndChild));
00150
00151 return ::ShowWindow(hwndChild, bShow ? SW_SHOW : SW_HIDE);
00152 }
00153
00155 BOOL ShowAndEnableDlgItem(int idChild, BOOL bShowAndEnable, BOOL bHideIfDisabled)
00156 {
00157 BOOL bRet = true;
00158
00159 if( bShowAndEnable ||
00160 bHideIfDisabled)
00161 {
00162 if(!this_()->ShowDlgItem(idChild, bShowAndEnable))
00163 {
00164 bRet = false;
00165 }
00166 }
00167
00168 if(!this_()->EnableDlgItem(idChild, bShowAndEnable))
00169 {
00170 bRet = false;
00171 }
00172
00173 return bRet;
00174 }
00175
00177 HWND SetDlgItemFocus(int idChild)
00178 {
00179 HWND hwndChild = GetDlgItem_(idChild);
00180
00181 ATLSTL_ASSERT(::IsWindow(hwndChild));
00182
00183 return ::SetFocus(hwndChild);
00184 }
00186
00189 private:
00190 dialog_window_type* this_()
00191 {
00192 return static_cast<dialog_window_type*>(this);
00193 }
00194 dialog_window_type const* this_() const
00195 {
00196 return static_cast<dialog_window_type const*>(this);
00197 }
00198
00199 HWND GetDlgItem_(int idChild) const
00200 {
00201 return this_()->GetDlgItem(idChild);
00202 }
00204 };
00205
00206
00207
00208 #ifndef _ATLSTL_NO_NAMESPACE
00209 # if defined(_STLSOFT_NO_NAMESPACE) || \
00210 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00211 }
00212 # else
00213 }
00214 }
00215 # endif
00216 #endif
00217
00218
00219
00220 #endif
00221
00222