Mercurial > octave
annotate libgui/src/tab-bar.h @ 33359:689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
* libgui/graphics/BaseControl.cc, libgui/graphics/Canvas.cc,
libgui/graphics/Figure.cc, libgui/graphics/FigureWindow.cc,
libgui/graphics/FigureWindow.h, libgui/graphics/QtHandlesUtils.cc,
libgui/graphics/Table.h, libgui/graphics/annotation-dialog.cc,
libgui/graphics/gl-select.cc, libgui/src/command-widget.cc,
libgui/src/dialog.cc, libgui/src/documentation-bookmarks.cc,
libgui/src/documentation.cc, libgui/src/dw-main-window.cc,
libgui/src/files-dock-widget.cc, libgui/src/gui-settings.cc,
libgui/src/gui-settings.h, libgui/src/gui-utils.cc,
libgui/src/led-indicator.cc, libgui/src/m-editor/file-editor-tab.cc,
libgui/src/m-editor/find-dialog.cc, libgui/src/m-editor/octave-qscintilla.cc,
libgui/src/main-window.cc, libgui/src/main-window.h,
libgui/src/octave-dock-widget.cc, libgui/src/set-path-dialog.cc,
libgui/src/set-path-model.cc, libgui/src/settings-dialog.cc,
libgui/src/tab-bar.cc, libgui/src/tab-bar.h,
libgui/src/terminal-dock-widget.cc, libgui/src/variable-editor-model.cc,
libgui/src/variable-editor-model.h, libgui/src/variable-editor.cc,
libgui/src/workspace-model.h, libgui/src/workspace-view.cc:
Use Octave coding convention of space between function name and parentheses.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 08 Apr 2024 14:39:40 -0700 |
parents | 2e484f9f1f18 |
children | 7f18c537e101 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31771
diff
changeset
|
3 // Copyright (C) 2018-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
25 |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
26 // This file implements a tab bar derived from QTabBar with a contextmenu |
27893
465ac679e976
Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents:
27412
diff
changeset
|
27 // and possibility to close a tab via double-left or middle mouse click. |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
28 |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
29 #if ! defined (octave_tab_bar_h) |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
30 #define octave_tab_bar_h 1 |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
31 |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
32 #include <QMenu> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27330
diff
changeset
|
33 #include <QMouseEvent> |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
34 #include <QSize> |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
35 #include <QStyleOptionTab> |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
36 #include <QStylePainter> |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
37 #include <QTabBar> |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
38 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
39 OCTAVE_BEGIN_NAMESPACE(octave) |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
40 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
41 // Subclassed QTabBar for usable tab-bar, rotated tabs and |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
42 // reimplemented mouse event |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
43 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
44 class tab_bar : public QTabBar |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
45 { |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
46 Q_OBJECT |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
47 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
48 public: |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
49 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
50 tab_bar (QWidget *p); |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
51 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
52 ~tab_bar () = default; |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
53 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
54 void set_rotated (int rotated); |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
55 QMenu * get_context_menu () { return m_context_menu; }; |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
56 QSize tabSizeHint (int idx) const; |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
57 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
58 signals: |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
59 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
60 void close_current_tab_signal (bool); |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
61 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
62 public slots: |
24724
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
63 |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
64 void switch_left_tab (); |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
65 void switch_right_tab (); |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
66 void move_tab_left (); |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
67 void move_tab_right (); |
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
68 void sort_tabs_alph (); |
24724
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
69 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
70 private slots: |
29465
0e9319d40977
add all open tabs to the context menu of the editor tabs (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
71 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
72 void ctx_menu_activated (QAction *a); |
29465
0e9319d40977
add all open tabs to the context menu of the editor tabs (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29358
diff
changeset
|
73 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
74 protected: |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
75 |
33359
689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents:
32632
diff
changeset
|
76 void paintEvent (QPaintEvent *e); |
689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents:
32632
diff
changeset
|
77 void mousePressEvent (QMouseEvent *event); |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
78 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
79 private: |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
80 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
81 void switch_tab (int direction, bool movetab = false); |
24724
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
82 |
31648
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
83 QMenu *m_context_menu; |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
84 QList <QAction *> m_ctx_actions; |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
85 int m_rotated; |
29d734430e5f
maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents:
31646
diff
changeset
|
86 }; |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
87 |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
88 OCTAVE_END_NAMESPACE(octave) |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
89 |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
90 #endif |