]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/PanelStack.h
Account for old versions of Pygments
[lyx.git] / src / frontends / qt4 / 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 QAbstractButton;
22 class QHideEvent;
23 class QLineEdit;
24 class QPushButton;
25 class QStackedWidget;
26 class QTimer;
27 class QTreeWidget;
28 class QTreeWidgetItem;
29
30 namespace lyx {
31 namespace frontend {
32
33
34 class PanelStack : public QWidget
35 {
36         Q_OBJECT
37 public:
38         ///
39         PanelStack(QWidget * parent = 0);
40
41         /// add a category with no associated panel
42         void addCategory(QString const & name, QString const & parent = QString());
43         /// add a widget panel with a given name, under the given parent
44         void addPanel(QWidget * panel, QString const & name,
45                 QString const & parent = QString());
46         /// show or hide panel
47         void showPanel(QString const & name, bool show);
48         /// set current panel by logical name
49         void setCurrentPanel(QString const &);
50         ///
51         bool isCurrentPanel(QString const & name) const;
52         ///
53         QSize sizeHint() const;
54
55 public Q_SLOTS:
56         /// the option filter changed
57         void filterChanged(QString const & search);
58         /// perform the search
59         void search();
60         /// reset the search box
61         void resetSearch();
62         /// set current panel from an item
63         void switchPanel(QTreeWidgetItem * it, QTreeWidgetItem * previous = 0);
64         /// click on the tree
65         void itemSelected(QTreeWidgetItem *, int);
66
67 protected:
68         /// widget hidden
69         void hideEvent(QHideEvent * event);
70
71 private:
72         ///
73         typedef QHash<QString, QTreeWidgetItem *> PanelMap;
74         ///
75         PanelMap panel_map_;
76
77         typedef QHash<QTreeWidgetItem *, QWidget *> WidgetMap;
78
79         WidgetMap widget_map_;
80
81         /// contains the search box
82         FancyLineEdit * search_;
83
84         /// contains the items
85         QTreeWidget * list_;
86
87         /// contains the panes
88         QStackedWidget * stack_;
89
90         // timer to delay the search between options
91         QTimer * delay_search_;
92
93 };
94
95 } // namespace frontend
96 } // namespace lyx
97
98 #endif // PANELSTACK_H