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"
18 #include <boost/scoped_ptr.hpp>
24 /** \c ButtonController controls the activation of the OK, Apply and
27 * It 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
32 class ButtonController : boost::noncopyable {
35 /** Methods to set and get the GUI view (containing the actual
37 * \param ptr is owned by the ButtonController.
39 void view(BCView * ptr);
40 BCView & view() const;
44 /** Methods to set and get the ButtonPolicy.
45 * \param ptr is owned by the ButtonController.
47 void bp(ButtonPolicy * ptr);
48 ButtonPolicy & bp() const;
52 void input(ButtonPolicy::SMInput) const;
55 /// Tell the BC that a particular button has been pressed.
62 /// Tell the BC that the dialog is being hidden
65 /**Refresh the activation state of the Ok, Apply, Close and
70 /** Refresh the activation state of all the widgets under the control
71 * of the BC to reflect the read-only status of the underlying buffer.
73 void refreshReadOnly() const;
75 /** Passthrough function -- returns its input value
76 * Tell the BC about the read-only status of the underlying buffer.
78 bool readOnly(bool = true) const;
80 /** \param validity Tell the BC that the data is, or is not, valid.
81 * Sets the activation state of the buttons immediately.
83 void valid(bool = true) const;
86 boost::scoped_ptr<ButtonPolicy> bp_;
87 boost::scoped_ptr<BCView> view_;
90 #endif // BUTTONCONTROLLER_H