aboutsummaryrefslogtreecommitdiff
path: root/include/cru
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru')
-rw-r--r--include/cru/ui/controls/Control.h3
-rw-r--r--include/cru/ui/style/StyleRule.h4
-rw-r--r--include/cru/ui/style/StyleRuleSet.h6
-rw-r--r--include/cru/ui/style/Styler.h5
4 files changed, 17 insertions, 1 deletions
diff --git a/include/cru/ui/controls/Control.h b/include/cru/ui/controls/Control.h
index 3b58222c..158a1578 100644
--- a/include/cru/ui/controls/Control.h
+++ b/include/cru/ui/controls/Control.h
@@ -3,6 +3,7 @@
#include "../events/UiEvents.h"
#include "../render/RenderObject.h"
#include "../style/StyleRuleSet.h"
+#include "cru/common/SelfResolvable.h"
#include "cru/ui/render/MeasureRequirement.h"
namespace cru::ui::controls {
@@ -16,7 +17,7 @@ namespace cru::ui::controls {
* - RemoveChild(Control* child)
* The last two methods are totally for convenient control tree management.
*/
-class CRU_UI_API Control : public Object {
+class CRU_UI_API Control : public Object, public SelfResolvable<Control> {
friend class RootControl;
protected:
diff --git a/include/cru/ui/style/StyleRule.h b/include/cru/ui/style/StyleRule.h
index fc37f7c7..27069930 100644
--- a/include/cru/ui/style/StyleRule.h
+++ b/include/cru/ui/style/StyleRule.h
@@ -8,6 +8,10 @@
#include <vector>
namespace cru::ui::style {
+/**
+ * \brief An immutable style rule contains a condition and a styler.
+ * \remarks This class is immutable and has value semantics.
+ */
class CRU_UI_API StyleRule : public Object {
public:
static ClonablePtr<StyleRule> Create(ClonablePtr<Condition> condition,
diff --git a/include/cru/ui/style/StyleRuleSet.h b/include/cru/ui/style/StyleRuleSet.h
index 348fdd5f..8bf9c9ff 100644
--- a/include/cru/ui/style/StyleRuleSet.h
+++ b/include/cru/ui/style/StyleRuleSet.h
@@ -6,6 +6,12 @@
#include <cstddef>
namespace cru::ui::style {
+/**
+ * \brief A set of style rules.
+ * \remarks Note this class is different from other constructs in style. It is
+ * mutable and has reference semantics. Change of it will be notified by
+ * StyleRuleSet::ChangeEvent.
+ */
class CRU_UI_API StyleRuleSet : public Object {
public:
StyleRuleSet() = default;
diff --git a/include/cru/ui/style/Styler.h b/include/cru/ui/style/Styler.h
index f4f66ea0..7df3e138 100644
--- a/include/cru/ui/style/Styler.h
+++ b/include/cru/ui/style/Styler.h
@@ -10,6 +10,11 @@
#include <vector>
namespace cru::ui::style {
+/**
+ * \brief The base class for all styler implementations.
+ * \remarks Styler should be immutable. And we use cru::ClonablePtr to wrap it
+ * in order to get both polymorphic and value semantics.
+ */
class CRU_UI_API Styler : public Object {
public:
virtual void Apply(controls::Control* control) const = 0;