aboutsummaryrefslogtreecommitdiff
path: root/src/ui/style/StyleRule.cpp
blob: 1a72a97019185471d59219e4b9159c1dfb713517 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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