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.
14 #include "GViewBase.h"
15 #include "support/filetools.h"
20 GViewBase::GViewBase(Dialog & parent, string const & t, bool allowResize) :
21 Dialog::View(parent, t), allowResize_(allowResize)
26 GViewBase::~GViewBase()
31 void GViewBase::hide()
37 void GViewBase::build()
40 string const iconName =
41 lyx::support::LibFileSearch("images", "lyx", "xpm");
42 if (!iconName.empty())
43 window()->set_icon_from_file(iconName);
44 window()->signal_delete_event().connect(
45 SigC::slot(*this, &GViewBase::onDeleteEvent));
46 window()->set_title(Glib::locale_to_utf8(getTitle()));
50 void GViewBase::show()
59 bool GViewBase::isVisible() const
61 return window() && window()->is_visible();
65 GBC & GViewBase::bcview()
67 return static_cast<GBC &>(dialog().bc().view());
70 void GViewBase::setCancel(Gtk::Button * cancel)
72 bcview().setCancel(cancel);
73 cancel->signal_clicked().connect(
74 SigC::slot(*this, &GViewBase::onCancel));
77 void GViewBase::setApply(Gtk::Button * apply)
79 bcview().setApply(apply);
80 apply->signal_clicked().connect(
81 SigC::slot(*this, &GViewBase::onApply));
84 void GViewBase::setOK(Gtk::Button * ok)
87 ok->signal_clicked().connect(
88 SigC::slot(*this, &GViewBase::onOK));
91 void GViewBase::setRestore(Gtk::Button * restore)
93 bcview().setRestore(restore);
94 restore->signal_clicked().connect(
95 SigC::slot(*this, &GViewBase::onRestore));
98 void GViewBase::onApply()
100 dialog().ApplyButton();
104 void GViewBase::onOK()
110 void GViewBase::onCancel()
112 dialog().CancelButton();
116 void GViewBase::onRestore()
118 dialog().RestoreButton();
122 bool GViewBase::onDeleteEvent(GdkEventAny *)
124 dialog().CancelButton();
129 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
130 GViewBase(parent, t, allowResize)
135 Gtk::Window * GViewGladeB::window()
140 xml_->get_widget("dialog", win);
145 const Gtk::Window * GViewGladeB::window() const
150 xml_->get_widget("dialog", win);