YSTest: ImageControl.h 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

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

- 文件列表
- 文件成员

ImageControl.h
浏览该文件的文档.
1 /*
2 © 2013-2016 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 INC_ImageBrowser_ImageControl_h_
29 #define INC_ImageBrowser_ImageControl_h_ 1
30
31 #include <YSBuild.h>
32
33 namespace ImageBrowser
34 {
35
36 using namespace YSLib;
37 using namespace Drawing;
39 using namespace Timers;
40 using namespace UI;
41
43 yconstexpr const Size DefaultMinPanelSize(320, 240);
45 yconstexpr const Size DefaultMaxPanelSize(1200, 800);
46
47 class ImagePanel : public Panel
48 {
49 private:
50 using Session = tuple<ImagePages, GAnimationSession<InvalidationUpdater>,
51 Timer, vector<TimeSpan>>;
52
54 unique_ptr<Session> session_ptr{};
56 Size min_panel_size, max_panel_size;
57
58 protected:
60 Thumb btnClose;
62 Label lblCloseTips{};
64 Label lblCenter;
65
66 private:
68 HoverUpdater hover_updater{btnClose};
70 TimedHoverState hover_state;
72 BorderResizer border;
73
74 protected:
76 MenuHost mhMain{};
78 Menu mnuContext;
79
80 private:
82 Rotation rot = RDeg0;
83
84 public:
86 explicit
87 ImagePanel(const Rect&, const Size& = DefaultMinPanelSize,
88 const Size& = DefaultMaxPanelSize);
89
90 private:
92 DefGetter(ynothrow, ImagePages&, PagesRef, get<0>(Deref(session_ptr)))
93
94 public:
96 DefSetter(, bool, RootMode, border.RootMode)
97
98 private:
100 PDefH(void, AdjustCloseButton, )
101 ImplExpr(SetLocationOf(btnClose, CalcCloseButtonLocation()))
102
104 PDefH(Point, CalcCloseButtonLocation, ) const
105 ImplRet({GetWidth() - 8 - btnClose.GetWidth(), 8})
106
107 public:
112 bool
113 CopyToClipboard() ynothrow;
114
116 PDefH(void, Flip, )
117 ImplExpr(rot = UI::Flip(rot), UpdateBrush())
118
120 void
121 Load(ImagePages&&);
123 template<typename _type>
124 void
125 Load(const _type& arg)
126 {
127 Load(ImagePages(&arg[0], min_panel_size, max_panel_size));
128 }
129
131 bool
132 ResetSize();
133
135 PDefH(void, RotateCCW, )
136 ImplExpr(rot = UI::RotateCCW(rot), UpdateBrush())
137
139 PDefH(void, RotateCW, )
140 ImplExpr(rot = UI::RotateCW(rot), UpdateBrush())
141
143 void
144 SetupContextMenu();
145
146 void
147 Unload();
148
149 private:
151 void
152 UpdateBrush();
153
155 void
156 UpdateMenuItem();
158 void
159 UpdateMenuItem(bool);
160 };
161
162 } // namespace ImageBrowser;
163
164 #endif
165
YSLib::UI::BorderResizer
调整大小的边框。
Definition: Border.h:120
ImageBrowser::ImagePanel::min_panel_size
Size min_panel_size
Definition: ImageControl.h:56
ImageBrowser::RotateCCW
Definition: ImageControl.cpp:41
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
ImageBrowser
Definition: ImageControl.cpp:31
UI
platform::Deref
yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:451
YSLib::UI::Panel
面板。
Definition: ypanel.h:45
YSBuild.h
YSLib 库配置文件。
YSLib::Drawing::ImagePages
图像页面集。
Definition: ImageProcessing.h:112
ImageBrowser::DefaultMinPanelSize
yconstexpr const Size DefaultMinPanelSize(320, 240)
YSLib::UI::Label
标签。
Definition: Label.h:143
ImageBrowser::ImagePanel::mnuContext
Menu mnuContext
Definition: ImageControl.h:78
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:679
ImageBrowser::Flip
Definition: ImageControl.cpp:39
ImageBrowser::RotateCW
Definition: ImageControl.cpp:40
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:766
YSLib::UI::SetLocationOf
YF_API void SetLocationOf(IWidget &, const Point &)
设置部件左上角所在位置（相对容器的偏移坐标）。
Definition: YWidget.cpp:76
Drawing
YSLib::Drawing::Rotation
Rotation
逆时针旋转角度指示输出指向。
Definition: YGDIBase.h:895
Timers
YSLib::Drawing::GBinaryGroup< SPos >
ImageBrowser::ImagePanel::hover_state
TimedHoverState hover_state
Definition: ImageControl.h:70
DefSetter
#define DefSetter(_q, _t, _n, _m)
Definition: YBaseMacro.h:252
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:540
ImageBrowser::ImagePanel::border
BorderResizer border
Definition: ImageControl.h:72
ImageBrowser::ImagePanel::lblCenter
Label lblCenter
Definition: ImageControl.h:64
ImageBrowser::ImagePanel::Session
tuple< ImagePages, GAnimationSession< InvalidationUpdater >, Timer, vector< TimeSpan >> Session
Definition: ImageControl.h:51
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YSLib::UI::Menu
菜单。
Definition: Menu.h:57
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:293
YSLib::Drawing::RDeg0
Definition: YGDIBase.h:897
ImageBrowser::ImagePanel
Definition: ImageControl.h:47
ImageBrowser::ImagePanel::btnClose
Thumb btnClose
Definition: ImageControl.h:60
ImageBrowser::DefaultMaxPanelSize
yconstexpr const Size DefaultMaxPanelSize(1200, 800)