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