1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
5 * Copyright 2007 Novell, Inc. (http://www.novell.com)
7 * See the LICENSE file included with the distribution for details.
11 #ifndef __MOON_THICKNESS_H__
12 #define __MOON_THICKNESS_H__
29 Thickness (double uniform
)
37 Thickness (double hori
, double vert
)
45 Thickness (double left
, double top
, double right
, double bottom
)
47 this->bottom
= bottom
;
53 Thickness (const Thickness
&thickness
)
55 bottom
= thickness
.bottom
;
56 right
= thickness
.right
;
57 left
= thickness
.left
;
61 Thickness
operator- ()
63 return Thickness (-left
, -top
, -right
, -bottom
);
66 Thickness
operator+ (const Thickness
&th
)
68 return Thickness (left
+ th
.left
, top
+ th
.top
, right
+ th
.right
, bottom
+ th
.bottom
);
71 Thickness
operator- (const Thickness
&th
)
73 return Thickness (left
- th
.left
, top
- th
.top
, right
- th
.right
, bottom
- th
.bottom
);
76 bool operator == (const Thickness
&v
)
78 return fabs (bottom
- v
.bottom
) < DBL_EPSILON
&& fabs(right
- v
.right
) < DBL_EPSILON
&& fabs (left
- v
.left
) < DBL_EPSILON
&& fabs (top
- v
.top
) < DBL_EPSILON
;
81 bool operator != (const Thickness
&v
)
87 // Parses @s and return a new Thickness in @t. Returns
88 // true if this was successful, false otherwise.
90 static bool FromStr (const char *s
, Thickness
*t
);
93 #endif /* __MOON_THICKNESS_H__ */