diff libinterp/corefcn/event-manager.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 ba317c535adb
children 58bff27d8714
line wrap: on
line diff
--- a/libinterp/corefcn/event-manager.cc	Mon Nov 11 20:22:52 2019 +0100
+++ b/libinterp/corefcn/event-manager.cc	Tue Nov 12 14:54:25 2019 +0100
@@ -591,3 +591,59 @@
   evmgr.copy_image_to_clipboard (file);
   return ovl ();
 }
+
+DEFMETHOD (commandwindow, interp, args, ,
+           doc: /* -*- texinfo -*-
+@deftypefn {} {} commandwindow ()
+Show the the GUI command window and give it the keyboard focus.
+@end deftypefn */)
+{
+  if (args.length () != 0)
+    print_usage ();
+
+  octave::event_manager& evmgr = interp.get_event_manager ();
+  evmgr.focus_window ("command");
+  return ovl ();
+}
+
+DEFMETHOD (commandhistory, interp, args, ,
+           doc: /* -*- texinfo -*-
+@deftypefn {} {} commandhistory ()
+Show the the GUI command history window and give it the keyboard focus.
+@end deftypefn */)
+{
+  if (args.length () != 0)
+    print_usage ();
+
+  octave::event_manager& evmgr = interp.get_event_manager ();
+  evmgr.focus_window ("history");
+  return ovl ();
+}
+
+DEFMETHOD (workspace, interp, args, ,
+           doc: /* -*- texinfo -*-
+@deftypefn {} {} workspace ()
+Show the the GUI workspace window and give it the keyboard focus.
+@end deftypefn */)
+{
+  if (args.length () != 0)
+    print_usage ();
+
+  octave::event_manager& evmgr = interp.get_event_manager ();
+  evmgr.focus_window ("workspace");
+  return ovl ();
+}
+
+DEFMETHOD (filebrowser, interp, args, ,
+           doc: /* -*- texinfo -*-
+@deftypefn {} {} filebrowser ()
+Show the the GUI file browser window and give it the keyboard focus.
+@end deftypefn */)
+{
+  if (args.length () != 0)
+    print_usage ();
+
+  octave::event_manager& evmgr = interp.get_event_manager ();
+  evmgr.focus_window ("filebrowser");
+  return ovl ();
+}