]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormBase.h
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FormBase.h
index 10f883ab14b7eb45c056dd5df0a587575ed0308a..9fe1f6eba7ca55d915b4d30cc069c60de741bdfc 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "ViewBase.h"
 #include "ButtonPolicies.h"
-#include "FeedbackController.h"
 #include "forms_fwd.h"
 
 #include "LString.h"
@@ -34,7 +33,7 @@ class Tooltips;
 
 /** This class is an XForms GUI base class.
  */
-class FormBase : public ViewBase, public FeedbackController
+class FormBase : public ViewBase
 {
 public:
        ///
@@ -42,11 +41,22 @@ public:
        ///
        virtual ~FormBase();
 
-       /** input callback function. invoked only by the xforms callback
-        *  interface
+       /** Input callback function.
+        *  Invoked only by the xforms callback interface
         */
        void InputCB(FL_OBJECT *, long);
 
+       /** Message callback function.
+        *  Invoked only by the xforms callback interface
+        */
+       void MessageCB(FL_OBJECT *, int event);
+
+       /** Prehandler callback function.
+        *  Invoked only by the xforms callback interface
+        */
+       void PrehandlerCB(FL_OBJECT * ob, int event, int key);
+
+       ///
        Tooltips & tooltips();
 
 protected:
@@ -55,7 +65,7 @@ protected:
        /// Hide the dialog.
        virtual void hide();
        /// Create the dialog if necessary, update it and display it.
-       void show();
+       virtual void show();
 
        /** Prepare the way to:
         *  1. display feedback as the mouse moves over ob. This feedback will
@@ -65,6 +75,17 @@ protected:
         */
        static void setPrehandler(FL_OBJECT * ob);
 
+       /** Pass the class a pointer to the message_widget so that it can
+           post the message */
+       void setMessageWidget(FL_OBJECT * message_widget);
+
+       /** Send the warning message from the daughter class to the
+           message_widget direct. The message will persist till the mouse
+           movesto a new object. */
+       void postWarning(string const & warning);
+       /// Reset the message_widget_
+       void clearMessage();
+
        ///
        xformsBC & bc();
 
@@ -84,6 +105,20 @@ private:
         */
        void prepare_to_show();
 
+       /** Get the feedback message for ob.
+           Called if warning_posted_ == false. */
+       virtual string const getFeedback(FL_OBJECT * /* ob */)
+               { return string(); }
+
+       /// Post the feedback message for ob to message_widget_
+       void postMessage(string const & message);
+
+       /** Variable used to decide whether to remove the existing feedback
+           message or not (if it is in fact a warning) */
+       bool warning_posted_;
+       /// The widget to display the feedback
+       FL_OBJECT * message_widget_;
+
        /// The dialog's minimum allowable dimensions.
        int minw_;
        ///
@@ -131,13 +166,15 @@ FL_FORM * FormDB<Dialog>::form() const
 template <class Controller, class Base>
 class FormCB: public Base
 {
-protected:
-       ///
-       FormCB(string const &, bool allowResize = true);
+public:
        /// The parent controller
        Controller & controller();
        ///
        Controller const & controller() const;
+
+protected:
+       ///
+       FormCB(string const &, bool allowResize = true);
 };