LMMS
Loading...
Searching...
No Matches
SideBarWidget.h
Go to the documentation of this file.
1/*
2 * SideBarWidget.h - base-class for all side-bar-widgets
3 *
4 * Copyright (c) 2004-2009 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_SIDE_BAR_WIDGET_H
26#define LMMS_GUI_SIDE_BAR_WIDGET_H
27
28#include <QPixmap>
29#include <QVBoxLayout>
30#include <QWidget>
31
32class QPushButton;
33
34namespace lmms::gui
35{
36
37
38class SideBarWidget : public QWidget
39{
40 Q_OBJECT
41public:
42 SideBarWidget( const QString & _title, const QPixmap & _icon,
43 QWidget * _parent );
44 ~SideBarWidget() override = default;
45
46 inline const QPixmap & icon() const
47 {
48 return m_icon;
49 }
50 inline const QString & title() const
51 {
52 return m_title;
53 }
54
55signals:
57
58protected:
59 void paintEvent( QPaintEvent * _pe ) override;
60 void resizeEvent( QResizeEvent * _re ) override;
61 void contextMenuEvent( QContextMenuEvent * ) override
62 {
63 }
64
65 QWidget * contentParent()
66 {
67 return m_contents;
68 }
69
70 void addContentWidget( QWidget * _w )
71 {
72 m_layout->addWidget( _w );
73 }
74
75 void addContentLayout( QLayout * _l )
76 {
77 m_layout->addLayout( _l );
78 }
79
80private:
81 QWidget * m_contents;
82 QVBoxLayout * m_layout;
83 QString m_title;
84 QPixmap m_icon;
85 QPushButton * m_closeBtn;
86 const QSize m_buttonSize;
87
88} ;
89
90
91} // namespace lmms::gui
92
93#endif // LMMS_GUI_SIDE_BAR_WIDGET_H
QWidget * m_contents
Definition SideBarWidget.h:81
void paintEvent(QPaintEvent *_pe) override
Definition SideBarWidget.cpp:59
QString m_title
Definition SideBarWidget.h:83
void contextMenuEvent(QContextMenuEvent *) override
Definition SideBarWidget.h:61
QWidget * contentParent()
Definition SideBarWidget.h:65
void addContentWidget(QWidget *_w)
Definition SideBarWidget.h:70
QPixmap m_icon
Definition SideBarWidget.h:84
QVBoxLayout * m_layout
Definition SideBarWidget.h:82
SideBarWidget(const QString &_title, const QPixmap &_icon, QWidget *_parent)
Definition SideBarWidget.cpp:38
const QPixmap & icon() const
Definition SideBarWidget.h:46
void resizeEvent(QResizeEvent *_re) override
Definition SideBarWidget.cpp:82
const QString & title() const
Definition SideBarWidget.h:50
const QSize m_buttonSize
Definition SideBarWidget.h:86
void addContentLayout(QLayout *_l)
Definition SideBarWidget.h:75
~SideBarWidget() override=default
QPushButton * m_closeBtn
Definition SideBarWidget.h:85
Definition AudioPortAudio.cpp:223