// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * * Copyright 2000 The LyX Team. * * ====================================================== * * \author Angus Leeming */ #ifndef FORMBASE_H #define FORMBASE_H #include class QDialog; #ifdef __GNUG__ #pragma interface #endif #include "ViewBase.h" #include "LString.h" #include "ButtonPolicies.h" class qt2BC; /** This class is an Qt2 GUI base class. */ class FormBase : public ViewBC { public: /// FormBase(ControlBase &, string const &); /// virtual ~FormBase() {} protected: /// Build the dialog virtual void build() = 0; /// Hide the dialog. void hide(); /// Create the dialog if necessary, update it and display it. void show(); private: /// Pointer to the actual instantiation of xform's form virtual QDialog* form() const = 0; // /** Filter the inputs on callback from xforms // Return true if inputs are valid. */ // virtual ButtonPolicy::SMInput input(FL_OBJECT *, long); private: /// dialog title, displayed by WM. string title_; }; template class FormDB: public FormBase { protected: /// FormDB(ControlBase &, string const &); /// Pointer to the actual instantiation of the Qt dialog virtual QDialog* form() const; /// Real GUI implementation. boost::scoped_ptr dialog_; }; template FormDB::FormDB(ControlBase & c, string const & t) : FormBase(c, t) {} template QDialog* FormDB::form() const { return dialog_.get(); } template class FormCB: public Base { protected: /// FormCB(ControlBase &, string const &); /// The parent controller Controller & controller() const; }; template FormCB::FormCB(ControlBase & c, string const & t) : Base(c, t) {} template Controller & FormCB::controller() const { return static_cast(controller_); //return dynamic_cast(controller_); } #endif // FORMBASE_H