]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBibitem.C
Really dull and boring header shit
[lyx.git] / src / frontends / xforms / FormBibitem.C
1 /**
2  * \file FormBibitem.C
3  * Read the file COPYING
4  *
5  * \author Angus Leeming 
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include <config.h>
16 #include "xformsBC.h"
17 #include "ControlBibitem.h"
18 #include "FormBibitem.h"
19 #include "forms/form_bibitem.h"
20 #include FORMS_H_LOCATION
21 #include "gettext.h"
22 #include "support/lstrings.h" // compare
23
24 typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
25
26 FormBibitem::FormBibitem()
27         : base_class(_("Bibliography Entry"))
28 {}
29
30
31 void FormBibitem::build()
32 {
33         dialog_.reset(build_bibitem(this));
34
35         fl_set_input_return(dialog_->input_key,   FL_RETURN_CHANGED);
36         fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
37
38         setPrehandler(dialog_->input_key);
39         setPrehandler(dialog_->input_label);
40
41         // Manage the ok, apply, restore and cancel/close buttons
42         bc().setOK(dialog_->button_ok);
43         bc().setCancel(dialog_->button_close);
44
45         bc().addReadOnly(dialog_->input_key);
46         bc().addReadOnly(dialog_->input_label);
47 }
48
49
50 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
51 {
52         // minimal validation
53         if (!compare(fl_get_input(dialog_->input_key), ""))
54                 return ButtonPolicy::SMI_NOOP;
55
56         return ButtonPolicy::SMI_VALID;
57 }
58
59
60 void FormBibitem::update()
61 {
62         fl_set_input(dialog_->input_key,
63                      controller().params().getContents().c_str());
64         fl_set_input(dialog_->input_label,
65                      controller().params().getOptions().c_str());
66 }
67
68
69 void FormBibitem::apply()
70 {
71         controller().params().setContents(fl_get_input(dialog_->input_key));
72         controller().params().setOptions(fl_get_input(dialog_->input_label));
73 }