]> git.tdb.fi Git - libs/gltk.git/blob - source/resources.h
Restore ability to handle raw image 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         };
36
37 public:
38         Resources();
39
40         const GL::Font &get_default_font() const;
41
42 private:
43         GL::Texture2D *create_texture(const std::string &);
44 };
45
46 } // namespace GLtk
47 } // namespace Msp
48
49 #endif