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