view_geometry.h Source File - ClanLib SDK
Description: view_geometry.h Source File

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
38 class ViewGeometry
39 {
40 public:
41 ViewGeometry() { }
42 ViewGeometry(const StyleCascade &style);
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
50 Rectf margin_box() const;
51
52 // \brief Border box relative to parent view
53 Rectf border_box() const;
54
55 // \brief Padding box relative to parent view
56 Rectf padding_box() const;
57
58 // \brief Content box relative to parent view
59 Rectf content_box() const;
60
61 // \brief Content offset relative to parent view
62 Pointf content_pos() const;
63
64 // \brief Content box size
65 Sizef content_size() const;
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}
clan::Pointf
2D (x,y) point structure - Float
Definition point.h:72
clan::Rectf
2D (left,top,right,bottom) rectangle structure - Float
Definition rect.h:503
clan::Sizef
2D (width,height) size structure - Float
Definition size.h:184
clan::StyleCascade
Style value resolver.
Definition style_cascade.h:68
clan::ViewGeometry
Definition view_geometry.h:39
clan::ViewGeometry::content_height
float content_height
Definition view_geometry.h:113
clan::ViewGeometry::from_border_box
static ViewGeometry from_border_box(const StyleCascade &style, const Rectf &box)
clan::ViewGeometry::border_bottom
float border_bottom
Definition view_geometry.h:89
clan::ViewGeometry::from_padding_box
static ViewGeometry from_padding_box(const StyleCascade &style, const Rectf &box)
clan::ViewGeometry::ViewGeometry
ViewGeometry()
Definition view_geometry.h:41
clan::ViewGeometry::content_box
Rectf content_box() const
clan::ViewGeometry::padding_right
float padding_right
Definition view_geometry.h:98
clan::ViewGeometry::content_x
float content_x
Definition view_geometry.h:104
clan::ViewGeometry::border_left
float border_left
Definition view_geometry.h:80
clan::ViewGeometry::margin_box
Rectf margin_box() const
clan::ViewGeometry::margin_left
float margin_left
Definition view_geometry.h:68
clan::ViewGeometry::content_pos
Pointf content_pos() const
clan::ViewGeometry::margin_right
float margin_right
Definition view_geometry.h:74
clan::ViewGeometry::content_size
Sizef content_size() const
clan::ViewGeometry::from_content_box
static ViewGeometry from_content_box(const StyleCascade &style, const Rectf &box)
clan::ViewGeometry::margin_bottom
float margin_bottom
Definition view_geometry.h:77
clan::ViewGeometry::padding_bottom
float padding_bottom
Definition view_geometry.h:101
clan::ViewGeometry::margin_top
float margin_top
Definition view_geometry.h:71
clan::ViewGeometry::content_width
float content_width
Definition view_geometry.h:110
clan::ViewGeometry::padding_box
Rectf padding_box() const
clan::ViewGeometry::border_top
float border_top
Definition view_geometry.h:83
clan::ViewGeometry::border_box
Rectf border_box() const
clan::ViewGeometry::ViewGeometry
ViewGeometry(const StyleCascade &style)
clan::ViewGeometry::from_margin_box
static ViewGeometry from_margin_box(const StyleCascade &style, const Rectf &box)
clan::ViewGeometry::padding_top
float padding_top
Definition view_geometry.h:95
clan::ViewGeometry::padding_left
float padding_left
Definition view_geometry.h:92
clan::ViewGeometry::content_y
float content_y
Definition view_geometry.h:107
clan::ViewGeometry::border_right
float border_right
Definition view_geometry.h:86
clan
Definition clanapp.h:36