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