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"
18 #include <boost/scoped_ptr.hpp>
19 #include <boost/noncopyable.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 {
34 ButtonController() : policy_(ButtonPolicy::IgnorantPolicy) {}
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 setPolicy(ButtonPolicy::Policy policy);
49 ButtonPolicy const & policy() const { return policy_; }
50 ButtonPolicy & policy() { return policy_; }
54 void input(ButtonPolicy::SMInput);
57 /// Tell the BC that a particular button has been pressed.
64 /// Tell the BC that the dialog is being hidden
67 /**Refresh the activation state of the Ok, Apply, Close and
72 /** Refresh the activation state of all the widgets under the control
73 * of the BC to reflect the read-only status of the underlying buffer.
75 void refreshReadOnly() const;
77 /** Passthrough function -- returns its input value
78 * Tell the BC about the read-only status of the underlying buffer.
80 bool readOnly(bool = true);
82 /** \param validity Tell the BC that the data is, or is not, valid.
83 * Sets the activation state of the buttons immediately.
85 void valid(bool = true);
89 boost::scoped_ptr<BCView> view_;
92 } // namespace frontend
95 #endif // BUTTONCONTROLLER_H