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"
26 /** General purpose button controller for up to four buttons.
27 Controls the activation of the OK, Apply and Cancel buttons.
28 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
34 /** \c ButtonController controls the activation of the OK, Apply and
37 * It actually supports 4 buttons in all and it's up to the user to decide on
38 * the activation policy and which buttons correspond to which output of the
42 class ButtonController
49 /// Methods to set and get the ButtonPolicy.
50 void setPolicy(ButtonPolicy::Policy policy);
51 ButtonPolicy const & policy() const;
52 ButtonPolicy & policy();
56 void input(ButtonPolicy::SMInput);
59 /// Tell the BC that a particular button has been pressed.
67 /// Tell the BC that the dialog is being hidden
70 /**Refresh the activation state of the Ok, Apply, Close and
75 /** Passthrough function -- returns its input value
76 * Tell the BC about the read-only status of the underlying buffer.
78 bool setReadOnly(bool);
81 * Sets the activation state of the buttons immediately.
82 * \param validity Tell the BC that the data is, or is not, valid.
91 /// Store pointers to these widgets. \param default_button determines
92 /// the default button of the dialog (bound to return). This is
94 void setOK(QPushButton * obj, bool const default_button = true);
95 void setApply(QPushButton * obj, bool const default_button = false);
96 void setCancel(QPushButton * obj, bool const default_button = false);
97 void setRestore(QPushButton * obj, bool const default_button = false);
98 void setAutoApply(QCheckBox * obj);
101 /** Add a pointer to the list of widgets whose activation
102 * state is dependent upon the read-only status of the
105 void addReadOnly(QWidget * obj);
107 /** Add a widget to the list of all widgets whose validity should
108 * be checked explicitly when the buttons are refreshed.
110 void addCheckedLineEdit(QLineEdit * input, QWidget * target = 0, int tabindex = -1);
112 /** Add a widget to the list of all widgets whose validity should
113 * be checked explicitly when the buttons are refreshed.
115 void addCheckedLineEditPanel(QLineEdit * input, QWidget * target, QString const panel);
119 ButtonController(ButtonController const &);
120 void operator=(ButtonController const &);
127 } // namespace frontend
130 #endif // BUTTONCONTROLLER_H