Lumiera  0.pre.03
»edityourfreedom«
UiManager Class Reference

#include "gui/ctrl/ui-manager.hpp"

Description

The Lumiera UI framework and backbone object.

Initialises the GTK and GLib framework, starts and stops the GTK event loop, and manages global concerns regarding a coherent user interface. Offers access to some global UI resources, and establishes further global services to create workspace windows, to bind menu / command actions and to create interface widgets for working with the the top-level model parts.

Note
UiManager itself is not a model::Controller, and thus not directly connected as a first-class entity to the Bus, but it operates the GlobalCtx, and thus in turn holds the interact::InteractionDirector, which corresponds to the model root.

Definition at line 95 of file ui-manager.hpp.

Public Types

using Operation = std::function< void(void)>
 

Public Member Functions

 UiManager (UiBus &bus)
 Initialise the GTK framework and the Lumiera UI backbone. More...
 
 ~UiManager ()
 
void allowCloseWindow (bool yes)
 
void createApplicationWindow ()
 Set up the first top-level application window. More...
 
void performMainLoop ()
 start the GTK Main loop and thus activate the UI. More...
 
void schedule (Operation &&task)
 perform an action within the UI event loop (GTK loop). More...
 
void terminateUI ()
 Cause the main event loop to terminate, so the application as a whole unwinds. More...
 
void updateWindowFocusRelatedActions ()
 

Private Types

using UIStyle = workspace::UIStyle
 

Private Attributes

unique_ptr< Actionsactions_
 
unique_ptr< Facadefacade_
 
unique_ptr< GlobalCtxglobals_
 
unique_ptr< UIStyleuiStyle_
 

Additional Inherited Members

- Protected Member Functions inherited from ApplicationBase
 ApplicationBase ()
 Initialise the GTK framework libraries. More...
 
 ~ApplicationBase ()
 

Member Typedef Documentation

◆ UIStyle

using UIStyle = workspace::UIStyle
private

Definition at line 99 of file ui-manager.hpp.

◆ Operation

using Operation = std::function<void(void)>

Definition at line 135 of file ui-manager.hpp.

Constructor & Destructor Documentation

◆ UiManager()

UiManager ( UiBus bus)

Initialise the GTK framework and the Lumiera UI backbone.

There is one global UiManager instance, which is created by the Application.

See also
performMainLoop
Remarks
Creating the UiManager initialises the interface globally on application start. It wires the global services and attaches to the UI-Bus, defines the main application menu and binds the corresponding actions. Moreover, the StyleManager register the icon configuration and sizes and loads the icon definitions.

Definition at line 105 of file ui-manager.cpp.

References UiManager::actions_, UiManager::facade_, UiManager::globals_, and UiManager::uiStyle_.

◆ ~UiManager()

~UiManager ( )

Definition at line 64 of file ui-manager.cpp.

Member Function Documentation

◆ createApplicationWindow()

void createApplicationWindow ( )

Set up the first top-level application window.

This triggers the build-up of the user interface widgets.

Remarks
this function is invoked once from the main application object, immediately prior to starting the GTK event loop.

Definition at line 122 of file ui-manager.cpp.

References UiManager::globals_.

◆ performMainLoop()

void performMainLoop ( )

start the GTK Main loop and thus activate the UI.

Run the GTK UI.

Note
this function does not return until UI shutdown.

Also activate the UI the external interfaces.

Remarks
this function is equivalent to calling Gtk::Main::run() In GTK-3.0.3, the implementation is already based on libGIO; after possibly handling command line arguments (which does not apply in our case), it invokes g_main_loop_run(), which in turn ends up polling the main context via g_main_context_iterate(), until the use count drops to zero. This is the "event loop".

Definition at line 139 of file ui-manager.cpp.

References UiManager::facade_, and UiManager::globals_.

◆ terminateUI()

void terminateUI ( )

Cause the main event loop to terminate, so the application as a whole unwinds.

Note
this function can be invoked from an UI event, since it just signals shutdown to the GTK event loop by invoking gtk_main_quit(). The latter will finish processing of the current event and then return from the UiManager::performmainLoop() call, which eventually causes the UI subsystem to signal termination to the Lumiera application as a whole.

Definition at line 157 of file ui-manager.cpp.

Referenced by WindowLocator::on_window_closed(), Actions::populateMainActions(), and NotificationService::triggerGuiShutdown().

+ Here is the caller graph for this function:

◆ schedule()

void schedule ( Operation &&  task)

perform an action within the UI event loop (GTK loop).

Remarks
moves the given operation into our private dispatcher queue and then schedules dequeuing and invocation into the UI event thread.
Parameters
opa completely closed lambda or functor
Warning
closure need to be by value or equivalent, since the operation will be executed within another call stack

Definition at line 171 of file ui-manager.cpp.

◆ updateWindowFocusRelatedActions()

void updateWindowFocusRelatedActions ( )
Todo:
find a solution how to enable/disable menu entries according to focus /////////////////////////////////////////////////TICKET #1076 find out how to handle this properly

Definition at line 178 of file ui-manager.cpp.

References UiManager::actions_, and UiManager::globals_.

Referenced by WorkspaceWindow::createUI().

+ Here is the caller graph for this function:

◆ allowCloseWindow()

void allowCloseWindow ( bool  yes)

Definition at line 186 of file ui-manager.cpp.

Referenced by WindowLocator::updateCloseWindowInMenus().

+ Here is the caller graph for this function:

Member Data Documentation

◆ globals_

◆ uiStyle_

unique_ptr<UIStyle> uiStyle_
private

Definition at line 102 of file ui-manager.hpp.

Referenced by UiManager::UiManager().

◆ actions_

unique_ptr<Actions> actions_
private

◆ facade_

unique_ptr<Facade> facade_
private

Definition at line 104 of file ui-manager.hpp.

Referenced by UiManager::performMainLoop(), and UiManager::UiManager().

+ Inheritance diagram for UiManager:
+ Collaboration diagram for UiManager:

The documentation for this class was generated from the following files: