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