You.i Engine
YiAnimatingLayout.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_ANIMATING_LAYOUT_H_
3 #define _YI_ANIMATING_LAYOUT_H_
4 
5 #include "layout/YiLayout.h"
6 #include "layout/YiLayoutState.h"
7 
8 #include <set>
9 
11 
68 {
69 public:
71  virtual ~CYIAnimatingLayout();
72 
78  void DisableAnimationsOnNextLayout(bool disable = true);
79 
85  void DisableAnimationsOnNextLayoutFor(CYISceneNode *pChild, bool disable = true);
86 
87  virtual void ChildAdded(CYISceneNode *pChild) override;
88 
89  virtual void ChildRemoved(CYISceneNode *pChild) override;
90 
91  virtual void ChildVisibilityChanged(CYISceneNode *pChild) override;
92 
100  void SetMovingTime(uint32_t movingTimeMs);
101 
102  uint32_t GetMovingTimeMs() const;
103 
111  void SetSizingTime(uint32_t sizingTimeMs);
112 
113  uint32_t GetSizingTimeMs() const;
114 
120  void SetTimeInterpolator(std::unique_ptr<CYITimeInterpolator> pInterpolator);
121 
124 
125 protected:
126  virtual void Configure() override;
127 
128  virtual void OnMeasurementsApplied() override;
129 
130  virtual const CYIRuntimeTypeInfo &GetLayoutConfigType() const override;
131 
132  virtual void ApplyPosition(CYISceneNode *pChild, const glm::vec3 &position) override;
133 
134  virtual void ApplySize(CYISceneNode *pChild, const glm::vec3 &size) override;
135 
136 private:
137  bool ShouldAnimatePositionFor(const CYISceneNode *pChild) const;
138  bool ShouldAnimateSizeFor(const CYISceneNode *pChild) const;
139 
140  uint32_t m_movingTimeMs;
141  uint32_t m_sizingTimeMs;
142  std::unique_ptr<CYITimeInterpolator> m_pTimeInterpolator;
143 
144  bool m_animationsDisabledOnNextLayout;
145  std::set<const CYISceneNode *> m_animationsDisabledOnNextLayoutForChildren;
146 
148 };
149 
156 {
157 public:
159  virtual ~CYIAnimatingLayoutConfig();
160  virtual std::unique_ptr<CYILayoutConfig> Clone() const override;
161 
162  virtual void ConfigureFrom(const IYIPropertiesSource *pSource) override;
163 
171  void SetAnimatePosition(bool animatePosition);
172 
173  bool IsUsingAnimatedPosition() const;
174 
182  void SetAnimateSize(bool animateSize);
183 
184  bool IsUsingAnimatedSize() const;
185 
186 protected:
189 
191 };
192 
201 {
202 public:
204  virtual ~CYIAnimatingLayoutState();
205 };
206 
210 {
211  return m_animatePosition;
212 }
213 
215 {
216  return m_animateSize;
217 }
218 
219 #endif // _YI_ANIMATING_LAYOUT_H_
A class used to hold per-child layout configuration for CYIAnimatingLayout layouts.
Definition: YiAnimatingLayout.h:155
Container for basic interpolator functions.
Definition: YiTimeInterpolator.h:20
virtual void Configure() override
bool m_animatePosition
Definition: YiAnimatingLayout.h:187
CYITimeInterpolator * GetTimeInterpolator()
virtual void OnMeasurementsApplied() override
void SetTimeInterpolator(std::unique_ptr< CYITimeInterpolator > pInterpolator)
void DisableAnimationsOnNextLayoutFor(CYISceneNode *pChild, bool disable=true)
virtual const CYIRuntimeTypeInfo & GetLayoutConfigType() const override
virtual ~CYIAnimatingLayout()
A class used to hold layout state for CYIAnimatingLayout layouts.
Definition: YiAnimatingLayout.h:200
bool IsUsingAnimatedSize() const
Definition: YiAnimatingLayout.h:214
uint32_t GetMovingTimeMs() const
void SetMovingTime(uint32_t movingTimeMs)
uint32_t GetSizingTimeMs() const
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:99
virtual void ChildRemoved(CYISceneNode *pChild) override
bool m_animateSize
Definition: YiAnimatingLayout.h:188
A class used to hold node-specific layout configuration (such as, for example, Margin).
Definition: YiLayoutConfig.h:25
virtual void ChildVisibilityChanged(CYISceneNode *pChild) override
The abstract runtime representation of a C++ type.
Definition: YiRtti.h:56
A class used to hold node-specific layout state.
Definition: YiLayoutState.h:16
A layout that can animate its children&#39;s position and size.
Definition: YiAnimatingLayout.h:67
void SetSizingTime(uint32_t sizingTimeMs)
An interface to a class that provides key-value properties.
Definition: YiPropertiesSource.h:21
This class defines a layout that can be applied to a scene view. The layout class determines how obje...
Definition: YiLayout.h:159
virtual void ApplyPosition(CYISceneNode *pChild, const glm::vec3 &position) override
void DisableAnimationsOnNextLayout(bool disable=true)
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
virtual void ApplySize(CYISceneNode *pChild, const glm::vec3 &size) override
virtual void ChildAdded(CYISceneNode *pChild) override
bool IsUsingAnimatedPosition() const
Definition: YiAnimatingLayout.h:209