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 "ButtonPolicies.h"
20 #include <libglademm.h>
22 #include <boost/scoped_ptr.hpp>
27 class GViewBase : public Dialog::View, public sigc::trackable {
29 GViewBase(Dialog &, std::string const &, bool allowResize);
31 void setCancel(Gtk::Button * cancel);
32 void setApply(Gtk::Button * apply);
33 void setOK(Gtk::Button * ok);
34 void setRestore(Gtk::Button * restore);
38 virtual void doBuild() = 0;
41 // Create the dialog if necessary, update it and display it.
44 virtual bool isVisible() const;
50 bool onDeleteEvent(GdkEventAny *);
52 virtual Gtk::Window * window() = 0;
53 virtual Gtk::Window const * window() const = 0;
58 template <class Dialog>
59 class GViewDB : public GViewBase {
61 GViewDB(Dialog &, std::string const &, bool allowResize);
62 virtual Gtk::Window const * window() const;
63 virtual Gtk::Window * window();
64 boost::scoped_ptr<Dialog> dialog_;
68 template <class Dialog>
69 GViewDB<Dialog>::GViewDB(Dialog & parent, std::string const & t, bool allowResize) :
70 GViewBase(parent, t, allowResize)
75 template <class Dialog>
76 Gtk::Window * GViewDB<Dialog>::window()
82 template <class Dialog>
83 const Gtk::Window * GViewDB<Dialog>::window() const
89 class GViewGladeB : public GViewBase {
91 GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
92 virtual Gtk::Window const * 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 {
101 Controller & controller();
102 Controller const & controller() const;
104 GViewCB(Dialog & parent, std::string const & t, bool allowResize = false);
108 template <class Controller, class Base>
109 GViewCB<Controller, Base>::GViewCB(Dialog & parent, std::string const & t,
111 Base(parent, t, allowResize)
116 template <class Controller, class Base>
117 Controller & GViewCB<Controller, Base>::controller()
119 return static_cast<Controller &>(getController());
123 template <class Controller, class Base>
124 Controller const & GViewCB<Controller, Base>::controller() const
126 return static_cast<Controller const &>(getController());
129 } // namespace frontend