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