]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/ButtonPolicies.h
More preference work from Angus
[lyx.git] / src / frontends / ButtonPolicies.h
index 40aed42457d76d385449936517159a9405052e4f..d4d48534bdda89bb0841318ef4bb3690033b1249 100644 (file)
@@ -21,7 +21,7 @@
 
 
 #include <vector>
-#include "support/utility.hpp"
+#include <boost/utility.hpp>
 
 
 /** An abstract base class for button policies.
@@ -38,6 +38,7 @@
     NoRepeatedApply            |       N  |    Y         |     N
     NoRepeatedApplyReadOnly    |       Y  |    Y         |     N
     Preferences                        |       N  |    Y         | No (Ok-Close)
+    Ignorant                   |      N/A |    N/A       |    N/A
     ========================================================================
 
     Policy
@@ -61,6 +62,8 @@
        has its own special version of repeated apply handling because its Ok
        button is actually a Save button -- its always reasonable to Save the
        preferences if the dialog has changed since the last save.
+
+    The IgnorantPolicy is a special case that allows anything.
  */
 class ButtonPolicy : public noncopyable {
 public:
@@ -106,9 +109,9 @@ public:
                UNDO_ALL = 8
        };
        ///
-       static const Button AllButtons =
-       Button(OKAY | APPLY | CANCEL | UNDO_ALL);
-       
+       static const Button ALL_BUTTONS =
+               Button(OKAY | APPLY | CANCEL | UNDO_ALL);
+  
        /** 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
@@ -417,4 +420,27 @@ private:
        StateMachine state_machine_;
 };
 
+
+/** Defines the policy used by dialogs that are forced to support a button
+    controller when they either don't have a use for one or are not ready to
+    use one.  This may be useful when testing a new button policy but wishing
+    to minimise problems to users by supplying an anything-goes policy via a
+    preprocessor directive.
+ */
+class IgnorantPolicy : public ButtonPolicy {
+public:
+       virtual ~IgnorantPolicy() {}
+       
+       /// Trigger a transition with this input.
+       virtual void input(SMInput) {}
+       /// Activation status of a button.
+       virtual bool buttonStatus(Button) const {
+               return true;
+       }
+       /// Are we in a read-only state?
+       virtual bool isReadOnly() const {
+               return false;
+       }
+};
+
 #endif