diff libgui/src/main-window.cc @ 27669:271b5cd640d7

Add functions to show GUI windows (bug #57213) * event-manager.h (interpreter_events::focus_window): New empty method. (event_manager::focus_window): New vistual method that executes the instance's focus_window method. * event_manager.cc (commandwindow, commandhistory, filebrowser, workspace): New builtin interpreter functions. * qt-interpreter-events.[h, cc] (qt_interpreter_events::focus_window_signal): New signal. (qt_interpreter_events::focus_window): Implements event_manager::focus_window, emits focus_window_signal. * main-window.[h, cc] (main_window::focus_window): New slot that activates the named window. * octave-qobject.cc (gui_qobject::gui_qobject): Connect qt_interpreter_events::focus_window_signal to main_window::focus_window. * __unimplemented__.m: Remove commandwindow, commandhistory, filebrowser, and workspace from the list. * gui.txi: Add commandwindow, commandhistory, filebrowser, workspace docstrings.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 12 Nov 2019 14:54:25 +0100
parents a1271c5b621a
children 61883a1a80a1
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Mon Nov 11 20:22:52 2019 +0100
+++ b/libgui/src/main-window.cc	Tue Nov 12 14:54:25 2019 +0100
@@ -266,6 +266,18 @@
     m_command_window->activate ();
   }
 
+  void main_window::focus_window (const QString& win_name)
+  {
+    if (win_name == "command")
+      m_command_window->activate ();
+    else if (win_name == "history")
+      m_history_window->activate ();
+    else if (win_name == "workspace")
+      m_workspace_window->activate ();
+    else if (win_name == "filebrowser")
+      m_file_browser_window->activate ();
+  }
+
   bool main_window::confirm_shutdown (void)
   {
     bool closenow = true;