blob: c14ccff3236172a17d80366e256bb23e6e0a8e6c (
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
|
/*
ui/bitmap.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#include "auxiliary/functions.h"
#include "ui/bitmap.h"
#include "ui/paint.h"
#include "sys/sys.h"
namespace ui
{
Bitmap::Bitmap(Widget *parent, const char *texture) : Widget(parent)
{
set_border(false);
set_background(true);
set_label("bitmap");
set_texture(texture);
}
Bitmap::~Bitmap()
{}
void Bitmap::print(size_t indent)
{
std::string marker("");
con_print << aux::pad_left(marker, indent*2) << label() << " \"" << texture() << "\"" << std::endl;
}
void Bitmap::set_texture(std::string const & texture)
{
bitmap_texture.assign(texture);
}
void Bitmap::set_texture(const char *texture)
{
if (texture)
bitmap_texture.assign(texture);
else
bitmap_texture.clear();
}
void Bitmap::draw_background()
{
if (bitmap_texture.size()) {
paint::color(1.0f, 1.0f, 1.0f, 1.0f);
paint::bitmap(global_location(), size(), bitmap_texture);
}
}
}
|