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
16 #include "ButtonPolicies.h"
19 #include <boost/scoped_ptr.hpp>
25 /** \c ButtonController controls the activation of the OK, Apply and
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
33 class ButtonController : boost::noncopyable {
36 /** Methods to set and get the GUI view (containing the actual
38 * \param ptr is owned by the ButtonController.
40 void view(BCView * ptr);
41 BCView & view() const;
45 /** Methods to set and get the ButtonPolicy.
46 * \param ptr is owned by the ButtonController.
48 void bp(ButtonPolicy * ptr);
49 ButtonPolicy & bp() const;
53 void input(ButtonPolicy::SMInput) const;
56 /// Tell the BC that a particular button has been pressed.
63 /// Tell the BC that the dialog is being hidden
66 /**Refresh the activation state of the Ok, Apply, Close and
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.
74 void refreshReadOnly() const;
76 /** Passthrough function -- returns its input value
77 * Tell the BC about the read-only status of the underlying buffer.
79 bool readOnly(bool = true) const;
81 /** \param validity Tell the BC that the data is, or is not, valid.
82 * Sets the activation state of the buttons immediately.
84 void valid(bool = true) const;
87 boost::scoped_ptr<ButtonPolicy> bp_;
88 boost::scoped_ptr<BCView> view_;
91 #endif // BUTTONCONTROLLER_H