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::trackable {
27 GViewBase(Dialog &, std::string const &, bool allowResize);
29 void setCancel(Gtk::Button * cancel);
30 void setApply(Gtk::Button * apply);
31 void setOK(Gtk::Button * ok);
32 void setRestore(Gtk::Button * restore);
36 virtual void doBuild() = 0;
39 // Create the dialog if necessary, update it and display it.
42 virtual bool isVisible() const;
48 bool onDeleteEvent(GdkEventAny *);
50 virtual Gtk::Window * window() = 0;
51 virtual Gtk::Window const * window() const = 0;
56 template <class Dialog>
57 class GViewDB : public GViewBase {
59 GViewDB(Dialog &, std::string const &, bool allowResize);
60 virtual const Gtk::Window * window() const;
61 virtual Gtk::Window * window();
62 boost::scoped_ptr<Dialog> dialog_;
66 template <class Dialog>
67 GViewDB<Dialog>::GViewDB(Dialog & parent, std::string const & t, bool allowResize) :
68 GViewBase(parent, t, allowResize)
73 template <class Dialog>
74 Gtk::Window * GViewDB<Dialog>::window()
80 template <class Dialog>
81 const Gtk::Window * GViewDB<Dialog>::window() const
87 class GViewGladeB : public GViewBase {
89 GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
90 virtual Gtk::Window const * window() const;
91 virtual Gtk::Window * window();
92 Glib::RefPtr<Gnome::Glade::Xml> xml_;
96 template <class Controller, class Base>
97 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());
127 } // namespace frontend