3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "GViewBase.h"
14 #include "support/filetools.h"
21 GViewBase::GViewBase(Dialog & parent, string const & t, bool allowResize) :
22 Dialog::View(parent, t), allowResize_(allowResize)
27 GViewBase::~GViewBase()
32 void GViewBase::hide()
38 void GViewBase::build()
41 string const iconName =
42 support::LibFileSearch("images", "lyx", "xpm");
43 if (!iconName.empty())
44 window()->set_icon_from_file(iconName);
45 window()->signal_delete_event().connect(
46 sigc::mem_fun(*this, &GViewBase::onDeleteEvent));
47 window()->set_title(Glib::locale_to_utf8(getTitle()));
51 void GViewBase::show()
61 bool GViewBase::isVisible() const
63 return window() && window()->is_visible();
67 GBC & GViewBase::bcview()
69 return static_cast<GBC &>(dialog().bc().view());
73 void GViewBase::setCancel(Gtk::Button * cancel)
75 bcview().setCancel(cancel);
76 cancel->signal_clicked().connect(
77 sigc::mem_fun(*this, &GViewBase::onCancel));
81 void GViewBase::setApply(Gtk::Button * apply)
83 bcview().setApply(apply);
84 apply->signal_clicked().connect(
85 sigc::mem_fun(*this, &GViewBase::onApply));
89 void GViewBase::setOK(Gtk::Button * ok)
92 ok->signal_clicked().connect(
93 sigc::mem_fun(*this, &GViewBase::onOK));
97 void GViewBase::setRestore(Gtk::Button * restore)
99 bcview().setRestore(restore);
100 restore->signal_clicked().connect(
101 sigc::mem_fun(*this, &GViewBase::onRestore));
105 void GViewBase::setTitle(std::string const & title)
107 Dialog::View::setTitle(title);
108 window()->set_title(title);
112 bool GViewBase::readOnly() const
114 return kernel().isBufferReadonly();
118 void GViewBase::onApply()
120 dialog().ApplyButton();
124 void GViewBase::onOK()
130 void GViewBase::onCancel()
132 dialog().CancelButton();
136 void GViewBase::onRestore()
138 dialog().RestoreButton();
142 bool GViewBase::onDeleteEvent(GdkEventAny *)
144 dialog().CancelButton();
149 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
150 GViewBase(parent, t, allowResize)
155 Gtk::Window * GViewGladeB::window()
160 xml_->get_widget("dialog", win);
165 Gtk::Window const * GViewGladeB::window() const
170 xml_->get_widget("dialog", win);
174 } // namespace frontend