]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBibitem.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / FormBibitem.C
1 /**
2  * \file FormBibitem.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Angus Leeming, a.leeming@ic.ac.uk 
7  * \author John Levon, moz@compsoc.man.ac.uk
8  */
9
10 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13
14 #include <config.h>
15 #include "xformsBC.h"
16 #include "ControlBibitem.h"
17 #include "FormBibitem.h"
18 #include "form_bibitem.h"
19 #include "gettext.h"
20 #include "support/lstrings.h" // compare
21
22 typedef FormCB<ControlBibitem, FormDB<FD_form_bibitem> > base_class;
23
24 FormBibitem::FormBibitem(ControlBibitem & c)
25         : base_class(c, _("Bibliography Entry"))
26 {}
27
28
29 void FormBibitem::build()
30 {
31         dialog_.reset(build_bibitem());
32
33         fl_set_input_return(dialog_->key,   FL_RETURN_CHANGED);
34         fl_set_input_return(dialog_->label, FL_RETURN_CHANGED);
35
36         // Manage the ok, apply, restore and cancel/close buttons
37         bc().setOK(dialog_->button_ok);
38         bc().setCancel(dialog_->button_cancel);
39
40         bc().addReadOnly(dialog_->key);
41         bc().addReadOnly(dialog_->label);
42 }
43
44
45 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
46 {
47         // minimal validation 
48         if (!compare(fl_get_input(dialog_->key), ""))
49                 return ButtonPolicy::SMI_NOOP;
50
51         return ButtonPolicy::SMI_VALID;
52 }
53
54
55 void FormBibitem::update()
56 {
57         fl_set_input(dialog_->key,
58                      controller().params().getContents().c_str());
59         fl_set_input(dialog_->label,
60                      controller().params().getOptions().c_str());
61 }
62
63
64 void FormBibitem::apply()
65 {
66         controller().params().setContents(fl_get_input(dialog_->key));
67         controller().params().setOptions(fl_get_input(dialog_->label));
68 }