2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * This file Copyright 2000
12 * ======================================================
14 * Author: Allan Rae <rae@lyx.org>
15 * Non-xforms-specific code stripped-out and placed in a base class by
16 * Angus Leeming <a.leeming@ic.ac.uk>
31 #include <boost/utility.hpp>
32 #include "ButtonControllerBase.h"
33 #include "ButtonController.h"
35 /** General purpose button controller for up to four buttons.
36 Controls the activation of the OK, Apply and Cancel buttons.
37 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
41 class qt2BC : public ButtonControllerBase
45 qt2BC(string const &, string const &);
47 /* Initialise Button Functions */
48 /// Call refresh() when finished setting the buttons.
49 void setOK(QButton * obj) {
53 void setApply(QButton * obj) {
57 void setCancel(QButton * obj) {
61 void setRestore(QButton * obj) {
65 void addReadOnly(QWidget * obj) {
66 read_only_.push_front(obj);
69 void eraseReadOnly() {
70 read_only_.erase(read_only_.begin(), read_only_.end());
73 /* Action Functions */
74 /// force a refresh of the buttons
75 virtual void refresh();
86 /// List of items to be deactivated when in one of the read-only states
87 std::list<QWidget *> read_only_;