]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormBase.h
try this for distinguishing inner and outer tabs
[lyx.git] / src / frontends / xforms / FormBase.h
index 87f37fd1e586d60b763c2507a06b88a16d7146dd..1cf0f693b1531b3836b376cac5136841247370b0 100644 (file)
 
 #include "DialogBase.h"
 #include "LString.h"
-#include <boost/utility.hpp>
 #include FORMS_H_LOCATION
 #include "ButtonController.h"
 #include "gettext.h"
+#include <sigc++/signal_system.h>
 
 class Buffer;
 class Dialogs;
@@ -28,19 +28,13 @@ class LyXView;
 #endif
 
 /** This class is an XForms GUI base class.
-    It is meant to be used solely as the parent class to FormBaseBI and FormBaseBD
+    It is meant to be used solely as the parent class to FormBaseBI
+    and FormBaseBD.
     @author Angus Leeming
  */
-class FormBase : public DialogBase, public noncopyable {
-public:
-       /** Constructor.
-           #FormBase(lv, d, _("DialogName"), BUFFER_DEPENDENT, new ButtonPolicy)#
-        */
-       FormBase(LyXView *, Dialogs *, string const &,
-                ButtonPolicy *, char const *, char const *);
-       ///
-       virtual ~FormBase();
 
+class FormBase : public DialogBase {
+public:
        /// Callback functions
        static  int WMHideCB(FL_FORM *, void *);
        ///
@@ -55,22 +49,35 @@ public:
        static void RestoreCB(FL_OBJECT *, long);
 
 protected: // methods
+       ///
+       FormBase(LyXView *, Dialogs *, string const &,
+                ButtonPolicy *, char const *, char const *);
+       ///
+       virtual ~FormBase();
+
+       /** Redraw the form (on receipt of a Signal indicating, for example,
+           that the xform colors have been re-mapped).
+           Must be virtual because dialogs with tabbed folders will need to
+           redraw the form for each tab.
+       */
+       virtual void redraw();
+
        /// Create the dialog if necessary, update it and display it.
-       void show();
+       virtual void show();
        /// Hide the dialog.
        virtual void hide();
-       /// bool indicates if a buffer switch took place
-       virtual void update(bool = false) {}
+       /// Update the dialog.
+       virtual void update() {}
        /// Connect signals. Also perform any necessary initialisation.
-       virtual void connect() = 0;
+       virtual void connect();
        /// Disconnect signals. Also perform any necessary housekeeping.
-       virtual void disconnect() = 0;
+       virtual void disconnect();
        /// Build the dialog
        virtual void build() = 0;
        /** Filter the inputs on callback from xforms
            Return true if inputs are valid.
         */
-       virtual bool input( FL_OBJECT *, long ) {
+       virtual bool input( FL_OBJECT *, long) {
                return true;
        }
        /// Apply from dialog (modify or create inset)
@@ -91,7 +98,6 @@ protected: // methods
        /// Pointer to the actual instantiation of xform's form
        virtual FL_FORM * form() const = 0;
 
-protected: // data
        /** Which LyXFunc do we use?
            We could modify Dialogs to have a visible LyXFunc* instead and
            save a couple of bytes per dialog.
@@ -103,10 +109,18 @@ protected: // data
        Dialogs * d_;
        /// Hide connection.
        Connection h_;
+       /// Redraw connection.
+       Connection r_;
        /// dialog title, displayed by WM.
        string title;
+private:
        ///
        ButtonPolicy * bp_;
+public:
+       /// Overcome a dumb xforms sizing bug
+       mutable int minw_;
+       ///
+       mutable int minh_;
 };
 
 
@@ -115,36 +129,34 @@ protected: // data
     an update() function which is also supported by restore().
  */
 class FormBaseBI : public FormBase {
-public:
+protected:
        /// Constructor
        FormBaseBI(LyXView *, Dialogs *, string const &,
-                  ButtonPolicy * bp = new OkApplyCancelPolicy,
+                  ButtonPolicy * bp,
                   char const * close = N_("Close"),
                   char const * cancel = N_("Cancel"));
 
-protected:
        /// Connect signals
        virtual void connect();
-       /// Disconnect signals
-       virtual void disconnect();
 };
 
 
 /** This class is an XForms GUI base class for Buffer Dependent dialogs
  */
 class FormBaseBD : public FormBase {
-public:
+protected:
        /// Constructor
        FormBaseBD(LyXView *, Dialogs *, string const &,
-                  ButtonPolicy * bp = new OkApplyCancelReadOnlyPolicy,
+                  ButtonPolicy * bp,
                   char const * close = N_("Close"),
                   char const * cancel = N_("Cancel"));
 
-protected:
        /// Connect signals
        virtual void connect();
        /// Disconnect signals
        virtual void disconnect();
+       /// bool indicates if a buffer switch took place
+       virtual void updateSlot(bool) { update(); }
 
        /// Update connection.
        Connection u_;