diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/cru/ui/controls/Control.h | 11 | ||||
| -rw-r--r-- | include/cru/ui/mapper/style/CheckedConditionMapper.h | 26 | 
2 files changed, 35 insertions, 2 deletions
| diff --git a/include/cru/ui/controls/Control.h b/include/cru/ui/controls/Control.h index 3293969d..c52a53af 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/ui/render/MeasureRequirement.h"  namespace cru::ui::controls { @@ -13,8 +14,7 @@ namespace cru::ui::controls {   *  - GetRenderObject()   *  - ForEachChild(const std::function<void(Control*)>& predicate)   *  - RemoveChild(Control* child) - * The last two methods are totally for convenient control tree management. The - * former one is even not used. + * The last two methods are totally for convenient control tree management.   */  class CRU_UI_API Control : public Object {    friend class RootControl; @@ -52,6 +52,13 @@ class CRU_UI_API Control : public Object {   public:    virtual render::RenderObject* GetRenderObject() const = 0; +  render::MeasureSize GetPreferredSize() { +    return GetRenderObject()->GetPreferredSize(); +  } +  void SetPreferredSize(const render::MeasureSize& size) { +    GetRenderObject()->SetPreferredSize(size); +  } +    //*************** region: focus ***************   public:    bool HasFocus(); diff --git a/include/cru/ui/mapper/style/CheckedConditionMapper.h b/include/cru/ui/mapper/style/CheckedConditionMapper.h new file mode 100644 index 00000000..d62aba60 --- /dev/null +++ b/include/cru/ui/mapper/style/CheckedConditionMapper.h @@ -0,0 +1,26 @@ +#pragma once +#include "../Mapper.h" +#include "IConditionMapper.h" +#include "cru/ui/style/Condition.h" + +namespace cru::ui::mapper::style { +class CRU_UI_API CheckedConditionMapper +    : public BasicPtrMapper<ui::style::CheckedCondition>, +      public virtual IConditionMapper { + public: +  CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(CheckedConditionMapper) + + public: +  bool SupportMapFromXml() override { return true; } +  bool XmlElementIsOfThisType(xml::XmlElementNode* node) override; + +  ClonablePtr<ui::style::Condition> MapConditionFromXml( +      xml::XmlElementNode* node) override { +    return MapFromXml(node); +  } + + protected: +  ClonablePtr<ui::style::CheckedCondition> DoMapFromXml( +      xml::XmlElementNode* node) override; +}; +}  // namespace cru::ui::mapper::style | 
