]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/PanelStack.h
Remove unused forward declarations
[lyx.git] / src / frontends / qt / PanelStack.h
1 // -*- C++ -*-
2 /**
3  * \file PanelStack.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef PANELSTACK_H
14 #define PANELSTACK_H
15
16 #include "FancyLineEdit.h"
17
18 #include <QHash>
19 #include <QWidget>
20
21 class QHideEvent;
22 class QStackedWidget;
23 class QTimer;
24 class QTreeWidget;
25 class QTreeWidgetItem;
26
27 namespace lyx {
28 namespace frontend {
29
30
31 class PanelStack : public QWidget
32 {
33         Q_OBJECT
34 public:
35         ///
36         PanelStack(QWidget * parent = 0);
37
38         /// add a category with no associated panel
39         void addCategory(QString const & name, QString const & parent = QString());
40         /// add a widget panel with a given name, under the given parent
41         void addPanel(QWidget * panel, QString const & name,
42                 QString const & parent = QString());
43         /// show or hide panel
44         void showPanel(QString const & name, bool show);
45         /// set current panel by logical name
46         void setCurrentPanel(QString const &);
47         ///
48         bool isCurrentPanel(QString const & name) const;
49         ///
50         QSize sizeHint() const override;
51
52 public Q_SLOTS:
53         /// the option filter changed
54         void filterChanged(QString const & search);
55         /// perform the search
56         void search();
57         /// reset the search box
58         void resetSearch();
59         /// set current panel from an item
60         void switchPanel(QTreeWidgetItem * it, QTreeWidgetItem * previous = 0);
61         /// click on the tree
62         void itemSelected(QTreeWidgetItem *, int);
63
64 protected:
65         /// widget hidden
66         void hideEvent(QHideEvent * event) override;
67
68 private:
69         ///
70         typedef QHash<QString, QTreeWidgetItem *> PanelMap;
71         ///
72         PanelMap panel_map_;
73
74         typedef QHash<QTreeWidgetItem *, QWidget *> WidgetMap;
75
76         WidgetMap widget_map_;
77
78         /// contains the search box
79         FancyLineEdit * search_;
80
81         /// contains the items
82         QTreeWidget * list_;
83
84         /// contains the panes
85         QStackedWidget * stack_;
86
87         // timer to delay the search between options
88         QTimer * delay_search_;
89
90 };
91
92 } // namespace frontend
93 } // namespace lyx
94
95 #endif // PANELSTACK_H