]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlDialog.tmpl
Really dull and boring header shit
[lyx.git] / src / frontends / controllers / ControlDialog.tmpl
1 // -*- C++ -*-
2 /**
3  * \file ControlDialog.tmpl
4  * Read the file COPYING
5  *
6  * \author Angus Leeming 
7  *
8  * Full author contact details are available in file CREDITS
9  *
10  * ControlDialog is a base class and so these templatised methods will be
11  * instantiated if this file is #included in the derived classes' .C file.
12  */
13
14 #include "ControlDialog.h"
15
16 #include "ButtonControllerBase.h"
17 #include "ViewBase.h"
18
19
20 template <class Base>
21 ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
22         : Base(lv, d), dialog_built_(false)
23 {}
24
25
26 template <class Base>
27 void ControlDialog<Base>::show()
28 {
29         if (isBufferDependent() && !bufferIsAvailable())
30                 return;
31
32         connect();
33
34         setParams();
35         if (emergency_exit_) {
36                 hide();
37                 return;
38         }
39
40         if (!dialog_built_) {
41                 view().build();
42                 dialog_built_ = true;
43         }
44
45         bc().readOnly(bufferIsReadonly());
46         view().show();
47 }
48
49 template <class Base>
50 void ControlDialog<Base>::update()
51 {
52         if (isBufferDependent() && !bufferIsAvailable())
53                 return;
54
55         setParams();
56         if (emergency_exit_) {
57                 hide();
58                 return;
59         }
60
61         bc().readOnly(bufferIsReadonly());
62         view().update();
63 }
64
65 template <class Base>
66 void ControlDialog<Base>::hide()
67 {
68         emergency_exit_ = false;
69         clearParams();
70
71         disconnect();
72         view().hide();
73 }