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, public Controller
32 GuiViewBase & 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), name_(name), Controller(this)
39 if (flags & Qt::Drawer)
40 setFeatures(QDockWidget::NoDockWidgetFeatures);
42 parent.addDockWidget(area, this);
45 virtual ~DockView() {}
47 /// Dialog inherited methods
50 void hideView() { QDockWidget::hide(); }
51 void showData(std::string const & data)
53 initialiseParams(data);
58 updateView(); // make sure its up-to-date
61 bool isVisibleView() const { return QDockWidget::isVisible(); }
62 void checkStatus() { updateView(); }
63 void redraw() { redrawView(); }
65 void updateData(std::string const & data)
67 initialiseParams(data);
70 bool isClosing() const { return false; }
71 void partialUpdateView(int /*id*/) {}
72 Controller & controller() { return *this; }
73 std::string name() const { return name_; }