4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Abdelrazak Younes
9 * Full author contact details are available in file CREDITS.
17 #include "qt_helpers.h"
20 #include <QDockWidget>
25 /// Dock Widget container for LyX dialogs.
26 /// This template class that encapsulates a given Widget inside a
27 /// QDockWidget and presents a Dialog interface
28 class DockView : public QDockWidget, public Dialog
32 GuiView & parent, ///< the main window where to dock.
33 std::string const & name, ///< dialog identifier.
34 Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
35 Qt::WindowFlags flags = 0
37 : QDockWidget(&parent, flags), Dialog(parent), name_(name)
39 if (flags & Qt::Drawer)
40 setFeatures(QDockWidget::NoDockWidgetFeatures);
41 parent.addDockWidget(area, this);
44 virtual ~DockView() {}
46 /// Dialog inherited methods
49 void hideView() { QDockWidget::hide(); }
50 void showData(std::string const & data)
52 initialiseParams(data);
57 updateView(); // make sure its up-to-date
60 bool isVisibleView() const { return QDockWidget::isVisible(); }
61 void checkStatus() { updateView(); }
62 void updateData(std::string const & data)
64 initialiseParams(data);
67 bool isClosing() const { return false; }
68 std::string name() const { return name_; }