Lumiera  0.pre.03
»edit your freedom«
cmd-context.cpp
Go to the documentation of this file.
1 /*
2  CmdContext - 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 
37 //#include "lib/util.hpp"
38 //#include "lib/symbol.hpp"
39 #include "lib/depend.hpp"
40 //#include "include/logging.h"
41 #include "include/ui-protocol.hpp"
44 #include "lib/format-string.hpp"
45 
46 //#include <string>
47 //#include <map>
48 
49 //using std::map;
50 //using std::string;
51 
52 //using util::contains;
53 //using util::isnil;
54 using util::_Fmt;
55 
56 namespace stage {
57 namespace interact {
58  namespace error = lumiera::error;
59 
60  namespace { // internal details
62 
63  inline InteractionState&
64  selectStateImplementation (Symbol ctxID)
65  {
66  if ( GESTURE_dragReolcate == ctxID)
67  return gestures().getStateFor (GestureState::DRAG, GestureState::ON_TIMELINE);
68  throw error::Config (_Fmt{"Unknown Context-ID '%s' encountered in Gesture wiring."}
69  % ctxID);
70  }
71  } // internal details
72 
73 
74 
75  Subject::~Subject() { } // Emit VTable here...
76 
78 
79 
80 
86  CmdContext::of (Symbol cmdID, Symbol ctxID)
87  {
88 
89  return CmdContext {selectStateImplementation(ctxID), cmdID};
90  }
91 
92 
93  void
95  {
96  REQUIRE (subject_);
97  iState_.linkTrigger (*subject_, cmdID_);
98  }
99 
100 
101 
108  CmdContext::Resolver::operator LuidH ()
109  {
110  REQUIRE (this->spec > 0); //note we can access the spec embedded in the Resolver struct
111  UNIMPLEMENTED ("forward the resolution operation, probably to InteractionDirector or similar...");
112  }
113 
114 
117 }} // namespace stage::interact
Hard wired key constants and basic definitions for communication with the GUI.
virtual ~Subject()
this is an interface
Definition: cmd-context.cpp:75
Sub-Service of the InteractionDirector: Hold and maintain InteractionState.
Front-end for printf-style string template interpolation.
A front-end for using printf-style formatting.
Abstract foundation for context dependent UI interactions.
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:289
void setupRelocateDrag()
Terminal builder operation: establish the infrastructure for the already defined participants to be i...
Definition: cmd-context.cpp:94
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:199
Token or Atom with distinct identity.
Definition: symbol.hpp:126
static CmdContext of(Symbol cmdID, Symbol ctxID)
global static service accessor function.
Definition: cmd-context.cpp:86
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
Singleton services and Dependency Injection.
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor...
Builder to define a binding to relate some entity or place within the UI with a specific from of inte...
Abstraction: support for binding command invocation into an UI context.
virtual ~GestureObserver()
this is an interface
Definition: cmd-context.cpp:77