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
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #ifndef WINSTL_INCL_H_WINSTL
00071 # include "winstl.h"
00072 #endif
00073
00074 #if defined(__STLSOFT_COMPILER_IS_GCC) && \
00075 __GNUC__ < 3
00076 # error winstl_control_functionals.h is not compatible with GNU C++ prior to 3.0
00077 #endif
00078 #if defined(__STLSOFT_COMPILER_IS_MSVC) && \
00079 _MSC_VER < 1200
00080 # error winstl_control_functionals.h is not compatible with Visual C++ 5.0 or earlier
00081 #endif
00082
00083 #ifndef STLSOFT_INCL_H_STLSOFT_STRING_ACCESS
00084 # include "stlsoft_string_access.h"
00085 #endif
00086 #ifndef WINSTL_INCL_H_WINSTL_STRING_ACCESS
00087 # include "winstl_string_access.h"
00088 #endif
00089 #ifndef WINSTL_INCL_H_WINSTL_CHAR_CONVERSIONS
00090 # include "winstl_char_conversions.h"
00091 #endif
00092 #ifndef WINSTL_INCL_H_WINSTL_CONTROL_FUNCTIONS
00093 # include "winstl_control_functions.h"
00094 #endif
00095
00096
00097
00098
00099
00100 #ifndef _WINSTL_NO_NAMESPACE
00101 # if defined(_STLSOFT_NO_NAMESPACE) || \
00102 defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION)
00103
00104 namespace winstl
00105 {
00106 # else
00107
00108
00109 namespace stlsoft
00110 {
00111
00112 namespace winstl_project
00113 {
00114
00115 # endif
00116 #endif
00117
00118 #if !defined(__STLSOFT_COMPILER_IS_MWERKS)
00119 stlsoft_ns_using(c_str_ptr)
00120 #endif
00121
00122
00123
00126
00130
00135
00136
00137
00138
00139
00141 struct listbox_front_inserter
00142 {
00143 public:
00145 ss_explicit_k listbox_front_inserter(HWND hwndListbox)
00146 : m_hwndListbox(hwndListbox)
00147 , m_bUnicode(::IsWindowUnicode(hwndListbox))
00148 {}
00149
00150 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00151
00152 template <ss_typename_param_k S>
00153 void operator ()(S const &s)
00154 {
00155 insert(c_str_ptr(s));
00156 }
00157 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00158
00159 void operator ()(ws_char_a_t const *s)
00160 {
00161 insert(s);
00162 }
00164 void operator ()(ws_char_w_t const *s)
00165 {
00166 insert(s);
00167 }
00168
00169
00170 private:
00171 void insert(ws_char_a_t const *s)
00172 {
00173 if(m_bUnicode)
00174 {
00175 listbox_insertstring_w(m_hwndListbox, a2w(s), 0);
00176 }
00177 else
00178 {
00179 listbox_insertstring_a(m_hwndListbox, s, 0);
00180 }
00181 }
00182 void insert(ws_char_w_t const *s)
00183 {
00184 if(m_bUnicode)
00185 {
00186 listbox_insertstring_w(m_hwndListbox, s, 0);
00187 }
00188 else
00189 {
00190 listbox_insertstring_a(m_hwndListbox, w2a(s), 0);
00191 }
00192 }
00193
00194 private:
00195 HWND m_hwndListbox;
00196 ws_int32_t m_bUnicode;
00197 };
00198
00200 struct listbox_add_inserter
00201 {
00202 public:
00204 ss_explicit_k listbox_add_inserter(HWND hwndListbox)
00205 : m_hwndListbox(hwndListbox)
00206 , m_bUnicode(::IsWindowUnicode(hwndListbox))
00207 {}
00208
00209 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00210
00211 template <ss_typename_param_k S>
00212 void operator ()(S const &s)
00213 {
00214 add(c_str_ptr(s));
00215 }
00216 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00217
00218 void operator ()(ws_char_a_t const *s)
00219 {
00220 add(s);
00221 }
00223 void operator ()(ws_char_w_t const *s)
00224 {
00225 add(s);
00226 }
00227
00228
00229 private:
00230 void add(ws_char_a_t const *s)
00231 {
00232 if(m_bUnicode)
00233 {
00234 listbox_addstring_w(m_hwndListbox, a2w(s));
00235 }
00236 else
00237 {
00238 listbox_addstring_a(m_hwndListbox, s);
00239 }
00240 }
00241 void add(ws_char_w_t const *s)
00242 {
00243 if(m_bUnicode)
00244 {
00245 listbox_addstring_w(m_hwndListbox, s);
00246 }
00247 else
00248 {
00249 listbox_addstring_a(m_hwndListbox, w2a(s));
00250 }
00251 }
00252
00253 private:
00254 HWND m_hwndListbox;
00255 ws_int32_t m_bUnicode;
00256 };
00257
00259 struct listbox_back_inserter
00260 {
00261 public:
00263 ss_explicit_k listbox_back_inserter(HWND hwndListbox)
00264 : m_hwndListbox(hwndListbox)
00265 , m_bUnicode(::IsWindowUnicode(hwndListbox))
00266 {}
00267
00268 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00269
00270 template <ss_typename_param_k S>
00271 void operator ()(S const &s)
00272 {
00273 insert(c_str_ptr(s));
00274 }
00275 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00276
00277 void operator ()(ws_char_a_t const *s)
00278 {
00279 insert(s);
00280 }
00282 void operator ()(ws_char_w_t const *s)
00283 {
00284 insert(s);
00285 }
00286
00287
00288 private:
00289 void insert(ws_char_a_t const *s)
00290 {
00291 if(m_bUnicode)
00292 {
00293 listbox_insertstring_w(m_hwndListbox, a2w(s), -1);
00294 }
00295 else
00296 {
00297 listbox_insertstring_a(m_hwndListbox, s, -1);
00298 }
00299 }
00300 void insert(ws_char_w_t const *s)
00301 {
00302 if(m_bUnicode)
00303 {
00304 listbox_insertstring_w(m_hwndListbox, s, -1);
00305 }
00306 else
00307 {
00308 listbox_insertstring_a(m_hwndListbox, w2a(s), -1);
00309 }
00310 }
00311
00312 private:
00313 HWND m_hwndListbox;
00314 ws_int32_t m_bUnicode;
00315 };
00316
00317
00318
00320 struct combobox_front_inserter
00321 {
00322 public:
00324 ss_explicit_k combobox_front_inserter(HWND hwndListbox)
00325 : m_hwndListbox(hwndListbox)
00326 , m_bUnicode(::IsWindowUnicode(hwndListbox))
00327 {}
00328
00329 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00330
00331 template <ss_typename_param_k S>
00332 void operator ()(S const &s)
00333 {
00334 insert(c_str_ptr(s));
00335 }
00336 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00337
00338 void operator ()(ws_char_a_t const *s)
00339 {
00340 insert(s);
00341 }
00343 void operator ()(ws_char_w_t const *s)
00344 {
00345 insert(s);
00346 }
00347
00348
00349 private:
00350 void insert(ws_char_a_t const *s)
00351 {
00352 if(m_bUnicode)
00353 {
00354 combobox_insertstring_w(m_hwndListbox, a2w(s), 0);
00355 }
00356 else
00357 {
00358 combobox_insertstring_a(m_hwndListbox, s, 0);
00359 }
00360 }
00361 void insert(ws_char_w_t const *s)
00362 {
00363 if(m_bUnicode)
00364 {
00365 combobox_insertstring_w(m_hwndListbox, s, 0);
00366 }
00367 else
00368 {
00369 combobox_insertstring_a(m_hwndListbox, w2a(s), 0);
00370 }
00371 }
00372
00373 private:
00374 HWND m_hwndListbox;
00375 ws_int32_t m_bUnicode;
00376 };
00377
00379 struct combobox_add_inserter
00380 {
00381 public:
00383 ss_explicit_k combobox_add_inserter(HWND hwndListbox)
00384 : m_hwndListbox(hwndListbox)
00385 , m_bUnicode(::IsWindowUnicode(hwndListbox))
00386 {}
00387
00388 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00389
00390 template <ss_typename_param_k S>
00391 void operator ()(S const &s)
00392 {
00393 add(c_str_ptr(s));
00394 }
00395 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00396
00397 void operator ()(ws_char_a_t const *s)
00398 {
00399 add(s);
00400 }
00402 void operator ()(ws_char_w_t const *s)
00403 {
00404 add(s);
00405 }
00406
00407
00408 private:
00409 void add(ws_char_a_t const *s)
00410 {
00411 if(m_bUnicode)
00412 {
00413 combobox_addstring_w(m_hwndListbox, a2w(s));
00414 }
00415 else
00416 {
00417 combobox_addstring_a(m_hwndListbox, s);
00418 }
00419 }
00420 void add(ws_char_w_t const *s)
00421 {
00422 if(m_bUnicode)
00423 {
00424 combobox_addstring_w(m_hwndListbox, s);
00425 }
00426 else
00427 {
00428 combobox_addstring_a(m_hwndListbox, w2a(s));
00429 }
00430 }
00431
00432 private:
00433 HWND m_hwndListbox;
00434 ws_int32_t m_bUnicode;
00435 };
00436
00438 struct combobox_back_inserter
00439 {
00440 public:
00442 ss_explicit_k combobox_back_inserter(HWND hwndListbox)
00443 : m_hwndListbox(hwndListbox)
00444 , m_bUnicode(::IsWindowUnicode(hwndListbox))
00445 {}
00446
00447 #ifdef __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00448
00449 template <ss_typename_param_k S>
00450 void operator ()(S const &s)
00451 {
00452 insert(c_str_ptr(s));
00453 }
00454 #endif // __STLSOFT_CF_MEMBER_TEMPLATE_FUNCTION_SUPPORT
00455
00456 void operator ()(ws_char_a_t const *s)
00457 {
00458 insert(s);
00459 }
00461 void operator ()(ws_char_w_t const *s)
00462 {
00463 insert(s);
00464 }
00465
00466
00467 private:
00468 void insert(ws_char_a_t const *s)
00469 {
00470 if(m_bUnicode)
00471 {
00472 combobox_insertstring_w(m_hwndListbox, a2w(s), -1);
00473 }
00474 else
00475 {
00476 combobox_insertstring_a(m_hwndListbox, s, -1);
00477 }
00478 }
00479 void insert(ws_char_w_t const *s)
00480 {
00481 if(m_bUnicode)
00482 {
00483 combobox_insertstring_w(m_hwndListbox, s, -1);
00484 }
00485 else
00486 {
00487 combobox_insertstring_a(m_hwndListbox, w2a(s), -1);
00488 }
00489 }
00490
00491 private:
00492 HWND m_hwndListbox;
00493 ws_int32_t m_bUnicode;
00494 };
00495
00497
00498
00499 #ifdef STLSOFT_UNITTEST
00500
00501 namespace unittest
00502 {
00503 ss_bool_t test_winstl_control_functionals(unittest_reporter *r)
00504 {
00505 using stlsoft::unittest::unittest_initialiser;
00506
00507 ss_bool_t bSuccess = true;
00508
00509 unittest_initialiser init(r, "WinSTL", "control_functionals", __FILE__);
00510
00511 #if 0
00512 if(<<TODO>>)
00513 {
00514 r->report("<<TODO>> failed ", __LINE__);
00515 bSuccess = false;
00516 }
00517 #endif
00518
00519 return bSuccess;
00520 }
00521
00522 unittest_registrar unittest_winstl_control_functionals(test_winstl_control_functionals);
00523
00524 }
00525
00526 #endif
00527
00528
00529
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542 #endif
00543
00544
00545
00546
00547
00548