-
Notifications
You must be signed in to change notification settings - Fork 388
Expand file tree
/
Copy pathWBorder.h
More file actions
134 lines (112 loc) · 3.14 KB
/
WBorder.h
File metadata and controls
134 lines (112 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bv, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WBORDER_H_
#define WBORDER_H_
#include <Wt/WLength.h>
#include <Wt/WColor.h>
namespace Wt {
/*! \brief Enumeration for border width
*/
enum class BorderWidth {
Thin, //!< Browser-dependent 'thin' border.
Medium, //!< Browser-dependent 'medium' border, default.
Thick, //!< Browser-dependent 'thick' border.
Explicit //!< Explicit width. See also explicitWidth()
};
/*! \brief Enumeration for border style
*/
enum class BorderStyle {
None, //!< No border (width ignored), default.
Hidden, //!< Invisible border (of specified width).
Dotted, //!< Dotted border
Dashed, //!< Dashed border
Solid, //!< Solid border
Double, //!< Double lined border
Groove, //!< Relief border grooved into the canvas
Ridge, //!< Relief border coming out of the canvas
Inset, //!< Relief border lowering contents into the canvas
Outset //!< Relief border letting contents come out of the canvas
};
/*! \class WBorder Wt/WBorder.h Wt/WBorder.h
* \brief A value class that defines the CSS border style of a widget.
*
* \ingroup style
*/
class WT_API WBorder
{
public:
/*! \brief Typedef for enum Wt::BorderWidth */
typedef BorderWidth Width;
/*! \brief Typedef for enum Wt::BorderStyle */
typedef BorderStyle Style;
/*! \brief Creates a border indicating <i>no border</i>.
*/
WBorder();
/*! \brief Creates a border with given style, thickness and color.
*/
WBorder(BorderStyle style, BorderWidth = BorderWidth::Medium,
WColor color = WColor());
/*! \brief Creates a border with an absolute width.
*/
WBorder(BorderStyle style, const WLength& width, WColor color = WColor());
/*! \brief Comparison operator
*/
bool operator==(const WBorder& other) const;
/*! \brief Comparison operator
*/
bool operator!=(const WBorder& other) const;
/*! \brief Sets the border width.
*
* If width == Explicit, then the width specified in
* \p explicitWidth is used.
*/
void setWidth(BorderWidth width,
const WLength& explicitWidth = WLength::Auto);
/*! \brief Sets the border color.
*/
void setColor(WColor color);
/*! \brief Sets the border style.
*/
void setStyle(BorderStyle style);
/*! \brief Returns the border width.
*
* \sa setWidth()
*/
BorderWidth width() const { return width_; }
/*! \brief Returns the border width when set explicitly.
*
* \sa setWidth()
*/
WLength explicitWidth() const { return explicitWidth_; }
/*! \brief Returns the border color.
*
* \sa setColor()
*/
WColor color() const { return color_; }
/*! \brief Returns the border style.
*
* \sa setStyle()
*/
BorderStyle style() const { return style_; }
/*! \brief Returns the CSS text for this border style.
*/
std::string cssText() const;
#ifdef WT_TARGET_JAVA
/*! \brief Clone method.
*
* Clones this border.
*/
WBorder clone() const;
#endif
private:
BorderWidth width_;
WLength explicitWidth_;
WColor color_;
BorderStyle style_;
};
}
#endif // WLENGTH