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