]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormBase.h
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / FormBase.h
index 8668e3722f92c5f7fa4ae54ba78b152ae0fb3942..3774f2bbf24c8725e510859d4f7713a22cd504e4 100644 (file)
@@ -4,11 +4,11 @@
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2000-2001 The LyX Team.
  *
  * ======================================================
  *
- * Author: Angus Leeming <a.leeming@ic.ac.uk>
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
  */
 
 #ifndef FORMBASE_H
@@ -33,7 +33,7 @@ class FormBase : public ViewBC<xformsBC>
 {
 public:
        ///
-       FormBase(ControlBase &, string const &);
+       FormBase(ControlButtons &, string const &, bool allowResize);
        ///
        virtual ~FormBase() {}
 
@@ -51,34 +51,30 @@ protected:
 private:
        /// Pointer to the actual instantiation of xform's form
        virtual FL_FORM * form() const = 0;
-       /** Filter the inputs on callback from xforms
-           Return true if inputs are valid. */
-       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long) = 0;
+       /// Filter the inputs on callback from xforms 
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
 
        /** Redraw the form (on receipt of a Signal indicating, for example,
            that the xform colors have been re-mapped). */
        virtual void redraw();
 
-protected:
-       /// Overcome a dumb xforms sizing bug
-       mutable int minw_;
+       /// The dialog's minimum allowable dimensions.
+       int minw_;
        ///
-       mutable int minh_;
-
-private:
+       int minh_;
+       /// Can the dialog be resized after it has been created?
+       bool allow_resize_;
        /// dialog title, displayed by WM.
        string title_;
 };
 
 
-template <class Controller, class Dialog>
-class FormBase2: public FormBase
+template <class Dialog>
+class FormDB: public FormBase
 {
 protected:
        ///
-       FormBase2(ControlBase &, string const &);
-       /// The parent controller
-       Controller & controller() const;
+       FormDB(ControlButtons &, string const &, bool allowResize=true);
        /// Pointer to the actual instantiation of xform's form
        virtual FL_FORM * form() const;
        /// Real GUI implementation.
@@ -86,25 +82,43 @@ protected:
 };
 
 
-template <class Controller, class Dialog>
-FormBase2<Controller, Dialog>::FormBase2(ControlBase & c, string const & t)
-       : FormBase(c, t)
+template <class Dialog>
+FormDB<Dialog>::FormDB(ControlButtons & c, string const & t, bool allowResize)
+       : FormBase(c, t, allowResize)
 {}
 
 
-template <class Controller, class Dialog>
-Controller & FormBase2<Controller, Dialog>::controller() const
+template <class Dialog>
+FL_FORM * FormDB<Dialog>::form() const
 {
-       return static_cast<Controller &>(controller_);
-       //return dynamic_cast<Controller &>(controller_);
+       if (dialog_.get()) return dialog_->form;
+       return 0;
 }
 
 
-template <class Controller, class Dialog>
-FL_FORM * FormBase2<Controller, Dialog>::form() const
+template <class Controller, class Base>
+class FormCB: public Base
 {
-       if (dialog_.get()) return dialog_->form;
-       return 0;
+protected:
+       ///
+       FormCB(ControlButtons &, string const &, bool allowResize=true);
+       /// The parent controller
+       Controller & controller() const;
+};
+
+
+template <class Controller, class Base>
+FormCB<Controller, Base>::FormCB(ControlButtons & c, string const & t,
+                                bool allowResize)
+       : Base(c, t, allowResize)
+{}
+
+
+template <class Controller, class Base>
+Controller & FormCB<Controller, Base>::controller() const
+{
+       return static_cast<Controller &>(controller_);
+       //return dynamic_cast<Controller &>(controller_);
 }