4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
16 #include <libglademm.h>
17 #include <boost/scoped_ptr.hpp>
19 #include "ButtonPolicies.h"
22 class GViewBase : public Dialog::View, public SigC::Object
25 GViewBase(Dialog &, std::string const &, bool allowResize);
27 void setCancel(Gtk::Button * cancel);
28 void setApply(Gtk::Button * apply);
29 void setOK(Gtk::Button * ok);
30 void setRestore(Gtk::Button * restore);
34 virtual void doBuild() = 0;
37 // Create the dialog if necessary, update it and display it.
40 virtual bool isVisible() const;
46 bool onDeleteEvent(GdkEventAny *);
48 virtual Gtk::Window * window() = 0;
49 virtual Gtk::Window const * window() const = 0;
53 template <class Dialog>
54 class GViewDB : public GViewBase
57 GViewDB(Dialog &, std::string const &, bool allowResize);
58 virtual const Gtk::Window * window() const;
59 virtual Gtk::Window * window();
60 boost::scoped_ptr<Dialog> dialog_;
64 template <class Dialog>
65 GViewDB<Dialog>::GViewDB(Dialog & parent, std::string const & t, bool allowResize) :
66 GViewBase(parent, t, allowResize)
71 template <class Dialog>
72 Gtk::Window * GViewDB<Dialog>::window()
78 template <class Dialog>
79 const Gtk::Window * GViewDB<Dialog>::window() const
85 class GViewGladeB : public GViewBase
88 GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
89 virtual const Gtk::Window * window() const;
90 virtual Gtk::Window * window();
91 Glib::RefPtr<Gnome::Glade::Xml> xml_;
95 template <class Controller, class Base>
96 class GViewCB : public Base
99 Controller & controller();
100 Controller const & controller() const;
102 GViewCB(Dialog & parent, std::string const & t, bool allowResize = false);
106 template <class Controller, class Base>
107 GViewCB<Controller, Base>::GViewCB(Dialog & parent, std::string const & t,
109 Base(parent, t, allowResize)
114 template <class Controller, class Base>
115 Controller & GViewCB<Controller, Base>::controller()
117 return static_cast<Controller &>(getController());
121 template <class Controller, class Base>
122 Controller const & GViewCB<Controller, Base>::controller() const
124 return static_cast<Controller const &>(getController());