]> git.tdb.fi Git - libs/gltk.git/blob - source/resources.h
Strip copyright messages and id tags from individual files
[libs/gltk.git] / source / resources.h
1 #ifndef MSP_GLTK_RESOURCES_H_
2 #define MSP_GLTK_RESOURCES_H_
3
4 #include <msp/gl/font.h>
5 #include <msp/gl/texture.h>
6 #include <msp/datafile/collection.h>
7 #include <msp/fs/path.h>
8 #include "graphic.h"
9 #include "style.h"
10
11 namespace Msp {
12 namespace GLtk {
13
14 /**
15 Stores resources such as styles and graphics.  All widgets require a Resources
16 instance in constructor.
17 */
18 class Resources: public DataFile::Collection
19 {
20 private:
21         FS::Path path;
22         GL::Font *default_font;
23
24 public:
25         class Loader: public Collection::Loader
26         {
27         private:
28                 Resources &res;
29
30         public:
31                 Loader(Resources &);
32         private:
33                 void default_font(const std::string &);
34                 void font(const std::string &);
35                 void style(const std::string &);
36         };
37
38         Resources();
39         Resources(const FS::Path &);
40 private:
41         void init();
42
43 public:
44         void set_path(const FS::Path &);
45         const GL::Font &get_default_font() const;
46 private:
47         GL::Font *create_font(const std::string &);
48         GL::Texture2D *create_texture(const std::string &);
49 };
50
51 } // namespace GLtk
52 } // namespace Msp
53
54 #endif