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 #include <libglademm.h>
15 #include "support/lstrings.h"
16 #include "ControlCommand.h"
24 GText::GText(Dialog & parent, string const & title, string const & label)
25 : GViewCB<ControlCommand, GViewGladeB>(parent, title),
26 label_(label), entry_(0)
32 string const contents = Glib::locale_from_utf8(entry_->get_text());
33 controller().params().setContents(contents);
38 string const contents = lyx::support::trim(
39 controller().params().getContents());
40 entry_->set_text(Glib::locale_to_utf8(contents));
45 string const gladeName = findGladeFile("text");
46 xml_ = Gnome::Glade::Xml::create(gladeName);
48 Gtk::Button * restore;
52 xml_->get_widget("Label", label);
53 xml_->get_widget("Text", entry_);
54 xml_->get_widget("Restore", restore);
55 xml_->get_widget("Cancel", cancel);
56 xml_->get_widget("Apply", apply);
57 xml_->get_widget("OK", ok);
58 label->set_text(Glib::locale_to_utf8(id_sc::id(label_)));
63 bcview().addReadOnly(entry_);
64 entry_->signal_changed().connect(
65 SigC::slot(*this, >ext::onEntryChanged));
68 void GText::onEntryChanged()
70 bc().valid(!entry_->get_text().empty());