Lumiera  0.pre.03
»edityourfreedom«
cmd-context.hpp
Go to the documentation of this file.
1 /*
2  CMD-CONTEXT.hpp - interface to access command context binding services within the UI
3 
4  Copyright (C) Lumiera.org
5  2017, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
53 #ifndef GUI_INTERACT_CMD_CONTEXT_H
54 #define GUI_INTERACT_CMD_CONTEXT_H
55 
56 
57 #include "lib/error.hpp"
58 #include "lib/nocopy.hpp"
59 //#include "gui/ctrl/bus-term.hpp"
60 //#include "lib/idi/entry-id.hpp"
61 #include "lib/hash-indexed.hpp"
62 #include "lib/symbol.hpp"
63 //#include "lib/util.hpp"
64 
65 #include <string>
66 
67 
68 namespace gui {
69 namespace interact {
70 
71 // using lib::HashVal;
72  using lib::hash::LuidH;
73  using lib::Symbol;
74 // using util::isnil;
75  using std::string;
76 
77 
78 
83  class CmdContext
85  {
86 
87  public:
88  ~CmdContext();
89 
90  /* === access front-end === */
91  static CmdContext& of (Symbol cmdID, string ctxID);
92 
93  struct Resolver;
94 
95  protected:
96  private:
97  };
98 
99 
104  {
105 
109  operator LuidH ();
110 
111 
112  enum Spec {
114  RECENT
115  };
116 
117 
118  friend Resolver
119  scope (Spec scopeSpec)
120  {
121  return Resolver{scopeSpec};
122  }
123 
124 
125  friend Resolver
126  element (Spec elementSpec)
127  {
128  return Resolver{elementSpec};
129  }
130 
131  private:
132  const Spec spec = HERE;
133 
135  : spec(s)
136  { }
137  };
138 
139 
140 }} // namespace gui::interact
141 #endif /*GUI_INTERACT_CMD_CONTEXT_H*/
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:47
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Abstract foundation of UI state tracking components.
Definition: cmd-context.hpp:83
Token or Atom with distinct identity.
Definition: symbol.hpp:116
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Marker types to indicate a literal string and a Symbol.
static CmdContext & of(Symbol cmdID, string ctxID)
global static service accessor function.
Definition: cmd-context.cpp:63
friend Resolver scope(Spec scopeSpec)
A template for generating hash based ID tags carrying compile-time type info.
Lumiera error handling (C++ interface).
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor...
Helper for dynamic command argument resolution.
friend Resolver element(Spec elementSpec)