]> git.tdb.fi Git - libs/gltk.git/blob - source/resources.h
Make func a normal argument of Text::process_lines
[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/datafile/directorysource.h>
8 #include <msp/fs/path.h>
9 #include "graphic.h"
10 #include "style.h"
11
12 namespace Msp {
13 namespace GLtk {
14
15 /**
16 Stores resources such as styles and graphics.  All widgets require a Resources
17 instance in constructor.
18 */
19 class Resources: public DataFile::Collection
20 {
21 public:
22         class Loader: public Collection::Loader
23         {
24         private:
25                 Resources &res;
26
27         public:
28                 Loader(Resources &);
29         private:
30                 void default_font(const std::string &);
31                 void font(const std::string &);
32         };
33
34 private:
35         FS::Path path;
36         GL::Font *default_font;
37         DataFile::DirectorySource *dir_src;
38
39 public:
40         Resources();
41         Resources(const FS::Path &);
42 private:
43         void init();
44 public:
45         ~Resources();
46
47         const GL::Font &get_default_font() const;
48
49 private:
50         GL::Texture2D *create_texture(const std::string &);
51 };
52
53 } // namespace GLtk
54 } // namespace Msp
55
56 #endif