You.i Engine
YiDecoratedView.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2018. All rights reserved.
2 #ifndef _YI_DECORATED_VIEW_H_
3 #define _YI_DECORATED_VIEW_H_
4 
5 #include "utility/YiColor.h"
6 #include "view/YiSceneView.h"
7 
8 #include <functional>
9 
10 struct NVGcontext;
11 
35 {
36 public:
38  {
41  };
42 
44  virtual ~CYIDecoratedView();
45 
46  virtual bool Init() override;
47 
48  void SetBackgroundColor(const CYIColor &color);
49  const CYIColor &GetBackgroundColor() const;
50 
51  void SetBorderThickness(float fThickness);
52  float GetBorderThickness() const;
53 
54  void SetBorderColor(const CYIColor &color);
55  const CYIColor &GetBorderColor() const;
56 
57  void SetCornerRadius(float fRadius);
58  void SetCornerRadiuses(float fTopLeftRadius, float fTopRightRadius, float fBottomLeftRadius, float fBottomRightRadius);
59  float GetTopLeftCornerRadius() const;
60  float GetTopRightCornerRadius() const;
61  float GetBottomLeftCornerRadius() const;
62  float GetBottomRightCornerRadius() const;
63 
64  void SetOverflowMode(OVERFLOW_MODE eMode);
66 
67 private:
68  struct CornerRadius
69  {
70  CornerRadius(float fRadius = 0.0f);
71 
72  float fTopLeft;
73  float fTopRight;
74  float fBottomLeft;
75  float fBottomRight;
76  };
77 
78  virtual void BuildDrawList(std::vector<IYIRenderer::Command> &drawList, CYIAbstractCameraSceneNode *pCameraToDrawWith) override;
79  void DoPreDrawActions() const;
80  void DoPostDrawActions() const;
81 
82  void ParseProperties();
83  void SetCornerRadius(const CornerRadius &radiuses);
84  void DirtyRendering();
85 
86  CYIColor m_backgroundColor; // Defaults to transparent
87 
88  float m_fBorderThickness; // Defaults to 0.0 (no border)
89  CYIColor m_borderColor; // Defaults to black
90  CornerRadius m_cornerRadius; // Defaults to 0.0 (square corners)
91 
92  OVERFLOW_MODE m_eOverflowMode;
93 
94  std::function<void()> m_preDrawFunction;
95  std::function<void()> m_postDrawFunction;
96  NVGcontext *m_pVg;
97 
99 };
100 
103 #endif // _YI_DECORATED_VIEW_H_
OVERFLOW_MODE
Definition: YiDecoratedView.h:37
const CYIColor & GetBackgroundColor() const
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
void SetBorderThickness(float fThickness)
const CYIColor & GetBorderColor() const
Provides a base for the definition of camera objects.
Definition: YiAbstractCameraSceneNode.h:30
#define YI_TYPE_BASES(...)
Definition: YiRtti.h:350
Definition: YiDecoratedView.h:40
A class used to add a background and a border to its content. This view supports clipping the content...
Definition: YiDecoratedView.h:34
virtual bool Init() override
void SetOverflowMode(OVERFLOW_MODE eMode)
float GetBorderThickness() const
float GetTopLeftCornerRadius() const
void SetCornerRadius(float fRadius)
virtual ~CYIDecoratedView()
void SetBackgroundColor(const CYIColor &color)
float GetTopRightCornerRadius() const
Definition: YiDecoratedView.h:39
float GetBottomRightCornerRadius() const
A class used to represent a color value.
Definition: YiColor.h:31
float GetBottomLeftCornerRadius() const
OVERFLOW_MODE GetOverflowMode() const
void SetCornerRadiuses(float fTopLeftRadius, float fTopRightRadius, float fBottomLeftRadius, float fBottomRightRadius)
void SetBorderColor(const CYIColor &color)