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"
25 /** General purpose button controller for up to four buttons.
26 Controls the activation of the OK, Apply and Cancel buttons.
27 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
33 /** \c ButtonController controls the activation of the OK, Apply and
36 * It actually supports 4 buttons in all and it's up to the user to decide on
37 * the activation policy and which buttons correspond to which output of the
41 class ButtonController
48 /// Methods to set and get the ButtonPolicy.
49 void setPolicy(ButtonPolicy::Policy policy);
50 ButtonPolicy const & policy() const;
51 ButtonPolicy & policy();
55 void input(ButtonPolicy::SMInput);
58 /// Tell the BC that a particular button has been pressed.
66 /// Tell the BC that the dialog is being hidden
69 /**Refresh the activation state of the Ok, Apply, Close and
74 /** Passthrough function -- returns its input value
75 * Tell the BC about the read-only status of the underlying buffer.
77 bool setReadOnly(bool);
80 * Sets the activation state of the buttons immediately.
81 * \param validity Tell the BC that the data is, or is not, valid.
90 /// Store pointers to these widgets. \param default_button determines
91 /// the default button of the dialog (bound to return). This is
93 void setOK(QPushButton * obj, bool const default_button = true);
94 void setApply(QPushButton * obj, bool const default_button = false);
95 void setCancel(QPushButton * obj, bool const default_button = false);
96 void setRestore(QPushButton * obj, bool const default_button = false);
97 void setAutoApply(QCheckBox * obj);
100 /** Add a pointer to the list of widgets whose activation
101 * state is dependent upon the read-only status of the
104 void addReadOnly(QWidget * obj);
106 /** Add a widget to the list of all widgets whose validity should
107 * be checked explicitly when the buttons are refreshed.
109 void addCheckedLineEdit(QLineEdit * input, QWidget * label = 0);
113 ButtonController(ButtonController const &);
114 void operator=(ButtonController const &);
121 } // namespace frontend
124 #endif // BUTTONCONTROLLER_H