]> git.tdb.fi Git - libs/gltk.git/blob - source/style.h
Enable loading of entry widgets from datafiles
[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 special(const std::string &);
45         };
46
47 private:
48         const GL::Font *font;
49         GL::Color font_color;
50         PartSeq parts;
51
52 public:
53         Style(Resources &);
54         const GL::Font *get_font() const  { return font; }
55         const GL::Color &get_font_color() const { return font_color; }
56         const PartSeq &get_parts() const { return parts; }
57 };
58
59 } // namespace GLtk
60 } // namespace Msp
61
62 #endif