3 * \file ButtonController.h
4 * Read the file COPYING
7 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS
13 #ifndef BUTTONCONTROLLER_H
14 #define BUTTONCONTROLLER_H
17 #include "ButtonControllerBase.h"
21 /** A templatised instantiation of the ButtonController requiring the
22 * gui-frontend widgets.
23 * The template declarations are in ButtonController.tmpl, which should
24 * be #included in the gui-frontend BC class, see e.g. xforms/xformsBC.C
26 template <class Button, class Widget>
27 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();
52 /// Enable/Disable a widget
53 virtual void setWidgetEnabled(Widget * obj, bool enable) = 0;
54 /// Enable/Disable a button
55 virtual void setButtonEnabled(Button * obj, bool enable) = 0;
56 /// Set the Label on the button
57 virtual void setButtonLabel(Button * obj, string const & label) = 0;
64 typedef std::list<Widget *> Widgets;
69 template <class BP, class GUIBC>
70 class ButtonController: public GUIBC
74 ButtonController(string const & = _("Cancel"),
75 string const & = _("Close"));
77 ~ButtonController() {}
79 virtual ButtonPolicy & bp() { return bp_; }
87 #include "ButtonController.tmpl"
89 #endif // BUTTONCONTROLLER_H