]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/panelstack.h
fd3ceee26f214928c44891e290f1e11dff515a37
[lyx.git] / src / frontends / qt2 / 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  *
9  * Full author contact details are available in file CREDITS.
10  */
11 #ifndef PANELSTACK_H
12 #define PANELSTACK_H
13
14 #include <qwidget.h>
15
16 #include <map>
17
18 class QListView;
19 class QListViewItem;
20 class QWidgetStack;
21
22 class PanelStack : public QWidget
23 {
24         Q_OBJECT
25 public:
26         PanelStack(QWidget * parent = 0, const char * name = "panelstack");
27
28         /// add a category with no associated panel
29         void addCategory(std::string const & name, std::string const & parent = std::string());
30
31         /// add a widget panel with a given name, under the given parent
32         void addPanel(QWidget * panel, std::string const & name, std::string const & parent = std::string());
33
34         /// set current panel by logical name
35         void setCurrentPanel(std::string const &);
36
37 public slots:
38         /// set current panel from an item
39         void switchPanel(QListViewItem * i);
40
41 private:
42         typedef std::map<std::string, QListViewItem *> PanelMap;
43
44         PanelMap panel_map_;
45
46         typedef std::map<QListViewItem *, QWidget *> WidgetMap;
47
48         WidgetMap widget_map_;
49
50         /// contains the items
51         QListView * list_;
52
53         /// contains the panes
54         QWidgetStack * stack_;
55 };
56
57 #endif // PANELSTACK_H