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 _GLIBCPP_CONCEPT_CHECKS
15 #undef _GLIBCPP_CONCEPT_CHECKS
18 #include "GViewBase.h"
19 #include "support/filetools.h"
26 GViewBase::GViewBase(Dialog & parent, string const & t, bool allowResize) :
27 Dialog::View(parent, t), allowResize_(allowResize)
32 GViewBase::~GViewBase()
37 void GViewBase::hide()
43 void GViewBase::build()
46 string const iconName =
47 support::LibFileSearch("images", "lyx", "xpm");
48 if (!iconName.empty())
49 window()->set_icon_from_file(iconName);
50 window()->signal_delete_event().connect(
51 sigc::mem_fun(*this, &GViewBase::onDeleteEvent));
52 window()->set_title(Glib::locale_to_utf8(getTitle()));
56 void GViewBase::show()
66 bool GViewBase::isVisible() const
68 return window() && window()->is_visible();
72 GBC & GViewBase::bcview()
74 return static_cast<GBC &>(dialog().bc().view());
78 void GViewBase::setCancel(Gtk::Button * cancel)
80 bcview().setCancel(cancel);
81 cancel->signal_clicked().connect(
82 sigc::mem_fun(*this, &GViewBase::onCancel));
86 void GViewBase::setApply(Gtk::Button * apply)
88 bcview().setApply(apply);
89 apply->signal_clicked().connect(
90 sigc::mem_fun(*this, &GViewBase::onApply));
94 void GViewBase::setOK(Gtk::Button * ok)
97 ok->signal_clicked().connect(
98 sigc::mem_fun(*this, &GViewBase::onOK));
102 void GViewBase::setRestore(Gtk::Button * restore)
104 bcview().setRestore(restore);
105 restore->signal_clicked().connect(
106 sigc::mem_fun(*this, &GViewBase::onRestore));
110 void GViewBase::setTitle(std::string const & title)
112 Dialog::View::setTitle(title);
113 window()->set_title(title);
117 bool GViewBase::readOnly() const
119 return kernel().isBufferReadonly();
123 void GViewBase::onApply()
125 dialog().ApplyButton();
129 void GViewBase::onOK()
135 void GViewBase::onCancel()
137 dialog().CancelButton();
141 void GViewBase::onRestore()
143 dialog().RestoreButton();
147 bool GViewBase::onDeleteEvent(GdkEventAny *)
149 dialog().CancelButton();
154 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
155 GViewBase(parent, t, allowResize)
160 Gtk::Window * GViewGladeB::window()
165 xml_->get_widget("dialog", win);
170 Gtk::Window const * GViewGladeB::window() const
175 xml_->get_widget("dialog", win);
179 } // namespace frontend