YSTest: ShlExplorer.cpp 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ShlExplorer.cpp
浏览该文件的文档.
1 /*
2 © 2013-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 #include "ShlExplorer.h"
29 #include "ShlReader.h"
30 #include YFM_YSLib_UI_ExStyle
31
32 namespace YReader
33 {
34
35 using ystdex::polymorphic_downcast;
36
37 namespace
38 {
39
41
42 using namespace IO;
43
44 enum class FileCategory
45 {
46 Empty = NodeCategory::Empty,
47 Unknown = NodeCategory::Regular,
48 Binary,
49 Text
50 };
51
52 bool
53 CheckTextFileExtensions(string ext)
54 {
55 for(auto& c : ext)
56 c = std::tolower(c);
57 try
58 {
59 const auto& m(FetchMIMEBiMapping().GetExtensionMap());
60 const auto i(m.find(ext));
61
62 // TODO: Compare for multiple values.
63 if(i != m.end())
64 {
65 const auto& pth(i->second);
66
67 return !pth.empty() && (pth.front() == "text"
68 || ystdex::ends_with(pth.back(), "xml"));
69 }
70 }
71 catch(std::out_of_range&)
72 {}
73 return false;
74 }
75
76 FileCategory
77 ClassifyFile(const Path& pth)
78 {
79 switch(ClassifyNode(pth))
80 {
81 case NodeCategory::Regular:
82 return CheckTextFileExtensions(GetExtensionOf(pth).GetMBCS(CS_Path))
83 ? FileCategory::Text : FileCategory::Binary;
84 case NodeCategory::Unknown:
85 break;
86 default:
87 return FileCategory::Empty;
88 }
89 // TODO: Verifying.
90 // TODO: Implementation for other categories.
91 return FileCategory::Unknown;
92 }
94
96 bool
97 CheckReaderEnability(FileBox& fb, RadioBox& hex)
98 {
99 if(fb.IsSelected())
100 {
101 switch(ClassifyFile(fb.GetPath()))
102 {
103 case FileCategory::Text:
104 return true;
105 case FileCategory::Binary:
106 return hex.GetState() == &hex;
107 default:
108 ;
109 }
110 }
111 return false;
112 }
113
114
116 inline bool
117 CheckMenuKey(const KeyInput& k)
118 {
119 #if YCL_Win32
120 auto ke(k);
121
122 unseq_apply([&](int vk){ke.set(vk, {});}, VK_CONTROL, VK_LCONTROL,
123 VK_RCONTROL);
124 return ke.none() && k[VK_CONTROL];
125 #else
126 return k.count() == 1 && k[YCL_KEY_Start];
127 #endif
128 }
129
130
132
133 yconstexpr auto PI = 3.14159265358979323;
134 yconstexpr auto PI_2 = PI * 2;
135 yconstexpr auto PI_4 = PI * 4;
136
138 void
139 DrawStar(Graphics& g, const Rect& bounds, Color c, const Point& pt, SDst r,
140 float a, size_t n = 5)
141 {
142 static yconstexpr auto PI_4 = PI * 4;
143 vector<Point> pts(n);
144
145 for(size_t i = 0; i < n; ++i)
146 pts[i] = {int(-std::cos(PI_4 / n * i + a) * r + pt.X),
147 int(std::sin(PI_4 / n * i + a) * r + pt.Y)};
148 DrawPolygon(g, bounds, pts.cbegin(), pts.cend(), c);
149 }
151
153 const char TU_Explorer_Main[]{u8R"NPL(root
154 ($type "Panel")($bounds "0 0 256 192")
155 (lblTitle
156 ($type "Label")($bounds "16 20 220 22"))
157 (lblPath
158 ($type "Label")($bounds "8 48 240 48"))
159 (lblInfo
160 ($type "Label")($bounds "8 100 240 64"))
161 )NPL"};
163 const char TU_Explorer_Sub[]{u8R"NPL(root
164 ($type "Panel")($bounds "0 0 256 192")
165 (fbMain
166 ($type "FileBox")($bounds "0 0 256 170"))
167 (btnOK
168 ($type "Button")($bounds "170 170 64 22"))
169 (btnMenu
170 ($type "Button")($bounds "0 170 72 22"))
171 (pnlSetting
172 ($type "Panel")($bounds "10 40 224 100")($z 128)
173 (ddlStyle
174 ($type "DropDownList")($bounds "10 24 80 22"))
175 (rbTxt
176 ($type "RadioButton")($bounds "120 18 100 18"))
177 (rbHex
178 ($type "RadioButton")($bounds "120 36 100 18"))
179 (cbFPS
180 ($type "CheckButton")($bounds "10 60 72 18"))
181 (btnPrevBackground
182 ($type "Button")($bounds "120 60 30 22"))
183 (btnNextBackground
184 ($type "Button")($bounds "164 60 30 22"))
185 )
186 (pnlTest1
187 ($type "Panel")($bounds "10 20 224 144")($z 128)
188 (tcTest1
189 ($type "TabControl")
190 ($bounds "3 3 218 138")
191 (pnlPage1
192 ($type "Panel")
193 (btnEnterTest
194 ($type "Button")($bounds "8 32 104 22"))
195 (lblDragTest
196 ($type "Label")($bounds "4 4 104 22"))
197 )
198 (pnlPage2
199 ($type "Panel")
200 (btnTestAni
201 ($type "Button")($bounds "8 32 104 22"))
202 )
203 (pnlPage3
204 ($type "Panel")
205 (tbTest
206 ($type "TextBox")($bounds "8 4 104 22"))
207 (btnTestEx
208 ($type "Button")($bounds "8 32 104 22"))
209 (cbDisableSetting
210 ($type "CheckButton")($bounds "8 64 104 22"))
211 )
212 )
213 )
214 )NPL"};
215
216 } // unnamed namespace;
217
218
219
220 SwitchScreensButton::SwitchScreensButton(ShlDS& shl, const Point& pt)
221 : Button({pt, {22, 22}}, 60),
222 shell(shl)
223 {
224 yunseq(
225 Text = u"％",
226 FetchEvent<Click>(*this) += [this]{
227 shell.get().SwapScreens();
228 }
229 );
230 }
231
232
233 ShlExplorer::ShlExplorer(const IO::Path& path,
234 const shared_ptr<Desktop>& h_dsk_up, const shared_ptr<Desktop>& h_dsk_dn)
235 : ShlDS(h_dsk_up, h_dsk_dn),
236 dynWgts_Main(FetchWidgetLoader(), TU_Explorer_Main),
237 dynWgts_Sub(FetchWidgetLoader(), TU_Explorer_Sub),
238 pFrmAbout(make_unique<FrmAbout>()), mhMain(*GetSubDesktopHandle()),
239 fpsCounter(std::chrono::milliseconds(500)),
240 btnSwitchMain(*this, {234, 170}), btnSwitchSub(*this, {234, 170})
241 {
242 using namespace std;
243 using namespace placeholders;
244 static struct Init
245 {
246 Init()
247 {
248 Styles::InitExStyles();
249 }
250 } init;
251 static int up_i(1);
252 auto& dsk_m(GetMainDesktop());
253 auto& dsk_s(GetSubDesktop());
254 auto& node(dynWgts_Main.WidgetNode);
255 DeclDynWidget(Panel, root, node)
256 DeclDynWidgetNode(Label, lblTitle)
257 DeclDynWidgetNode(Label, lblPath)
258 DeclDynWidgetNode(Label, lblInfo)
259 auto& node_sub(dynWgts_Sub.WidgetNode);
260 DeclDynWidget(Panel, root_sub, node_sub)
261 DeclDynWidgetN(FileBox, fbMain, node_sub)
262 DeclDynWidgetN(Button, btnOK, node_sub)
263 DeclDynWidgetN(Button, btnMenu, node_sub)
264 auto& node_pnlSetting(AccessWidgetNode(node_sub, "pnlSetting"));
265 DeclDynWidget(Panel, pnlSetting, node_pnlSetting)
266 DeclDynWidgetN(DropDownList, ddlStyle, node_pnlSetting)
267 DeclDynWidgetN(RadioButton, rbTxt, node_pnlSetting)
268 DeclDynWidgetN(RadioButton, rbHex, node_pnlSetting)
269 DeclDynWidgetN(CheckButton, cbFPS, node_pnlSetting)
270 DeclDynWidgetN(Button, btnPrevBackground, node_pnlSetting)
271 DeclDynWidgetN(Button, btnNextBackground, node_pnlSetting)
272 auto& node_pnlTest1(AccessWidgetNode(node_sub, "pnlTest1"));
273 auto& node_tcTest1(AccessWidgetNode(node_pnlTest1, "tcTest1"));
274 DeclDynWidget(Panel, pnlTest1, node_pnlTest1)
275 DeclDynWidgetN(TabControl, tcTest1, node_pnlTest1)
276 auto& node_pnlPage1(AccessWidgetNode(node_tcTest1, "pnlPage1"));
277 auto& node_pnlPage2(AccessWidgetNode(node_tcTest1, "pnlPage2"));
278 auto& node_pnlPage3(AccessWidgetNode(node_tcTest1, "pnlPage3"));
279 DeclDynWidget(Panel, pnlPage2, node_pnlPage2)
280 DeclDynWidgetN(Label, lblDragTest, node_pnlPage1)
281 DeclDynWidgetN(Button, btnEnterTest, node_pnlPage1)
282 DeclDynWidgetN(Button, btnTestAni, node_pnlPage2)
283 DeclDynWidgetN(TextBox, tbTest, node_pnlPage3)
284 DeclDynWidgetN(Button, btnTestEx, node_pnlPage3)
285 DeclDynWidgetN(CheckButton, cbDisableSetting, node_pnlPage3)
286
287 AddButtonToTabBar(tcTest1, node_pnlTest1, "btnTab1", u"基本测试");
288 AddButtonToTabBar(tcTest1, node_pnlTest1, "btnTab2", u"动画测试");
289 AddButtonToTabBar(tcTest1, node_pnlTest1, "btnTab3", u"附加测试");
290 tcTest1.UpdateTabPages();
291 p_border = make_unique<BorderResizer>(pnlTest1, 4);
292 p_ChkFPS = &cbFPS;
293 dsk_m += root,
294 dsk_m.Add(btnSwitchMain, 96),
295 dsk_s += root_sub,
296 // XXX: NPL script should be used to describe Z-order variable.
297 dsk_s.Add(btnSwitchSub, 96),
298 AddWidgetsZ(root_sub, DefaultWindowZOrder, *pFrmAbout);
299 fbMain.SetRenderer(make_unique<BufferedRenderer>(true)),
300 pnlSetting.SetRenderer(make_unique<BufferedRenderer>()),
301 pnlTest1.SetRenderer(make_unique<BufferedRenderer>()),
302 unseq_apply(bind(SetVisibleOf, _1, false), pnlSetting, pnlTest1,
303 *pFrmAbout),
304 unseq_apply(bind(&ShlDS::WrapForSwapScreens, this, _1, ref(SwapMask)),
305 dsk_m, dsk_s),
306 ani.Reset(&pnlTest1),
307 ddlStyle.SetList(FetchVisualStyleNames()),
308 rbTxt.ShareTo(rbHex),
309 rbTxt.Select(),
310 unseq_apply(bind(Enable, _1, false), btnOK, btnPrevBackground),
311 yunseq(
312 dsk_m.Background = ImageBrush(FetchImage(0)),
313 dsk_s.Background = SolidBrush(FetchGUIState().Colors[Styles::Panel]),
314 root.Background = nullptr,
315 root_sub.Background = nullptr,
316 lblTitle.Text = G_APP_NAME,
317 lblPath.AutoWrapLine = true, lblPath.Text = String(path),
318 lblInfo.AutoWrapLine = true, lblInfo.Text = u"文件列表：请选择一个文件。",
319 // TODO: Show current working directory properly.
320 btnOK.Text = u"确定(A)",
321 #if YCL_Win32
322 btnMenu.Text = u"菜单(Ctrl)",
323 #else
324 btnMenu.Text = u"菜单(Start)",
325 #endif
326 tbTest.Text = u"测试文本",
327 ddlStyle.Text = [](const TextList::ListType& lst){
328 const auto& name(FetchGUIState().Styles.GetCurrent()->first);
329
330 YAssert(!lst.empty(), "Invalid list found.");
331 return name.empty() ? lst[0] : String(name);
332 }(ddlStyle.GetList()),
333 rbTxt.Text = u"文本阅读",
334 rbHex.Text = u"十六进制浏览",
335 cbFPS.Text = u"显示 FPS",
336 pnlSetting.Background = SolidBrush({160, 252, 160}),
337 pnlTest1.Background = SolidBrush({248, 248, 120}),
338 lblDragTest.HorizontalAlignment = TextAlignment::Left,
339 // btnTestEx.Enabled = {},
340 btnTestEx.Font.SetStyle(FontStyle::Bold | FontStyle::Italic),
341 btnTestEx.Text = u"附加测试",
342 btnTestEx.HorizontalAlignment = TextAlignment::Left,
343 btnTestEx.VerticalAlignment = TextAlignment::Down,
344 btnTestAni.Text = u"开始动画",
345 cbDisableSetting.Text = u"禁用设置选择框",
346 lblDragTest.Text = u"移动设置面板位置",
347 btnEnterTest.Font.SetStyle(FontStyle::Italic),
348 btnEnterTest.Text = u"边界测试",
349 btnEnterTest.HorizontalAlignment = TextAlignment::Right,
350 btnEnterTest.VerticalAlignment = TextAlignment::Up,
351 btnPrevBackground.Font.SetStyle(FontStyle::Bold),
352 btnPrevBackground.Text = u"<<",
353 btnNextBackground.Font.SetStyle(FontStyle::Bold),
354 btnNextBackground.Text = u">>",
355 fbMain.SetPath(path),
356 dsk_s.BoundControlPtr = [&, this](const KeyInput& k)->IWidget*{
357 if(k.count() == 1)
358 {
359 if(k[YCL_KEY(A)])
360 return &btnOK;
361 }
362 else if(CheckMenuKey(k))
363 return &btnMenu;
364 return nullptr;
365 },
366 FetchEvent<KeyUp>(dsk_s) += OnKey_Bound_TouchUp,
367 FetchEvent<KeyDown>(dsk_s) += OnKey_Bound_TouchDown,
368 FetchEvent<KeyPress>(dsk_s) += [&](KeyEventArgs&& e){
369 if(e.GetKeys()[YCL_KEY(X)])
370 SwitchVisibleToFront(pnlSetting);
371 },
372 fbMain.GetViewChanged() += [&]{
373 lblPath.Text = String(fbMain.GetPath());
374 Invalidate(lblPath);
375 },
376 fbMain.GetSelected() += [&]{
377 Enable(btnOK, CheckReaderEnability(fbMain, rbHex));
378 },
379 FetchEvent<Click>(btnOK) += [&]{
380 if(fbMain.IsSelected())
381 {
382 const auto& path(fbMain.GetPath());
383 // const string s(path);
384 const auto category(ClassifyFile(path));
385
386 if(category == FileCategory::Text
387 || category == FileCategory::Binary)
388 {
389 const auto h_up(GetMainDesktopHandle());
390 const auto h_dn(GetSubDesktopHandle());
391 const bool b(category == FileCategory::Text
392 && rbTxt.IsSelected());
393
394 PostTask([=]{
395 ResetDSDesktops(*h_up, *h_dn);
396 if(b)
397 NowShellTo(ystdex::make_shared<ShlTextReader>(path,
398 h_up, h_dn));
399 else
400 NowShellTo(ystdex::make_shared<ShlHexBrowser>(path,
401 h_up, h_dn));
402 }, 0xF8);
403 }
404 }
405 },
406 FetchEvent<Click>(cbFPS) += [this]{
407 SetInvalidationOf(GetSubDesktop());
408 },
409 FetchEvent<Click>(rbHex) += [&]{
410 Enable(btnOK, CheckReaderEnability(fbMain, rbHex));
411 SetInvalidationOf(GetSubDesktop());
412 },
413 FetchEvent<Move>(pnlSetting) += [&]{
414 lblDragTest.Text = to_string(GetLocationOf(pnlSetting)) + ';';
415 Invalidate(lblDragTest);
416 },
417 FetchEvent<TouchHeld>(pnlSetting) += OnTouchHeld_Dragging,
418 #if YCL_DS
419 FetchEvent<TouchDown>(pnlSetting) += [&]{
420 struct ::mallinfo t(::mallinfo());
421
422 lblInfo.Text = ystdex::sfmt("%d,%d,%d,%d,%d;",
423 t.arena, t.ordblks, t.uordblks, t.fordblks, t.keepcost);
424 Invalidate(lblInfo);
425 },
426 #endif
427 FetchEvent<Click>(pnlSetting) += [&]{
428 yunseq(
429 lblDragTest.ForeColor = GenerateRandomColor(),
430 lblTitle.ForeColor = GenerateRandomColor()
431 );
432 Invalidate(pnlSetting);
433 },
434 FetchEvent<TouchHeld>(pnlTest1) += OnTouchHeld_Dragging,
435 FetchEvent<Paint>(pnlPage2) += [&, this](PaintEventArgs&& e){
436 auto& g(e.Target);
437 const auto& pt(GetLocationOf(pnlTest1));
438 auto& bounds(e.ClipArea);
439
440 DrawStar(g, bounds, ColorSpace::Red, pt + Point{96, 96}, 48, rad);
441 DrawStar(g, bounds, ColorSpace::Green, pt + Point{96, 96}, 48,
442 rad + PI);
443 if(ani.GetConnectionRef().Ready)
444 {
445 rad += 0.02;
446 if(rad > PI_2)
447 rad -= PI_2;
448 }
449 UpdateClipArea(e, {{}, GetSizeOf(e.GetSender())});
450 },
451 FetchEvent<Click>(btnTestEx) += [&](CursorEventArgs&& e){
452 const auto& k(e.GetKeys());
453 auto& btn(polymorphic_downcast<Button&>(e.GetSender()));
454
455 if(lblTitle.Background)
456 lblTitle.Background = nullptr;
457 else
458 lblTitle.Background = SolidBrush(GenerateRandomColor());
459 lblInfo.Text = btn.Text + u", " + String(to_string(
460 FetchImageLoadTime())) + u";\n" + String(k.to_string());
461 unseq_apply([](IWidget& wgt){Invalidate(wgt);}, lblTitle, lblInfo);
462 },
463 FetchEvent<Click>(btnTestAni) += [&]{
464 auto& conn(ani.GetConnectionRef());
465
466 if(conn.Ready)
467 yunseq(btnTestAni.Text = u"开始动画", conn.Ready = {});
468 else
469 {
470 yunseq(btnTestAni.Text = u"停止动画", conn.Ready = true),
471 ani.Start();
472 }
473 Invalidate(btnTestAni);
474 },
475 FetchEvent<Enter>(btnEnterTest) += [](CursorEventArgs&& e){
476 auto& btn(ystdex::polymorphic_downcast<Button&>(e.GetSender()));
477
478 btn.Text = u"Enter: " + String(to_string(e.Position));
479 Invalidate(btn);
480 },
481 FetchEvent<Leave>(btnEnterTest) += [](CursorEventArgs&& e){
482 auto& btn(ystdex::polymorphic_downcast<Button&>(e.GetSender()));
483
484 btn.Text = u"Leave: " + String(to_string(e.Position));
485 Invalidate(btn);
486 },
487 mhMain.Roots[&btnMenu] = 1u,
488 FetchEvent<Click>(btnMenu) += [this]{
489 auto& mnu(mhMain[1u]);
490
491 if(mhMain.IsShowing(1u))
492 {
493 mhMain.HideAll();
494 mnu.ClearSelected();
495 }
496 else
497 mhMain.Show(1u);
498 Invalidate(mnu);
499 },
500 FetchEvent<Click>(btnPrevBackground) += [&]{
501 auto& dsk_m(GetMainDesktop());
502 auto& dsk_s(GetSubDesktop());
503
504 if(up_i > 0)
505 {
506 --up_i;
507 Enable(btnNextBackground);
508 }
509 if(up_i == 0)
510 Enable(btnPrevBackground, false);
511 dsk_m.Background = ImageBrush(FetchImage(up_i));
512 unseq_apply(SetInvalidationOf, dsk_m, dsk_s);
513 },
514 FetchEvent<Click>(btnNextBackground) += [&]{
515 auto& dsk_m(GetMainDesktop());
516 auto& dsk_s(GetSubDesktop());
517
518 if(size_t(up_i + 1) < Image_N)
519 {
520 ++up_i;
521 Enable(btnPrevBackground);
522 }
523 if(size_t(up_i + 1) == Image_N)
524 Enable(btnNextBackground, false);
525 dsk_m.Background = ImageBrush(FetchImage(up_i));
526 SetInvalidationOf(dsk_m),
527 SetInvalidationOf(dsk_s);
528 },
529 cbDisableSetting.Ticked += [&](CheckBox::TickedArgs&& e){
530 unseq_apply(bind(SetEnabledOf, _1, !e), cbFPS, rbTxt, rbHex);
531 unseq_apply([](IWidget& wgt){Invalidate(wgt);}, cbFPS, rbTxt, rbHex);
532 },
533 ddlStyle.GetConfirmed() += [&, this]{
534 FetchGUIState().Styles.Switch(ddlStyle.Text.GetMBCS());
535 unseq_apply([](IWidget& wgt){InvalidateAll(wgt);}, dsk_m, dsk_s);
536 }
537 );
538 RequestFocusCascade(fbMain),
539 unseq_apply(SetInvalidationOf, dsk_m, dsk_s);
540
541 auto& m1(*(ynew Menu({}, share_raw(
542 new TextList::ListType{u"测试", u"关于", u"设置(X)", u"退出"}), 1u)));
543 auto& m2(*(ynew Menu({},
544 share_raw(new TextList::ListType{u"项目1", u"项目2"}), 2u)));
545
546 m1.Confirmed += [&](IndexEventArgs&& e){
547 switch(e.Value)
548 {
549 case 1U:
550 Show(*pFrmAbout);
551 break;
552 case 2U:
553 SwitchVisibleToFront(pnlSetting);
554 break;
555 case 3U:
556 YSLib::PostQuitMessage(0);
557 }
558 },
559 m2.Confirmed += [&](IndexEventArgs&& e){
560 #if YCL_Win32
561 MinGW32::TestFramework(e.Value);
562 #endif
563 if(e.Value == 0)
564 SwitchVisibleToFront(pnlTest1);
565 },
566 mhMain += m1, mhMain += m2,
567 m1 += make_pair(0u, &m2);
568 unseq_apply(ResizeForContent, m1, m2),
569 SetLocationOf(m1, Point(btnMenu.GetX(), btnMenu.GetY() - m1.GetHeight()));
570 //m1.SetWidth(btnMenu.GetWidth() + 20);
571 }
572
573 void
574 ShlExplorer::OnPaint()
575 {
576 // NOTE: Hack for performance.
577 // DeclDynWidgetN(CheckButton, cbFPS, dynWgts_Sub.WidgetNode, "pnlSetting")
578 auto& cbFPS(*p_ChkFPS);
579
580 // NOTE: Overriding member function %OnInput using %SM_TASK is also valid
581 // because the %SM_Input message is sent continuously, but less efficient.
582 if(cbFPS.IsTicked())
583 {
584 using namespace ColorSpace;
585
586 const u32 t(fpsCounter.Refresh());
587
588 if(t != 0)
589 {
590 auto& g(ystdex::polymorphic_downcast<BufferedRenderer&>(
591 GetMainDesktop().GetRenderer()).GetContext());
592 yconstexpr Rect r(176, 0, 80, 20);
593 char strt[20];
594
595 std::sprintf(strt, "FPS: %u.%03u", unsigned(t / 1000),
596 unsigned(t % 1000));
597 FillRect(g, r, Blue);
598 DrawText(g, r, strt, DefaultMargin, White, false);
599 bUpdateUp = true;
600 }
601 }
602 }
603
604 } // namespace YReader;
605
YSLib::Drawing::DefaultMargin
yconstexpr Padding DefaultMargin(2, 2, 2, 2)
默认边距。
YSLib::UI::GetSizeOf
pt pt Y const IWidget &wgt const IWidget &wgt GetSizeOf
无效化：使相对于部件的子部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: ywidget.h:156
YSLib::UI::GetLocationOf
pt pt Y const IWidget &wgt GetLocationOf
Definition: ywidget.h:148
YSLib::UI::IndexEventArgs
GValueEventArgs< MTextList::IndexType > IndexEventArgs
索引事件。
Definition: textlist.h:47
YSLib::UI::OnKey_Bound_TouchDown
YF_API void OnKey_Bound_TouchDown(KeyEventArgs &&)
处理按键事件：按键-指针设备接触开始。
Definition: ycontrol.cpp:171
G_APP_NAME
#define G_APP_NAME
Definition: Shells.h:58
YSLib::UI::SetLocationOf
YF_API void SetLocationOf(IWidget &, const Point &)
设置部件左上角所在位置（相对于容器的偏移坐标）。
Definition: ywidget.cpp:73
YSLib::true
bool return true
Definition: DSMain.cpp:177
YSLib::Drawing::GenerateRandomColor
Color GenerateRandomColor()
Definition: ShellHelper.h:293
YSLib::PostQuitMessage
YF_API void PostQuitMessage(int nExitCode, Messaging::Priority p=0xF0)
以优先级 p 发起 Shell 终止请求，返回 nExitCode。
Definition: yapp.cpp:83
YSLib::u32
std::uint32_t u32
Definition: yadaptor.h:69
YSLib::UI::FetchGUIState
YF_API GUIState & FetchGUIState()
取默认图形用户界面公共状态。
Definition: ygui.cpp:442
YSLib::UI::AddWidgetsZ
void AddWidgetsZ(_tCon &con, ZOrderType z, _tWidgets &...wgts)
向部件容器添加指定 Z 顺序的子部件。
Definition: yuicont.h:414
YSLib::UI::TextAlignment::Down
YReader::FrmAbout
关于窗体。
Definition: About.h:40
YSLib::Drawing::FillRect
YF_API void FillRect(const Graphics &g, const Rect &, Color c)
填充标准矩形。
Definition: ydraw.cpp:146
YSLib::UI::Invalidate
YF_API void Invalidate(IWidget &, const Rect &)
无效化：使相对于部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: ywidget.cpp:111
YSLib::UI::InvalidateAll
void InvalidateAll(IWidget &wgt, const Rect &bounds)
Definition: ywidget.cpp:124
YSLib::Drawing::bounds
bounds
Definition: ydraw.h:188
YSLib::UI::SetInvalidationOf
void SetInvalidationOf(IWidget &wgt)
Definition: ywidget.cpp:60
YSLib::UI::MCheckBox::TickedArgs
MSelector::SelectedArgs TickedArgs
选择框选中状态参数类型。
Definition: Selector.h:107
YSLib::FetchMIMEBiMapping
YF_API MIMEBiMapping & FetchMIMEBiMapping()
取 MIME 类型名和文件扩展名双向映射对象。
Definition: Initialization.cpp:413
YSLib::UI::Enable
YF_API bool Enable(IWidget &, bool=true)
设置部件可用性，且当可用性改变时无效化部件区域。
Definition: ycontrol.cpp:90
ystdex::share_raw
std::shared_ptr< _type > share_raw(const _pSrc &p)
Definition: memory.hpp:165
YSLib::UI::OnTouchHeld_Dragging
YF_API void OnTouchHeld_Dragging(CursorEventArgs &&)
处理屏幕接触移动事件：拖放按下部件。
Definition: ycontrol.cpp:144
YSLib::UI::Button
按钮。
Definition: button.h:116
YCL_KEY_Start
#define YCL_KEY_Start
Definition: Input.h:46
ystdex::unseq_apply
void unseq_apply(_fCallable &&f, _tParams &&...args)
无序调用。
Definition: functional.hpp:144
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:39
platform::Consoles::White
Definition: Video.h:475
ynew
#define ynew
Definition: ynew.h:205
YSLib::UI::Show
YF_API void Show(IWidget &)
显示部件。
Definition: ywidget.cpp:206
platform::PathCategory::Empty
YSLib::IO::GetExtensionOf
String GetExtensionOf(const String &fname)
Definition: YSLib/Service/FileSystem.cpp:99
YSLib::UI::SetEnabledOf
void SetEnabledOf(IWidget &wgt, bool b)
设置部件可用性。
Definition: ycontrol.h:101
YSLib::UI::MLabel::Text
String Text
标签文本。
Definition: label.h:76
DeclDynWidgetN
#define DeclDynWidgetN(_t, _n,...)
声明指定节点下的按相同名称访问的动态部件。
Definition: Loader.h:270
YSLib::Drawing::FontStyle::Italic
斜体。
platform::Consoles::Blue
Definition: Video.h:469
YSLib::UI::SetList
void SetList(const shared_ptr< ListType > &)
设置文本列表。
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: ygdibase.h:235
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:748
YReader::ShlExplorer::OnPaint
void OnPaint() override
处理绘制消息：更新到屏幕并刷新 FPS 。
Definition: ShlExplorer.cpp:574
YSLib::UI::TextAlignment::Left
YSLib::UI::wgt
_tWidget & wgt
Definition: ywgtevt.h:596
YCL_DS
#define YCL_DS
Definition: Platform.h:137
YSLib::UI::name
yconstfn const string & name
Definition: Loader.h:110
YSLib::Drawing::DrawText
YF_API void DrawText(const Graphics &g, TextState &ts, const String &str, bool line_wrap)
绘制文本。
Definition: TextRenderer.cpp:236
platform::NodeCategory::Unknown
YSLib::IO::Path
路径。
Definition: YSLib/Service/FileSystem.h:75
platform::Consoles::Red
Definition: Video.h:472
YReader::FetchWidgetLoader
WidgetLoader & FetchWidgetLoader()
Definition: Shells.cpp:130
ystdex::polymorphic_downcast
_pDst polymorphic_downcast(_tSrc *x)
多态类指针向派生类指针转换。
Definition: cast.hpp:124
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: ygdibase.h:416
YSLib::UI::Styles::StyleMap::Switch
PaintEventArgs &&void Switch(const string &)
Definition: ystyle.cpp:337
YReader::SwitchScreensButton::shell
std::reference_wrapper< ShlDS > shell
Definition: ShlExplorer.h:40
platform::KeyCategory::Menu
表示菜单键（如 Menu 和 Win ）。
Definition: Keys.h:129
YSLib::UI::RequestFocusCascade
YF_API void RequestFocusCascade(IWidget &)
级联请求部件及上层容器焦点。
Definition: yfocus.cpp:138
YSLib::UI::Styles::Panel
面板背景。
Definition: ystyle.h:183
YSLib::NowShellTo
errno_t NowShellTo(const shared_ptr< Shell > &hShl)
向句柄指定的 Shell 对象转移线程控制权。
Definition: ShellHelper.h:187
YSLib::UI::TextAlignment::Up
YSLib::UI::SwitchVisibleToFront
YF_API void SwitchVisibleToFront(IWidget &)
切换部件显示状态并请求提升至前端。
Definition: ShellHelper.cpp:151
platform::A
yconstfn A
Definition: Video.h:118
DeclDynWidget
#define DeclDynWidget(_t, _n,...)
声明动态部件。
Definition: Loader.h:263
YSLib::Drawing::DrawPolygon
void DrawPolygon(Graphics &g, const Rect &bounds, _tIn first, _tIn last, Color c)
描画多边形。
Definition: ydraw.h:240
platform_ex::Reset
unsigned long Reset(COMPtr< _iCOM > &ptr) ynothrow
Definition: include/YCLib/COM.h:406
YSLib::UI::Styles::InitExStyles
YF_API void InitExStyles()
初始化扩展样式。
Definition: ExStyle.cpp:232
YReader::FetchImage
shared_ptr< Image > & FetchImage(size_t)
Definition: Shells.cpp:94
ystdex::to_string
std::string to_string(unsigned char val)
转换为字符串。
Definition: string.hpp:353
platform::Consoles::Color
Color
控制台颜色枚举。
Definition: Video.h:458
YSLib::DS::ResetDSDesktops
YF_API void ResetDSDesktops(Desktop &, Desktop &)
以默认屏幕复位两个桌面。
Definition: shlds.cpp:60
YReader::ShlExplorer::ShlExplorer
ShlExplorer(const IO::Path &=IO::FetchCurrentWorkingDirectory(), const shared_ptr< Desktop > &={}, const shared_ptr< Desktop > &={})
构造：使用指定路径和上下桌面。
Definition: ShlExplorer.cpp:233
YSLib::UI::TextAlignment::Right
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:462
YCL_KEY
#define YCL_KEY(X)
Definition: Input.h:45
YSLib::UI::OnKey_Bound_TouchUp
YF_API void OnKey_Bound_TouchUp(KeyEventArgs &&)
处理按键事件：按键-指针设备接触结束。
Definition: ycontrol.cpp:159
YSLib::Drawing::r
bounds & r
Definition: ydraw.h:220
ystdex::ends_with
bool ends_with(const _tRange1 &input, const _tRange2 &test, _fPred comp)
判断第一个参数指定的串是否以第二个参数结束。
Definition: string.hpp:158
YSLib::Drawing::g
c yconstfn g
Definition: ystyle.h:104
YSLib::Drawing::X
p1 X
Definition: ydraw.h:188
ystdex::sfmt
std::basic_string< _tChar > sfmt(const _tChar *fmt,...)
以 C 标准输出格式的输出 std::basic_string 实例的对象。
Definition: string.hpp:399
YReader::AddButtonToTabBar
void AddButtonToTabBar(TabControl &, const ValueNode &, const string &, const String &, SDst=64)
向标签栏和节点添加按钮。
Definition: Shells.cpp:158
CHRLib::c
c
Definition: chrproc.h:76
YSLib::UI::DefaultWindowZOrder
const ZOrderType DefaultWindowZOrder(128)
默认窗口 Z 顺序值。
YSLib::UI::ResizeForContent
void ResizeForContent(TextList &tl)
Definition: textlist.cpp:423
ystdex::make_unique
enable_if_t<!is_array< _type >::value, std::unique_ptr< _type > > make_unique(_tParams &&...args)
使用 new 和指定参数构造指定类型的 std::unique_ptr 实例。
Definition: memory.hpp:213
YSLib::Drawing::FontStyle::Bold
粗体。
YReader::FetchImageLoadTime
double FetchImageLoadTime()
Definition: Shells.cpp:123
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:68
YSLib::UI::GUIState::Styles
Styles::StyleMap Styles
样式映射。
Definition: ygui.h:129
ShlReader.h
Shell 阅读器框架。
YReader::Image_N
yconstexpr size_t Image_N(3)
YSLib::UI::FetchVisualStyleNames
YF_API shared_ptr< TextList::ListType > FetchVisualStyleNames(String=u"<Default>")
取视觉样式名称。
Definition: ShellHelper.cpp:159
platform::Consoles::Green
Definition: Video.h:470
YSLib::PostTask
void PostTask(_fCallable &&f, Messaging::Priority prior=Messaging::NormalPriority)
通过消息队列部署后任务。
Definition: Task.h:43
ShlExplorer.h
文件浏览器。
YAssert
#define YAssert(_expr, _msg)
Definition: cassert.h:73
YSLib::IO::ClassifyNode
YF_API NodeCategory ClassifyNode(const Path &)
按文件系统节点类别对路径分类。
Definition: YSLib/Service/FileSystem.cpp:186
YReader::SwitchScreensButton::SwitchScreensButton
SwitchScreensButton(ShlDS &, const Point &)
Definition: ShlExplorer.cpp:220
DeclDynWidgetNode
#define DeclDynWidgetNode(_t, _n)
声明名称为 node 的节点下的按相同名称访问的动态部件。
Definition: Loader.h:276