2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000 The LyX Team.
9 * ======================================================
11 * \author Angus Leeming <a.leeming@ic.ac.uk>
17 #include <boost/smart_ptr.hpp>
27 #include "ButtonPolicies.h"
31 /** This class is an Qt2 GUI base class.
33 class FormBase : public ViewBC<qt2BC>
37 FormBase(ControlBase &, string const &);
39 virtual ~FormBase() {}
43 virtual void build() = 0;
46 /// Create the dialog if necessary, update it and display it.
50 /// Pointer to the actual instantiation of xform's form
51 virtual QDialog* form() const = 0;
52 // /** Filter the inputs on callback from xforms
53 // Return true if inputs are valid. */
54 // virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
57 /// dialog title, displayed by WM.
62 template <class Dialog>
63 class FormDB: public FormBase
67 FormDB(ControlBase &, string const &);
68 /// Pointer to the actual instantiation of the Qt dialog
69 virtual QDialog* form() const;
70 /// Real GUI implementation.
71 boost::scoped_ptr<Dialog> dialog_;
75 template <class Dialog>
76 FormDB<Dialog>::FormDB(ControlBase & c, string const & t)
81 template <class Dialog>
82 QDialog* FormDB<Dialog>::form() const
88 template <class Controller, class Base>
89 class FormCB: public Base
93 FormCB(ControlBase &, string const &);
94 /// The parent controller
95 Controller & controller() const;
99 template <class Controller, class Base>
100 FormCB<Controller, Base>::FormCB(ControlBase & c, string const & t)
105 template <class Controller, class Base>
106 Controller & FormCB<Controller, Base>::controller() const
108 return static_cast<Controller &>(controller_);
109 //return dynamic_cast<Controller &>(controller_);