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