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