]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/PanelStack.h
cosmetics
[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 <QWidget>
17 #include <QHash>
18
19 class QTreeWidget;
20 class QTreeWidgetItem;
21 class QStackedWidget;
22
23 namespace lyx {
24 namespace frontend {
25
26
27 class PanelStack : public QWidget
28 {
29         Q_OBJECT
30 public:
31         ///
32         PanelStack(QWidget * parent = 0);
33
34         /// add a category with no associated panel
35         void addCategory(QString const & name, QString const & parent = QString());
36         /// add a widget panel with a given name, under the given parent
37         void addPanel(QWidget * panel, QString const & name,
38                 QString const & parent = QString());
39         /// set current panel by logical name
40         void setCurrentPanel(QString const &);
41         ///
42         QSize sizeHint() const;
43
44 public Q_SLOTS:
45         /// set current panel from an item
46         void switchPanel(QTreeWidgetItem * it, QTreeWidgetItem * previous = 0);
47         /// click on the tree
48         void itemSelected(QTreeWidgetItem *, int);
49
50 private:
51         ///
52         typedef QHash<QString, QTreeWidgetItem *> PanelMap;
53         ///
54         PanelMap panel_map_;
55
56         typedef QHash<QTreeWidgetItem *, QWidget *> WidgetMap;
57
58         WidgetMap widget_map_;
59
60         /// contains the items
61         QTreeWidget * list_;
62
63         /// contains the panes
64         QStackedWidget * stack_;
65 };
66
67 } // namespace frontend
68 } // namespace lyx
69
70 #endif // PANELSTACK_H