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 {
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
90 GViewGladeB(Dialog & parent, std::string const & t, bool allowResize);
91 virtual Gtk::Window const * window() const;
92 virtual Gtk::Window * window();
93 Glib::RefPtr<Gnome::Glade::Xml> xml_;
97 template <class Controller, class Base>
98 class GViewCB : public Base {
100 Controller & controller();
101 Controller const & controller() const;
103 GViewCB(Dialog & parent, std::string const & t, bool allowResize = false);
107 template <class Controller, class Base>
108 GViewCB<Controller, Base>::GViewCB(Dialog & parent, std::string const & t,
110 Base(parent, t, allowResize)
115 template <class Controller, class Base>
116 Controller & GViewCB<Controller, Base>::controller()
118 return static_cast<Controller &>(getController());
122 template <class Controller, class Base>
123 Controller const & GViewCB<Controller, Base>::controller() const
125 return static_cast<Controller const &>(getController());
128 } // namespace frontend