]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/qt2BC.h
add iso8859-15 support
[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 <boost/utility.hpp>
32 #include "ButtonControllerBase.h"
33 #include "ButtonController.h"
34
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
39     state machine.
40 */
41 class qt2BC : public ButtonControllerBase
42 {
43 public:
44         ///
45         qt2BC(string const &, string const &);
46
47         /* Initialise Button Functions */
48         /// Call refresh() when finished setting the buttons.
49         void setOK(QButton * obj) {
50                 okay_ = obj;
51         }
52         ///
53         void setApply(QButton * obj) {
54                 apply_ = obj;
55         }
56         ///
57         void setCancel(QButton * obj) {
58                 cancel_ = obj;
59         }
60         ///
61         void setRestore(QButton * obj) {
62                 restore_ = obj;
63         }
64         ///
65         void addReadOnly(QWidget * obj) {
66                 read_only_.push_front(obj);
67         }
68         ///
69         void eraseReadOnly() {
70                 read_only_.erase(read_only_.begin(), read_only_.end());
71         }
72
73         /* Action Functions */
74         /// force a refresh of the buttons
75         virtual void refresh();
76
77 private:
78         ///
79         QButton * okay_;
80         ///
81         QButton * apply_;
82         ///
83         QButton * cancel_;
84         ///
85         QButton * restore_;
86         /// List of items to be deactivated when in one of the read-only states
87         std::list<QWidget *> read_only_;
88 };
89
90 #endif // XFORMSBC_H