clean-up the WindowManager source (#1064)
in one of the preceding refactorings, I've extracted most of the functionality from WindowManager, to make it more focussed
This commit is contained in:
parent
1cb2567557
commit
a6fb10b9e0
4 changed files with 34 additions and 32 deletions
|
|
@ -101,7 +101,7 @@
|
|||
** This interaction also implies, that the element automatically detaches itself at end of life.
|
||||
** - **act**: send a \ref GenNode representing the action
|
||||
** - **note**: _send_ a GenNode representing the _state mark_
|
||||
** - **mark**: _receive_ a GenNode representing the _feedback_ or a replayed _state mark_
|
||||
** - **mark**: _receive_ a GenNode representing the _feedback,_ a replayed _state mark_ or _generic message._
|
||||
** - **diff**: ask to retrieve a diff, which
|
||||
** - either is an incremental status update
|
||||
** - or is a from-scratch reconfiguration
|
||||
|
|
|
|||
|
|
@ -66,17 +66,21 @@
|
|||
** directed towards individual elements. The interactions at the bus are closely interrelated
|
||||
** with the [elementary UI-Element operations](tangible.hpp).
|
||||
**
|
||||
** - **act**: send a [GenNode] representing the action
|
||||
** - *act*: send a [GenNode] representing the action
|
||||
** - in a first step, a command prototype is [outfitted](\ref InvocationTrail::bind()) with actual
|
||||
** parameter values. -> see [InvocationTrail]
|
||||
** - the actual command invocation is triggered by a ["bang" message](\ref InvocationTrail::bang())
|
||||
** - **note**: send a [GenNode] representing the _state mark;_
|
||||
** - *note*: send a [GenNode] representing the _state mark;_
|
||||
** some (abstracted) presentation state manager is expected to listen to these messages,
|
||||
** possibly recording state to be restored later. The contents of the _state mark_ message
|
||||
** are implementation defined; knowledge about these is shared between individual widget
|
||||
** implementations and (partially, to some degree) the presentation state manager.
|
||||
** - **mark**: down-link communication to _feed back_ state updates or
|
||||
** to replay previously recorded _state marks_
|
||||
** - *mark*: down-link communication to _feed back_ state updates or
|
||||
** to replay previously recorded _state marks._
|
||||
**
|
||||
** @note The *mark* verb can also be used as an (future) extension point to send _generic messages_ --
|
||||
** possibly even to broadcast them to interested subjects, which have been registered with the
|
||||
** \ref Nexus as targeted receivers...
|
||||
**
|
||||
** @warning deliberately the UI-Bus is **not threadsafe**.
|
||||
** Only [Tangible] elements performing in the UI-event thread are allowed to talk to the bus.
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
using util::cStr;
|
||||
using std::list;
|
||||
using std::shared_ptr;
|
||||
|
||||
|
||||
namespace gui {
|
||||
|
|
@ -39,20 +38,21 @@ namespace workspace {
|
|||
|
||||
|
||||
WindowManager::WindowManager (UiManager& uiManager)
|
||||
: uiManager_(uiManager)
|
||||
: uiManager_{uiManager}
|
||||
, windowList_{}
|
||||
{ }
|
||||
|
||||
|
||||
void
|
||||
WindowManager::newWindow (gui::model::Project& source_project, gui::controller::Controller& source_controller)
|
||||
{
|
||||
shared_ptr<WorkspaceWindow> window (new WorkspaceWindow{uiManager_, source_project, source_controller});
|
||||
PWindow window (new WorkspaceWindow{uiManager_, source_project, source_controller});
|
||||
REQUIRE(window);
|
||||
|
||||
window->signal_delete_event().connect(sigc::mem_fun(
|
||||
this, &WindowManager::on_window_closed));
|
||||
|
||||
windowList.push_back(window);
|
||||
windowList_.push_back(window);
|
||||
|
||||
window->show();
|
||||
|
||||
|
|
@ -66,11 +66,11 @@ namespace workspace {
|
|||
REQUIRE(event);
|
||||
REQUIRE(event->window);
|
||||
|
||||
list<shared_ptr<WorkspaceWindow>>::iterator iterator{windowList.begin()};
|
||||
list<PWindow>::iterator iterator{windowList_.begin()};
|
||||
|
||||
while (iterator != windowList.end())
|
||||
while (iterator != windowList_.end())
|
||||
{
|
||||
shared_ptr<WorkspaceWindow> workspace_window(*iterator);
|
||||
PWindow workspace_window(*iterator);
|
||||
REQUIRE(workspace_window);
|
||||
|
||||
Glib::RefPtr<Gdk::Window> window = workspace_window->get_window();
|
||||
|
|
@ -78,13 +78,13 @@ namespace workspace {
|
|||
if (window->gobj() == event->window)
|
||||
{
|
||||
// This window has been closed
|
||||
iterator = windowList.erase(iterator);
|
||||
iterator = windowList_.erase(iterator);
|
||||
}
|
||||
else
|
||||
iterator++;
|
||||
}
|
||||
|
||||
if (windowList.empty())
|
||||
if (windowList_.empty())
|
||||
{
|
||||
// All windows have been closed - we should exit
|
||||
Gtk::Main *main = Gtk::Main::instance(); ////////////////////////////////////////////////TICKET #1032 : use gtk::Application instead of gtk::Main
|
||||
|
|
@ -102,7 +102,7 @@ namespace workspace {
|
|||
void
|
||||
WindowManager::updateCloseWindowInMenus()
|
||||
{
|
||||
uiManager_.allowCloseWindow ( 1 < windowList.size());
|
||||
uiManager_.allowCloseWindow ( 1 < windowList_.size());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,13 @@
|
|||
|
||||
|
||||
/** @file window-manager.hpp
|
||||
** Manager for all application windows and resources.
|
||||
** This file defines the global UI Manager class. The central WindowManager
|
||||
** instance is owned by the GtkLumiera object and initialised in GTK-main.
|
||||
** The WindowManager has the ability to create new windows integrated with
|
||||
** the application framework, to provide Icons and other resources and
|
||||
** to set and access a general UI theme.
|
||||
** Manager for all top level application windows.
|
||||
** The central WindowManager instance is owned by the GtkLumiera object and
|
||||
** initialised in GTK-main. The WindowManager allows to create new windows
|
||||
** integrated with the application framework.
|
||||
**
|
||||
** @see gtk-lumiera.hpp
|
||||
** @see ui-manager.hpp
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -39,9 +38,8 @@
|
|||
#include "gui/gtk-base.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <cairomm/cairomm.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <list>
|
||||
|
||||
|
||||
namespace gui {
|
||||
|
|
@ -54,28 +52,30 @@ namespace workspace {
|
|||
class UiManager;
|
||||
class WorkspaceWindow;
|
||||
|
||||
using std::shared_ptr;
|
||||
using std::string;
|
||||
using std::list;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The centralised manager of all the windows,
|
||||
* icons and resources within Lumiera's GUI.
|
||||
* A centralised manager of all top level application windows.
|
||||
*/
|
||||
class WindowManager
|
||||
: boost::noncopyable
|
||||
{
|
||||
UiManager& uiManager_;
|
||||
using PWindow = shared_ptr<WorkspaceWindow>;
|
||||
|
||||
UiManager& uiManager_;
|
||||
list<PWindow> windowList_;
|
||||
|
||||
|
||||
public:
|
||||
WindowManager (UiManager&);
|
||||
|
||||
/**
|
||||
* Creates a new window connected to a specified project and controller
|
||||
* Create a new window connected to a specified project and controller
|
||||
* @param source_project The project to connect the window to.
|
||||
* @param source_controller The controller to connect the window to.
|
||||
* @todo better way to connect to the model ////////////////////////////////////////////////////TICKET #1048 : rectify UI lifecycle
|
||||
*/
|
||||
void newWindow (gui::model::Project&, gui::controller::Controller&);
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ namespace workspace {
|
|||
private:
|
||||
|
||||
/** Event handler for when a window has been closed */
|
||||
bool on_window_closed(GdkEventAny* event);
|
||||
bool on_window_closed (GdkEventAny* event);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -100,8 +100,6 @@ namespace workspace {
|
|||
|
||||
private:
|
||||
|
||||
std::list<shared_ptr<workspace::WorkspaceWindow>> windowList;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue