-#include <config.h>
+/**
+ * \file xformsBC.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Allan Rae
+ * \author Angus Leeming
+ * \author Baruch Even
+ *
+ * Full author contact details are available in file CREDITS.
+ */
-#include FORMS_H_LOCATION
+#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
#include "xformsBC.h"
#include "xforms_helpers.h"
+#include "lyx_forms.h"
+
+using std::string;
-xformsBC::xformsBC(string const & cancel, string const & close)
- : ButtonControllerBase(cancel, close),
- okay_(0), apply_(0), cancel_(0), undo_all_(0), read_only_()
+
+xformsBC::xformsBC(ButtonController const & parent,
+ string const & cancel, string const & close)
+ : GuiBC<FL_OBJECT, FL_OBJECT>(parent, cancel, close)
{}
-void xformsBC::refresh()
+void xformsBC::setButtonEnabled(FL_OBJECT * obj, bool enabled) const
+{
+ setEnabled(obj, enabled);
+}
+
+
+void xformsBC::setWidgetEnabled(FL_OBJECT * obj, bool enabled) const
+{
+ setEnabled(obj, enabled);
+}
+
+
+void xformsBC::setButtonLabel(FL_OBJECT * obj, string const & label) const
{
- if (okay_) {
- if (bp().buttonStatus(ButtonPolicy::OKAY)) {
- setEnabled(okay_, true);
- } else {
- setEnabled(okay_, false);
- }
- }
- if (apply_) {
- if (bp().buttonStatus(ButtonPolicy::APPLY)) {
- setEnabled(apply_, true);
- } else {
- setEnabled(apply_, false);
- }
- }
- if (undo_all_) {
- if (bp().buttonStatus(ButtonPolicy::UNDO_ALL)) {
- setEnabled(undo_all_, true);
- } else {
- setEnabled(undo_all_, false);
- }
- }
- if (cancel_) {
- if (bp().buttonStatus(ButtonPolicy::CANCEL)) {
- fl_set_object_label(cancel_, cancel_label.c_str());
- } else {
- fl_set_object_label(cancel_, close_label.c_str());
- }
- }
- if (!read_only_.empty()) {
- bool enable = true;
- if (bp().isReadOnly()) enable = false;
-
- for (std::list<FL_OBJECT *>::iterator iter = read_only_.begin();
- iter != read_only_.end(); ++iter) {
- setEnabled(*iter, enable);
- }
- }
+ fl_set_object_label(obj, label.c_str());
}