Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 5e194358c963c01fbe00c9ce7f72ee8b68f07dd9 (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
59
60
/*
   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(const size_t indent) const
{
	std::string marker("");
	con_print << aux::pad_left(marker, indent*2) << label() << " \"" << texture() << "\"" << std::endl;
}

void Bitmap::set_texture(const std::string & texture)
{
	bitmap_texture.assign(texture);
}

void Bitmap::set_texture(const char *texture)
{
	if (texture)
		bitmap_texture.assign(texture);
	else
		bitmap_texture.clear();
}

void Bitmap::set_color(const math::Color & color)
{
	bitmap_color.assign(color);
}

void Bitmap::draw_background()
{
	if (bitmap_texture.size()) {
		Paint::set_color(bitmap_color);
		Paint::draw_bitmap(global_location(), size(), bitmap_texture);
	}
}

}