]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/DockView.h
Move <QKeyEvent> from DockView.h
[lyx.git] / src / frontends / qt / 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 "Dialog.h"
16
17 #include <QDockWidget>
18
19 namespace lyx {
20 namespace frontend {
21
22 /// Dock Widget container for LyX dialogs.
23 /**
24  * This template class that encapsulates a given Widget inside a
25  * QDockWidget and presents a Dialog interface
26  * FIXME: create a DockView.cpp file
27  **/
28 class DockView : public QDockWidget, public Dialog
29 {
30         Q_OBJECT
31
32 public:
33         DockView(GuiView & parent, ///< the main window where to dock.
34                  QString const & name, ///< dialog identifier.
35                  QString const & title, ///< dialog title.
36                  Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of
37                                                                                                                            ///the dock (and
38                                                                                                                            ///also drawer)
39                  Qt::WindowFlags flags = 0);
40
41         virtual ~DockView() {}
42
43         QWidget * asQWidget() override { return this; }
44         QWidget const * asQWidget() const override { return this; }
45
46         /// We don't want to restore geometry session for dock widgets.
47         void restoreSession() override {}
48
49         void keyPressEvent(QKeyEvent * ev) override;
50
51         /// Dialog inherited methods
52         //@{
53         void applyView() override {}
54         bool isClosing() const override { return false; }
55         bool needBufferOpen() const override { return false; }
56         //@}
57
58 protected Q_SLOTS:
59         void onBufferViewChanged() override {}
60 };
61
62 } // namespace frontend
63 } // namespace lyx
64
65 #endif // DOCK_VIEW_H