stub new parts
This commit is contained in:
parent
1e5c1059d3
commit
f58b2af228
5 changed files with 199 additions and 7 deletions
62
src/gui/interact/presentation-state-manager.cpp
Normal file
62
src/gui/interact/presentation-state-manager.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
PresentationStateManager - maintaining persistent interface state
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2016, 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 presentation-state-manager.cpp
|
||||
** Implementation details of persistent presentation state organisation.
|
||||
**
|
||||
** @see BusTerm_test
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
//#include "lib/util.hpp"
|
||||
//#include "lib/symbol.hpp"
|
||||
//#include "include/logging.h"
|
||||
#include "gui/interact/presentation-state-manager.hpp"
|
||||
|
||||
//#include <boost/noncopyable.hpp>
|
||||
//#include <string>
|
||||
//#include <map>
|
||||
|
||||
//using std::map;
|
||||
//using std::string;
|
||||
|
||||
//using util::contains;
|
||||
//using util::isnil;
|
||||
|
||||
namespace gui {
|
||||
namespace interact {
|
||||
|
||||
namespace { // internal details
|
||||
|
||||
} // internal details
|
||||
|
||||
|
||||
PresentationStateManager::~PresentationStateManager() { } // Emit VTables here...
|
||||
|
||||
|
||||
|
||||
|
||||
/** nonsense */
|
||||
|
||||
}} // namespace gui::interact
|
||||
106
src/gui/interact/presentation-state-manager.hpp
Normal file
106
src/gui/interact/presentation-state-manager.hpp
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
PRESENTATION-STATE-MANAGER.hpp - maintaining persistent interface state
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2016, 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 presentation-state-manager.hpp
|
||||
** Interface: a component to maintain persistent interface state.
|
||||
** Here, "presentation state" is understood as state not rooted within the
|
||||
** model and without effect on the final rendered result. Most of this state
|
||||
** is transitory and arises from the normal working from the UI (and toolkit set).
|
||||
** Yet part of this state is relevant to the _way to work with the tooling_, so we
|
||||
** typically expect these choices and traces of usage to remain sticky, persistent
|
||||
** across editing sessions.
|
||||
**
|
||||
** ## Implementation technique
|
||||
** In Lumiera, handling of persistent presentation state relies on the UI backbone
|
||||
** structure known as [UI-Bus](\ref ui-bus.hpp). Any element of more than local relevance,
|
||||
** as attached to this backbone, will emit *state mark notification* messages, whenever
|
||||
** some transition of presentation state is deemed relevant. The PresentationStateManager
|
||||
** operates as one of the [core services](\ref core-service.hpp) and receives, groups and
|
||||
** remembers those messages, always retaining the latest state information observed for any
|
||||
** property of any [tangible interface element](\ref tangible.hpp) encountered thus far.
|
||||
**
|
||||
** @todo as of 2/2016 this is complete WIP-WIP-WIP
|
||||
**
|
||||
** @see ////TODO_test usage example
|
||||
**
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GUI_INTERACT_PRESENTATION_STATE_MANAGER_H
|
||||
#define GUI_INTERACT_PRESENTATION_STATE_MANAGER_H
|
||||
|
||||
|
||||
#include "lib/error.hpp"
|
||||
//#include "gui/ctrl/bus-term.hpp"
|
||||
//#include "lib/idi/entry-id.hpp"
|
||||
#include "lib/diff/gen-node.hpp"
|
||||
//#include "lib/symbol.hpp"
|
||||
//#include "lib/util.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace gui {
|
||||
namespace interact {
|
||||
|
||||
// using lib::HashVal;
|
||||
// using util::isnil;
|
||||
using std::string;
|
||||
|
||||
|
||||
/**
|
||||
* Interface: handling of persistent interface state.
|
||||
* @todo write type comment...
|
||||
*/
|
||||
class PresentationStateManager
|
||||
: boost::noncopyable
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
virtual ~PresentationStateManager(); ///< this is an interface
|
||||
|
||||
|
||||
virtual lib::diff::GenNode const&
|
||||
currentState (string elementSymbol, string propertyID) =0;
|
||||
|
||||
virtual void
|
||||
replayState (string elementSymbol, string propertyID) =0;
|
||||
|
||||
virtual void
|
||||
replayAllState () =0;
|
||||
|
||||
virtual void
|
||||
replayAllState (string propertyID) =0;
|
||||
|
||||
virtual void
|
||||
replayAllProperties (string elementSymbol) =0;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // namespace gui::interact
|
||||
#endif /*GUI_INTERACT_PRESENTATION_STATE_MANAGER_H*/
|
||||
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "lib/test/test-helper.hpp"
|
||||
#include "gui/ctrl/bus-term.hpp"
|
||||
#include "gui/interact/presentation-state-manager.hpp"
|
||||
#include "test/test-nexus.hpp"
|
||||
#include "test/mock-elm.hpp"
|
||||
#include "lib/idi/entry-id.hpp"
|
||||
|
|
@ -36,6 +38,8 @@
|
|||
|
||||
using lib::idi::EntryID;
|
||||
using lib::idi::BareEntryID;
|
||||
using gui::interact::PresentationStateManager;
|
||||
using gui::ctrl::BusTerm;
|
||||
using gui::test::MockElm;
|
||||
using lib::diff::GenNode;
|
||||
using lib::diff::Rec;
|
||||
|
|
@ -238,7 +242,7 @@ namespace test {
|
|||
{
|
||||
MARK_TEST_FUN
|
||||
gui::test::Nexus::startNewLog();
|
||||
PresentationStateManager stateManager = gui::test::Nexus::useMockStateManager();
|
||||
PresentationStateManager& stateManager = gui::test::Nexus::useMockStateManager();
|
||||
|
||||
MockElm mockA("alpha");
|
||||
MockElm mockB("bravo");
|
||||
|
|
@ -275,7 +279,7 @@ namespace test {
|
|||
replayStateMark ()
|
||||
{
|
||||
MARK_TEST_FUN
|
||||
PresentationStateManager stateManager = gui::test::Nexus::getMockStateManager();
|
||||
PresentationStateManager& stateManager = gui::test::Nexus::getMockStateManager();
|
||||
|
||||
MockElm mockA("alpha");
|
||||
// no "bravo" this time
|
||||
|
|
@ -284,8 +288,8 @@ namespace test {
|
|||
CHECK (not mockA.isExpanded());
|
||||
CHECK (not mockC.isTouched());
|
||||
|
||||
stateManager.replay("alpha", "expand");
|
||||
CHECK (mockA.isExpanded);
|
||||
stateManager.replayState ("alpha", "expand");
|
||||
CHECK (mockA.isExpanded());
|
||||
|
||||
auto& uiBus = gui::test::Nexus::testUI();
|
||||
uiBus.mark (mockA.getID(), GenNode{"expand", false});
|
||||
|
|
@ -293,10 +297,10 @@ namespace test {
|
|||
CHECK (not mockA.isExpanded());
|
||||
CHECK (mockA.isTouched());
|
||||
|
||||
stateManager.replayAllState("expand");
|
||||
stateManager.replayAllState ("expand");
|
||||
|
||||
CHECK (mockA.isExpanded);
|
||||
CHECK (not mockC.isExpanded);
|
||||
CHECK (mockA.isExpanded());
|
||||
CHECK (not mockC.isExpanded());
|
||||
CHECK (not mockC.isTouched());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////TODO WIP
|
||||
|
|
|
|||
|
|
@ -546,6 +546,21 @@ namespace test{
|
|||
|
||||
|
||||
|
||||
|
||||
interact::PresentationStateManager&
|
||||
Nexus::useMockStateManager()
|
||||
{
|
||||
UNIMPLEMENTED("install a presentation manager mock and state mark handler");
|
||||
}
|
||||
|
||||
interact::PresentationStateManager&
|
||||
Nexus::getMockStateManager()
|
||||
{
|
||||
UNIMPLEMENTED("access installed Mock presentation manager");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return a defunct BusTerm with up-link to [ZombieNexus]
|
||||
* @remarks useful to create zombie mock UI-Elements for testing.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#include "lib/error.hpp"
|
||||
#include "gui/ctrl/bus-term.hpp"
|
||||
#include "gui/model/tangible.hpp"
|
||||
#include "gui/interact/presentation-state-manager.hpp"
|
||||
#include "test/placeholder-command.hpp"
|
||||
#include "lib/test/event-log.hpp"
|
||||
#include "lib/diff/gen-node.hpp"
|
||||
|
|
@ -96,6 +97,10 @@ namespace test{
|
|||
static void setStateMarkHandler (StateMarkHandler =StateMarkHandler());
|
||||
|
||||
|
||||
static interact::PresentationStateManager& useMockStateManager();
|
||||
static interact::PresentationStateManager& getMockStateManager();
|
||||
|
||||
|
||||
using Cmd = interact::InvocationTrail;
|
||||
|
||||
template<typename...ARGS>
|
||||
|
|
|
|||
Loading…
Reference in a new issue