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"
25 class GViewBase : public Dialog::View, public SigC::Object
28 GViewBase(Dialog &, std::string const &, bool allowResize);
30 void setCancel(Gtk::Button * cancel);
31 void setApply(Gtk::Button * apply);
32 void setOK(Gtk::Button * ok);
33 void setRestore(Gtk::Button * restore);
37 virtual void doBuild() = 0;
40 // Create the dialog if necessary, update it and display it.
43 virtual bool isVisible() const;
49 bool onDeleteEvent(GdkEventAny *);
51 virtual Gtk::Window * window() = 0;
52 virtual Gtk::Window const * window() const = 0;
56 template <class Dialog>
57 class GViewDB : public GViewBase
60 GViewDB(Dialog &, std::string const &, bool allowResize);
61 virtual const Gtk::Window * window() const;
62 virtual Gtk::Window * window();
63 boost::scoped_ptr<Dialog> dialog_;
67 template <class Dialog>
68 GViewDB<Dialog>::GViewDB(Dialog & parent, std::string const & t, bool allowResize) :
69 GViewBase(parent, t, allowResize)
74 template <class Dialog>
75 Gtk::Window * GViewDB<Dialog>::window()
81 template <class Dialog>
82 const Gtk::Window * GViewDB<Dialog>::window() const
88 class GViewGladeB : public GViewBase
91 GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
92 virtual const Gtk::Window * window() const;
93 virtual Gtk::Window * window();
94 Glib::RefPtr<Gnome::Glade::Xml> xml_;
98 template <class Controller, class Base>
99 class GViewCB : public Base
102 Controller & controller();
103 Controller const & controller() const;
105 GViewCB(Dialog & parent, std::string const & t, bool allowResize = false);
109 template <class Controller, class Base>
110 GViewCB<Controller, Base>::GViewCB(Dialog & parent, std::string const & t,
112 Base(parent, t, allowResize)
117 template <class Controller, class Base>
118 Controller & GViewCB<Controller, Base>::controller()
120 return static_cast<Controller &>(getController());
124 template <class Controller, class Base>
125 Controller const & GViewCB<Controller, Base>::controller() const
127 return static_cast<Controller const &>(getController());
130 } // namespace frontend