]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ButtonControllerBase.h
Really dull and boring header shit
[lyx.git] / src / frontends / controllers / ButtonControllerBase.h
1 // -*- C++ -*-
2 /**
3  * \file ButtonControllerBase.h
4  * Read the file COPYING
5  *
6  * \author Allan Rae
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #ifndef BUTTONCONTROLLERBASE_H
12 #define BUTTONCONTROLLERBASE_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "ButtonPolicies.h"
19 #include "LString.h"
20
21 /** Abstract base class for a ButtonController
22
23  * Controls the activation of the OK, Apply and Cancel buttons.
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 abstract base class stripped of xforms-specific code by
29  * Angus Leeming <leeming@lyx.org>
30  */
31 class ButtonControllerBase : boost::noncopyable
32 {
33 public:
34         /** Constructor.
35             The cancel/close label entries are _not_ managed within the class
36             thereby allowing you to reassign at will and to use static labels.
37             It also means if you really don't want to have the Cancel button
38             label be different when there is nothing changed in the dialog then
39             you can just assign "Cancel" to both labels.  Or even reuse this
40             class for something completely different.
41          */
42         ButtonControllerBase(string const & cancel, string const & close);
43         ///
44         virtual ~ButtonControllerBase() {}
45         ///
46         virtual ButtonPolicy & bp() = 0;
47         ///
48         virtual void input(ButtonPolicy::SMInput);
49         ///
50         void ok();
51         ///
52         void apply();
53         ///
54         void cancel();
55         ///
56         void restore();
57         ///
58         void hide();
59         ///
60         virtual void refresh() = 0;
61         ///
62         virtual void refreshReadOnly() = 0;
63
64         /// Passthrough function -- returns its input value
65         bool readOnly(bool = true);
66         ///
67         void readWrite();
68         ///
69         void valid(bool = true);
70         ///
71         void invalid();
72
73 protected:
74         ///
75         string cancel_label_;
76         ///
77         string close_label_;
78 };
79
80 #endif // BUTTONCONTROLLERBASE_H