Lumiera  0.pre.03
»edit your freedom«
view-locator.hpp
Go to the documentation of this file.
1 /*
2  VIEW-LOCATOR.hpp - access and allocation of UI component views
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 
64 #ifndef STAGE_INTERACT_VIEW_LOCATOR_H
65 #define STAGE_INTERACT_VIEW_LOCATOR_H
66 
67 #include "lib/depend-inject.hpp"
68 #include "stage/id-scheme.hpp"
71 #include "lib/idi/genfunc.hpp"
72 #include "lib/symbol.hpp"
73 #include "lib/nocopy.hpp"
74 
75 #include <functional>
76 #include <string>
77 #include <memory>
78 
79 
80 namespace stage {
81 namespace ctrl{
82  class PanelLocator;
83 }
84 namespace interact {
85 
86  using std::unique_ptr;
87  using std::string;
88  using lib::Symbol;
89 
90  class UILocationSolver;
91 
92 
93 
101  {
103 
104  lib::Depend<model::ElementAccess> elementAccess;
105  Service_LocationSolver locResolver_;
106 
107 
108  public:
109  ViewLocator ();
110  ~ViewLocator();
111 
112 
116  template<class V>
117  V& get();
118 
119  private:
120  /* === accessors to sibling global services === */
121 
122  };
123 
124 
125 
126  template<class V>
127  inline V&
128  ViewLocator::get()
129  {
130  auto& viewSpec = idi::viewSpec<V>();
131  Symbol viewID{lib::idi::typeSymbol<V>()};
132 
133  UICoord targetLocation = viewSpec.locate(viewID);
134  UICoord realView = viewSpec.alloc (targetLocation);
135 
136  return elementAccess().access<V> (realView);
137  }
138 
139 
140 }}// namespace stage::interact
141 #endif /*STAGE_INTERACT_VIEW_LOCATOR_H*/
Access or allocate a UI component view.
Describe a location within the UI through structural/topological coordinates.
Definition: ui-coord.hpp:138
Hard wired definitions for the object identification system used within the UI.
Configuration handle to expose a service implementation through the Depend<SRV> front-end.
A framework for configuration of view access and allocation patterns.
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Per type specific configuration of instances created as service dependencies.
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:289
Generic functions to build identification schemes.
Interface to discover and access raw UI elements in a cross cutting way.
Descriptor< VIEW > & viewSpec()
Access point: Factory for "view specs".
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.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46