]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GBibItem.C
Extracted from r14281
[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 GBibItem::GBibItem(Dialog & parent)
33         : GViewCB<ControlCommand, GViewGladeB>(parent, _("Bibliography Entry Settings"), false)
34 {}
35
36
37 void GBibItem::doBuild()
38 {
39         string const gladeName = findGladeFile("bibitem");
40         xml_ = Gnome::Glade::Xml::create(gladeName);
41
42         Gtk::Button * button;
43         xml_->get_widget("Cancel", button);
44         setCancel(button);
45         xml_->get_widget("OK", button);
46         setOK(button);
47
48         xml_->get_widget("Key", keyentry_);
49         xml_->get_widget("Label", labelentry_);
50
51         keyentry_->signal_changed().connect(
52                 sigc::mem_fun(*this, &GBibItem::changed));
53         labelentry_->signal_changed().connect(
54                 sigc::mem_fun(*this, &GBibItem::changed));
55
56         bcview().addReadOnly(keyentry_);
57         bcview().addReadOnly(labelentry_);
58 }
59
60
61 void GBibItem::update()
62 {
63         bc().refreshReadOnly();
64
65         keyentry_->set_text (controller().params().getContents());
66         labelentry_->set_text (controller().params().getOptions());
67 }
68
69
70 void GBibItem::apply()
71 {
72         controller().params().setContents(keyentry_->get_text());
73         controller().params().setOptions(labelentry_->get_text());
74 }
75
76 void GBibItem::changed()
77 {
78         if (keyentry_->get_text().size() > 0)
79                 bc().valid(TRUE);
80         else
81                 bc().valid(FALSE);
82 }
83
84 } // namespace frontend
85 } // namespace lyx