]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBibitem.C
Rewrote the maths panel so that ALL the popups now derive from FormBaseBD,
[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
7  * \author John Levon
8  */
9
10 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13
14 #include <config.h>
15 #include "ControlBibitem.h"
16 #include "FormBibitem.h"
17 #include "form_bibitem.h"
18 #include "gettext.h"
19 #include "xformsBC.h"
20 #include "support/lstrings.h" // compare
21
22 FormBibitem::FormBibitem(ControlBibitem & c)
23         : FormBase2<ControlBibitem, FD_form_bibitem>(c, _("Bibliography Entry"))
24 {}
25
26
27 void FormBibitem::build()
28 {
29         dialog_.reset(build_bibitem());
30
31         fl_set_input_return(dialog_->key,   FL_RETURN_CHANGED);
32         fl_set_input_return(dialog_->label, FL_RETURN_CHANGED);
33
34         // Manage the ok, apply, restore and cancel/close buttons
35         bc().setOK(dialog_->button_ok);
36         bc().setCancel(dialog_->button_cancel);
37         bc().refresh();
38
39         bc().addReadOnly(dialog_->key);
40         bc().addReadOnly(dialog_->label);
41 }
42
43
44 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
45 {
46         // minimal validation 
47         if (!compare(fl_get_input(dialog_->key), ""))
48                 return ButtonPolicy::SMI_NOOP;
49
50         return ButtonPolicy::SMI_VALID;
51 }
52
53
54 void FormBibitem::update()
55 {
56         fl_set_input(dialog_->key,
57                      controller().params().getContents().c_str());
58         fl_set_input(dialog_->label,
59                      controller().params().getOptions().c_str());
60 }
61
62
63 void FormBibitem::apply()
64 {
65         controller().params().setContents(fl_get_input(dialog_->key));
66         controller().params().setOptions(fl_get_input(dialog_->label));
67 }