Skylicht Engine
Loading...
Searching...
No Matches
CGUILayout.h
1/*
2!@
3MIT License
4
5Copyright (c) 2020 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "CGUIElement.h"
28#include "Graphics2D/EntityData/CGUILayoutData.h"
29
30namespace Skylicht
31{
48 class SKYLICHT_API CGUILayout : public CGUIElement
49 {
50 friend class CCanvas;
51 public:
52 CGUILayoutData* m_layoutData;
53
54 protected:
55 CGUILayout(CCanvas* canvas, CGUIElement* parent);
56 CGUILayout(CCanvas* canvas, CGUIElement* parent, const core::rectf& rect);
57
58 public:
59 virtual ~CGUILayout();
60
61 virtual void render(CCamera* camera);
62
63 virtual void update(CCamera* camera);
64
65 inline void setAlign(CGUILayoutData::EAlignType type)
66 {
67 m_layoutData->AlignType = type;
68 }
69
70 inline void setSpacing(float space)
71 {
72 m_layoutData->Spacing = space;
73 }
74
75 inline float getSpacing()
76 {
77 return m_layoutData->Spacing;
78 }
79
80 inline void setWrap(bool b)
81 {
82 m_layoutData->IsWrap = b;
83 }
84
85 inline void setWrapSpacing(float space)
86 {
87 m_layoutData->WrapSpacing = space;
88 }
89
90 inline float getWrapSpacing()
91 {
92 return m_layoutData->WrapSpacing;
93 }
94
95 inline void setFitChildrenSize(bool b)
96 {
97 m_layoutData->FitChildrenSize = b;
98 }
99
100 inline bool isFitChildrenSize()
101 {
102 return m_layoutData->FitChildrenSize;
103 }
104
105 DECLARE_GETTYPENAME(CGUILayout)
106
107 virtual CObjectSerializable* createSerializable();
108
109 virtual void loadSerializable(CObjectSerializable* object);
110
111 void updateChildOrder();
112 };
113}
This is an object class used to set up the camera, including its position, viewing angle,...
Definition CCamera.h:70
Definition CGUILayoutData.h:32
Definition CObjectSerializable.h:36
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
rect< f32 > rectf
Rectangle with float values.
Definition rect.h:271