-
Notifications
You must be signed in to change notification settings - Fork 388
Expand file tree
/
Copy pathWBorder.C
More file actions
110 lines (96 loc) · 2.14 KB
/
WBorder.C
File metadata and controls
110 lines (96 loc) · 2.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
/*
* Copyright (C) 2008 Emweb bv, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
#include "Wt/WBorder.h"
namespace Wt {
WBorder::WBorder()
: width_(BorderWidth::Medium),
style_(BorderStyle::None)
{ }
WBorder::WBorder(BorderStyle style, BorderWidth width, WColor color)
: width_(width),
color_(color),
style_(style)
{ }
WBorder::WBorder(BorderStyle style, const WLength& width, WColor color)
: width_(BorderWidth::Explicit),
explicitWidth_(width),
color_(color),
style_(style)
{ }
bool WBorder::operator==(const WBorder& other) const
{
return
width_ == other.width_
&& color_ == other.color_
&& style_ == other.style_;
}
bool WBorder::operator!=(const WBorder& other) const
{
return !(*this == other);
}
void WBorder::setWidth(BorderWidth width, const WLength& explicitWidth)
{
width_ = width;
explicitWidth_ = explicitWidth;
}
void WBorder::setColor(WColor color)
{
color_ = color;
}
void WBorder::setStyle(BorderStyle style)
{
style_ = style;
}
std::string WBorder::cssText() const
{
std::string style;
switch (style_) {
case BorderStyle::None:
return "none";
case BorderStyle::Hidden:
style = "hidden"; break;
case BorderStyle::Dotted:
style = "dotted"; break;
case BorderStyle::Dashed:
style = "dashed"; break;
case BorderStyle::Solid:
style = "solid"; break;
case BorderStyle::Double:
style = "double"; break;
case BorderStyle::Groove:
style = "groove"; break;
case BorderStyle::Ridge:
style = "ridge"; break;
case BorderStyle::Inset:
style = "inset"; break;
case BorderStyle::Outset:
style = "outset"; break;
}
std::string width;
switch (width_) {
case BorderWidth::Thin:
width = "thin"; break;
case BorderWidth::Medium:
width = "medium"; break;
case BorderWidth::Thick:
width = "thick"; break;
case BorderWidth::Explicit:
width = explicitWidth_.cssText();
}
return width + " " + style + " " + color_.cssText();
}
#ifdef WT_TARGET_JAVA
WBorder WBorder::clone() const
{
WBorder b;
b.width_ = width_;
b.explicitWidth_ = explicitWidth_;
b.color_ = color_;
b.style_ = style_;
return b;
}
#endif
}