blob: 33e10fcd738058674fe2d3aa047e0daf3196ed26 (
plain)
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
|
/*
ui/text.cc
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#include "ui/paint.h"
#include "ui/plaintext.h"
namespace ui
{
PlainText::PlainText(Widget *parent, const char *text) : Widget(parent)
{
set_label("text");
set_text(text);
}
PlainText::~PlainText()
{
}
void PlainText::print(const size_t indent) const
{
std::string marker("");
con_print << aux::pad_left(marker, indent*2) << label() << " \"" << text() << "\"" << std::endl;
}
void PlainText::clear()
{
widget_text.clear();
}
void PlainText::set_text(const char *text)
{
if (text)
widget_text.assign(text);
else
widget_text.clear();
}
void PlainText::set_text(const std::string &text)
{
widget_text.assign(text);
}
void PlainText::draw()
{
if (!text().size())
return;
Paint::set_color(palette()->foreground());
Paint::draw_text(global_location(), font(), text());
}
}
|