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 WINSTL_INCL_WINSTL_CONTROLS_HPP_LISTBOX_DATA_SEQUENCE
00049 #define WINSTL_INCL_WINSTL_CONTROLS_HPP_LISTBOX_DATA_SEQUENCE
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_SEQUENCE_MAJOR 1
00053 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_SEQUENCE_MINOR 2
00054 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_SEQUENCE_REVISION 2
00055 # define WINSTL_VER_WINSTL_CONTROLS_HPP_LISTBOX_DATA_SEQUENCE_EDIT 5
00056 #endif
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00073 # include <winstl/winstl.h>
00074 #endif
00075 #ifndef WINSTL_INCL_WINSTL_CONTROLS_HPP_LISTBOX_DATA_CONST_ITERATOR
00076 # include <winstl/controls/listbox_data_const_iterator.hpp>
00077 #endif
00078 #ifndef WINSTL_INCL_WINSTL_CONTROLS_H_FUNCTIONS
00079 # include <winstl/controls/functions.h>
00080 #endif
00081 #ifndef STLSOFT_INCL_STLSOFT_COLLECTIONS_UTIL_HPP_COLLECTIONS
00082 # include <stlsoft/collections/util/collections.hpp>
00083 #endif
00084 #ifndef STLSOFT_INCL_STLSOFT_UTIL_STD_HPP_ITERATOR_HELPER
00085 # include <stlsoft/util/std/iterator_helper.hpp>
00086 #endif
00087
00088
00089
00090
00091
00092 #ifndef _WINSTL_NO_NAMESPACE
00093 # if defined(_STLSOFT_NO_NAMESPACE) || \
00094 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00095
00096 namespace winstl
00097 {
00098 # else
00099
00100
00101 namespace stlsoft
00102 {
00103
00104 namespace winstl_project
00105 {
00106
00107 # endif
00108 #endif
00109
00110
00111
00112
00113
00114 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00115 struct listbox_data_sequence_traits
00116 {
00117 public:
00118 static ws_int_t err_constant()
00119 {
00120 return LB_ERR;
00121 }
00122 static ws_int_t get_count(HWND hwnd)
00123 {
00124 return listbox_getcount(hwnd);
00125 }
00126 static ws_dword_t get_data(HWND hwnd, ws_int_t index)
00127 {
00128 return listbox_getitemdata(hwnd, index);
00129 }
00130 };
00131 #endif
00132
00139 class listbox_data_sequence
00140 : public stlsoft_ns_qual(stl_collection_tag)
00141 {
00144 public:
00146 typedef listbox_data_sequence class_type;
00148 typedef listbox_data_const_iterator<listbox_data_sequence_traits> const_iterator;
00150 typedef const_iterator::const_reference const_reference;
00152 typedef const_iterator::value_type value_type;
00154 typedef const_iterator::size_type size_type;
00156 typedef const_iterator::difference_type difference_type;
00157 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00159 typedef const_iterator::const_reverse_iterator_type const_reverse_iterator;
00160 #endif
00161 private:
00162 typedef listbox_data_sequence_traits control_traits_type;
00164
00167 public:
00169 ss_explicit_k listbox_data_sequence(HWND hwndListBox)
00170 : m_hwnd(hwndListBox)
00171 {}
00173
00176 public:
00178 size_type size() const
00179 {
00180 return static_cast<size_type>(control_traits_type::get_count(m_hwnd));
00181 }
00183 ws_bool_t empty() const
00184 {
00185 return 0 == size();
00186 }
00188 static size_type max_size()
00189 {
00190 return static_cast<size_type>(-1) / sizeof(LPCTSTR);
00191 }
00193
00196 public:
00200 const_iterator begin() const
00201 {
00202 return const_iterator(m_hwnd, 0);
00203 }
00207 const_iterator end() const
00208 {
00209 return const_iterator(m_hwnd, static_cast<int>(size()));
00210 }
00211
00212 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00216 const_reverse_iterator rbegin() const
00217 {
00218 return const_reverse_iterator(end());
00219 }
00223 const_reverse_iterator rend() const
00224 {
00225 return const_reverse_iterator(begin());
00226 }
00227 #endif
00229
00232 public:
00234 value_type operator [](difference_type index) const
00235 {
00236 return const_iterator::get_value_at_(m_hwnd, index);
00237 }
00239
00242 private:
00243 HWND m_hwnd;
00245 };
00246
00248
00249
00250 #ifdef STLSOFT_UNITTEST
00251 # include "./unittest/listbox_data_sequence_unittest_.h"
00252 #endif
00253
00254
00255
00256 #ifndef _WINSTL_NO_NAMESPACE
00257 # if defined(_STLSOFT_NO_NAMESPACE) || \
00258 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00259 }
00260 # else
00261 }
00262 }
00263 # endif
00264 #endif
00265
00266
00267
00268 #endif
00269
00270