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
32 GuiBC(string const & cancel, string const & close);
35 void setOK(Button * obj) { okay_ = obj; }
37 void setApply(Button * obj) { apply_ = obj; }
39 void setCancel(Button * obj) { cancel_ = obj; }
41 void setRestore(Button * obj) { restore_ = obj; }
43 void addReadOnly(Widget * obj) { read_only_.push_back(obj); }
45 void eraseReadOnly() { read_only_.clear(); }
47 /// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
49 /// Refresh the status of any widgets in the read_only list
50 void refreshReadOnly();
53 /// Enable/Disable a widget
54 virtual void setWidgetEnabled(Widget * obj, bool enable) = 0;
55 /// Enable/Disable a button
56 virtual void setButtonEnabled(Button * obj, bool enable) = 0;
57 /// Set the Label on the button
58 virtual void setButtonLabel(Button * obj, string const & label) = 0;
65 typedef std::list<Widget *> Widgets;
70 template <class BP, class GUIBC>
71 class ButtonController: public GUIBC
75 ButtonController(string const & = _("Cancel"),
76 string const & = _("Close"));
78 ~ButtonController() {}
80 virtual ButtonPolicy & bp() { return bp_; }
88 #include "ButtonController.tmpl"
90 #endif // BUTTONCONTROLLER_H