]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ButtonController.h
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[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 class BCView;
23
24
25 /** \c ButtonController controls the activation of the OK, Apply and
26  *  Cancel buttons.
27  *
28  * It 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  */
32
33 class ButtonController : boost::noncopyable {
34 public:
35         //@{
36         /** Methods to set and get the GUI view (containing the actual
37          *   button widgets.
38          *  \param ptr is owned by the ButtonController.
39          */
40         void view(BCView * ptr);
41         BCView & view() const;
42         //@}
43
44         //@{
45         /** Methods to set and get the ButtonPolicy.
46          *  \param ptr is owned by the ButtonController.
47          */
48         void bp(ButtonPolicy * ptr);
49         ButtonPolicy & bp() const;
50         //@}
51
52         ///
53         void input(ButtonPolicy::SMInput) const;
54
55         //@{
56         /// Tell the BC that a particular button has been pressed.
57         void ok() const;
58         void apply() const;
59         void cancel() const;
60         void restore() const;
61         //@}
62
63         /// Tell the BC that the dialog is being hidden
64         void hide() const;
65
66         /**Refresh the activation state of the Ok, Apply, Close and
67          * Restore buttons.
68          */
69         void refresh() const;
70
71         /** Refresh the activation state of all the widgets under the control
72          *  of the BC to reflect the read-only status of the underlying buffer.
73          */
74         void refreshReadOnly() const;
75
76         /** Passthrough function -- returns its input value
77          *  Tell the BC about the read-only status of the underlying buffer.
78          */
79         bool readOnly(bool = true) const;
80
81         /** \param validity Tell the BC that the data is, or is not, valid.
82          *  Sets the activation state of the buttons immediately.
83          */
84         void valid(bool = true) const;
85
86 private:
87         boost::scoped_ptr<ButtonPolicy> bp_;
88         boost::scoped_ptr<BCView> view_;
89 };
90
91 #endif // BUTTONCONTROLLER_H