Olive
collapsiblewidget.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef COLLAPSIBLEWIDGET_H
22 #define COLLAPSIBLEWIDGET_H
23 
24 #include <QWidget>
25 class QLabel;
26 class QCheckBox;
27 class QHBoxLayout;
28 class QVBoxLayout;
29 class QPushButton;
30 class QFrame;
31 class CheckboxEx;
32 
33 class CollapsibleWidgetHeader : public QWidget {
34  Q_OBJECT
35 public:
36  CollapsibleWidgetHeader(QWidget* parent = 0);
37  bool selected;
38 protected:
39  void mousePressEvent(QMouseEvent* event);
40  void paintEvent(QPaintEvent *event);
41 signals:
42  void select(bool, bool);
43 };
44 
45 class CollapsibleWidget : public QWidget
46 {
47  Q_OBJECT
48 public:
49  CollapsibleWidget(QWidget* parent = 0);
50  void setContents(QWidget* c);
51  void setText(const QString &);
52  bool is_focused();
53  bool is_expanded();
54 
56  bool selected;
57  QWidget* contents;
59 private:
60  QLabel* header;
61  QVBoxLayout* layout;
62  QPushButton* collapse_button;
63  QFrame* line;
64  QHBoxLayout* title_bar_layout;
65  void set_button_icon(bool open);
66 
67 signals:
68  void deselect_others(QWidget*);
69  void visibleChanged();
70 
71 private slots:
72  void on_enabled_change(bool b);
73  void on_visible_change();
74 
75 public slots:
76  void header_click(bool s, bool deselect);
77 };
78 
79 #endif // COLLAPSIBLEWIDGET_H
bool is_focused()
Definition: collapsiblewidget.cpp:82
CollapsibleWidgetHeader * title_bar
Definition: collapsiblewidget.h:58
Definition: collapsiblewidget.h:45
bool is_expanded()
Definition: collapsiblewidget.cpp:87
bool selected
Definition: collapsiblewidget.h:56
void paintEvent(QPaintEvent *event)
Definition: collapsiblewidget.cpp:135
void header_click(bool s, bool deselect)
Definition: collapsiblewidget.cpp:69
CollapsibleWidget(QWidget *parent=0)
Definition: collapsiblewidget.cpp:37
QLabel * header
Definition: collapsiblewidget.h:60
void on_enabled_change(bool b)
Definition: collapsiblewidget.cpp:109
Definition: checkboxex.h:26
QPushButton * collapse_button
Definition: collapsiblewidget.h:62
Definition: collapsiblewidget.h:33
void select(bool, bool)
void deselect_others(QWidget *)
void set_button_icon(bool open)
Definition: collapsiblewidget.cpp:91
CheckboxEx * enabled_check
Definition: collapsiblewidget.h:55
QWidget * contents
Definition: collapsiblewidget.h:57
QVBoxLayout * layout
Definition: collapsiblewidget.h:61
CollapsibleWidgetHeader(QWidget *parent=0)
Definition: collapsiblewidget.cpp:119
void mousePressEvent(QMouseEvent *event)
Definition: collapsiblewidget.cpp:123
void setText(const QString &)
Definition: collapsiblewidget.cpp:105
QFrame * line
Definition: collapsiblewidget.h:63
QHBoxLayout * title_bar_layout
Definition: collapsiblewidget.h:64
bool selected
Definition: collapsiblewidget.h:37
void setContents(QWidget *c)
Definition: collapsiblewidget.cpp:95
void on_visible_change()
Definition: collapsiblewidget.cpp:113