Mercurial > octave
annotate libgui/src/dw-main-window.h @ 25398:a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
* dw-main-window.cc/h (dw_main_window): new class derived from QMainWindow
with action and shortcuts for closing dock widgets;
(createPopupMenu): add new actions to the popup menu of QMainWindow;
(add_action): convenience function for adding an action;
(notice_settings): update the shortcuts from the settings file;
(request_close): slot for closing active widget;
(request_close_other): slot for closing other widgets;
(request_close_all_files): slot for closing all widgets;
* module.mk: add new files dw-main-window.cc/h
* variable-editor.cc (variable_editor): use new class dw_main_window;
(notice_settings): update settings of dw_main_window
* variable-editor.h: use dw_main_window instead of QMainWindow
author | Torsten <mttl@mailbox.org> |
---|---|
date | Tue, 22 May 2018 22:41:12 +0200 |
parents | |
children | ad3d018e595f |
rev | line source |
---|---|
25398
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
1 /* |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
2 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
3 Copyright (C) 2013-2018 Torsten <mttl@mailbox.org> |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
4 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
6 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
10 (at your option) any later version. |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
11 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
15 GNU General Public License for more details. |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
16 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
20 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
21 */ |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
22 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
23 #if ! defined (dw_main_window_h) |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
24 #define dw_main_window_h 1 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
25 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
26 #include <QMainWindow> |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
27 #include <QSettings> |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
28 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
29 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
30 namespace octave |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
31 { |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
32 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
33 class dw_main_window : public QMainWindow |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
34 { |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
35 Q_OBJECT |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
36 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
37 public: |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
38 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
39 dw_main_window (QWidget *parent = nullptr); |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
40 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
41 ~dw_main_window (void) = default; |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
42 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
43 // No copying! |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
44 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
45 dw_main_window (const dw_main_window&) = delete; |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
46 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
47 dw_main_window& operator = (const dw_main_window&) = delete; |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
48 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
49 public slots: |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
50 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
51 void notice_settings (const QSettings*); |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
52 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
53 protected slots: |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
54 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
55 virtual QMenu* createPopupMenu (); |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
56 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
57 private slots: |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
58 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
59 void request_close_file (); |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
60 void request_close_all_files (); |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
61 void request_close_other_files (); |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
62 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
63 signals: |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
64 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
65 protected: |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
66 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
67 private: |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
68 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
69 QAction *add_action (QMenu *menu, const QIcon& icon, const QString& text, |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
70 const char *member, QWidget *receiver); |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
71 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
72 QAction *m_close_action; |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
73 QAction *m_close_all_action; |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
74 QAction *m_close_others_action; |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
75 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
76 }; |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
77 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
78 } |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
79 |
a78e5b8d5ee7
provide shortcuts for closing widgets of the variable editor (bug #53002)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
80 #endif |