]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ButtonController.h
Flatten the ButtonController tree by splitting it into a Controller and
[lyx.git] / src / frontends / controllers / ButtonController.h
1 // -*- C++ -*-
2 /**
3  * \file ButtonController.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Allan Rae
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef BUTTONCONTROLLER_H
13 #define BUTTONCONTROLLER_H
14
15
16 #include "ButtonPolicies.h"
17
18 #include "LString.h"
19 #include <boost/scoped_ptr.hpp>
20
21
22 /** Controls the activation of the OK, Apply and Cancel buttons.
23  *
24  * Actually supports 4 buttons in all and it's up to the user to decide on
25  * the activation policy and which buttons correspond to which output of the
26  * state machine.
27  * Author: Allan Rae <rae@lyx.org>.
28  * This class stripped of xforms-specific code by
29  * Angus Leeming <leeming@lyx.org>
30  */
31 class BCView;
32
33 class ButtonController : boost::noncopyable {
34 public:
35         ///
36         ~ButtonController();
37
38         ///
39         BCView & view() const;
40         ///
41         void view(BCView *);
42
43         ///
44         ButtonPolicy & bp() const;
45         ///
46         void bp(ButtonPolicy *);
47
48         ///
49         void input(ButtonPolicy::SMInput);
50         ///
51         void ok();
52         ///
53         void apply();
54         ///
55         void cancel();
56         ///
57         void restore();
58         ///
59         void hide();
60
61         ///
62         void refresh();
63         ///
64         void refreshReadOnly();
65
66         /// Passthrough function -- returns its input value
67         bool readOnly(bool = true);
68         ///
69         void readWrite();
70
71         ///
72         void valid(bool = true);
73         ///
74         void invalid();
75
76 private:
77         ///
78         boost::scoped_ptr<ButtonPolicy> bp_;
79         ///
80         boost::scoped_ptr<BCView> view_;
81 };
82
83 #endif // BUTTONCONTROLLER_H