]> git.tdb.fi Git - libs/gltk.git/blob - source/logic.h
Strip copyright messages and id tags from individual files
[libs/gltk.git] / source / logic.h
1 #ifndef MSP_GLTK_LOGIC_H_
2 #define MSP_GLTK_LOGIC_H_
3
4 #include <list>
5 #include <map>
6 #include <string>
7 #include <sigc++/slot.h>
8 #include <msp/core/except.h>
9 #include <msp/datafile/loader.h>
10
11 namespace Msp {
12 namespace GLtk {
13
14 class Widget;
15
16 /**
17 Stores use interface logic.  This is represented as widget bindings.  Each
18 binding has type and data.
19
20 See also class Connector.
21 */
22 class Logic
23 {
24 public:
25         class Loader: public DataFile::Loader
26         {
27         private:
28                 Logic &logic;
29                 const std::map<std::string, Widget *> &widgets;
30
31         public:
32                 Loader(Logic &, const std::map<std::string, Widget *> &);
33         private:
34                 void bind(const std::string &, const std::string &);
35         };
36
37         struct WidgetBinding
38         {
39                 Widget *wdg;
40                 std::string type;
41                 std::string data;
42         };
43
44 private:
45         std::list<WidgetBinding> bindings;
46
47 public:
48         const std::list<WidgetBinding> &get_bindings() const { return bindings; }
49 };
50
51 } // namespace GLtk
52 } // namespace Msp
53
54 #endif