]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/panelstack.h
If I ever see another licence blurb again, it'll be too soon...
[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 "LString.h"
15
16 #include <qwidget.h>
17
18 #include <map>
19
20 class QListView;
21 class QListViewItem;
22 class QWidgetStack;
23
24 class PanelStack : public QWidget
25 {
26         Q_OBJECT
27 public:
28         PanelStack(QWidget * parent = 0, const char * name = "panelstack");
29
30         /// add a category with no associated panel
31         void addCategory(string const & name, string const & parent = string());
32
33         /// add a widget panel with a given name, under the given parent
34         void addPanel(QWidget * panel, string const & name, string const & parent = string());
35
36         /// set current panel by logical name
37         void setCurrentPanel(string const &);
38
39 public slots:
40         /// set current panel from an item
41         void switchPanel(QListViewItem * i);
42
43 private:
44         typedef std::map<string, QListViewItem *> PanelMap;
45
46         PanelMap panel_map_;
47
48         typedef std::map<QListViewItem *, QWidget *> WidgetMap;
49
50         WidgetMap widget_map_;
51
52         /// contains the items
53         QListView * list_;
54
55         /// contains the panes
56         QWidgetStack * stack_;
57 };
58
59 #endif // PANELSTACK_H