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 
49 {
50 public:
51  using ListType = TextList::ListType;
53  using HViewEvent = TextList::HViewEvent;
55  using IndexType = TextList::IndexType;
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>& = {});
73 
74 
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 
115  ImplBodyMem(tlContent, AdjustViewForContent, )
116 
123  ImplBodyMem(tlContent, AdjustViewLength, )
124 
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:
170 
171 public:
173  explicit
174  FileBox(const Rect& = {});
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:
248 
249 protected:
251  ListBox lbContent;
252 
253 public:
255  explicit
256  DropDownList(const Rect& = {}, const shared_ptr<ListType>& = {});
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 
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 
#define DefEventGetter(_q, _tEventHandler, _name, _member)
定义事件访问器。
Definition: yevt.hpp:710
TextList tlContent
Definition: ComboList.h:66
#define ImplBodyMem(_m, _n,...)
Definition: YBaseMacro.h:116
void Refresh(PaintEventArgs &&) override
刷新:按指定参数绘制界面并更新状态。
#define DefWidgetMemberIteration(...)
定义部件成员下标及部件成员迭代器起始、终止和范围操作。
下拉列表。
Definition: ComboList.h:230
#define DefWidgetMemberIterationBase(_tBase,...)
定义基于基类的部件成员下标及部件成员迭代器起始、终止和范围操作。
带滚动条的文本列表框。
Definition: ComboList.h:48
TextList::HViewEvent HViewEvent
Definition: ComboList.h:53
部件绘制参数。
Definition: ywgtevt.h:276
void UpdateView(TextList &tl, bool is_active)
Definition: textlist.cpp:431
#define YF_API
Definition: Platform.h:64
成员下标迭代器。
Definition: iterator.hpp:1380
GIHEvent< UIEventArgs && > ItemType
Definition: ywgtevt.h:424
TextList::ViewArgs ViewArgs
Definition: ComboList.h:52
IO::Path pthDirectory
目录的完整路径。
Definition: ComboList.h:169
按钮。
Definition: button.h:116
void ResetView()
复位视图。
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
#define DefSetterMem(_t, _n, _m)
Definition: YBaseMacro.h:200
文件列表框。
Definition: ComboList.h:162
PDefH(void, Activate, Console &console, Drawing::Color fc=Drawing::ColorSpace::White) ImplExpr(Activate(console
激活:使用指定屏幕、有效性、前景色和默认背景色。
void SetSelected(ListType::size_type)
按指定项目索引设置选中项目。
YSLib 标准字符串(使用 UCS-2 作为内部编码)。
Definition: ystring.h:47
ListBox::ViewArgs ViewArgs
视图参数类型。
Definition: ComboList.h:239
带滚动条的容器。
Definition: scroll.h:414
#define ImplExpr(...)
Definition: YBaseMacro.h:93
TextList::IndexType IndexType
Definition: ComboList.h:55
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
屏幕标准矩形:表示屏幕矩形区域。
Definition: ygdibase.h:416
void AdjustViewForContent()
按内容大小依次调整视图中选中和首个项目的索引,然后按需调整竖直偏移量。
ListBox::HViewEvent HViewEvent
视图事件委托类型。
Definition: ComboList.h:245
Selected const shared_ptr< ListType > const pair< Color, Color > viewer Contains
Definition: textlist.h:124
ListBox::ListType ListType
Definition: ComboList.h:233
DefGetterMem(const ynothrow, ListType::size_type, SelectedIndex, viewer) SDst GetFullViewHeight() const
取完整视图高。
Selected const shared_ptr< ListType > const pair< Color, Color > & DefDeMoveCtor(TextList) DefPredMem(const ynothrow
#define DefEventGetterMem(_q, _tEventHandler, _name, _member)
Definition: yevt.hpp:714
void AdjustViewLength()
调整视图长度。
#define DefPredMem(_q, _n, _m)
Definition: YBaseMacro.h:177
屏幕区域大小。
Definition: ygdibase.h:249
Selected const shared_ptr< ListType > const pair< Color, Color > Selected
Definition: textlist.h:122
TextList::ListType ListType
Definition: ComboList.h:51
GValueEventArgs< bool > ViewArgs
视图参数类型。
Definition: textlist.h:67
TextList::ItemType ItemType
Definition: ComboList.h:57