]> git.tdb.fi Git - libs/gltk.git/blob - source/logic.h
Add ConnSignal action for Connector
[libs/gltk.git] / source / logic.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_LOGIC_H_
9 #define MSP_GLTK_LOGIC_H_
10
11 #include <list>
12 #include <map>
13 #include <string>
14 #include <sigc++/slot.h>
15 #include <msp/core/except.h>
16 #include <msp/datafile/loader.h>
17
18 namespace Msp {
19 namespace GLtk {
20
21 class Widget;
22
23 /**
24 Stores use interface logic.  This is represented as widget bindings.  Each
25 binding has type and data.
26
27 See also class Connector.
28 */
29 class Logic
30 {
31 public:
32         class Loader: public DataFile::Loader
33         {
34         private:
35                 Logic &logic;
36                 const std::map<std::string, Widget *> &widgets;
37
38         public:
39                 Loader(Logic &, const std::map<std::string, Widget *> &);
40         private:
41                 void bind(const std::string &, const std::string &);
42         };
43
44         struct WidgetBinding
45         {
46                 Widget *wdg;
47                 std::string type;
48                 std::string data;
49         };
50
51 private:
52         std::list<WidgetBinding> bindings;
53
54 public:
55         const std::list<WidgetBinding> &get_bindings() const { return bindings; }
56 };
57
58 } // namespace GLtk
59 } // namespace Msp
60
61 #endif