annotate libgui/src/octave-dock-widget.h @ 24014:bffd7d826887

style fixes for some GUI source files * files-dock-widget.cc, files-dock-widget.h, octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc, octave-dock-widget.h, resource-manager.cc, resource-manager.h, shortcut-manager.cc, shortcut-manager.h, variable-editor-model.cc, variable-editor-model.h, variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h: Use m_ prefix for member variables, order functions consistently in header and source files, and follow more Octave coding conventions.
author John W. Eaton <jwe@octave.org>
date Wed, 06 Sep 2017 12:53:28 -0400
parents 21baad6b35c4
children 1d6c940a1b37
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
1 /*
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 2012-2017 Richard Crozier
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
4
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
5 This file is part of Octave.
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
6
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
10 (at your option) any later version.
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22417
diff changeset
15 GNU General Public License for more details.
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
16
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
20
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
21 */
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20186
diff changeset
23 #if ! defined (octave_octave_dock_widget_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17790
diff changeset
24 #define octave_octave_dock_widget_h 1
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
25
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
26 #include <QDockWidget>
16611
999400bebe5e move more common code from dock widgets into octave-dock-widget.h
Torsten <ttl@justmail.de>
parents: 16461
diff changeset
27 #include <QSettings>
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
28 #include <QIcon>
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
29 #include <QMainWindow>
18180
b3838cedfe04 redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
30 #include <QToolButton>
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
31 #include <QMouseEvent>
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
32
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
33 class octave_dock_widget : public QDockWidget
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
34 {
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
35 Q_OBJECT
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
36
16461
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
37 public:
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
38
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23446
diff changeset
39 octave_dock_widget (QWidget *p = nullptr);
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
40
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
41 virtual ~octave_dock_widget (void) = default;
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
42
16809
84505f200e05 fix checked state of window menu entries at startup (bug #39322)
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
43 virtual void connect_visibility_changed (void);
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
44
16818
caf3d2a45da0 clean up some code for undocking and docking widgets
Torsten <ttl@justmail.de>
parents: 16809
diff changeset
45 void make_window (void);
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 16881
diff changeset
46 void make_widget (bool dock=true);
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
47 void set_title (const QString&);
19983
643de08e524c save and restore previously active widget in a tabbed stack (bug #42980)
Torsten <ttl@justmail.de>
parents: 19945
diff changeset
48 void set_predecessor_widget (octave_dock_widget *prev_widget);
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
49
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
50 signals:
16461
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
51
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
52 /** Custom signal that tells whether a user has clicked away
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
53 * that dock widget, i.e the active dock widget has
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
54 * changed. */
16340
045ce3896e3f Stop compilation warning about signal function declared virtual.
Rik <rik@octave.org>
parents: 16057
diff changeset
55 void active_changed (bool active);
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
56
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
57 protected:
16461
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
58
19983
643de08e524c save and restore previously active widget in a tabbed stack (bug #42980)
Torsten <ttl@justmail.de>
parents: 19945
diff changeset
59 virtual void closeEvent (QCloseEvent *e);
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
60
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
61 QWidget * focusWidget (void);
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
62
16461
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
63 public slots:
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
64
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
65 virtual void focus (void)
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
66 {
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
67 if (! isVisible ())
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
68 setVisible (true);
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
69
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
70 setFocus ();
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
71 activateWindow ();
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
72 raise ();
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
73 }
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
74
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
75 virtual void handle_visibility (bool visible)
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
76 {
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
77 if (visible && ! isFloating ())
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
78 focus ();
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
79 }
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
80
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
81 virtual void notice_settings (const QSettings*) { }
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
82
18180
b3838cedfe04 redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
83 void handle_settings (const QSettings*);
16611
999400bebe5e move more common code from dock widgets into octave-dock-widget.h
Torsten <ttl@justmail.de>
parents: 16461
diff changeset
84
19423
d93293218966 custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents: 19360
diff changeset
85 void handle_active_dock_changed (octave_dock_widget*, octave_dock_widget*);
d93293218966 custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents: 19360
diff changeset
86
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
87 QMainWindow * main_win (void) { return m_parent; }
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
88
22177
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 20986
diff changeset
89 void save_settings (void);
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 20986
diff changeset
90
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
91 protected slots:
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
92
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
93 /** Slot to steer changing visibility from outside. */
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
94 virtual void handle_visibility_changed (bool visible)
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
95 {
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
96 if (visible)
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
97 emit active_changed (true);
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
98 }
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
99
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
100 /** slots to handle copy & paste */
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
101 virtual void copyClipboard (void) { }
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
102 virtual void pasteClipboard (void) { }
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
103 virtual void selectAll (void) { }
19945
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19918
diff changeset
104 /** slots to handle undo */
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
105 virtual void do_undo (void) { }
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
106
19360
2f9d9663b6b0 fix double clicks into the borders of floating dock widgets (bug #43662)
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
107 // event filter for double clicks into the window decoration elements
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22868
diff changeset
108 bool eventFilter (QObject *obj, QEvent *e);
19360
2f9d9663b6b0 fix double clicks into the borders of floating dock widgets (bug #43662)
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
109
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
110 private slots:
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
111
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
112 void change_floating (bool);
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
113 void change_visibility (bool);
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
114
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
115 private:
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
116
19423
d93293218966 custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents: 19360
diff changeset
117 void set_style (bool active);
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
118 void set_focus_predecessor (void);
19423
d93293218966 custom style of dock widget title bars depending on focus (bug #43837)
Torsten <ttl@justmail.de>
parents: 19360
diff changeset
119
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
120 QMainWindow *m_parent; // store the parent since we are reparenting to 0
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
121 bool m_floating;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
122 bool m_custom_style;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
123 int m_title_3d;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
124 int m_icon_size;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
125 QColor m_bg_color;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
126 QColor m_bg_color_active;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
127 QColor m_fg_color;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
128 QColor m_fg_color_active;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
129 QString m_icon_color;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
130 QString m_icon_color_active;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
131 octave_dock_widget *m_predecessor_widget;
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16611
diff changeset
132
18180
b3838cedfe04 redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
133 #if defined (Q_OS_WIN32)
24014
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
134 QWidget *m_title_widget;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
135 QToolButton *m_dock_button;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
136 QToolButton *m_close_button;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
137 QAction *m_dock_action;
bffd7d826887 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
138 QAction *m_close_action;
18180
b3838cedfe04 redesign of dock widgets title bar with configurable colors
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
139 #endif
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
140 };
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
diff changeset
141
16461
094bd3627ead move common functionality to octave_dock_widget base class
John W. Eaton <jwe@octave.org>
parents: 16340
diff changeset
142 #endif