28 #ifndef YSL_INC_UI_ystyle_h_
29 #define YSL_INC_UI_ystyle_h_ 1
32 #include YFM_YSLib_UI_YComponent
33 #include YFM_YSLib_Service_YDraw
108 ImplRet(colored ? c : Color(g, g, g))
117 using Hue = ystdex::fixed_point<
u16, 9>;
238 DefGetter(ynothrow, ColorListType&, List, colors)
242 pair<Drawing::
Color, Drawing::Color>
243 GetPair(ColorListType::size_type, ColorListType::size_type) const;
273 template<typename _tIn>
277 for(; first != last; ++
first)
281 table.emplace(
Key(idx, get<0U>(ref)), get<1U>(ref));
284 template<
typename _type,
typename _tIn>
291 std::initializer_list<pair<StyleItem, Handler>> il)
293 template<typename _type>
302 template<
typename _tRange>
309 template<
typename _type,
typename _tRange>
332 template<
typename _type1,
typename _type2>
359 using MapType::const_iterator;
360 using MapType::iterator;
367 :
MapType({{}}), current(cbegin())
369 template<
typename... _tParams>
375 DefGetter(
const ynothrow, const_iterator, Current, current)
377 template<typename... _tParams>
379 Add(_tParams&&...
args)
386 Remove(
const string&);
390 ImplExpr(PaintAsStyle(painter.GetKey(), std::move(e)))
396 Switch(const
string&);
size_t StyleItem
标识样式渲染项的类型。
YF_API HandlerTable & FetchDefault()
取默认样式处理器表。
DefGetter(const ynothrow, const_iterator, Current, current) template< typename..._tParams > void Add(_tParams &&...args)
YF_API void DrawCross(const Graphics &, const Rect &, const Rect &, Color)
在指定图形接口上下文中使用指定颜色描画交叉直线段(“×”)。
static auto first(const _tIterator &i) -> decltype((i->first))
PDefH(void, AddHandlers, HandlerTable &table, std::type_index idx, std::initializer_list< pair< StyleItem, Handler >> il) ImplExpr(Styles
yconstfn const string _tParams && args
#define DefDeCopyCtor(_t)
std::function< void(PaintEventArgs &&)> Handler
样式处理器。
YF_API void DrawRectRoundCorner(const PaintContext &pc, const Size &s, Color)
绘制部件边框用空心标准矩形。
std::uint16_t SDst
屏幕坐标距离。
Painter(_type1 &&arg1, _type2 &&arg2)
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
#define DefGetter(_q, _t, _n,...)
map< VisualEvent, MappedType > MapType
映射表类型。
YF_API void DrawTick(const Graphics &, const Rect &, const Rect &, Color, Color)
不可复制对象:禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
hsl_t ColorToHSL(Color c)
void AddHandlers(HandlerTable &table, std::type_index idx, _tIn first, _tIn last)
向样式处理器表添加指定类型的处理器。
map< string, HandlerTable > MapType
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
unordered_map< Key, Handler, ystdex::combined_hash< Key >> HandlerTable
样式处理器表。
pair< string, HandlerTable > VisualStyle
视觉样式。
#define yconstfn
指定编译时常量函数。
const IWidget &wgt ImplRet(wgt.GetView().IsVisible()) bool YF_API Contains(const IWidget &
判断点是否在部件的可视区域内。
StyleMap(_tParams &&...args)
#define DefDeMoveAssignment(_t)
YF_API void DrawArrow(const Graphics &, const Rect &, SDst=4, Rotation=RDeg0, Color=ColorSpace::Black)
在指定图形接口上下文上描画箭头。
Selected const shared_ptr< ListType > const pair< Color, Color > & DefDeMoveCtor(TextList) DefPredMem(const ynothrow
Color HSLToColor(hsl_t c)
YF_API void RectDrawArrow(const PaintContext &, SDst, Rotation=RDeg0, Color=ColorSpace::Black)
在指定上下文的矩形中画箭头。
PDefH(void, DrawLineSeg, const Graphics &g, const Rect &bounds, const Point &p1, const Point &p2, Color c) ImplExpr(DrawLineSeg(g
YF_API Color RollColor(hsl_t, Hue)
色调偏移。
static auto second(const _tIterator &i) -> decltype((i->second))
#define DefDeCopyAssignment(_t)
vector< ItemType > ColorListType
pair< std::type_index, StyleItem > Key
标识查找样式的键。