// -*- C++ -*-
-/* This file is part of
- * ======================================================
+/**
+ * \file xformsBC.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author Allan Rae
+ * \author Angus Leeming
+ * \author Baruch Even
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2000 The LyX Team.
- *
- * This file Copyright 2000
- * Allan Rae
- * ======================================================
- *
- * Author: Allan Rae <rae@lyx.org>
- * Non-xforms-specific code stripped-out and placed in a base class by
- * Angus Leeming <a.leeming@ic.ac.uk>
+ * Full author contact details are available in file CREDITS.
*/
#ifndef XFORMSBC_H
#define XFORMSBC_H
-#include FORMS_H_LOCATION
-#include <list>
+#include "forms_fwd.h"
-#ifdef __GNUG__
-#pragma interface
-#endif
+#include "BCView.h"
+#include "gettext.h"
-#include "ButtonController.h"
-
-/** General purpose button controller for up to four buttons.
- Controls the activation of the OK, Apply and Cancel buttons.
- Actually supports 4 buttons in all and it's up to the user to decide on
- the activation policy and which buttons correspond to which output of the
- state machine.
-*/
-class xformsBC : public ButtonControllerBase
-{
+class xformsBC : public GuiBC<FL_OBJECT, FL_OBJECT> {
public:
///
- xformsBC(string const &, string const &);
+ xformsBC(ButtonController const &,
+ std::string const & = _("Cancel"), std::string const & = _("Close"));
- /* Initialise Button Functions */
- /// Call refresh() when finished setting the buttons.
- void setOK(FL_OBJECT * obj) {
- okay_ = obj;
- }
- ///
- void setApply(FL_OBJECT * obj) {
- apply_ = obj;
- }
- ///
- void setCancel(FL_OBJECT * obj) {
- cancel_ = obj;
- }
- ///
- void setUndoAll(FL_OBJECT * obj) {
- undo_all_ = obj;
- }
- ///
- void addReadOnly(FL_OBJECT * obj) {
- read_only_.push_front(obj);
- }
- ///
- void eraseReadOnly() {
- read_only_.erase(read_only_.begin(), read_only_.end());
- }
+private:
+ /// Updates the button sensitivity (enabled/disabled)
+ void setButtonEnabled(FL_OBJECT *, bool enabled) const;
- /* Action Functions */
- /// force a refresh of the buttons
- virtual void refresh();
+ /// Updates the widget sensitivity (enabled/disabled)
+ void setWidgetEnabled(FL_OBJECT *, bool enabled) const;
-private:
- ///
- FL_OBJECT * okay_;
- ///
- FL_OBJECT * apply_;
- ///
- FL_OBJECT * cancel_;
- ///
- FL_OBJECT * undo_all_;
- /// List of items to be deactivated when in one of the read-only states
- std::list<FL_OBJECT *> read_only_;
+ /// Set the label on the button
+ void setButtonLabel(FL_OBJECT *, std::string const & label) const;
};
#endif // XFORMSBC_H