29 #include YFM_YSLib_UI_TabControl
30 #include YFM_YSLib_UI_YGUI
31 #include YFM_YSLib_Service_YGDI // for Drawing::Clip;
37 using namespace Drawing;
45 FetchEvent<Resize>(*this) += [
this]{
53 MLinearUIContainer::operator+=(tab);
54 SetContainerPtrOf(tab,
this);
66 auto& sender(e.GetSender());
76 const SDst h(GetHeight());
99 if(!e.ClipArea.IsUnstrictlyEmpty())
100 for(
auto pr(GetChildren()); pr.first != pr.second; ++pr.first)
102 auto&
wgt(*pr.first);
114 wgt.GetRenderer().Paint(
wgt, std::move(e));
118 pc.ClipArea |= e.ClipArea;
136 TabControl::operator+=(IWidget&
wgt)
138 tab_pages.push_back(&dynamic_cast<Panel&>(wgt));
139 SetContainerPtrOf(wgt,
this);
140 SetVisibleOf(wgt, {});
146 AddWidgetHandlerAdaptor<TouchDown>(ctl, *
this, [&]{
153 TabControl::GetPageBounds() const
ynothrow
155 const SDst h(GetHeight());
158 return Rect(0, h_tb, GetWidth(), h < h_tb ? 0 : h - h_tb);
173 return idx < GetTabCount() ?
SwitchPage(idx) :
false;
191 if(
p_bar->SwitchPage(ctl))
194 SetVisibleOf(*
p_page, {});
196 const auto i(
Find(ctl));
200 SetVisibleOf(*
p_page,
true);
213 auto pr(tb.GetChildren());
217 for(
auto pr(tb.GetChildren()); !
p_page && i < tp_count
218 && pr.first != pr.second;
yunseq(++pr.first, ++i))
222 SetVisibleOf(*
p_page,
true),
const vector< Panel * > tab_pages void Attach(Control &)
附加:添加 TouchDown 事件处理器。
bool Clip(Rect &x, const Rect &y)
剪切操作:取标准矩形交集并判断是否严格非空。
pt pt Y const IWidget &wgt const IWidget &wgt GetSizeOf
无效化:使相对于部件的子部件的指定区域在直接和间接的窗口缓冲区中无效。
pt pt Y const IWidget &wgt GetLocationOf
unique_ptr< TabBar > p_bar
标签栏。
void Refresh(PaintEventArgs &&) override
刷新:按指定参数绘制界面并更新状态。
GetTabBarRef().GetCount()) DefGetter(const ynothrow
YF_API GUIState & FetchGUIState()
取默认图形用户界面公共状态。
bool SwitchTab(Control &)
按标签切换页面。
virtual bool operator-=(IWidget &)
void SetBoundsOf(IWidget &wgt, const Rect &r)
YF_API void Invalidate(IWidget &, const Rect &)
无效化:使相对于部件的指定区域在直接和间接的窗口缓冲区中无效。
static void DefaultPaintTabBorder(PaintEventArgs &&)
绘制默认标签页边框。
void UpdateTabPages()
更新标签页状态。
std::function< void(PaintEventArgs &&)> PaintTabForeground
标签前景附加绘制操作。
std::uint16_t SDst
屏幕坐标距离。
vector< Panel * > tab_pages
YF_API bool RemoveFrom(IWidget &, IWidget &)
从容器中移除部件。
SPos Offset
首个标签所在的起始偏移位置。
#define yunseq
无序列依赖表达式组求值。
YF_API bool IsFocused(const IWidget &)
判断部件是否取得焦点。
TabControl(const Rect &={})
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
bool operator-=(IWidget &)
从部件组移除部件。
#define YAssertNonnull(_expr)
bool IsEnabled(const IWidget &wgt)
判断部件是否为可用的控件。
bool SwitchPage(size_t)
切换页面。
if(YB_UNLIKELY(r >=sGraphics.Height)) throw std return pBuffer r *sGraphics Width
virtual void operator+=(IWidget &)
size_t Find(IWidget &) const
查找页面部件。
bool SwitchPage(Control &)
切换页面。
p1 p1 p2 p2 c YF_API void DrawRect(const Graphics &g, const Rect &bounds, const Point &pt, const Size &s, Color c)
描画标准矩形。
AController *controller_ptr Renderer *renderer_ptr View *view_ptr SPos
std::function< void(PaintEventArgs &&)> PaintTabBackground
标签背景附加绘制操作。
#define YAssert(_expr, _msg)