]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImplementation.h
Clean up quit code.
[lyx.git] / src / frontends / qt4 / GuiImplementation.h
1 // -*- C++ -*-
2 /**
3  * \file GuiImplementation.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef GUI_H
14 #define GUI_H
15
16 #include "frontends/Gui.h"
17
18 #include <QObject>
19
20 #include <map>
21
22 class LyXView;
23
24 namespace lyx {
25 namespace frontend {
26
27 class GuiWorkArea;
28 class GuiView;
29
30 /**
31  * The GuiImplementation class is the interface to all Qt4 components.
32  */
33 class GuiImplementation: public QObject, public Gui
34 {
35         Q_OBJECT
36
37 public:
38         GuiImplementation();
39         virtual ~GuiImplementation() {}
40
41
42         virtual LyXView& createRegisteredView();
43         virtual bool closeAllViews();
44         virtual bool unregisterView(int id);
45
46         virtual LyXView& view(int id) const;
47
48         virtual int newWorkArea(unsigned int width, unsigned int height, int view_id);
49         virtual WorkArea& workArea(int id);
50
51 private:
52
53         /// Multiple views container.
54         /**
55         * Warning: This must not be a smart pointer as the destruction of the
56         * object is handled by Qt when the view is closed 
57         * \sa Qt::WA_DeleteOnClose attribute.
58         */
59         std::map<int, GuiView *> views_;
60
61         /// Multiple workareas container.
62         /**
63         * Warning: This must not be a smart pointer as the destruction of the
64         * object is handled by Qt when its parent view is closed.
65         */
66         std::map<int, GuiWorkArea *> work_areas_;
67         ///
68
69         /// view of a buffer. Eventually there will be several.
70         std::map<int, boost::shared_ptr<BufferView> > buffer_views_;
71
72
73         std::vector<int> const & workAreaIds();
74
75         std::vector<int> work_area_ids_;
76 };
77
78 } // namespace frontend
79 } // namespace lyx
80
81 #endif // GUI_H