diff options
Diffstat (limited to 'src/ui/style/StyleRule.cpp')
-rw-r--r-- | src/ui/style/StyleRule.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ui/style/StyleRule.cpp b/src/ui/style/StyleRule.cpp new file mode 100644 index 00000000..1a72a970 --- /dev/null +++ b/src/ui/style/StyleRule.cpp @@ -0,0 +1,17 @@ +#include "cru/ui/style/StyleRule.hpp" + +namespace cru::ui::style { +StyleRule::StyleRule(ClonablePtr<Condition> condition, + ClonablePtr<Styler> styler, std::u16string name) + : condition_(std::move(condition)), + styler_(std::move(styler)), + name_(std::move(name)) {} + +bool StyleRule::CheckAndApply(controls::Control *control) const { + auto active = condition_->Judge(control); + if (active) { + styler_->Apply(control); + } + return active; +} +} // namespace cru::ui::style |