]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ButtonPolicies.h
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / ButtonPolicies.h
index bf8a758374ff4235bc7e10d65e9f11797ad9cc16..3300c9a208bc44e10974633185051e5b6cc329ea 100644 (file)
@@ -1,21 +1,15 @@
-/*
+// -*- 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"
+
+namespace lyx {
+namespace frontend {
 
 /** An abstract base class for button policies.
     A state machine implementation of the various button policies used by the
@@ -68,7 +65,7 @@
 
     The IgnorantPolicy is a special case that allows anything.
  */
-class ButtonPolicy : public boost::noncopyable {
+class ButtonPolicy : boost::noncopyable {
 public:
        ///
        virtual ~ButtonPolicy() {}
@@ -97,7 +94,7 @@ public:
                ///
                BOGUS = 55
        };
-       
+
        /// The various button types.
        enum Button {
                ///
@@ -109,12 +106,12 @@ public:
                ///
                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
@@ -124,28 +121,28 @@ public:
            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.
@@ -194,7 +191,7 @@ public:
        OkCancelPolicy();
        ///
        //virtual ~OkCancelPolicy() {}
-       
+
        /// Trigger a transition with this input.
        virtual void input(SMInput);
        /** Activation status of a button.
@@ -237,7 +234,7 @@ public:
        OkCancelReadOnlyPolicy();
        ///
        //virtual ~OkCancelReadOnlyPolicy() {}
-       
+
        /// Trigger a transition with this input.
        virtual void input(SMInput);
        /// Activation status of a button.
@@ -276,14 +273,13 @@ private:
     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.
@@ -326,7 +322,7 @@ public:
        OkApplyCancelReadOnlyPolicy();
        ///
        //virtual ~OkApplyCancelReadOnlyPolicy() {}
-       
+
        /// Trigger a transition with this input.
        virtual void input(SMInput);
        /// Activation status of a button.
@@ -362,7 +358,7 @@ public:
        OkApplyCancelPolicy();
        ///
        //virtual ~OkApplyCancelPolicy() {}
-       
+
        /// Trigger a transition with this input.
        virtual void input(SMInput);
        /// Activation status of a button.
@@ -395,7 +391,7 @@ public:
        NoRepeatedApplyPolicy();
        ///
        //virtual ~NoRepeatedApplyPolicy() {}
-       
+
        /// Trigger a transition with this input.
        virtual void input(SMInput);
        /// Activation status of a button.
@@ -429,7 +425,7 @@ public:
        PreferencesPolicy();
        ///
        //virtual ~PreferencesPolicy() {}
-       
+
        /// Trigger a transition with this input.
        virtual void input(SMInput);
        /// Activation status of a button.
@@ -459,7 +455,7 @@ private:
 class IgnorantPolicy : public ButtonPolicy {
 public:
        //virtual ~IgnorantPolicy() {}
-       
+
        /// Trigger a transition with this input.
        virtual void input(SMInput) {}
        /// Activation status of a button.
@@ -472,4 +468,7 @@ public:
        }
 };
 
+} // namespace frontend
+} // namespace lyx
+
 #endif