]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/gnomeBC.h
Fixed compilation problems.
[lyx.git] / src / frontends / gnome / gnomeBC.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 1995-2000 The LyX Team.
8  *
9  * ======================================================
10  *
11  * Author: Baruch Even  <baruch@lyx.org>
12  */
13
14 #ifndef GNOMEBC_H
15 #define GNOMEBC_H
16
17 #include "ButtonController.h"
18 #include <list>
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 namespace Gtk {
25 class Button;
26 class Widget;
27 }
28
29 class gnomeBC : public ButtonControllerBase
30 {
31 public:
32         ///
33         gnomeBC(string const & cancel, string const & close);
34
35         /* Initialise Button Functions */
36         /// Call refresh() when finished setting the buttons.
37         void setOK(Gtk::Button * obj) {
38                 okay_ = obj;
39         }
40         ///
41         void setApply(Gtk::Button * obj) {
42                 apply_ = obj;
43         }
44         ///
45         void setCancel(Gtk::Button * obj) {
46                 cancel_ = obj;
47         }
48         ///
49         void setUndoAll(Gtk::Button * obj) {
50                 undo_all_ = obj;
51         }
52         ///
53         void addReadOnly(Gtk::Widget * obj) {
54                 read_only_.push_front(obj);
55         }
56         ///
57         void eraseReadOnly() {
58                 read_only_.clear();
59         }
60
61         /* Action Functions */
62         /// force a refresh of the buttons
63         virtual void refresh();
64
65 private:
66         /// Updates the button sensitivity (enabled/disabled)
67         void setSensitive(Gtk::Button * btn, ButtonPolicy::Button id);
68         ///
69         Gtk::Button * okay_;
70         ///
71         Gtk::Button * apply_;
72         ///
73         Gtk::Button * cancel_;
74         ///
75         Gtk::Button * undo_all_;
76         /// List of items to be deactivated when in one of the read-only states
77         typedef std::list<Gtk::Widget *> WidgetList;
78         WidgetList read_only_;
79 };
80
81 #endif // GNOMEBC_H