34 using std::chrono::milliseconds;
42 template<
typename _type>
57 return std::stoi(FetchSetting<string>(con,
name));
64 const auto s(FetchSetting<string>(con,
name).c_str());
67 if(std::sscanf(
s,
"%u%u%u", &r, &g, &b) != 3)
68 throw std::invalid_argument(
"Color components are not enough.");
70 if(r < 0x100 && g < 0x100 && b < 0x100)
71 return Color(r, g, b);
72 throw std::invalid_argument(
"Invalid color components found.");
74 return Color(min<MonoType>(r, 0xFF), min<MonoType>(g, 0xFF),
75 min<MonoType>(b, 0xFF));
81 ColorToNode(
const string&
name,
const Color& value)
85 return YSLib::MakeNode(name,
to_string(value.GetR()) +
' '
95 FetchSetting<string>(con, family)))
96 return Font(*p, FetchSetting<int>(con, size));
103 : UpColor(240, 216, 192), DownColor(192, 216, 240), FontColor(),
105 ScrollDuration(1000), SmoothScrollDuration(80)
108 : UpColor(FetchSetting<
Color>(con,
"UpColor")), DownColor(
109 FetchSetting<
Color>(con,
"DownColor")), FontColor(FetchSetting<
Color>(con,
110 "FontColor")),
Font(FetchFontSetting(con,
"FontFamily",
"FontSize")),
111 SmoothScroll(FetchSetting<int>(con,
"SmoothScroll") != 0),
112 ScrollDuration(FetchSetting<int>(con,
"ScrollDuration")),
113 SmoothScrollDuration(FetchSetting<int>(con,
"SmoothScrollDuration"))
119 ColorToNode(
"DownColor", DownColor),
120 ColorToNode(
"FontColor", FontColor),
121 MakeNode(
"FontFamily",
Font.GetFontFamily().GetFamilyName()),
125 StringifyToNode(
"SmoothScrollDuration", SmoothScrollDuration.count())};
set< ValueNode > Container
YF_API const ValueNode & AccessNode(const ValueNode::Container *, const string &)
访问容器中的节点。
ValueNode StringifyToNode(_tString &&name, _tParams &&...args)
取指定名称和转换为字符串的值类型节点。
yconstfn const string & name
YF_API Drawing::FontCache & FetchDefaultFontCache()
取默认字体缓存。
YF_API const Typeface & FetchDefaultTypeface()
取默认字型引用。
std::string to_string(unsigned char val)
转换为字符串。
ValueNode MakeNode(_tString &&name, _tParams &&...args)
取指定名称和退化参数的值类型节点。