]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormBibitem.C
No longer pass Controller & or Dialogs & to the View c-tors.
[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 "forms/form_bibitem.h"
19 #include FORMS_H_LOCATION
20 #include "gettext.h"
21 #include "support/lstrings.h" // compare
22
23 typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
24
25 FormBibitem::FormBibitem()
26         : base_class(_("Bibliography Entry"))
27 {}
28
29
30 void FormBibitem::build()
31 {
32         dialog_.reset(build_bibitem(this));
33
34         fl_set_input_return(dialog_->input_key,   FL_RETURN_CHANGED);
35         fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
36
37         setPrehandler(dialog_->input_key);
38         setPrehandler(dialog_->input_label);
39
40         // Manage the ok, apply, restore and cancel/close buttons
41         bc().setOK(dialog_->button_ok);
42         bc().setCancel(dialog_->button_close);
43
44         bc().addReadOnly(dialog_->input_key);
45         bc().addReadOnly(dialog_->input_label);
46 }
47
48
49 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
50 {
51         // minimal validation
52         if (!compare(fl_get_input(dialog_->input_key), ""))
53                 return ButtonPolicy::SMI_NOOP;
54
55         return ButtonPolicy::SMI_VALID;
56 }
57
58
59 void FormBibitem::update()
60 {
61         fl_set_input(dialog_->input_key,
62                      controller().params().getContents().c_str());
63         fl_set_input(dialog_->input_label,
64                      controller().params().getOptions().c_str());
65 }
66
67
68 void FormBibitem::apply()
69 {
70         controller().params().setContents(fl_get_input(dialog_->input_key));
71         controller().params().setOptions(fl_get_input(dialog_->input_label));
72 }