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()
69 bool GViewBase::isVisible() const
71 return window() && window()->is_visible();
75 GBC & GViewBase::bcview()
77 return static_cast<GBC &>(dialog().bc().view());
81 void GViewBase::setCancel(Gtk::Button * cancel)
83 bcview().setCancel(cancel);
84 cancel->signal_clicked().connect(
85 sigc::mem_fun(*this, &GViewBase::onCancel));
89 void GViewBase::setApply(Gtk::Button * apply)
91 bcview().setApply(apply);
92 apply->signal_clicked().connect(
93 sigc::mem_fun(*this, &GViewBase::onApply));
97 void GViewBase::setOK(Gtk::Button * ok)
100 ok->signal_clicked().connect(
101 sigc::mem_fun(*this, &GViewBase::onOK));
105 void GViewBase::setRestore(Gtk::Button * restore)
107 bcview().setRestore(restore);
108 restore->signal_clicked().connect(
109 sigc::mem_fun(*this, &GViewBase::onRestore));
113 void GViewBase::setTitle(std::string const & title)
115 Dialog::View::setTitle(title);
116 window()->set_title(title);
120 bool GViewBase::readOnly() const
122 return kernel().isBufferReadonly();
126 void GViewBase::onApply()
128 dialog().ApplyButton();
132 void GViewBase::onOK()
138 void GViewBase::onCancel()
140 dialog().CancelButton();
144 void GViewBase::onRestore()
146 dialog().RestoreButton();
150 bool GViewBase::onDeleteEvent(GdkEventAny *)
152 dialog().CancelButton();
157 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
158 GViewBase(parent, t, allowResize)
163 Gtk::Window * GViewGladeB::window()
168 xml_->get_widget("dialog", win);
173 Gtk::Window const * GViewGladeB::window() const
178 xml_->get_widget("dialog", win);
182 } // namespace frontend