1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2013-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING.  If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_dw_main_window_h)
27 #define octave_dw_main_window_h 1
28 
29 #include <QMainWindow>
30 
31 #include "gui-settings.h"
32 
33 namespace octave
34 {
35   class base_qobject;
36 
37   class dw_main_window : public QMainWindow
38   {
39     Q_OBJECT
40 
41   public:
42 
43     dw_main_window (base_qobject& oct_qboj, QWidget *parent = nullptr);
44 
45     ~dw_main_window (void) = default;
46 
47     // No copying!
48 
49     dw_main_window (const dw_main_window&) = delete;
50 
51     dw_main_window& operator = (const dw_main_window&) = delete;
52 
53   public slots:
54 
55     void notice_settings (const gui_settings *);
56 
57   protected slots:
58 
59     virtual QMenu* createPopupMenu ();
60 
61     virtual bool event (QEvent *ev);
62 
63   private slots:
64 
65     void request_close ();
66     void request_close_all ();
67     void request_close_other ();
68 
69     void request_switch_left ();
70     void request_switch_right ();
71 
72   private:
73 
74     void request_switch (int direction);
75 
76     QAction *add_action (QMenu *menu, const QIcon& icon, const QString& text,
77                          const char *member, QWidget *receiver);
78 
79     base_qobject& m_octave_qobj;
80 
81     QList<QDockWidget *> m_dw_list;
82 
83     QAction *m_close_action;
84     QAction *m_close_all_action;
85     QAction *m_close_others_action;
86 
87     QAction *m_switch_left_action;
88     QAction *m_switch_right_action;
89 
90     QList<QAction *> m_actions_list;
91   };
92 
93 }
94 
95 #endif
96