]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/qt2BC.h
First attempt at converting copyright dialog to MVC architecture
[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 QButton;
29
30 #include "ButtonController.h"
31
32 /** General purpose button controller for up to four buttons.
33     Controls the activation of the OK, Apply and Cancel buttons.
34     Actually supports 4 buttons in all and it's up to the user to decide on
35     the activation policy and which buttons correspond to which output of the
36     state machine.
37 */
38 class qt2BC : public ButtonControllerBase
39 {
40 public:
41         ///
42         qt2BC(string const &, string const &);
43
44         /* Initialise Button Functions */
45         /// Call refresh() when finished setting the buttons.
46         void setOK(QButton * obj) {
47                 okay_ = obj;
48         }
49         ///
50         void setApply(QButton * obj) {
51                 apply_ = obj;
52         }
53         ///
54         void setCancel(QButton * obj) {
55                 cancel_ = obj;
56         }
57         ///
58         void setUndoAll(QButton * obj) {
59                 undo_all_ = obj;
60         }
61         ///
62         void addReadOnly(QButton * obj) {
63                 read_only_.push_front(obj);
64         }
65         ///
66         void eraseReadOnly() {
67                 read_only_.erase(read_only_.begin(), read_only_.end());
68         }
69
70         /* Action Functions */
71         /// force a refresh of the buttons
72         virtual void refresh();
73
74 private:
75         ///
76         QButton * okay_;
77         ///
78         QButton * apply_;
79         ///
80         QButton * cancel_;
81         ///
82         QButton * undo_all_;
83         /// List of items to be deactivated when in one of the read-only states
84         std::list<QButton *> read_only_;
85 };
86
87 #endif // XFORMSBC_H