]> git.lyx.org Git - lyx.git/blob - src/frontends/qt3/GuiImplementation.h
This is the merging of the GUI API cleanup branch that was developed in svn+ssh:...
[lyx.git] / src / frontends / qt3 / GuiImplementation.h
1 // -*- C++ -*-
2 /**
3  * \file qt3/Gui.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 GUI_IMPLEMENTATION_H
13 #define GUI_IMPLEMENTATION_H
14
15 #include "frontends/Gui.h"
16 #include "frontends/LyXView.h"
17
18 #include "qscreen.h"
19 #include "QWorkArea.h"
20
21 #include "GuiClipboard.h"
22 #include "GuiWorkArea.h"
23
24 #include <boost/shared_ptr.hpp>
25
26 namespace lyx {
27 namespace frontend {
28
29 typedef QScreen FScreen;
30 typedef QWorkArea FWorkArea;
31
32 /**
33  * The Gui class is the interface to all Qt3 components.
34  */
35 class GuiImplementation: public lyx::frontend::Gui
36 {
37 public:
38         GuiImplementation(LyXView & owner): owner_(owner)
39         {
40         }
41
42         virtual ~GuiImplementation()
43         {
44         }
45
46         lyx::frontend::Clipboard& clipboard()
47         {
48                 return *clipboard_;
49         }
50
51         int newWorkArea(int w, int h)
52         {
53                 old_work_area_.reset(new FWorkArea(owner_, w, h));
54                 old_screen_.reset(new FScreen(*old_work_area_.get()));
55                 work_area_.reset(new GuiWorkArea(owner_, w, h, old_screen_.get(), old_work_area_.get()));
56                 clipboard_.reset(new GuiClipboard(old_work_area_.get()));
57                 guiCursor().connect(work_area_.get());
58         }
59
60         lyx::frontend::WorkArea& workArea(int id)
61         {
62                 return *work_area_;
63         }
64
65         void destroyWorkArea(int id)
66         {
67                 clipboard_.reset();
68                 work_area_.reset();
69                 old_work_area_.reset();
70                 old_screen_.reset();
71         }
72
73 private:
74         ///
75         boost::shared_ptr<GuiClipboard> clipboard_;
76         ///
77         boost::shared_ptr<GuiWorkArea> work_area_;
78         ///
79         boost::shared_ptr<FWorkArea> old_work_area_;
80         ///
81         boost::shared_ptr<FScreen> old_screen_;
82         ///
83         LyXView & owner_;
84 };
85
86 } // namespace frontend
87 } // namespace lyx
88
89 #endif // GUI_IMPLEMENTATION_H