2017-09-02 19:28:57 +02:00
|
|
|
/*
|
|
|
|
|
ViewLocator - access and allocation of UI component views
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2017, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @file view-locator.cpp
|
|
|
|
|
** Implementation details of a machinery to allocate UI global component views.
|
2018-02-01 23:08:43 +01:00
|
|
|
** Essentially this compilation unit hosts the implementation backing the [ViewSpec-DSL](view-spec-dsl.hpp)
|
|
|
|
|
** and the [Location Solver](ui-location-solver.hpp) to drive evaluation of the standard location defaults,
|
|
|
|
|
** which are [hard-wired into the UI](\ref id-scheme.hpp). For this integration of various facilities and
|
|
|
|
|
** frameworks we rely on actual definitions for the DSL-tokens, which themselves are functors and tied by
|
|
|
|
|
** lambda-binding into the implementation side of ViewLocator; which both acts as a front-end to access
|
|
|
|
|
** the service to "get or create" a component and also holds the UILocationSolver component to perform
|
|
|
|
|
** the actual location solving mechanism. The DSL thus sits between both poles, since _resolving a view_
|
|
|
|
|
** draws upon the default locating configuration encoded as DSL tokens, which in turn call back into
|
|
|
|
|
** the implementation services within ViewLocator to resolve those partial location specifications
|
|
|
|
|
** against the currently existing UI topology and then to access or create new UI components as
|
|
|
|
|
** laid out through those definitions.
|
2017-09-02 19:28:57 +02:00
|
|
|
**
|
|
|
|
|
** @todo WIP 9/2017 early draft ////////////////////////////////////////////////////////////TICKET #1104
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2018-04-15 01:39:46 +02:00
|
|
|
#include "gui/gtk-base.hpp"
|
2017-09-02 19:28:57 +02:00
|
|
|
#include "gui/interact/view-locator.hpp"
|
2018-04-15 01:39:46 +02:00
|
|
|
#include "gui/interact/view-spec-dsl.hpp"
|
2018-02-01 23:08:43 +01:00
|
|
|
#include "gui/interact/ui-location-solver.hpp"
|
2018-01-14 01:58:25 +01:00
|
|
|
#include "gui/ctrl/panel-locator.hpp"
|
2018-04-07 02:55:47 +02:00
|
|
|
#include "gui/model/element-access.hpp"
|
2018-01-14 01:58:25 +01:00
|
|
|
#include "gui/interact/ui-coord-resolver.hpp"
|
2018-04-04 03:48:53 +02:00
|
|
|
#include "lib/depend.hpp"
|
2017-10-01 23:25:23 +02:00
|
|
|
#include "lib/symbol.hpp"
|
2017-09-02 19:28:57 +02:00
|
|
|
//#include "lib/util.hpp"
|
|
|
|
|
|
|
|
|
|
//using util::cStr;
|
|
|
|
|
//using util::isnil;
|
2017-10-01 23:25:23 +02:00
|
|
|
using lib::Symbol;
|
2018-04-07 02:55:47 +02:00
|
|
|
//using gui::ctrl::PanelLocator;
|
|
|
|
|
//using gui::ctrl::WindowLocator;
|
|
|
|
|
using gui::model::ElementAccess;
|
2017-09-02 19:28:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace gui {
|
2018-01-15 03:56:02 +01:00
|
|
|
namespace error = lumiera::error;
|
|
|
|
|
|
|
|
|
|
|
2017-09-02 19:28:57 +02:00
|
|
|
|
2018-04-15 01:39:46 +02:00
|
|
|
/* ==== definitions and concrete bindings for the View-Spec-DSL ==== */
|
2017-09-02 19:28:57 +02:00
|
|
|
|
2018-04-15 01:39:46 +02:00
|
|
|
namespace idi { // Namespace for the actual ViewSpec DSL tokens
|
|
|
|
|
|
|
|
|
|
|
2018-06-14 17:02:34 +02:00
|
|
|
AllocSpec<uint> limitAllocation =[](UICoord target, uint limit)
|
|
|
|
|
{
|
|
|
|
|
lib::Depend<model::ElementAccess> rawElementAccessor;
|
2018-06-15 18:02:08 +02:00
|
|
|
return rawElementAccessor().locate_or_create (target, limit);
|
2018-06-14 17:02:34 +02:00
|
|
|
};
|
2018-04-15 01:39:46 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
namespace interact {
|
|
|
|
|
|
|
|
|
|
const Symbol UIC_CURRENT_WINDOW{"currentWindow"};
|
|
|
|
|
const Symbol UIC_FIRST_WINDOW {"firstWindow"};
|
|
|
|
|
const Symbol UIC_ELIDED {"."};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ViewLocator::ViewLocator ()
|
|
|
|
|
: locResolver_{LocationQuery::service}
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
// dtors via smart-ptr invoked from here...
|
|
|
|
|
ViewLocator::~ViewLocator() { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* === Service accessors within global context === */
|
|
|
|
|
|
|
|
|
|
// PanelLocator&
|
|
|
|
|
// ViewLocator::panelLocator()
|
|
|
|
|
// {
|
|
|
|
|
// return windowLoc_.locatePanel();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-02 19:28:57 +02:00
|
|
|
}}// namespace gui::interact
|