YSTest: ComboList.h 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ComboList.h
浏览该文件的文档.
1 /*
2 © 2011-2014 FrankHB.
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 "YModules.h"
32 #include YFM_YSLib_UI_TextList
33 #include YFM_YSLib_UI_Scroll
34 #include YFM_YSLib_Service_FileSystem
35 //#include YFM_YSLib_UI_YStyle
36
37 namespace YSLib
38 {
39
40 namespace UI
41 {
42
48 class YF_API ListBox : public ScrollableContainer
49 {
50 public:
51 using ListType = TextList::ListType;
52 using ViewArgs = TextList::ViewArgs;
53 using HViewEvent = TextList::HViewEvent;
55 using IndexType = TextList::IndexType;
57 using ItemType = TextList::ItemType;
59 using iterator = ystdex::subscriptive_iterator<ListBox, IWidget>;
60
61 protected:
62 /*
63 \brief 文本列表。
64 \since build 391
65 */
66 TextList tlContent;
67
68 public:
70 explicit
71 ListBox(const Rect& = {}, const shared_ptr<ListType>& = {});
72 DefDeMoveCtor(ListBox)
73
74
75 DefWidgetMemberIterationBase(ScrollableContainer, tlContent)
76
77 DefPredMem(const ynothrow, Selected, tlContent)
78 PDefH(bool, Contains, ListType::size_type i)
79 ImplBodyMem(tlContent, Contains, i)
80
81 DefGetterMem(const ynothrow, ListType::size_type, HeadIndex, tlContent)
82 DefGetterMem(const ynothrow, ListType::size_type, SelectedIndex,
83 tlContent)
85 DefGetterMem(const ynothrow, const ListType&, List, tlContent)
87 DefGetterMem(ynothrow, ListType&, ListRef, tlContent)
88 DefEventGetter(ynothrow, HViewEvent, ViewChanged, tlContent.ViewChanged) \
90 DefEventGetter(ynothrow, HIndexEvent, Selected, tlContent.Selected) \
92 DefEventGetter(ynothrow, HIndexEvent, Confirmed, tlContent.Confirmed) \
94
99 DefSetterMem(const shared_ptr<ListType>&, List, tlContent)
105 PDefH(void, SetSelected, ListType::size_type i)
106 ImplBodyMem(tlContent, SetSelected, i)
107
114 PDefH(void, AdjustViewForContent, )
115 ImplBodyMem(tlContent, AdjustViewForContent, )
116
122 PDefH(void, AdjustViewLength, )
123 ImplBodyMem(tlContent, AdjustViewLength, )
124
130 PDefH(void, ClearSelected, )
131 ImplBodyMem(tlContent, ClearSelected, )
132
138 PDefH(IndexType, Find, const ItemType& text)
139 ImplBodyMem(tlContent, Find, text)
140
141 PDefH(void, ResetView, )
142 ImplBodyMem(tlContent, ResetView, )
143
150 void
151 ResizeForPreferred(const Size& sup, Size s = {});
152
153 PDefH(void, UpdateView, )
154 ImplExpr(UI::UpdateView(tlContent))
155 };
156
157
162 class YF_API FileBox : public ListBox
163 {
164 protected:
169 IO::Path pthDirectory;
170
171 public:
173 explicit
174 FileBox(const Rect& = {});
175 DefDeMoveCtor(FileBox)
176
177
181 bool
182 operator=(const IO::Path&);
183
188 bool
189 operator/=(const String&);
194 bool
195 operator/=(const IO::Path&);
196
201 DefGetter(const ynothrow, const IO::Path&, Directory, pthDirectory)
205 IO::Path
206 GetPath() const;
207
213 bool
214 SetPath(const IO::Path&);
215
220 ListType
221 ListItems() const;
222 };
223
224
230 class YF_API DropDownList : public Button
231 {
232 public:
233 using ListType = ListBox::ListType;
239 using ViewArgs = ListBox::ViewArgs;
245 using HViewEvent = ListBox::HViewEvent;
247 using iterator = ystdex::subscriptive_iterator<DropDownList, IWidget>;
248
249 protected:
251 ListBox lbContent;
252
253 public:
255 explicit
256 DropDownList(const Rect& = {}, const shared_ptr<ListType>& = {});
257 DefDeMoveCtor(DropDownList)
262 ~DropDownList() override;
263
265 DefWidgetMemberIteration(lbContent)
266
267
268 DefGetterMem(const ynothrow, const ListType&, List, lbContent)
270 DefGetterMem(ynothrow, ListType&, ListRef, lbContent)
275 DefEventGetterMem(ynothrow, HViewEvent, ViewChanged, lbContent)
280 DefEventGetterMem(ynothrow, HIndexEvent, Selected, lbContent)
285 DefEventGetterMem(ynothrow, HIndexEvent, Confirmed, lbContent)
286
291 DefSetterMem(const shared_ptr<ListType>&, List, lbContent)
292
299 PDefH(void, AdjustViewForContent, )
300 ImplBodyMem(lbContent, AdjustViewForContent, )
301
302 private:
307 void
308 DetachTopWidget();
309
310 public:
315 void
316 Refresh(PaintEventArgs&&) override;
317 };
318
319 } // namespace UI;
320
321 } // namespace YSLib;
322
323 #endif
324
DefEventGetter
#define DefEventGetter(_q, _tEventHandler, _name, _member)
定义事件访问器。
Definition: yevt.hpp:710
YSLib::UI::ListBox::tlContent
TextList tlContent
Definition: ComboList.h:66
YSLib::UI::ClearSelected
ClearSelected
Definition: textlist.h:229
ImplBodyMem
#define ImplBodyMem(_m, _n,...)
Definition: YBaseMacro.h:116
YSLib::UI::Refresh
void Refresh(PaintEventArgs &&) override
刷新：按指定参数绘制界面并更新状态。
DefWidgetMemberIteration
#define DefWidgetMemberIteration(...)
定义部件成员下标及部件成员迭代器起始、终止和范围操作。
Definition: WidgetIteration.h:131
YModules.h
YSLib::UI::DropDownList
下拉列表。
Definition: ComboList.h:230
DefWidgetMemberIterationBase
#define DefWidgetMemberIterationBase(_tBase,...)
定义基于基类的部件成员下标及部件成员迭代器起始、终止和范围操作。
Definition: WidgetIteration.h:139
YSLib::UI::ListBox
带滚动条的文本列表框。
Definition: ComboList.h:48
YSLib::UI::ListBox::HViewEvent
TextList::HViewEvent HViewEvent
Definition: ComboList.h:53
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: ywgtevt.h:276
YSLib::UI::UpdateView
void UpdateView(TextList &tl, bool is_active)
Definition: textlist.cpp:431
YF_API
#define YF_API
Definition: Platform.h:64
ystdex::subscriptive_iterator
成员下标迭代器。
Definition: iterator.hpp:1380
YSLib::UI::EventMapping::ItemType
GIHEvent< UIEventArgs && > ItemType
Definition: ywgtevt.h:424
YSLib::UI::ListBox::ViewArgs
TextList::ViewArgs ViewArgs
Definition: ComboList.h:52
YSLib::UI::FileBox::pthDirectory
IO::Path pthDirectory
目录的完整路径。
Definition: ComboList.h:169
YSLib::UI::Button
按钮。
Definition: button.h:116
YSLib::UI::ResetView
void ResetView()
复位视图。
YSLib::UI::DropDownList::lbContent
ListBox lbContent
Definition: ComboList.h:251
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
DefSetterMem
#define DefSetterMem(_t, _n, _m)
Definition: YBaseMacro.h:200
YSLib::UI::FileBox
文件列表框。
Definition: ComboList.h:162
YSLib::UI::PDefH
PDefH(void, Activate, Console &console, Drawing::Color fc=Drawing::ColorSpace::White) ImplExpr(Activate(console
激活：使用指定屏幕、有效性、前景色和默认背景色。
YSLib::UI::SetSelected
void SetSelected(ListType::size_type)
按指定项目索引设置选中项目。
YSLib::Text::String
YSLib 标准字符串（使用 UCS-2 作为内部编码）。
Definition: ystring.h:47
YSLib::UI::DropDownList::ViewArgs
ListBox::ViewArgs ViewArgs
视图参数类型。
Definition: ComboList.h:239
YSLib::UI::ScrollableContainer
带滚动条的容器。
Definition: scroll.h:414
ImplExpr
#define ImplExpr(...)
Definition: YBaseMacro.h:93
YSLib::UI::ListBox::IndexType
TextList::IndexType IndexType
Definition: ComboList.h:55
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
YSLib::IO::Path
路径。
Definition: YSLib/Service/FileSystem.h:75
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: ygdibase.h:416
YSLib::UI::AdjustViewForContent
void AdjustViewForContent()
按内容大小依次调整视图中选中和首个项目的索引，然后按需调整竖直偏移量。
YSLib::UI::DropDownList::HViewEvent
ListBox::HViewEvent HViewEvent
视图事件委托类型。
Definition: ComboList.h:245
YSLib::UI::Contains
Selected const shared_ptr< ListType > const pair< Color, Color > viewer Contains
Definition: textlist.h:124
platform_ex::Windows::s
return s
Definition: MinGW32.cpp:49
YSLib::UI::DropDownList::ListType
ListBox::ListType ListType
Definition: ComboList.h:233
YSLib::UI::DefGetterMem
DefGetterMem(const ynothrow, ListType::size_type, SelectedIndex, viewer) SDst GetFullViewHeight() const
取完整视图高。
YSLib::UI::DefDeMoveCtor
Selected const shared_ptr< ListType > const pair< Color, Color > & DefDeMoveCtor(TextList) DefPredMem(const ynothrow
DefEventGetterMem
#define DefEventGetterMem(_q, _tEventHandler, _name, _member)
Definition: yevt.hpp:714
YSLib::UI::AdjustViewLength
void AdjustViewLength()
调整视图长度。
DefPredMem
#define DefPredMem(_q, _n, _m)
Definition: YBaseMacro.h:177
YSLib::Drawing::Size
屏幕区域大小。
Definition: ygdibase.h:249
YSLib::UI::Selected
Selected const shared_ptr< ListType > const pair< Color, Color > Selected
Definition: textlist.h:122
YSLib::UI::ListBox::ListType
TextList::ListType ListType
Definition: ComboList.h:51
YSLib::UI::ViewArgs
GValueEventArgs< bool > ViewArgs
视图参数类型。
Definition: textlist.h:67
YSLib::UI::ListBox::ItemType
TextList::ItemType ItemType
Definition: ComboList.h:57