]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/DockView.h
0a2f6bb876e02a19e81c2d601bb7065e54c6c455
[lyx.git] / src / frontends / qt4 / DockView.h
1 // -*- C++ -*-
2 /**
3  * \file DockView.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef DOCK_VIEW_H
13 #define DOCK_VIEW_H
14
15 #include "controllers/Dialog.h"
16 #include "qt_helpers.h"
17
18 #include <boost/scoped_ptr.hpp>
19
20 #include <QDockWidget>
21 #include <QMainWindow>
22
23 namespace lyx {
24 namespace frontend {
25
26 /*
27 /// Dock Widget container for LyX dialogs.
28 /// This template class that encapsulates a given Widget inside a
29 /// DockWidget and presents a Dialog::View interface
30 template<class Controller, class Widget>
31 class DockView : public QDockWidget, public Dialog::View
32 {
33 public:
34         DockView(
35                 Dialog & dialog, ///< The (one) parent Dialog class.
36                 Controller * form, ///< Associated model/controller
37                 QMainWindow * parent, ///< the main window where to dock.
38                 docstring const & title, ///< Window title (shown in the top title bar).
39                 Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
40                 Qt::WindowFlags flags = 0
41                 )
42                 : QDockWidget(toqstr(title), parent, flags), 
43                         Dialog::View(dialog, title)
44         {
45                 if (flags & Qt::Drawer)
46                         setFeatures(QDockWidget::NoDockWidgetFeatures);
47                 widget_.reset(new Widget(form));
48                 setWidget(widget_.get());
49                 parent->addDockWidget(area, this);
50         }
51
52         /// Dialog::View inherited methods
53         //@{
54         void applyView() {}
55         void hideView() { QDockWidget::hide(); }
56         void showView() { QDockWidget::show(); }
57         bool isVisibleView() const { return QDockWidget::isVisible(); }
58         void redrawView() {}
59         void updateView()
60         {
61                 widget_->update();
62                 QDockWidget::update();
63         }
64         //@}
65 private:
66         /// The encapsulated widget.
67         boost::scoped_ptr<Widget> widget_;
68 };
69 */
70
71 } // frontend
72 } // lyx
73
74 #endif // TOC_WIDGET_H