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