]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/qt2BC.h
Fixed connections. There is still a bug somewhere.
[lyx.git] / src / frontends / qt2 / qt2BC.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  *           This file Copyright 2000
11  *           Allan Rae
12  * ======================================================
13  *
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>
17  */
18
19 #ifndef QT2BC_H
20 #define QT2BC_H
21
22 #include <list>
23
24 #ifdef __GNUG__
25 #pragma interface
26 #endif
27
28 class QWidget;
29 class QButton;
30
31 #include "ButtonController.h"
32
33 /** General purpose button controller for up to four buttons.
34     Controls the activation of the OK, Apply and Cancel buttons.
35     Actually supports 4 buttons in all and it's up to the user to decide on
36     the activation policy and which buttons correspond to which output of the
37     state machine.
38 */
39 class qt2BC : public ButtonControllerBase
40 {
41 public:
42         ///
43         qt2BC(string const &, string const &);
44
45         /* Initialise Button Functions */
46         /// Call refresh() when finished setting the buttons.
47         void setOK(QButton * obj) {
48                 okay_ = obj;
49         }
50         ///
51         void setApply(QButton * obj) {
52                 apply_ = obj;
53         }
54         ///
55         void setCancel(QButton * obj) {
56                 cancel_ = obj;
57         }
58         ///
59         void setUndoAll(QButton * obj) {
60                 undo_all_ = obj;
61         }
62         ///
63         void addReadOnly(QWidget * obj) {
64                 read_only_.push_front(obj);
65         }
66         ///
67         void eraseReadOnly() {
68                 read_only_.erase(read_only_.begin(), read_only_.end());
69         }
70
71         /* Action Functions */
72         /// force a refresh of the buttons
73         virtual void refresh();
74
75 private:
76         ///
77         QButton * okay_;
78         ///
79         QButton * apply_;
80         ///
81         QButton * cancel_;
82         ///
83         QButton * undo_all_;
84         /// List of items to be deactivated when in one of the read-only states
85         std::list<QWidget *> read_only_;
86 };
87
88 #endif // XFORMSBC_H