view_geometry.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 The ClanLib Team
4**
5** This software is provided 'as-is', without any express or implied
6** warranty. In no event will the authors be held liable for any damages
7** arising from the use of this software.
8**
9** Permission is granted to anyone to use this software for any purpose,
10** including commercial applications, and to alter it and redistribute it
11** freely, subject to the following restrictions:
12**
13** 1. The origin of this software must not be misrepresented; you must not
14** claim that you wrote the original software. If you use this software
15** in a product, an acknowledgment in the product documentation would be
16** appreciated but is not required.
17** 2. Altered source versions must be plainly marked as such, and must not be
18** misrepresented as being the original software.
19** 3. This notice may not be removed or altered from any source distribution.
20**
21** Note: Some of the libraries ClanLib may link to may have additional
22** requirements or restrictions.
23**
24** File Author(s):
25**
26** Magnus Norddahl
27*/
28
29#pragma once
30
31#include "../../Core/Math/rect.h"
32
33namespace clan
34{
35 class StyleCascade;
36
37 // \brief View position and size after being laid out by layout functions
39 {
40 public:
43
44 static ViewGeometry from_margin_box(const StyleCascade &style, const Rectf &box);
45 static ViewGeometry from_border_box(const StyleCascade &style, const Rectf &box);
46 static ViewGeometry from_padding_box(const StyleCascade &style, const Rectf &box);
47 static ViewGeometry from_content_box(const StyleCascade &style, const Rectf &box);
48
49 // \brief Margin box relative to parent view
51
52 // \brief Border box relative to parent view
54
55 // \brief Padding box relative to parent view
57
58 // \brief Content box relative to parent view
60
61 // \brief Content offset relative to parent view
63
64 // \brief Content box size
66
67 // \brief Left margin width
68 float margin_left = 0.0f;
69
70 // \brief Top margin width
71 float margin_top = 0.0f;
72
73 // \brief Right margin width
74 float margin_right = 0.0f;
75
76 // \brief Bottom margin width
77 float margin_bottom = 0.0f;
78
79 // \brief Left border width
80 float border_left = 0.0f;
81
82 // \brief Top border width
83 float border_top = 0.0f;
84
85 // \brief Right border width
86 float border_right = 0.0f;
87
88 // \brief Bottom border width
89 float border_bottom = 0.0f;
90
91 // \brief Left padding width
92 float padding_left = 0.0f;
93
94 // \brief Top padding width
95 float padding_top = 0.0f;
96
97 // \brief Right padding width
98 float padding_right = 0.0f;
99
100 // \brief Bottom padding width
101 float padding_bottom = 0.0f;
102
103 // \brief Content area horizontal offset relative to parent view
104 float content_x = 0.0f;
105
106 // \brief Content area vertical offset relative to parent view
107 float content_y = 0.0f;
108
109 // \brief Content area width
110 float content_width = 0.0f;
111
112 // \brief Content area height
113 float content_height = 0.0f;
114 };
115}
2D (x,y) point structure - Float
Definition point.h:72
2D (left,top,right,bottom) rectangle structure - Float
Definition rect.h:460
2D (width,height) size structure - Float
Definition size.h:189
Style value resolver.
Definition style_cascade.h:68
Definition view_geometry.h:39
float content_height
Definition view_geometry.h:113
static ViewGeometry from_border_box(const StyleCascade &style, const Rectf &box)
float border_bottom
Definition view_geometry.h:89
static ViewGeometry from_padding_box(const StyleCascade &style, const Rectf &box)
ViewGeometry()
Definition view_geometry.h:41
Rectf content_box() const
float padding_right
Definition view_geometry.h:98
float content_x
Definition view_geometry.h:104
float border_left
Definition view_geometry.h:80
Rectf margin_box() const
float margin_left
Definition view_geometry.h:68
Pointf content_pos() const
float margin_right
Definition view_geometry.h:74
Sizef content_size() const
static ViewGeometry from_content_box(const StyleCascade &style, const Rectf &box)
float margin_bottom
Definition view_geometry.h:77
float padding_bottom
Definition view_geometry.h:101
float margin_top
Definition view_geometry.h:71
float content_width
Definition view_geometry.h:110
Rectf padding_box() const
float border_top
Definition view_geometry.h:83
Rectf border_box() const
ViewGeometry(const StyleCascade &style)
static ViewGeometry from_margin_box(const StyleCascade &style, const Rectf &box)
float padding_top
Definition view_geometry.h:95
float padding_left
Definition view_geometry.h:92
float content_y
Definition view_geometry.h:107
float border_right
Definition view_geometry.h:86
Definition clanapp.h:36