GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
tab-bar.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2018-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 // This file implements a tab bar derived from QTabBar with a contextmenu
27 // and possibility to close a tab via double-left or middle mouse click.
28 
29 #if ! defined (octave_tab_bar_h)
30 #define octave_tab_bar_h 1
31 
32 #include <QMenu>
33 #include <QMouseEvent>
34 #include <QTabBar>
35 
36 namespace octave
37 {
38  // Subclassed QTabBar for usable tab-bar and reimplemented mouse event
39 
40  class tab_bar : public QTabBar
41  {
42  Q_OBJECT
43 
44  public:
45 
46  tab_bar (QWidget *p);
47 
48  ~tab_bar (void);
49 
50  QMenu *get_context_menu (void) { return m_context_menu; };
51 
52  signals:
53 
55 
56  public slots:
57 
58  void switch_left_tab (void);
59  void switch_right_tab (void);
60  void move_tab_left (void);
61  void move_tab_right (void);
62  void sort_tabs_alph (void);
63 
64  protected:
65 
66  void mousePressEvent(QMouseEvent *event);
67 
68  private:
69 
71 
72  void switch_tab (int direction, bool movetab = false);
73  };
74 }
75 
76 #endif
void close_current_tab_signal(bool)
QMenu * get_context_menu(void)
Definition: tab-bar.h:50
void mousePressEvent(QMouseEvent *event)
Definition: tab-bar.cc:134
void switch_left_tab(void)
Definition: tab-bar.cc:47
void move_tab_left(void)
Definition: tab-bar.cc:57
void switch_tab(int direction, bool movetab=false)
Definition: tab-bar.cc:71
QMenu * m_context_menu
Definition: tab-bar.h:70
tab_bar(QWidget *p)
Definition: tab-bar.cc:37
void sort_tabs_alph(void)
Definition: tab-bar.cc:96
void switch_right_tab(void)
Definition: tab-bar.cc:52
void move_tab_right(void)
Definition: tab-bar.cc:64
~tab_bar(void)
Definition: tab-bar.cc:41