4 #include "css_length.h"
18 style
= border_style_none
;
21 css_border(const css_border
& val
)
28 css_border
& operator=(const css_border
& val
)
36 string
to_string() const;
49 border(const border
& val
)
55 border(const css_border
& val
)
57 width
= (int) val
.width
.val();
61 border
& operator=(const border
& val
)
68 border
& operator=(const css_border
& val
)
70 width
= (int) val
.width
.val();
77 struct border_radiuses
102 border_radiuses(const border_radiuses
& val
)
104 top_left_x
= val
.top_left_x
;
105 top_left_y
= val
.top_left_y
;
106 top_right_x
= val
.top_right_x
;
107 top_right_y
= val
.top_right_y
;
108 bottom_right_x
= val
.bottom_right_x
;
109 bottom_right_y
= val
.bottom_right_y
;
110 bottom_left_x
= val
.bottom_left_x
;
111 bottom_left_y
= val
.bottom_left_y
;
113 border_radiuses
& operator = (const border_radiuses
& val
)
115 top_left_x
= val
.top_left_x
;
116 top_left_y
= val
.top_left_y
;
117 top_right_x
= val
.top_right_x
;
118 top_right_y
= val
.top_right_y
;
119 bottom_right_x
= val
.bottom_right_x
;
120 bottom_right_y
= val
.bottom_right_y
;
121 bottom_left_x
= val
.bottom_left_x
;
122 bottom_left_y
= val
.bottom_left_y
;
125 void operator += (const margins
& mg
)
127 top_left_x
+= mg
.left
;
128 top_left_y
+= mg
.top
;
129 top_right_x
+= mg
.right
;
130 top_right_y
+= mg
.top
;
131 bottom_right_x
+= mg
.right
;
132 bottom_right_y
+= mg
.bottom
;
133 bottom_left_x
+= mg
.left
;
134 bottom_left_y
+= mg
.bottom
;
137 void operator -= (const margins
& mg
)
139 top_left_x
-= mg
.left
;
140 top_left_y
-= mg
.top
;
141 top_right_x
-= mg
.right
;
142 top_right_y
-= mg
.top
;
143 bottom_right_x
-= mg
.right
;
144 bottom_right_y
-= mg
.bottom
;
145 bottom_left_x
-= mg
.left
;
146 bottom_left_y
-= mg
.bottom
;
151 if (top_left_x
< 0) top_left_x
= 0;
152 if (top_left_y
< 0) top_left_y
= 0;
153 if (top_right_x
< 0) top_right_x
= 0;
154 if (top_right_y
< 0) top_right_y
= 0;
155 if (bottom_right_x
< 0) bottom_right_x
= 0;
156 if (bottom_right_y
< 0) bottom_right_y
= 0;
157 if (bottom_left_x
< 0) bottom_left_x
= 0;
158 if (bottom_left_y
< 0) bottom_left_y
= 0;
162 struct css_border_radius
164 css_length top_left_x
;
165 css_length top_left_y
;
167 css_length top_right_x
;
168 css_length top_right_y
;
170 css_length bottom_right_x
;
171 css_length bottom_right_y
;
173 css_length bottom_left_x
;
174 css_length bottom_left_y
;
181 css_border_radius(const css_border_radius
& val
)
183 top_left_x
= val
.top_left_x
;
184 top_left_y
= val
.top_left_y
;
185 top_right_x
= val
.top_right_x
;
186 top_right_y
= val
.top_right_y
;
187 bottom_left_x
= val
.bottom_left_x
;
188 bottom_left_y
= val
.bottom_left_y
;
189 bottom_right_x
= val
.bottom_right_x
;
190 bottom_right_y
= val
.bottom_right_y
;
193 css_border_radius
& operator=(const css_border_radius
& val
)
195 top_left_x
= val
.top_left_x
;
196 top_left_y
= val
.top_left_y
;
197 top_right_x
= val
.top_right_x
;
198 top_right_y
= val
.top_right_y
;
199 bottom_left_x
= val
.bottom_left_x
;
200 bottom_left_y
= val
.bottom_left_y
;
201 bottom_right_x
= val
.bottom_right_x
;
202 bottom_right_y
= val
.bottom_right_y
;
205 border_radiuses
calc_percents(int width
, int height
) const
208 ret
.bottom_left_x
= bottom_left_x
.calc_percent(width
);
209 ret
.bottom_left_y
= bottom_left_y
.calc_percent(height
);
210 ret
.top_left_x
= top_left_x
.calc_percent(width
);
211 ret
.top_left_y
= top_left_y
.calc_percent(height
);
212 ret
.top_right_x
= top_right_x
.calc_percent(width
);
213 ret
.top_right_y
= top_right_y
.calc_percent(height
);
214 ret
.bottom_right_x
= bottom_right_x
.calc_percent(width
);
215 ret
.bottom_right_y
= bottom_right_y
.calc_percent(height
);
226 css_border_radius radius
;
228 css_borders() = default;
230 bool is_visible() const
232 return left
.width
.val() != 0 || right
.width
.val() != 0 || top
.width
.val() != 0 || bottom
.width
.val() != 0;
235 css_borders(const css_borders
& val
)
244 css_borders
& operator=(const css_borders
& val
)
253 string
to_string() const
255 return "left: " + left
.to_string() +
256 ", top: " + top
.to_string() +
257 ", right: " + top
.to_string() +
258 ", bottom: " + bottom
.to_string();
268 border_radiuses radius
;
272 borders(const borders
& val
)
281 borders(const css_borders
& val
)
289 bool is_visible() const
291 return left
.width
!= 0 || right
.width
!= 0 || top
.width
!= 0 || bottom
.width
!= 0;
294 borders
& operator=(const borders
& val
)
304 borders
& operator=(const css_borders
& val
)
315 #endif // LH_BORDERS_H