]> git.lyx.org Git - features.git/blob - src/frontends/controllers/ControlButtons.C
cf3745f1f3344553cd0c09e2639ac9e54f705351
[features.git] / src / frontends / controllers / ControlButtons.C
1 /**
2  * \file ControlButtons.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "ControlButtons.h"
15 #include "ButtonController.h"
16 #include "BCView.h"
17 #include "ViewBase.h"
18 #include "lyxrc.h"
19 #include "support/LAssert.h"
20
21
22 ControlButtons::ControlButtons()
23         : emergency_exit_(false), is_closing_(false),
24           bc_ptr_(new ButtonController), view_ptr_(0)
25 {}
26
27
28 ControlButtons::~ControlButtons()
29 {}
30
31
32 void ControlButtons::ApplyButton()
33 {
34         apply();
35         bc().apply();
36 }
37
38
39 void ControlButtons::OKButton()
40 {
41         is_closing_ = true;
42         apply();
43         is_closing_ = false;
44         hide();
45         bc().ok();
46 }
47
48
49 void ControlButtons::CancelButton()
50 {
51         hide();
52         bc().cancel();
53 }
54
55
56 void ControlButtons::RestoreButton()
57 {
58         update();
59         bc().restore();
60 }
61
62
63 bool ControlButtons::IconifyWithMain() const
64 {
65         return lyxrc.dialogs_iconify_with_main;
66 }
67
68
69 ButtonController & ControlButtons::bc()
70 {
71         lyx::Assert(bc_ptr_.get());
72         return *bc_ptr_.get();
73 }
74
75
76 ViewBase & ControlButtons::view()
77 {
78         lyx::Assert(view_ptr_);
79         return *view_ptr_;
80 }
81
82
83 void ControlButtons::setView(ViewBase & v)
84 {
85         view_ptr_ = &v;
86 }