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"
31 GViewBase::GViewBase(Dialog & parent, docstring const & t, bool allowResize) :
32 Dialog::View(parent, t), allowResize_(allowResize)
37 GViewBase::~GViewBase()
42 void GViewBase::hide()
48 void GViewBase::build()
51 string const iconName =
52 support::libFileSearch("images", "lyx", "xpm");
53 if (!iconName.empty())
54 window()->set_icon_from_file(iconName);
55 window()->signal_delete_event().connect(
56 sigc::mem_fun(*this, &GViewBase::onDeleteEvent));
57 window()->set_title(Glib::locale_to_utf8(getTitle()));
61 void GViewBase::show()
69 if (dialog().controller().exitEarly())
76 bool GViewBase::isVisible() const
78 return window() && window()->is_visible();
82 GBC & GViewBase::bcview()
84 return static_cast<GBC &>(dialog().bc().view());
88 void GViewBase::setCancel(Gtk::Button * cancel)
90 bcview().setCancel(cancel);
91 cancel->signal_clicked().connect(
92 sigc::mem_fun(*this, &GViewBase::onCancel));
96 void GViewBase::setApply(Gtk::Button * apply)
98 bcview().setApply(apply);
99 apply->signal_clicked().connect(
100 sigc::mem_fun(*this, &GViewBase::onApply));
104 void GViewBase::setOK(Gtk::Button * ok)
107 ok->signal_clicked().connect(
108 sigc::mem_fun(*this, &GViewBase::onOK));
112 void GViewBase::setRestore(Gtk::Button * restore)
114 bcview().setRestore(restore);
115 restore->signal_clicked().connect(
116 sigc::mem_fun(*this, &GViewBase::onRestore));
120 void GViewBase::setTitle(lyx::docstring const & title)
122 Dialog::View::setTitle(title);
123 window()->set_title(title);
127 bool GViewBase::readOnly() const
129 return kernel().isBufferReadonly();
133 void GViewBase::onApply()
135 dialog().ApplyButton();
139 void GViewBase::onOK()
145 void GViewBase::onCancel()
147 dialog().CancelButton();
151 void GViewBase::onRestore()
153 dialog().RestoreButton();
157 bool GViewBase::onDeleteEvent(GdkEventAny *)
159 dialog().CancelButton();
164 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
165 GViewBase(parent, t, allowResize)
170 Gtk::Window * GViewGladeB::window()
175 xml_->get_widget("dialog", win);
180 Gtk::Window const * GViewGladeB::window() const
185 xml_->get_widget("dialog", win);
189 } // namespace frontend