LMMS
Loading...
Searching...
No Matches
TabBar.h
Go to the documentation of this file.
1/*
2 * TabBar.h - class tabBar
3 *
4 * Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_GUI_TAB_BAR_H
26#define LMMS_GUI_TAB_BAR_H
27
28#include <QBoxLayout>
29#include <QMap>
30#include <QWidget>
31
32#include "lmms_export.h"
33
34
35namespace lmms::gui
36{
37
38
39class TabButton;
40
41
42class LMMS_EXPORT TabBar : public QWidget
43{
44 Q_OBJECT
45public:
46 TabBar( QWidget * _parent,
47 QBoxLayout::Direction _dir = QBoxLayout::LeftToRight );
48 ~TabBar() override = default;
49
50 TabButton * addTab( QWidget * _w, const QString & _text,
51 int _id, bool _add_stretch = false,
52 bool _text_is_tooltip = false,
53 // TODO Remove fixWidgetToParentSize once it is used
54 // with false everywhere.
55 // At the time of writing it is only used in
56 // LadspaBrowser with default parameters.
57 bool fixWidgetToParentSize = true );
58 void removeTab( int _id );
59
60 inline void setExclusive( bool _on )
61 {
62 m_exclusive = _on;
63 }
64
65 int activeTab();
66
67
68public slots:
69 void setActiveTab( int _id );
70
71
72protected:
73 bool tabState( int _id );
74 void setTabState( int _id, bool _checked );
75 bool allHidden();
76
77
78protected slots:
79 void hideAll( int _exception = -1 );
80 void tabClicked( int _id );
81
82
83private:
84 QMap<int, QPair<TabButton *, QWidget *> > m_tabs;
85 QBoxLayout * m_layout;
87
88
89signals:
92
93} ;
94
95
96} // namespace lmms::gui
97
98#endif // LMMS_GUI_TAB_BAR_H
QBoxLayout * m_layout
Definition TabBar.h:85
QMap< int, QPair< TabButton *, QWidget * > > m_tabs
Definition TabBar.h:84
void setExclusive(bool _on)
Definition TabBar.h:60
TabButton * addTab(QWidget *_w, const QString &_text, int _id, bool _add_stretch=false, bool _text_is_tooltip=false, bool fixWidgetToParentSize=true)
Definition TabBar.cpp:45
void removeTab(int _id)
Definition TabBar.cpp:98
bool m_exclusive
Definition TabBar.h:86
TabBar(QWidget *_parent, QBoxLayout::Direction _dir=QBoxLayout::LeftToRight)
Definition TabBar.cpp:34
~TabBar() override=default
Definition TabButton.h:35
Definition AudioPortAudio.cpp:223