]> git.tdb.fi Git - libs/gltk.git/blob - source/style.h
Adjust things to conform to changes in other libraries
[libs/gltk.git] / source / style.h
1 #ifndef MSP_GLTK_STYLE_H_
2 #define MSP_GLTK_STYLE_H_
3
4 #include <msp/gl/color.h>
5 #include <msp/gl/font.h>
6 #include <msp/gl/sampler.h>
7 #include <msp/datafile/objectloader.h>
8 #include "part.h"
9
10 namespace Msp {
11 namespace GLtk {
12
13 class Resources;
14
15 /**
16 Styles define what wigets look like.  They are made up of Parts and some
17 generic properties.
18 */
19 class Style
20 {
21 public:
22         class Loader: public DataFile::CollectionObjectLoader<Style, Resources>
23         {
24         public:
25                 Loader(Style &, Resources &);
26
27         private:
28                 void font(const std::string &);
29                 void font_color_normal(float, float, float);
30                 void font_color(State, float, float, float);
31                 void part(const std::string &);
32                 void unnamed_part();
33         };
34
35         typedef std::list<Part> PartSeq;
36
37 private:
38         const GL::Font *font;
39         unsigned font_size;
40         GL::Color font_color[N_STATES_];
41         const GL::Sampler *sampler;
42         PartSeq parts;
43
44 public:
45         Style();
46         const GL::Font &get_font() const;
47         unsigned get_font_size() const { return font_size; }
48         const GL::Color &get_font_color(State) const;
49         const GL::Sampler &get_sampler() const;
50         const PartSeq &get_parts() const { return parts; }
51         const Part *get_part(const std::string &) const;
52         bool compare_states(State, State) const;
53 };
54
55 } // namespace GLtk
56 } // namespace Msp
57
58 #endif