3 * \file ButtonController.h
4 * Copyright 2002 the LyX Team
5 * Read the file COPYING
7 * \author Allan Rae, rae@lyx.org
8 * \author Angus Leeming, a.leeming@ic.ac.uk
9 * \author Baruch Even, baruch.even@writeme.com
12 #ifndef BUTTONCONTROLLER_H
13 #define BUTTONCONTROLLER_H
16 #include "ButtonControllerBase.h"
20 /** A templatised instantiation of the ButtonController requiring the
21 * gui-frontend widgets.
22 * The template declarations are in ButtonController.tmpl, which should
23 * be #included in the gui-frontend BC class, see e.g. xforms/xformsBC.C
25 template <class Button, class Widget>
26 class GuiBC : public ButtonControllerBase
30 GuiBC(string const & cancel, string const & close);
33 void setOK(Button * obj) { okay_ = obj; }
35 void setApply(Button * obj) { apply_ = obj; }
37 void setCancel(Button * obj) { cancel_ = obj; }
39 void setRestore(Button * obj) { restore_ = obj; }
41 void addReadOnly(Widget * obj) { read_only_.push_back(obj); }
43 void eraseReadOnly() { read_only_.clear(); }
45 /// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
47 /// Refresh the status of any widgets in the read_only list
48 void refreshReadOnly();
51 /// Enable/Disable a widget
52 virtual void setWidgetEnabled(Widget * obj, bool enable) = 0;
53 /// Enable/Disable a button
54 virtual void setButtonEnabled(Button * obj, bool enable) = 0;
55 /// Set the Label on the button
56 virtual void setButtonLabel(Button * obj, string const & label) = 0;
63 typedef std::list<Widget *> Widgets;
68 template <class BP, class GUIBC>
69 class ButtonController: public GUIBC
73 ButtonController(string const & = _("Cancel"),
74 string const & = _("Close"));
76 virtual ButtonPolicy & bp() { return bp_; }
84 #include "ButtonController.tmpl"
86 #endif // BUTTONCONTROLLER_H