]> git.tdb.fi Git - libs/gltk.git/blob - source/part.h
Initial revision
[libs/gltk.git] / source / part.h
1 #ifndef MSP_GLTK_PART_H_
2 #define MSP_GLTK_PART_H_
3
4 #include <map>
5 #include <string>
6 #include <msp/parser/loader.h>
7 #include "alignment.h"
8 #include "state.h"
9
10 namespace Msp {
11 namespace GLtk {
12
13 class Graphic;
14 class Resources;
15
16 class Part
17 {
18 public:
19         class Loader: public Parser::Loader
20         {
21         public:
22                 Loader(Part &);
23         private:
24                 Part &part;
25
26                 void graphic(State, const std::string &);
27                 void align(int, int);
28                 void fill(bool, bool);
29         };
30
31         Part(const Resources &, const std::string &);
32         const std::string &get_name() const { return name; }
33         const Graphic *get_graphic(State) const;
34         const Alignment &get_alignment() const { return align; }
35         bool get_fill_x() const { return fill_x; }
36         bool get_fill_y() const { return fill_y; }
37         void render(const Geometry &, State) const;
38 private:
39         const Resources &res;
40         std::string name;
41         const Graphic *graphic[N_STATES_];
42         Alignment align;
43         bool fill_x;
44         bool fill_y;
45 };
46 typedef std::list<Part> PartSeq;
47
48 } // namespace GLtk
49 } // namespace Msp
50
51 #endif