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);
35 void setTitle(std::string const &);
36 bool readOnly() const;
40 virtual void doBuild() = 0;
43 // Create the dialog if necessary, update it and display it.
46 virtual bool isVisible() const;
52 bool onDeleteEvent(GdkEventAny *);
54 virtual Gtk::Window * window() = 0;
55 virtual Gtk::Window const * window() const = 0;
60 template <class Dialog>
61 class GViewDB : public GViewBase {
63 GViewDB(Dialog &, std::string const &, bool allowResize);
64 virtual Gtk::Window const * window() const;
65 virtual Gtk::Window * window();
66 boost::scoped_ptr<Dialog> dialog_;
70 template <class Dialog>
71 GViewDB<Dialog>::GViewDB(Dialog & parent, std::string const & t, bool allowResize) :
72 GViewBase(parent, t, allowResize)
77 template <class Dialog>
78 Gtk::Window * GViewDB<Dialog>::window()
84 template <class Dialog>
85 const Gtk::Window * GViewDB<Dialog>::window() const
91 class GViewGladeB : public GViewBase {
93 GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
94 virtual Gtk::Window const * window() const;
95 virtual Gtk::Window * window();
96 Glib::RefPtr<Gnome::Glade::Xml> xml_;
100 template <class Controller, class Base>
101 class GViewCB : public Base {
103 Controller & controller();
104 Controller const & controller() const;
106 GViewCB(Dialog & parent, std::string const & t, bool allowResize = false);
110 template <class Controller, class Base>
111 GViewCB<Controller, Base>::GViewCB(Dialog & parent, std::string const & t,
113 Base(parent, t, allowResize)
118 template <class Controller, class Base>
119 Controller & GViewCB<Controller, Base>::controller()
121 return static_cast<Controller &>(this->getController());
125 template <class Controller, class Base>
126 Controller const & GViewCB<Controller, Base>::controller() const
128 return static_cast<Controller const &>(this->getController());
131 } // namespace frontend