2003-03-28 01:21:42 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file panelstack.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-03-28 01:21:42 +00:00
|
|
|
*/
|
|
|
|
#ifndef PANELSTACK_H
|
|
|
|
#define PANELSTACK_H
|
|
|
|
|
|
|
|
#include <qwidget.h>
|
|
|
|
|
|
|
|
#include <map>
|
2003-10-06 19:57:16 +00:00
|
|
|
#include <string>
|
2003-03-28 01:21:42 +00:00
|
|
|
|
|
|
|
class QListView;
|
|
|
|
class QListViewItem;
|
|
|
|
class QWidgetStack;
|
|
|
|
|
|
|
|
class PanelStack : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PanelStack(QWidget * parent = 0, const char * name = "panelstack");
|
|
|
|
|
|
|
|
/// add a category with no associated panel
|
2003-10-06 15:43:21 +00:00
|
|
|
void addCategory(std::string const & name, std::string const & parent = std::string());
|
2003-03-28 01:21:42 +00:00
|
|
|
|
|
|
|
/// add a widget panel with a given name, under the given parent
|
2003-10-06 15:43:21 +00:00
|
|
|
void addPanel(QWidget * panel, std::string const & name, std::string const & parent = std::string());
|
2003-03-28 01:21:42 +00:00
|
|
|
|
|
|
|
/// set current panel by logical name
|
2003-10-06 15:43:21 +00:00
|
|
|
void setCurrentPanel(std::string const &);
|
2003-03-28 01:21:42 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
/// set current panel from an item
|
|
|
|
void switchPanel(QListViewItem * i);
|
|
|
|
|
|
|
|
private:
|
2003-10-06 15:43:21 +00:00
|
|
|
typedef std::map<std::string, QListViewItem *> PanelMap;
|
2003-03-28 01:21:42 +00:00
|
|
|
|
|
|
|
PanelMap panel_map_;
|
|
|
|
|
|
|
|
typedef std::map<QListViewItem *, QWidget *> WidgetMap;
|
|
|
|
|
|
|
|
WidgetMap widget_map_;
|
|
|
|
|
|
|
|
/// contains the items
|
|
|
|
QListView * list_;
|
|
|
|
|
|
|
|
/// contains the panes
|
|
|
|
QWidgetStack * stack_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PANELSTACK_H
|