-/*
+// -*- C++ -*-
+/**
* \file ButtonPolicies.h
- * \author Allan Rae, rae@lyx.org
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * Provides a state machine implementation of the various button policies
- * used by the dialogs.
- *
- * This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
+ * \author Allan Rae
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
+ * Full author contact details are available in file CREDITS.
*
- * This file Copyright 2000
- * Allan Rae
- * ======================================================
+ * Provides a state machine implementation of the various button policies
+ * used by the dialogs.
*/
#ifndef BUTTONPOLICIES_H
#include <vector>
#include <boost/utility.hpp>
-#include "support/LOstream.h"
+#include "support/std_ostream.h"
/** An abstract base class for button policies.
A state machine implementation of the various button policies used by the
The IgnorantPolicy is a special case that allows anything.
*/
-class ButtonPolicy : public boost::noncopyable {
+class ButtonPolicy : boost::noncopyable {
public:
///
virtual ~ButtonPolicy() {}
///
BOGUS = 55
};
-
+
/// The various button types.
enum Button {
///
///
CANCEL = 4,
///
- UNDO_ALL = 8
+ RESTORE = 8
};
///
static const Button ALL_BUTTONS =
- Button(OKAY | APPLY | CANCEL | UNDO_ALL);
-
+ Button(OKAY | APPLY | CANCEL | RESTORE);
+
/** State machine inputs.
All the policies so far have both CANCEL and HIDE always going to
INITIAL. This won't necessarily be true for all [future] policies
HIDE are treated differently.
*/
enum SMInput {
- ///
+ /// the dialog contents are now valid
SMI_VALID = 0,
- ///
+ /// the dialog contents are now invalid
SMI_INVALID,
- ///
+ /// an apply-and-hide action has happened
SMI_OKAY,
- ///
+ /// an apply action has happened
SMI_APPLY,
- ///
+ /// a cancel action has happened
SMI_CANCEL,
- ///
- SMI_UNDO_ALL,
- ///
+ /// a restore action has happened
+ SMI_RESTORE,
+ /// the dialog has been hidden
SMI_HIDE,
- ///
+ /// the dialog contents are read-only
SMI_READ_ONLY,
- ///
+ /// the dialog contents can be modified
SMI_READ_WRITE,
- ///
+ /// the state of the dialog contents has not changed
SMI_NOOP,
- ///
- SMI_TOTAL // not a real input
+ /// for internal use
+ SMI_TOTAL
};
/// Trigger a transition with this input.
OkCancelPolicy();
///
//virtual ~OkCancelPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput);
/** Activation status of a button.
OkCancelReadOnlyPolicy();
///
//virtual ~OkCancelReadOnlyPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput);
/// Activation status of a button.
This is based on the value of the bool state of the Button::CANCEL.
true == Cancel, false == Close
*/
-class NoRepeatedApplyReadOnlyPolicy : public ButtonPolicy
-{
+class NoRepeatedApplyReadOnlyPolicy : public ButtonPolicy {
public:
///
NoRepeatedApplyReadOnlyPolicy();
///
//virtual ~NoRepeatedApplyReadOnlyPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput);
/// Activation status of a button.
OkApplyCancelReadOnlyPolicy();
///
//virtual ~OkApplyCancelReadOnlyPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput);
/// Activation status of a button.
OkApplyCancelPolicy();
///
//virtual ~OkApplyCancelPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput);
/// Activation status of a button.
NoRepeatedApplyPolicy();
///
//virtual ~NoRepeatedApplyPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput);
/// Activation status of a button.
PreferencesPolicy();
///
//virtual ~PreferencesPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput);
/// Activation status of a button.
class IgnorantPolicy : public ButtonPolicy {
public:
//virtual ~IgnorantPolicy() {}
-
+
/// Trigger a transition with this input.
virtual void input(SMInput) {}
/// Activation status of a button.