Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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)
5 2017, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
44#ifndef STAGE_INTERACT_CMD_CONTEXT_H
45#define STAGE_INTERACT_CMD_CONTEXT_H
46
47
48#include "lib/error.hpp"
49#include "lib/nocopy.hpp"
50//#include "stage/ctrl/bus-term.hpp"
51//#include "lib/idi/entry-id.hpp"
52#include "lib/hash-indexed.hpp"
53#include "lib/opaque-holder.hpp"
54#include "lib/symbol.hpp"
55#include "lib/nocopy.hpp"
56//#include "lib/util.hpp"
57
58//#include <string>
59#include <utility>
60
61namespace Gtk {
62 class Widget;
63}
64namespace stage {
65namespace interact {
66
67// using lib::HashVal;
68 using lib::hash::LuidH;
69 using lib::Symbol;
70// using util::isnil;
71// using std::string;
72
73 class InteractionState;
74
75
76
89 : public util::MoveAssign
90 {
92
93 public:
94 virtual ~GestureObserver();
95
96 GestureObserver (Symbol cmdID) : cmdID_(cmdID) { }
97
100
101
102 Symbol getCmdID() const { return cmdID_; }
103
104 virtual void updateOffset (double deltaX, double deltaY) =0;
105 virtual void markGestureCompleted() =0;
106 };
107
108
111 : public GestureObserver
112 {
113 void updateOffset (double, double) override { /*NOOP*/ }
114 void markGestureCompleted() override { /*NOOP*/ }
115 public:
117 };
118
119
120
129 {
130 protected:
131 virtual ~Subject();
132
133 public:
135 virtual void buildGestureObserver (Symbol cmdID, Buffer) =0;
136 virtual Gtk::Widget& exposeWidget() =0;
137 };
138
139
140
148 {
151
152 /* ===== Builder State ===== */
153 Subject* subject_{nullptr};
154
156 : iState_{iState}
157 , cmdID_{cmdID}
158 { }
159 public:
160 // using the default move-ctor
161
162 /* === access front-end === */
163 static CmdContext of (Symbol cmdID, Symbol ctxID);
164
165 struct Resolver;
166
168 CmdContext&& linkSubject (Subject& subj) { this->subject_ = &subj; return std::move (*this); }
169
178 void setupRelocateDrag();
179
180 protected:
181 private:
182 };
183
184
190 {
191
195 operator LuidH ();
196
197
198 enum Spec {
200 RECENT
201 };
202
203
204 friend Resolver
205 scope (Spec scopeSpec)
206 {
207 return Resolver{scopeSpec};
208 }
209
210
211 friend Resolver
212 element (Spec elementSpec)
213 {
214 return Resolver{elementSpec};
215 }
216
217 private:
218 const Spec spec = HERE;
219
221 : spec(s)
222 { }
223 };
224
225
226}} // namespace stage::interact
227#endif /*STAGE_INTERACT_CMD_CONTEXT_H*/
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
Token or Atom with distinct identity.
Definition symbol.hpp:120
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...
static CmdContext of(Symbol cmdID, Symbol ctxID)
global static service accessor function.
CmdContext(InteractionState &iState, Symbol cmdID)
CmdContext && linkSubject(Subject &subj)
Builder operation: define the subject to use for the following interaction bindings.
InteractionState & iState_
void setupRelocateDrag()
Terminal builder operation: establish the infrastructure for the already defined participants to be i...
Collaboration interface for tracking the formation of a gesture.
GestureObserver(GestureObserver &&)=default
virtual ~GestureObserver()
this is an interface
GestureObserver & operator=(GestureObserver &&)=default
virtual void markGestureCompleted()=0
virtual void updateOffset(double deltaX, double deltaY)=0
»Null Object« when no gesture is being tracked currently
void updateOffset(double, double) override
Abstract foundation for context dependent UI interactions.
Role-Interface: the Subject of Interaction.
virtual void buildGestureObserver(Symbol cmdID, Buffer)=0
prompt the Subject to build an Observer for the gesture in formation
virtual ~Subject()
this is an interface
virtual Gtk::Widget & exposeWidget()=0
the exposed widget can be used for wiring signal handlers
Types marked with this mix-in may be moved and move-assigned.
Definition nocopy.hpp:64
Types marked with this mix-in may be moved but not copied.
Definition nocopy.hpp:50
Any copy and copy construction prohibited.
Definition nocopy.hpp:38
Lumiera error handling (C++ interface).
A template for generating hash based ID tags carrying compile-time type info.
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Helper allowing type erasure while holding the actual object inline.
Helper for dynamic command argument resolution.
friend Resolver element(Spec elementSpec)
friend Resolver scope(Spec scopeSpec)
Marker types to indicate a literal string and a Symbol.