Mercurial > octave
annotate libgui/src/tab-bar.h @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | d4d83344d653 |
children | c6d54dd31a7e |
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 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30398
diff
changeset
|
3 // Copyright (C) 2018-2022 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 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
39 namespace octave |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
40 { |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
41 // Subclassed QTabBar for usable tab-bar, rotated tabs and |
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
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 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
44 class tab_bar : public QTabBar |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
45 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
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 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
48 public: |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
49 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
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 |
29550
8dd0fca2a3d9
where possible, use default destructors in GUI classes
John W. Eaton <jwe@octave.org>
parents:
29467
diff
changeset
|
52 ~tab_bar (void) = default; |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
53 |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
54 void set_rotated (int rotated); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29550
diff
changeset
|
55 QMenu * get_context_menu (void) { return m_context_menu; }; |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
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 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
58 signals: |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
59 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
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 |
24724
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
62 public slots: |
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
63 |
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
64 void switch_left_tab (void); |
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
65 void switch_right_tab (void); |
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
66 void move_tab_left (void); |
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
67 void move_tab_right (void); |
27330
e449134870fb
allow to sort editor tabs alphabetically (bug #42602)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
26376
diff
changeset
|
68 void sort_tabs_alph (void); |
24724
fa60be0abc21
add tab move and switch shortcuts to the doc browser
Torsten <mttl@mailbox.org>
parents:
24718
diff
changeset
|
69 |
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
|
70 private slots: |
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 |
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
|
72 void ctx_menu_activated (QAction *a); |
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 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
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 |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
76 void paintEvent(QPaintEvent *e); |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
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 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
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 |
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
|
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 |
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
|
83 QMenu *m_context_menu; |
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
|
84 QList <QAction *> m_ctx_actions; |
29467
80457383d5e1
allow rotated tabs in the file editor (bug #60276)
Torsten Lilge <ttl-octave@mailbox.org>
parents:
29465
diff
changeset
|
85 int m_rotated; |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
86 }; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24679
diff
changeset
|
87 } |
24679
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
88 |
a3e67a9e7be5
move derived tab bar from editor and doc viewer into separate file
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
89 #endif |