]> git.tdb.fi Git - libs/gltk.git/blob - source/style.h
typedef tweaks
[libs/gltk.git] / source / style.h
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 #ifndef MSP_GLTK_STYLE_H_
9 #define MSP_GLTK_STYLE_H_
10
11 #include <msp/gl/color.h>
12 #include <msp/gl/font.h>
13 #include <msp/datafile/loader.h>
14 #include "part.h"
15
16 namespace Msp {
17 namespace GLtk {
18
19 class Resources;
20
21 /**
22 Styles define what wigets look like.  They are made up of Parts and some
23 generic properties.
24 */
25 class Style
26 {
27 public:
28         class Loader: public DataFile::Loader
29         {
30         private:
31                 Style &style;
32                 Resources &res;
33
34         public:
35                 typedef Resources Collection;
36
37                 Loader(Style &, Resources &);
38                 Style &get_object() const { return style; }
39                 Resources &get_collection() const { return res; }
40         private:
41                 void font(const std::string &);
42                 void font_color(float, float, float);
43                 void part();
44                 void part(const std::string &);
45         };
46
47         typedef std::list<Part> PartSeq;
48
49 private:
50         const GL::Font *font;
51         GL::Color font_color;
52         PartSeq parts;
53
54 public:
55         Style(Resources &);
56         const GL::Font *get_font() const  { return font; }
57         const GL::Color &get_font_color() const { return font_color; }
58         const PartSeq &get_parts() const { return parts; }
59         const Part *get_part(const std::string &) const;
60 };
61
62 } // namespace GLtk
63 } // namespace Msp
64
65 #endif