3 * \file ButtonController.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Angus Leeming
11 * Full author contact details are available in file CREDITS
14 #ifndef BUTTONCONTROLLER_H
15 #define BUTTONCONTROLLER_H
18 #include "ButtonControllerBase.h"
22 /** A templatised instantiation of the ButtonController requiring the
23 * gui-frontend widgets.
24 * The template declarations are in ButtonController.tmpl, which should
25 * be #included in the gui-frontend BC class, see e.g. xforms/xformsBC.C
27 template <class Button, class Widget>
28 class GuiBC : public ButtonControllerBase {
31 GuiBC(string const & cancel, string const & close);
34 void setOK(Button * obj) { okay_ = obj; }
36 void setApply(Button * obj) { apply_ = obj; }
38 void setCancel(Button * obj) { cancel_ = obj; }
40 void setRestore(Button * obj) { restore_ = obj; }
42 void addReadOnly(Widget * obj) { read_only_.push_back(obj); }
44 void eraseReadOnly() { read_only_.clear(); }
46 /// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
48 /// Refresh the status of any widgets in the read_only list
49 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 {
72 ButtonController(string const & = _("Cancel"),
73 string const & = _("Close"));
75 ~ButtonController() {}
77 virtual ButtonPolicy & bp() { return bp_; }
84 #include "ButtonController.tmpl"
86 #endif // BUTTONCONTROLLER_H