2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-26 03:53:02 +00:00
|
|
|
* \file PanelStack.h
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
2008-09-21 09:11:21 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#ifndef PANELSTACK_H
|
|
|
|
#define PANELSTACK_H
|
|
|
|
|
2011-06-05 17:54:27 +00:00
|
|
|
#include "FancyLineEdit.h"
|
|
|
|
|
2008-03-05 20:48:19 +00:00
|
|
|
#include <QHash>
|
2011-06-05 17:54:27 +00:00
|
|
|
#include <QWidget>
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2011-06-05 17:54:27 +00:00
|
|
|
class QAbstractButton;
|
|
|
|
class QHideEvent;
|
|
|
|
class QLineEdit;
|
|
|
|
class QPushButton;
|
|
|
|
class QStackedWidget;
|
|
|
|
class QTimer;
|
2006-03-05 17:24:44 +00:00
|
|
|
class QTreeWidget;
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
|
2006-10-30 14:39:05 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
class PanelStack : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2008-03-05 20:48:19 +00:00
|
|
|
///
|
2006-03-05 17:24:44 +00:00
|
|
|
PanelStack(QWidget * parent = 0);
|
|
|
|
|
|
|
|
/// add a category with no associated panel
|
2008-03-05 20:48:19 +00:00
|
|
|
void addCategory(QString const & name, QString const & parent = QString());
|
2006-03-05 17:24:44 +00:00
|
|
|
/// add a widget panel with a given name, under the given parent
|
2008-03-05 20:48:19 +00:00
|
|
|
void addPanel(QWidget * panel, QString const & name,
|
|
|
|
QString const & parent = QString());
|
2010-01-10 14:46:39 +00:00
|
|
|
/// show or hide panel
|
|
|
|
void showPanel(QString const & name, bool show);
|
2006-03-05 17:24:44 +00:00
|
|
|
/// set current panel by logical name
|
2008-03-05 20:48:19 +00:00
|
|
|
void setCurrentPanel(QString const &);
|
|
|
|
///
|
2010-01-10 14:46:39 +00:00
|
|
|
bool isCurrentPanel(QString const & name) const;
|
|
|
|
///
|
2008-03-05 20:48:19 +00:00
|
|
|
QSize sizeHint() const;
|
2007-04-25 16:39:21 +00:00
|
|
|
|
2006-06-30 14:37:33 +00:00
|
|
|
public Q_SLOTS:
|
2011-06-05 17:54:27 +00:00
|
|
|
/// the option filter changed
|
|
|
|
void filterChanged(QString const & search);
|
|
|
|
/// perform the search
|
|
|
|
void search();
|
|
|
|
/// reset the search box
|
|
|
|
void resetSearch();
|
2006-03-05 17:24:44 +00:00
|
|
|
/// set current panel from an item
|
2007-04-25 16:39:21 +00:00
|
|
|
void switchPanel(QTreeWidgetItem * it, QTreeWidgetItem * previous = 0);
|
2008-03-19 18:15:16 +00:00
|
|
|
/// click on the tree
|
|
|
|
void itemSelected(QTreeWidgetItem *, int);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2011-06-05 17:54:27 +00:00
|
|
|
protected:
|
|
|
|
/// widget hidden
|
|
|
|
void hideEvent(QHideEvent * event);
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
private:
|
2008-03-05 20:48:19 +00:00
|
|
|
///
|
|
|
|
typedef QHash<QString, QTreeWidgetItem *> PanelMap;
|
|
|
|
///
|
2006-03-05 17:24:44 +00:00
|
|
|
PanelMap panel_map_;
|
|
|
|
|
2008-03-05 20:48:19 +00:00
|
|
|
typedef QHash<QTreeWidgetItem *, QWidget *> WidgetMap;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
WidgetMap widget_map_;
|
|
|
|
|
2011-06-05 17:54:27 +00:00
|
|
|
/// contains the search box
|
|
|
|
FancyLineEdit * search_;
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
/// contains the items
|
|
|
|
QTreeWidget * list_;
|
|
|
|
|
|
|
|
/// contains the panes
|
|
|
|
QStackedWidget * stack_;
|
2011-06-05 17:54:27 +00:00
|
|
|
|
|
|
|
// timer to delay the search between options
|
|
|
|
QTimer * delay_search_;
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
};
|
|
|
|
|
2006-10-30 14:39:05 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#endif // PANELSTACK_H
|