28 #ifndef YSL_INC_UI_menu_h_
29 #define YSL_INC_UI_menu_h_ 1
32 #include YFM_YSLib_UI_TextList
33 #include YFM_YSLib_UI_YUIContainer // for UI::ZOrderType;
56 using SubMap = map<IndexType, Menu*>;
74 Menu(
const Rect& = {},
const shared_ptr<ListType>& = {},
ID = 0);
86 PDefHOp(
Menu&, [],
size_t idx)
94 operator+=(const ValueType&);
101 operator-=(IndexType);
109 IsItemEnabled(ListType::size_type) const;
121 SetItemEnabled(ListType::size_type idx,
bool =
true);
153 ShowSub(IndexType,
ZOrderType = DefaultMenuZOrder);
169 ListType::size_type) override;
177 LocateMenu(Menu&, const Menu&, Menu::IndexType);
189 using ValueType = MenuMap::value_type;
218 operator+=(
const ValueType&);
288 ShowRaw(Menu& mnu,
ZOrderType = DefaultMenuZOrder);
300 PDefH(
void, Hide, Menu& mnu)
324 HideUnrelated(Menu& mnu, Menu& mnuParent);
YF_API void LocateMenu(Menu &, const Menu &, Menu::IndexType)
定位菜单:以第二个参数作为参考父菜单,按指定参考偏移索引定位菜单。
YF_API void Hide(IWidget &)
隐藏部件。
map< IndexType, Menu * > SubMap
子菜单映射表类型。
#define DefGetter(_q, _t, _n,...)
YF_API void Show(IWidget &)
显示部件。
virtual bool CheckConfirmed(ListType::size_type) const
检查列表中的指定项是否有效。
PDefH(void, Activate, Console &console, Drawing::Color fc=Drawing::ColorSpace::White) ImplExpr(Activate(console
激活:使用指定屏幕、有效性、前景色和默认背景色。
不可复制对象:禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
SubMap::value_type ValueType
子菜单映射表项目类型。
map< IWidget *, Menu::ID > Roots
根菜单关联映射。
virtual void DrawItem(const Graphics &, const Rect &mask, const Rect &, ListType::size_type)
绘制列表项。
vector< bool > vDisabled
未启用菜单项。
MenuMap mMenus
菜单组:存储非空菜单指针。
Selected const shared_ptr< ListType > const pair< Color, Color > viewer Contains
const IWidget &wgt ImplRet(wgt.GetView().IsVisible()) bool YF_API Contains(const IWidget &
判断点是否在部件的可视区域内。
map< Menu::ID, ItemType > MenuMap
菜单组类型。
bool exists(const _tCon &con, const _tKey &key)
判断指定的容器中存在指定的键。
const ZOrderType DefaultMenuZOrder(224)
默认菜单 Z 顺序值。
SubMap mSubMenus
子菜单映射表:存储非空子菜单指针。
#define YAssert(_expr, _msg)
#define DefDelMoveCtor(_t)