]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/PanelStack.h
Move the buffer related part from GuiView::renameBuffer to Buffer::saveAs.
[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
13 #ifndef PANELSTACK_H
14 #define PANELSTACK_H
15
16 #include <QWidget>
17 #include <QHash>
18
19 class QTreeWidget;
20 class QTreeWidgetItem;
21 class QStackedWidget;
22
23 namespace lyx {
24 namespace frontend {
25
26
27 class PanelStack : public QWidget
28 {
29         Q_OBJECT
30 public:
31         ///
32         PanelStack(QWidget * parent = 0);
33
34         /// add a category with no associated panel
35         void addCategory(QString const & name, QString const & parent = QString());
36         /// add a widget panel with a given name, under the given parent
37         void addPanel(QWidget * panel, QString const & name,
38                 QString const & parent = QString());
39         /// show or hide panel
40         void showPanel(QString const & name, bool show);
41         /// set current panel by logical name
42         void setCurrentPanel(QString const &);
43         ///
44         bool isCurrentPanel(QString const & name) const;
45         ///
46         QSize sizeHint() const;
47
48 public Q_SLOTS:
49         /// set current panel from an item
50         void switchPanel(QTreeWidgetItem * it, QTreeWidgetItem * previous = 0);
51         /// click on the tree
52         void itemSelected(QTreeWidgetItem *, int);
53
54 private:
55         ///
56         typedef QHash<QString, QTreeWidgetItem *> PanelMap;
57         ///
58         PanelMap panel_map_;
59
60         typedef QHash<QTreeWidgetItem *, QWidget *> WidgetMap;
61
62         WidgetMap widget_map_;
63
64         /// contains the items
65         QTreeWidget * list_;
66
67         /// contains the panes
68         QStackedWidget * stack_;
69 };
70
71 } // namespace frontend
72 } // namespace lyx
73
74 #endif // PANELSTACK_H