Lumiera  0.pre.03
»edit your freedom«
UiManager Class Reference

#include "stage/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 97 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...
 
void allowCloseWindow (bool yes)
 
void configureStyle (timeline::TimelineWidget const &)
 
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...
 

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 104 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 121 of file ui-manager.cpp.

◆ 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 138 of file ui-manager.cpp.

◆ 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 156 of file ui-manager.cpp.

Referenced by 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 170 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 177 of file ui-manager.cpp.

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

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