]> git.tdb.fi Git - libs/gltk.git/blob - source/style.cpp
Initial revision
[libs/gltk.git] / source / style.cpp
1 #include "resources.h"
2 #include "style.h"
3
4 using namespace std;
5
6 namespace Msp {
7 namespace GLtk {
8
9 Style::Style(const Resources &r, const string &w, const string &n):
10         res(r),
11         widget(w),
12         name(n),
13         font(&res.get_default_font())
14 { }
15
16
17 Style::Loader::Loader(Style &s):
18         style(s)
19 {
20         add("font", &Loader::font);
21         add("font_color", &Loader::font_color);
22         add("part", &Loader::part);
23 }
24
25 void Style::Loader::font(const string &f)
26 {
27         style.font=&style.res.get_font(f);
28 }
29
30 void Style::Loader::font_color(float r, float g, float b)
31 {
32         style.font_color=Color(r, g, b);
33 }
34
35 void Style::Loader::part(const string &n)
36 {
37         Part p(style.res, n);
38         load_sub(p);
39         style.parts.push_back(p);
40 }
41
42 } // namespace GLtk
43 } // namespace Msp