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