YSTest: Viewer.h 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

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

- 文件列表
- 文件成员

Viewer.h
浏览该文件的文档.
1 /*
2 © 2011-2015 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_viewer_hpp_
29 #define YSL_INC_UI_viewer_hpp_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_UI_YComponent
33
34 namespace YSLib
35 {
36
37 namespace UI
38 {
39
45 class YF_API SequenceViewer
46 {
47 private:
52 size_t head = 0;
53 size_t selected = 0;
54 bool is_selected = {};
56
57 public:
58 size_t Length = 1;
59
65 SequenceViewer() = default;
66
71 DefPred(const ynothrow, Selected, is_selected)
72
73
77 bool
78 Contains(size_t) const ynothrow;
79
80 DefGetter(const ynothrow, size_t, HeadIndex, head)
81 DefGetter(const ynothrow, size_t, SelectedIndex, selected)
82 DefGetter(const ynothrow, ptrdiff_t, Offset, IsSelected()
83 ? ptrdiff_t(GetSelectedIndex()) - ptrdiff_t(GetHeadIndex()) : -1) \
85
90 size_t
91 GetValid(size_t total) const ynothrow;
92
98 bool
99 SetHeadIndex(size_t t, size_t total);
105 bool
106 SetSelectedIndex(size_t t, size_t total);
107
115 bool
116 AdjustForContent(size_t total);
117
119 PDefH(bool, CheckSelected, size_t idx) const
120 ImplRet(IsSelected() && GetSelectedIndex() == idx)
121
126 PDefH(void, ClearSelected, )
127 ImplExpr(is_selected = {})
128
133 SequenceViewer&
134 IncreaseHead(ptrdiff_t d, size_t total);
135
141 SequenceViewer&
142 IncreaseSelected(ptrdiff_t d, size_t total);
143
148 bool
149 MoveViewerToBegin();
150
155 bool
156 MoveViewerToEnd(size_t total);
157
162 PDefH(void, Reset, )
163 ImplUnseq(head = 0, selected = 0, Length = 1, is_selected = {})
164
172 bool
173 RestrictSelected();
174
182 bool
183 RestrictView();
184 };
185
186
192 class YF_API AMUnitList
193 {
194 protected:
196 SequenceViewer vwList{};
201 SDst uTopOffset = 0;
203 size_t idxShared = size_t(-1);
204
205 public:
206 virtual DefDeDtor(AMUnitList)
207
208
212 bool CyclicTraverse = {};
213
219 SDst
220 GetFullViewHeight() const;
227 SDst
228 GetItemHeight() const;
229
230 protected:
236 virtual SDst
237 GetItemHeightCore() const;
238
239 public:
241 size_t
242 GetLastLabelIndexClipped(SPos, SDst) const;
244 DefGetter(const ynothrow, size_t, SharedIndex, idxShared)
246 DefGetter(const ynothrow, SDst, TopOffset, uTopOffset)
251 DeclIEntry(size_t GetTotal() const)
253 DeclIEntry(IWidget& GetUnitRef() const)
259 Point
260 GetUnitLocation(size_t) const;
266 SDst
267 GetViewPosition() const;
268
278 SDst
279 AdjustBottomForHeight(SDst, SDst);
280
282
283
293 SDst
294 AdjustOffsetForHeight(SDst, bool);
295
301 void
302 AdjustViewForContent(SDst);
303
310 void
311 AdjustViewLengthForHeight(SDst, SDst);
312
318 size_t
319 CheckPoint(const Size&, const Point&);
320
325 void
326 ResetView();
328 };
329
330 } // namespace UI;
331
332 } // namespace YSLib;
333
334 #endif
335
ytest::timing::total
auto total(size_t n, _fNow now, _func &&f, _tParams &&...args) -> decltype(now()-now())
测试指定函数执行若干次的总时间。
Definition: timing.hpp:91
YSLib::UI::PDefH
PDefH(void, DisplayFor, IWidget &wgt, Timers::TimeSpan delay) ImplExpr(Show(wgt)
在一定时间内显示部件。
YSLib::UI::ynothrow
AView &y ynothrow
Definition: YWidgetView.cpp:47
DeclIEntry
#define DeclIEntry(_sig)
Definition: YBaseMacro.h:396
DefPred
#define DefPred(_q, _n,...)
Definition: YBaseMacro.h:232
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
UI
platform::size_t
YF_API size_t
Definition: FileIO.h:1353
YSLib::UI::ImplRet
const IWidget &wgt ImplRet(wgt.GetView().IsVisible()) bool YF_API Contains(const IWidget &
判断点是否在部件的可视区域内。
ImplUnseq
#define ImplUnseq(...)
Definition: YBaseMacro.h:110
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:44
DefDeDtor
#define DefDeDtor(_t)
Definition: YBaseMacro.h:177
YSLib::UI::AMUnitList
单元部件列表模块。
Definition: Viewer.h:192
YF_API
#define YF_API
Definition: Platform.h:56
platform::SPos
std::int16_t SPos
屏幕坐标度量。
Definition: Video.h:43
YSLib::Drawing::GBinaryGroup< SPos >
YModules.h
platform_ex::Reset
unsigned long Reset(COMPtr< _iCOM > &ptr) ynothrow
Definition: COM.h:406
YSLib::UI::SequenceViewer
序列视图。
Definition: Viewer.h:45
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YSLib::UI::ImplExpr
IWidget bool b ImplExpr(wgt.GetController().SetEnabled(b)) YF_API bool Enable(IWidget &
设置部件可用性，且当可用性改变时无效化部件区域。
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:293
CHRLib::d
_tDst * d
Definition: CharacterProcessing.h:139
YSLib::UI::bool
IWidget bool b bool
Definition: YControl.h:121