]> git.lyx.org Git - lyx.git/blob - src/frontends/qt3/GuiImplementation.h
* [qt3, xforms, gtk]/GuiImplementation::newWorkArea: return 0
[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                 return 0;
59         }
60
61         lyx::frontend::WorkArea& workArea(int id)
62         {
63                 return *work_area_;
64         }
65
66         void destroyWorkArea(int id)
67         {
68                 clipboard_.reset();
69                 work_area_.reset();
70                 old_work_area_.reset();
71                 old_screen_.reset();
72         }
73
74 private:
75         ///
76         boost::shared_ptr<GuiClipboard> clipboard_;
77         ///
78         boost::shared_ptr<GuiWorkArea> work_area_;
79         ///
80         boost::shared_ptr<FWorkArea> old_work_area_;
81         ///
82         boost::shared_ptr<FScreen> old_screen_;
83         ///
84         LyXView & owner_;
85 };
86
87 } // namespace frontend
88 } // namespace lyx
89
90 #endif // GUI_IMPLEMENTATION_H