YSTest: ComboList.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ComboList.h
浏览该文件的文档.
1 ﻿/*
2 Copyright by FrankHB 2011 - 2013.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_UI_ComboList_h_
29 #define YSL_INC_UI_ComboList_h_ 1
30
31 #include "textlist.h"
32 #include "scroll.h"
33 #include "../Core/yfilesys.h"
34 //#include "ystyle.h"
35
36 YSL_BEGIN
37
38 YSL_BEGIN_NAMESPACE(UI)
39
40
45 class YF_API ListBox : public ScrollableContainer
46 {
47 public:
48 typedef TextList::ListType ListType;
49 typedef TextList::ViewArgs ViewArgs;
50 typedef TextList::HViewEvent HViewEvent;
52 typedef TextList::IndexType IndexType;
54 typedef TextList::ItemType ItemType;
56 typedef ystdex::subscriptive_iterator<ListBox, IWidget> Iterator;
57
58 protected:
59 /*
60 \brief 文本列表。
61 \since build 391
62 */
63 TextList tlContent;
64
65 public:
67 explicit
68 ListBox(const Rect& = {}, const shared_ptr<ListType>& = {});
69 inline DefDeMoveCtor(ListBox)
70
71
72 DefWidgetMemberIterationBase(ScrollableContainer, tlContent)
73
74 DefPredMem(const ynothrow, Selected, tlContent)
75 PDefH(bool, Contains, ListType::size_type i)
76 ImplBodyMem(tlContent, Contains, i)
77
78 DefGetterMem(const ynothrow, ListType::size_type, HeadIndex, tlContent)
79 DefGetterMem(const ynothrow, ListType::size_type, SelectedIndex,
80 tlContent)
82 DefGetterMem(const ynothrow, const ListType&, List, tlContent)
84 DefGetterMem(ynothrow, ListType&, ListRef, tlContent)
85 DefEventGetterMem(ynothrow, HViewEvent, ViewChanged, tlContent) \
87 DefEventGetterMem(ynothrow, HIndexEvent, Selected, tlContent) \
89 DefEventGetterMem(ynothrow, HIndexEvent, Confirmed, tlContent) \
91
96 DefSetterMem(const shared_ptr<ListType>&, List, tlContent)
102 PDefH(void, SetSelected, ListType::size_type i)
103 ImplBodyMem(tlContent, SetSelected, i)
104
111 PDefH(void, AdjustViewForContent, )
112 ImplBodyMem(tlContent, AdjustViewForContent, )
113
119 PDefH(void, AdjustViewLength, )
120 ImplBodyMem(tlContent, AdjustViewLength, )
121
127 PDefH(void, ClearSelected, )
128 ImplBodyMem(tlContent, ClearSelected, )
129
135 PDefH(IndexType, Find, const ItemType& text)
136 ImplBodyMem(tlContent, Find, text)
137
138 PDefH(void, ResetView, )
139 ImplBodyMem(tlContent, ResetView, )
140
147 void
148 ResizeForPreferred(const Size& sup, Size s = {});
149
150 PDefH(void, UpdateView, )
151 ImplExpr(UI::UpdateView(tlContent))
152 };
153
154
159 class YF_API FileBox : public IO::FileList, public ListBox
160 {
161 public:
163 explicit
164 FileBox(const Rect& = {});
165 inline DefDeMoveCtor(FileBox)
166
167
170 IO::Path
171 GetPath() const;
172
178 bool
179 SetPath(const IO::Path&);
180 };
181
182
188 class YF_API DropDownList : public Button
189 {
190 public:
191 typedef ListBox::ListType ListType;
197 typedef ListBox::ViewArgs ViewArgs;
203 typedef ListBox::HViewEvent HViewEvent;
205 typedef ystdex::subscriptive_iterator<DropDownList, IWidget> Iterator;
206
207 protected:
209 ListBox lbContent;
210
211 public:
213 explicit
214 DropDownList(const Rect& = {}, const shared_ptr<ListType>& = {});
215 inline DefDeMoveCtor(DropDownList)
220 ~DropDownList() override;
221
223 DefWidgetMemberIteration(lbContent)
224
225
226 DefGetterMem(const ynothrow, const ListType&, List, lbContent)
228 DefGetterMem(ynothrow, ListType&, ListRef, lbContent)
233 DefEventGetterMem(ynothrow, HViewEvent, ViewChanged, lbContent)
238 DefEventGetterMem(ynothrow, HIndexEvent, Selected, lbContent)
243 DefEventGetterMem(ynothrow, HIndexEvent, Confirmed, lbContent)
244
249 DefSetterMem(const shared_ptr<ListType>&, List, lbContent)
250
257 PDefH(void, AdjustViewForContent, )
258 ImplBodyMem(lbContent, AdjustViewForContent, )
259
260 private:
265 void
266 DetachTopWidget();
267
268 public:
273 void
274 Refresh(PaintEventArgs&&) override;
275 };
276
277 YSL_END_NAMESPACE(UI)
278
279 YSL_END
280
281 #endif
282