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 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
21 #include "GViewBase.h"
22 #include "support/filetools.h"
29 GViewBase::GViewBase(Dialog & parent, string const & t, bool allowResize) :
30 Dialog::View(parent, t), allowResize_(allowResize)
35 GViewBase::~GViewBase()
40 void GViewBase::hide()
46 void GViewBase::build()
49 string const iconName =
50 support::LibFileSearch("images", "lyx", "xpm");
51 if (!iconName.empty())
52 window()->set_icon_from_file(iconName);
53 window()->signal_delete_event().connect(
54 sigc::mem_fun(*this, &GViewBase::onDeleteEvent));
55 window()->set_title(Glib::locale_to_utf8(getTitle()));
59 void GViewBase::show()
67 if (dialog().controller().exitEarly())
74 bool GViewBase::isVisible() const
76 return window() && window()->is_visible();
80 GBC & GViewBase::bcview()
82 return static_cast<GBC &>(dialog().bc().view());
86 void GViewBase::setCancel(Gtk::Button * cancel)
88 bcview().setCancel(cancel);
89 cancel->signal_clicked().connect(
90 sigc::mem_fun(*this, &GViewBase::onCancel));
94 void GViewBase::setApply(Gtk::Button * apply)
96 bcview().setApply(apply);
97 apply->signal_clicked().connect(
98 sigc::mem_fun(*this, &GViewBase::onApply));
102 void GViewBase::setOK(Gtk::Button * ok)
105 ok->signal_clicked().connect(
106 sigc::mem_fun(*this, &GViewBase::onOK));
110 void GViewBase::setRestore(Gtk::Button * restore)
112 bcview().setRestore(restore);
113 restore->signal_clicked().connect(
114 sigc::mem_fun(*this, &GViewBase::onRestore));
118 void GViewBase::setTitle(std::string const & title)
120 Dialog::View::setTitle(title);
121 window()->set_title(title);
125 bool GViewBase::readOnly() const
127 return kernel().isBufferReadonly();
131 void GViewBase::onApply()
133 dialog().ApplyButton();
137 void GViewBase::onOK()
143 void GViewBase::onCancel()
145 dialog().CancelButton();
149 void GViewBase::onRestore()
151 dialog().RestoreButton();
155 bool GViewBase::onDeleteEvent(GdkEventAny *)
157 dialog().CancelButton();
162 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
163 GViewBase(parent, t, allowResize)
168 Gtk::Window * GViewGladeB::window()
173 xml_->get_widget("dialog", win);
178 Gtk::Window const * GViewGladeB::window() const
183 xml_->get_widget("dialog", win);
187 } // namespace frontend