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"
26 GText::GText(Dialog & parent, string const & title, string const & label)
27 : GViewCB<ControlCommand, GViewGladeB>(parent, title),
28 label_(label), entry_(0)
35 string const contents = Glib::locale_from_utf8(entry_->get_text());
36 controller().params().setContents(contents);
42 string const contents = support::trim(
43 controller().params().getContents());
44 entry_->set_text(Glib::locale_to_utf8(contents));
50 string const gladeName = findGladeFile("text");
51 xml_ = Gnome::Glade::Xml::create(gladeName);
53 Gtk::Button * restore;
57 xml_->get_widget("Label", label);
58 xml_->get_widget("Text", entry_);
59 xml_->get_widget("Restore", restore);
60 xml_->get_widget("Cancel", cancel);
61 xml_->get_widget("Apply", apply);
62 xml_->get_widget("OK", ok);
63 label->set_text(Glib::locale_to_utf8(id_sc::id(label_)));
68 bcview().addReadOnly(entry_);
69 entry_->signal_changed().connect(
70 sigc::mem_fun(*this, >ext::onEntryChanged));
74 void GText::onEntryChanged()
76 bc().valid(!entry_->get_text().empty());
79 } // namespace frontend