3 * \file ButtonController.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
12 #ifndef BUTTONCONTROLLER_H
13 #define BUTTONCONTROLLER_H
15 #include "ButtonPolicy.h"
16 #include <boost/scoped_ptr.hpp>
23 /** \c ButtonController controls the activation of the OK, Apply and
26 * It actually supports 4 buttons in all and it's up to the user to decide on
27 * the activation policy and which buttons correspond to which output of the
31 class ButtonController : boost::noncopyable {
34 /** Methods to set and get the GUI view (containing the actual
36 * \param ptr is owned by the ButtonController.
38 void view(BCView * ptr);
39 BCView & view() const;
43 /** Methods to set and get the ButtonPolicy.
44 * \param ptr is owned by the ButtonController.
46 void bp(ButtonPolicy * ptr);
47 ButtonPolicy & bp() const;
51 void input(ButtonPolicy::SMInput) const;
54 /// Tell the BC that a particular button has been pressed.
61 /// Tell the BC that the dialog is being hidden
64 /**Refresh the activation state of the Ok, Apply, Close and
69 /** Refresh the activation state of all the widgets under the control
70 * of the BC to reflect the read-only status of the underlying buffer.
72 void refreshReadOnly() const;
74 /** Passthrough function -- returns its input value
75 * Tell the BC about the read-only status of the underlying buffer.
77 bool readOnly(bool = true) const;
79 /** \param validity Tell the BC that the data is, or is not, valid.
80 * Sets the activation state of the buttons immediately.
82 void valid(bool = true) const;
85 boost::scoped_ptr<ButtonPolicy> bp_;
86 boost::scoped_ptr<BCView> view_;
89 } // namespace frontend
92 #endif // BUTTONCONTROLLER_H