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 
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 
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 
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  {
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:
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
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 
yconstexpr Padding DefaultMargin(2, 2, 2, 2)
默认边距。
pt pt Y const IWidget &wgt const IWidget &wgt GetSizeOf
无效化:使相对于部件的子部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: ywidget.h:156
pt pt Y const IWidget &wgt GetLocationOf
Definition: ywidget.h:148
GValueEventArgs< MTextList::IndexType > IndexEventArgs
索引事件。
Definition: textlist.h:47
YF_API void OnKey_Bound_TouchDown(KeyEventArgs &&)
处理按键事件:按键-指针设备接触开始。
Definition: ycontrol.cpp:171
#define G_APP_NAME
Definition: Shells.h:58
YF_API void SetLocationOf(IWidget &, const Point &)
设置部件左上角所在位置(相对于容器的偏移坐标)。
Definition: ywidget.cpp:73
bool return true
Definition: DSMain.cpp:177
Color GenerateRandomColor()
Definition: ShellHelper.h:293
YF_API void PostQuitMessage(int nExitCode, Messaging::Priority p=0xF0)
以优先级 p 发起 Shell 终止请求,返回 nExitCode。
Definition: yapp.cpp:83
std::uint32_t u32
Definition: yadaptor.h:69
YF_API GUIState & FetchGUIState()
取默认图形用户界面公共状态。
Definition: ygui.cpp:442
void AddWidgetsZ(_tCon &con, ZOrderType z, _tWidgets &...wgts)
向部件容器添加指定 Z 顺序的子部件。
Definition: yuicont.h:414
关于窗体。
Definition: About.h:40
YF_API void FillRect(const Graphics &g, const Rect &, Color c)
填充标准矩形。
Definition: ydraw.cpp:146
YF_API void Invalidate(IWidget &, const Rect &)
无效化:使相对于部件的指定区域在直接和间接的窗口缓冲区中无效。
Definition: ywidget.cpp:111
void InvalidateAll(IWidget &wgt, const Rect &bounds)
Definition: ywidget.cpp:124
void SetInvalidationOf(IWidget &wgt)
Definition: ywidget.cpp:60
MSelector::SelectedArgs TickedArgs
选择框选中状态参数类型。
Definition: Selector.h:107
YF_API MIMEBiMapping & FetchMIMEBiMapping()
取 MIME 类型名和文件扩展名双向映射对象。
YF_API bool Enable(IWidget &, bool=true)
设置部件可用性,且当可用性改变时无效化部件区域。
Definition: ycontrol.cpp:90
std::shared_ptr< _type > share_raw(const _pSrc &p)
Definition: memory.hpp:165
YF_API void OnTouchHeld_Dragging(CursorEventArgs &&)
处理屏幕接触移动事件:拖放按下部件。
Definition: ycontrol.cpp:144
按钮。
Definition: button.h:116
#define YCL_KEY_Start
Definition: Input.h:46
void unseq_apply(_fCallable &&f, _tParams &&...args)
无序调用。
Definition: functional.hpp:144
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:39
#define ynew
Definition: ynew.h:205
YF_API void Show(IWidget &)
显示部件。
Definition: ywidget.cpp:206
String GetExtensionOf(const String &fname)
void SetEnabledOf(IWidget &wgt, bool b)
设置部件可用性。
Definition: ycontrol.h:101
String Text
标签文本。
Definition: label.h:76
#define DeclDynWidgetN(_t, _n,...)
声明指定节点下的按相同名称访问的动态部件。
Definition: Loader.h:270
void SetList(const shared_ptr< ListType > &)
设置文本列表。
GBinaryGroup< SPos > Point
屏幕二维点(直角坐标表示)。
Definition: ygdibase.h:235
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:748
void OnPaint() override
处理绘制消息:更新到屏幕并刷新 FPS 。
_tWidget & wgt
Definition: ywgtevt.h:596
#define YCL_DS
Definition: Platform.h:137
yconstfn const string & name
Definition: Loader.h:110
YF_API void DrawText(const Graphics &g, TextState &ts, const String &str, bool line_wrap)
绘制文本。
WidgetLoader & FetchWidgetLoader()
Definition: Shells.cpp:130
_pDst polymorphic_downcast(_tSrc *x)
多态类指针向派生类指针转换。
Definition: cast.hpp:124
屏幕标准矩形:表示屏幕矩形区域。
Definition: ygdibase.h:416
PaintEventArgs &&void Switch(const string &)
Definition: ystyle.cpp:337
std::reference_wrapper< ShlDS > shell
Definition: ShlExplorer.h:40
表示菜单键(如 Menu 和 Win )。
Definition: Keys.h:129
YF_API void RequestFocusCascade(IWidget &)
级联请求部件及上层容器焦点。
Definition: yfocus.cpp:138
面板背景。
Definition: ystyle.h:183
errno_t NowShellTo(const shared_ptr< Shell > &hShl)
向句柄指定的 Shell 对象转移线程控制权。
Definition: ShellHelper.h:187
YF_API void SwitchVisibleToFront(IWidget &)
切换部件显示状态并请求提升至前端。
yconstfn A
Definition: Video.h:118
#define DeclDynWidget(_t, _n,...)
声明动态部件。
Definition: Loader.h:263
void DrawPolygon(Graphics &g, const Rect &bounds, _tIn first, _tIn last, Color c)
描画多边形。
Definition: ydraw.h:240
unsigned long Reset(COMPtr< _iCOM > &ptr) ynothrow
YF_API void InitExStyles()
初始化扩展样式。
Definition: ExStyle.cpp:232
shared_ptr< Image > & FetchImage(size_t)
Definition: Shells.cpp:94
std::string to_string(unsigned char val)
转换为字符串。
Definition: string.hpp:353
Color
控制台颜色枚举。
Definition: Video.h:458
YF_API void ResetDSDesktops(Desktop &, Desktop &)
以默认屏幕复位两个桌面。
Definition: shlds.cpp:60
ShlExplorer(const IO::Path &=IO::FetchCurrentWorkingDirectory(), const shared_ptr< Desktop > &={}, const shared_ptr< Desktop > &={})
构造:使用指定路径和上下桌面。
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:462
#define YCL_KEY(X)
Definition: Input.h:45
YF_API void OnKey_Bound_TouchUp(KeyEventArgs &&)
处理按键事件:按键-指针设备接触结束。
Definition: ycontrol.cpp:159
bounds & r
Definition: ydraw.h:220
bool ends_with(const _tRange1 &input, const _tRange2 &test, _fPred comp)
判断第一个参数指定的串是否以第二个参数结束。
Definition: string.hpp:158
c yconstfn g
Definition: ystyle.h:104
std::basic_string< _tChar > sfmt(const _tChar *fmt,...)
以 C 标准输出格式的输出 std::basic_string 实例的对象。
Definition: string.hpp:399
void AddButtonToTabBar(TabControl &, const ValueNode &, const string &, const String &, SDst=64)
向标签栏和节点添加按钮。
Definition: Shells.cpp:158
const ZOrderType DefaultWindowZOrder(128)
默认窗口 Z 顺序值。
void ResizeForContent(TextList &tl)
Definition: textlist.cpp:423
enable_if_t<!is_array< _type >::value, std::unique_ptr< _type > > make_unique(_tParams &&...args)
使用 new 和指定参数构造指定类型的 std::unique_ptr 实例。
Definition: memory.hpp:213
double FetchImageLoadTime()
Definition: Shells.cpp:123
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:68
Styles::StyleMap Styles
样式映射。
Definition: ygui.h:129
Shell 阅读器框架。
yconstexpr size_t Image_N(3)
YF_API shared_ptr< TextList::ListType > FetchVisualStyleNames(String=u"<Default>")
取视觉样式名称。
void PostTask(_fCallable &&f, Messaging::Priority prior=Messaging::NormalPriority)
通过消息队列部署后任务。
Definition: Task.h:43
文件浏览器。
#define YAssert(_expr, _msg)
Definition: cassert.h:73
YF_API NodeCategory ClassifyNode(const Path &)
按文件系统节点类别对路径分类。
SwitchScreensButton(ShlDS &, const Point &)
#define DeclDynWidgetNode(_t, _n)
声明名称为 node 的节点下的按相同名称访问的动态部件。
Definition: Loader.h:276