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
00049 #ifndef WINSTL_INCL_WINSTL_CONTROLS_HPP_TREEVIEW_SEQUENCE
00050 #define WINSTL_INCL_WINSTL_CONTROLS_HPP_TREEVIEW_SEQUENCE
00051
00052 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00053 # define WINSTL_VER_WINSTL_CONTROLS_HPP_TREEVIEW_SEQUENCE_MAJOR 4
00054 # define WINSTL_VER_WINSTL_CONTROLS_HPP_TREEVIEW_SEQUENCE_MINOR 0
00055 # define WINSTL_VER_WINSTL_CONTROLS_HPP_TREEVIEW_SEQUENCE_REVISION 6
00056 # define WINSTL_VER_WINSTL_CONTROLS_HPP_TREEVIEW_SEQUENCE_EDIT 71
00057 #endif
00058
00059
00060
00061
00062
00063 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00064 # include <winstl/winstl.h>
00065 #endif
00066 #ifndef STLSOFT_INCL_STLSOFT_UTIL_STD_HPP_ITERATOR_HELPER
00067 # include <stlsoft/util/std/iterator_helper.hpp>
00068 #endif
00069 #ifndef WINSTL_INCL_WINSTL_CONTROLS_H_COMMCTRL_FUNCTIONS
00070 # include <winstl/controls/commctrl_functions.h>
00071 #endif
00072 #ifndef STLSOFT_INCL_STLSOFT_COLLECTIONS_UTIL_HPP_COLLECTIONS
00073 # include <stlsoft/collections/util/collections.hpp>
00074 #endif
00075
00076
00077
00078 #ifndef _WINSTL_NO_NAMESPACE
00079 # if defined(_STLSOFT_NO_NAMESPACE) || \
00080 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00081
00082 namespace winstl
00083 {
00084 # else
00085
00086
00087 namespace stlsoft
00088 {
00089
00090 namespace winstl_project
00091 {
00092
00093 # endif
00094 #endif
00095
00096
00097
00105 template <UINT N, UINT P>
00106 class treeview_sequence_const_iterator
00107 : public stlsoft_ns_qual(iterator_base)<winstl_ns_qual_std(forward_iterator_tag)
00108 , HTREEITEM
00109 , ws_ptrdiff_t
00110 , void
00111 , HTREEITEM
00112 >
00113 {
00116 public:
00118 typedef treeview_sequence_const_iterator<N, P> class_type;
00120 typedef HTREEITEM value_type;
00122 typedef ws_ptrdiff_t difference_type;
00124 typedef value_type effective_reference;
00126
00129 private:
00130 #if 0
00131
00132 friend struct treeview_sequence_const_iterator_friend;
00133 friend class treeview_visible_sequence;
00134 #else
00135 public:
00136 #endif
00137 treeview_sequence_const_iterator(HWND hwndTree, HTREEITEM hitem);
00138 public:
00140 treeview_sequence_const_iterator();
00142 treeview_sequence_const_iterator(class_type const& rhs);
00143
00145 treeview_sequence_const_iterator& operator =(class_type const& rhs);
00147
00150 public:
00152 effective_reference operator *() const;
00154 class_type& operator ++();
00156 class_type operator ++(int);
00157
00159 ws_bool_t operator ==(class_type const& rhs) const;
00161 ws_bool_t operator !=(class_type const& rhs) const;
00163
00166 private:
00167 HWND m_hwnd;
00168 HTREEITEM m_hitem;
00170 };
00171
00172
00178 template <UINT N, UINT P>
00179 class treeview_sequence_base
00180 : public stlsoft_ns_qual(stl_collection_tag)
00181 {
00184 #if defined(STLSOFT_COMPILER_IS_DMC) && \
00185 __DMC__ < 0x0840
00186 public:
00187 #else
00188 protected:
00189 #endif
00191 typedef treeview_sequence_base<N, P> class_type;
00193 typedef treeview_sequence_const_iterator<N, P> const_iterator;
00195 typedef ss_typename_type_k const_iterator::value_type value_type;
00197 typedef ss_typename_type_k const_iterator::difference_type difference_type;
00199
00202 protected:
00204 treeview_sequence_base(HWND hwndTree, HTREEITEM hitem);
00206
00209 public:
00213 const_iterator begin() const;
00217 const_iterator end() const;
00219
00222 private:
00223 HWND m_hwnd;
00224 HTREEITEM m_hitem;
00226 };
00227
00228
00233 class treeview_child_sequence
00234 : public treeview_sequence_base<TVGN_NEXT, TVGN_PREVIOUS>
00235 {
00238 private:
00239 typedef treeview_sequence_base<TVGN_NEXT, TVGN_PREVIOUS> base_class_type;
00240 public:
00242 typedef treeview_child_sequence class_type;
00244 typedef base_class_type::const_iterator const_iterator;
00246 typedef base_class_type::value_type value_type;
00248 typedef base_class_type::difference_type difference_type;
00250
00253 public:
00255 treeview_child_sequence(HWND hwndTree, HTREEITEM hitem);
00257 ss_explicit_k treeview_child_sequence(HWND hwndTree);
00259 };
00260
00261
00266 class treeview_peer_sequence
00267 : public treeview_sequence_base<TVGN_NEXT, TVGN_PREVIOUS>
00268 {
00271 private:
00272 typedef treeview_sequence_base<TVGN_NEXT, TVGN_PREVIOUS> base_class_type;
00273 public:
00275 typedef treeview_child_sequence class_type;
00277 typedef base_class_type::const_iterator const_iterator;
00279 typedef base_class_type::value_type value_type;
00281 typedef base_class_type::difference_type difference_type;
00283
00286 public:
00288 treeview_peer_sequence(HWND hwndTree, HTREEITEM hitem);
00290 };
00291
00292
00297 class treeview_visible_sequence
00298 : public treeview_sequence_base<TVGN_NEXTVISIBLE, TVGN_PREVIOUSVISIBLE>
00299 {
00302 private:
00303 typedef treeview_sequence_base<TVGN_NEXTVISIBLE, TVGN_PREVIOUSVISIBLE> base_class_type;
00304 public:
00306 typedef treeview_child_sequence class_type;
00308 typedef base_class_type::const_iterator const_iterator;
00310 typedef base_class_type::value_type value_type;
00312 typedef base_class_type::difference_type difference_type;
00314
00317 public:
00319 ss_explicit_k treeview_visible_sequence(HWND hwndTree);
00321 };
00322
00323
00324
00325
00326
00327 #ifdef STLSOFT_UNITTEST
00328 # include "./unittest/treeview_sequence_unittest_.h"
00329 #endif
00330
00331
00332
00333
00334
00335 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00336
00337
00338
00339 template <UINT N, UINT P>
00340 inline treeview_sequence_const_iterator<N, P>::treeview_sequence_const_iterator(HWND hwndTree, HTREEITEM hitem)
00341 : m_hwnd(hwndTree)
00342 , m_hitem(hitem)
00343 {}
00344
00345 template <UINT N, UINT P>
00346 inline treeview_sequence_const_iterator<N, P>::treeview_sequence_const_iterator()
00347 : m_hwnd(NULL)
00348 , m_hitem(NULL)
00349 {}
00350
00351 template <UINT N, UINT P>
00352 inline treeview_sequence_const_iterator<N, P>::treeview_sequence_const_iterator(treeview_sequence_const_iterator<N, P> const& rhs)
00353 : m_hwnd(rhs.m_hwnd)
00354 , m_hitem(rhs.m_hitem)
00355 {}
00356
00357 template <UINT N, UINT P>
00358 inline treeview_sequence_const_iterator<N, P> &treeview_sequence_const_iterator<N, P>::operator =(treeview_sequence_const_iterator<N, P> const& rhs)
00359 {
00360 m_hwnd = rhs.m_hwnd;
00361 m_hitem = rhs.m_hitem;
00362
00363 return *this;
00364 }
00365
00366 template <UINT N, UINT P>
00367 inline HTREEITEM treeview_sequence_const_iterator<N, P>::operator *() const
00368 {
00369 return m_hitem;
00370 }
00371
00372 template <UINT N, UINT P>
00373 inline ss_typename_type_ret_k treeview_sequence_const_iterator<N, P>::class_type& treeview_sequence_const_iterator<N, P>::operator ++()
00374 {
00375 if(m_hitem != NULL)
00376 {
00377 m_hitem = treeview_getnextitem(m_hwnd, m_hitem, N);
00378 }
00379
00380 return *this;
00381 }
00382
00383 template <UINT N, UINT P>
00384 inline ss_typename_type_ret_k treeview_sequence_const_iterator<N, P>::class_type treeview_sequence_const_iterator<N, P>::operator ++(int)
00385 {
00386 class_type ret(*this);
00387
00388 operator ++();
00389
00390 return ret;
00391 }
00392
00393 template <UINT N, UINT P>
00394 inline ws_bool_t treeview_sequence_const_iterator<N, P>::operator ==(treeview_sequence_const_iterator<N, P> const& rhs) const
00395 {
00396 return m_hitem == rhs.m_hitem;
00397 }
00398
00399 template <UINT N, UINT P>
00400 inline ws_bool_t treeview_sequence_const_iterator<N, P>::operator !=(treeview_sequence_const_iterator<N, P> const& rhs) const
00401 {
00402 return !operator ==(rhs);
00403 }
00404
00405
00406
00407 template <UINT N, UINT P>
00408 inline treeview_sequence_base<N, P>::treeview_sequence_base(HWND hwndTree, HTREEITEM hitem)
00409 : m_hwnd(hwndTree)
00410 , m_hitem(hitem)
00411 {}
00412
00413 template <UINT N, UINT P>
00414 inline ss_typename_type_ret_k treeview_sequence_base<N, P>::const_iterator treeview_sequence_base<N, P>::begin() const
00415 {
00416 return const_iterator(m_hwnd, m_hitem);
00417 }
00418
00419 template <UINT N, UINT P>
00420 inline ss_typename_type_ret_k treeview_sequence_base<N, P>::const_iterator treeview_sequence_base<N, P>::end() const
00421 {
00422 return const_iterator();
00423 }
00424
00425
00426
00427 inline treeview_child_sequence::treeview_child_sequence(HWND hwndTree, HTREEITEM hitem)
00428 : base_class_type(hwndTree, treeview_getchilditem(hwndTree, hitem))
00429 {}
00430
00431 inline treeview_child_sequence::treeview_child_sequence(HWND hwndTree)
00432 : base_class_type(hwndTree, treeview_getchilditem(hwndTree, treeview_getrootitem(hwndTree)))
00433 {}
00434
00435
00436
00437 inline treeview_peer_sequence::treeview_peer_sequence(HWND hwndTree, HTREEITEM hitem)
00438 : base_class_type(hwndTree, hitem)
00439 {}
00440
00441
00442
00443 inline treeview_visible_sequence::treeview_visible_sequence(HWND hwndTree)
00444 : base_class_type(hwndTree, treeview_getnextitem(hwndTree, NULL, TVGN_FIRSTVISIBLE))
00445 {}
00446
00447 #endif
00448
00449
00450
00451 #ifndef _WINSTL_NO_NAMESPACE
00452 # if defined(_STLSOFT_NO_NAMESPACE) || \
00453 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00454 }
00455 # else
00456 }
00457 }
00458 # endif
00459 #endif
00460
00461
00462
00463 #endif
00464
00465