UI-top-level: solve several of the previously tricky wiring problems
...this solution feels good thus far
This commit is contained in:
parent
e94b294121
commit
de7e47fa21
5 changed files with 34 additions and 15 deletions
|
|
@ -320,10 +320,8 @@ namespace workspace {
|
|||
|
||||
void
|
||||
onMenu_file_quit()
|
||||
{ //////global -> InteractionDirector
|
||||
Main *main = Main::instance();
|
||||
REQUIRE(main);
|
||||
main->quit();
|
||||
{
|
||||
globalCtx_.uiManager_.terminateUI();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -398,14 +396,13 @@ namespace workspace {
|
|||
void
|
||||
onMenu_window_new_window()
|
||||
{
|
||||
// windowList_.newWindow(); //////////////////////////////////TODO move into UiManager??
|
||||
globalCtx_.windowList_.newWindow();
|
||||
}
|
||||
|
||||
void
|
||||
onMenu_window_close_window()
|
||||
{
|
||||
getWorkspaceWindow().hide();
|
||||
// delete &workspaceWindow;
|
||||
globalCtx_.windowList_.closeWindow();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -110,7 +110,15 @@ namespace workspace {
|
|||
globals_->windowList_.newWindow();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
UiManager::terminateUI()
|
||||
{
|
||||
Gtk::Main *main = Gtk::Main::instance(); /////////////////////////////////////TICKET #1032 : use gtk::Application instead of gtk::Main
|
||||
REQUIRE(main);
|
||||
main->quit();
|
||||
}
|
||||
|
||||
void
|
||||
UiManager::updateWindowFocusRelatedActions()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -116,6 +116,11 @@ namespace workspace {
|
|||
*/
|
||||
void createApplicationWindow();
|
||||
|
||||
/**
|
||||
* Cause the main event loop to terminate, so the application as a whole unwinds.
|
||||
*/
|
||||
void terminateUI();
|
||||
|
||||
/** @todo find a solution how to enable/disable menu entries according to focus
|
||||
* /////////////////////////////////////////////////TICKET #1076 find out how to handle this properly
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -68,6 +68,18 @@ namespace workspace {
|
|||
}
|
||||
|
||||
|
||||
/** close (and thus destroy) the current active window.
|
||||
* @note closing the last window terminates the application
|
||||
* @warning when no window is currently active,
|
||||
* the fist one in list will be killed
|
||||
*/
|
||||
void
|
||||
WindowList::closeWindow()
|
||||
{
|
||||
findActiveWindow().hide();
|
||||
}
|
||||
|
||||
|
||||
/** find and retrieve a WorkspaceWindow (top-level window)
|
||||
* marked as 'active' by GTK.
|
||||
* @return the first matching window, or the first window
|
||||
|
|
@ -132,12 +144,8 @@ namespace workspace {
|
|||
}
|
||||
|
||||
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
|
||||
REQUIRE(main);
|
||||
main->quit();
|
||||
}
|
||||
// All windows have been closed - we should exit
|
||||
globalCtx_.uiManager_.terminateUI();
|
||||
|
||||
updateCloseWindowInMenus();
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ namespace workspace {
|
|||
|
||||
bool empty() const;
|
||||
|
||||
void newWindow ();
|
||||
void newWindow();
|
||||
void closeWindow();
|
||||
|
||||
WorkspaceWindow& findActiveWindow();
|
||||
WorkspaceWindow& findFocusWindow();
|
||||
|
|
|
|||
Loading…
Reference in a new issue