Olive
collapsiblewidget.h
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 
55  CheckboxEx* enabled_check;
56  bool selected;
57  QWidget* contents;
58  CollapsibleWidgetHeader* title_bar;
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
Definition: collapsiblewidget.h:45
Definition: checkboxex.h:26
Definition: collapsiblewidget.h:33