]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/gnomeBC.C
Fixed compilation problems.
[lyx.git] / src / frontends / gnome / gnomeBC.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "gnomeBC.h"
8 #include "gtk--/widget.h"
9 #include "gtk--/button.h"
10
11 gnomeBC::gnomeBC(string const & cancel, string const & close)
12         : ButtonControllerBase(cancel, close),
13           okay_(0), apply_(0), cancel_(0), undo_all_(0)
14 {}
15
16
17 void gnomeBC::setSensitive(Gtk::Button * btn, ButtonPolicy::Button id)
18 {
19         if (btn) {
20                 bool const enabled = bp().buttonStatus(id);
21                 btn->set_sensitive(enabled);
22         }
23 }
24
25
26 void gnomeBC::refresh()
27 {
28         setSensitive(okay_, ButtonPolicy::OKAY);
29         setSensitive(apply_, ButtonPolicy::APPLY);
30         setSensitive(undo_all_, ButtonPolicy::UNDO_ALL);
31
32 #warning Handle the cancel button correctly! (be 20010327)
33 #if 0
34         if (cancel_) {
35                 bool const enabled = bp().buttonStatus(ButtonPolicy::CANCEL);
36 //              if (enabled)
37 //                      Change label to cancel_label_
38 //              else
39 //                      Change label to close_label_
40 //Need to adapt it somehow since we use stock Gnome buttons.
41         }
42 #endif
43         
44         if (!read_only_.empty()) {
45                 bool enable = true;
46                 if (bp().isReadOnly()) enable = false;
47                 
48                 WidgetList::const_iterator end = read_only_.end();
49                 for (WidgetList::const_iterator iter = read_only_.begin();
50                      iter != end; ++iter) {
51                         (*iter)->set_sensitive(enable);
52                 }
53         }
54 }