4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Angus Leeming
11 * Full author contact details are available in file CREDITS.
19 #include "CheckedLineEdit.h"
27 /** General purpose button controller for up to four buttons.
28 Controls the activation of the OK, Apply and Cancel buttons.
29 Actually supports 4 buttons in all and it's up to the user to decide on
30 the activation policy and which buttons correspond to which output of the
34 class Qt2BC : public BCView
38 Qt2BC(ButtonController & parent);
41 /** Store pointers to these widgets.
43 void setOK(QPushButton * obj) { okay_ = obj; }
44 void setApply(QPushButton * obj) { apply_ = obj; }
45 void setCancel(QPushButton * obj) { cancel_ = obj; }
46 void setRestore(QPushButton * obj) { restore_ = obj; }
49 /** Add a pointer to the list of widgets whose activation
50 * state is dependent upon the read-only status of the
53 void addReadOnly(QWidget * obj) { read_only_.push_back(obj); }
55 /// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
56 virtual void refresh() const;
57 /// Refresh the status of any widgets in the read_only list
58 virtual void refreshReadOnly() const;
60 /** Add a widget to the list of all widgets whose validity should
61 * be checked explicitly when the buttons are refreshed.
63 void addCheckedWidget(CheckedLineEdit * ptr);
66 /// \return true if all CheckedWidgets are in a valid state.
67 bool checkWidgets() const;
70 typedef boost::shared_ptr<CheckedLineEdit> CheckedWidgetPtr;
71 typedef std::list<CheckedWidgetPtr> CheckedWidgetList;
72 CheckedWidgetList checked_widgets;
75 /// Updates the widget sensitivity (enabled/disabled)
76 void setWidgetEnabled(QWidget *, bool enabled) const;
80 QPushButton * cancel_;
81 QPushButton * restore_;
83 typedef std::list<QWidget *> Widgets;
87 } // namespace frontend