]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlButtons.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.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 using namespace lyx::support;
22
23 ControlButtons::ControlButtons()
24         : emergency_exit_(false), is_closing_(false),
25           bc_ptr_(new ButtonController), view_ptr_(0)
26 {}
27
28
29 ControlButtons::~ControlButtons()
30 {}
31
32
33 void ControlButtons::ApplyButton()
34 {
35         apply();
36         bc().apply();
37 }
38
39
40 void ControlButtons::OKButton()
41 {
42         is_closing_ = true;
43         apply();
44         is_closing_ = false;
45         hide();
46         bc().ok();
47 }
48
49
50 void ControlButtons::CancelButton()
51 {
52         hide();
53         bc().cancel();
54 }
55
56
57 void ControlButtons::RestoreButton()
58 {
59         update();
60         bc().restore();
61 }
62
63
64 bool ControlButtons::IconifyWithMain() const
65 {
66         return lyxrc.dialogs_iconify_with_main;
67 }
68
69
70 ButtonController & ControlButtons::bc()
71 {
72         Assert(bc_ptr_.get());
73         return *bc_ptr_.get();
74 }
75
76
77 ViewBase & ControlButtons::view()
78 {
79         Assert(view_ptr_);
80         return *view_ptr_;
81 }
82
83
84 void ControlButtons::setView(ViewBase & v)
85 {
86         view_ptr_ = &v;
87 }