]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GBibItem.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / gtk / GBibItem.C
1 /**
2  * \file GBibItem.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Spray
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
16 #endif
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
19 #endif
20
21 #include "GBibItem.h"
22 #include "ControlCommand.h"
23 #include "ghelpers.h"
24
25 #include <libglademm.h>
26
27 using std::string;
28
29 namespace lyx {
30 namespace frontend {
31
32 // FIXME UNICODE
33 GBibItem::GBibItem(Dialog & parent)
34         : GViewCB<ControlCommand, GViewGladeB>(parent, lyx::to_utf8(_("Bibliography Entry Settings")), false)
35 {}
36
37
38 void GBibItem::doBuild()
39 {
40         string const gladeName = findGladeFile("bibitem");
41         xml_ = Gnome::Glade::Xml::create(gladeName);
42
43         Gtk::Button * button;
44         xml_->get_widget("Cancel", button);
45         setCancel(button);
46         xml_->get_widget("OK", button);
47         setOK(button);
48
49         xml_->get_widget("Key", keyentry_);
50         xml_->get_widget("Label", labelentry_);
51
52         keyentry_->signal_changed().connect(
53                 sigc::mem_fun(*this, &GBibItem::changed));
54         labelentry_->signal_changed().connect(
55                 sigc::mem_fun(*this, &GBibItem::changed));
56
57         bcview().addReadOnly(keyentry_);
58         bcview().addReadOnly(labelentry_);
59 }
60
61
62 void GBibItem::update()
63 {
64         bc().refreshReadOnly();
65
66         keyentry_->set_text (controller().params().getContents());
67         labelentry_->set_text (controller().params().getOptions());
68 }
69
70
71 void GBibItem::apply()
72 {
73         controller().params().setContents(keyentry_->get_text());
74         controller().params().setOptions(labelentry_->get_text());
75 }
76
77 void GBibItem::changed()
78 {
79         if (keyentry_->get_text().size() > 0)
80                 bc().valid(TRUE);
81         else
82                 bc().valid(FALSE);
83 }
84
85 } // namespace frontend
86 } // namespace lyx