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