]> git.tdb.fi Git - libs/gltk.git/blob - source/style.cpp
Enable loading of entry widgets from datafiles
[libs/gltk.git] / source / style.cpp
1 /* $Id$
2
3 This file is part of libmspgltk
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "resources.h"
9 #include "style.h"
10
11 using namespace std;
12
13 namespace Msp {
14 namespace GLtk {
15
16 Style::Style(Resources &r):
17         font(&r.get_default_font())
18 { }
19
20
21 Style::Loader::Loader(Style &s, Resources &r):
22         style(s),
23         res(r)
24 {
25         add("font",       &Style::font);
26         add("font_color", &Loader::font_color);
27         add("part",       &Loader::part);
28         add("special",    &Loader::special);
29 }
30
31 void Style::Loader::font_color(float r, float g, float b)
32 {
33         style.font_color=GL::Color(r, g, b);
34 }
35
36 void Style::Loader::part()
37 {
38         Part p((string()));
39         load_sub(p, res);
40         style.parts.push_back(p);
41 }
42
43 void Style::Loader::special(const string &n)
44 {
45         Part p(n);
46         load_sub(p, res);
47         style.parts.push_back(p);
48 }
49
50 } // namespace GLtk
51 } // namespace Msp