]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImplementation.C
18c13b5c1c2f3a5088457e8a4938426910909164
[lyx.git] / src / frontends / qt4 / GuiImplementation.C
1 // -*- C++ -*-
2 /**
3  * \file GuiImplementation.C
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 #include "GuiImplementation.h"
14 #include "GuiWorkArea.h"
15 #include "QtView.h"
16
17 using boost::shared_ptr;
18
19 namespace lyx {
20 namespace frontend {
21
22 GuiImplementation::GuiImplementation(QtView & owner): owner_(owner), max_id_(0)
23 {
24 }
25
26
27 Clipboard& GuiImplementation::clipboard()
28 {
29         return clipboard_;
30 }
31
32
33 int GuiImplementation::newWorkArea(int w, int h)
34 {
35         size_t const id = max_id_;
36         ++max_id_;
37         work_areas_[id].reset(new GuiWorkArea(owner_, w, h));
38         return id;
39 }
40
41 WorkArea& GuiImplementation::workArea(int id)
42 {
43         BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
44
45         guiCursor().connect(work_areas_[id].get());
46
47         return *work_areas_[id].get();
48 }
49
50
51 void GuiImplementation::destroyWorkArea(int id)
52 {
53         work_areas_.erase(id);
54 }
55
56 } // namespace frontend
57 } // namespace lyx