3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS
13 #pragma implementation
18 #include "ControlBibitem.h"
19 #include "FormBibitem.h"
20 #include "forms/form_bibitem.h"
21 #include FORMS_H_LOCATION
23 #include "support/lstrings.h" // compare
25 typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
27 FormBibitem::FormBibitem()
28 : base_class(_("Bibliography Entry"))
32 void FormBibitem::build()
34 dialog_.reset(build_bibitem(this));
36 fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
37 fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
39 setPrehandler(dialog_->input_key);
40 setPrehandler(dialog_->input_label);
42 // Manage the ok, apply, restore and cancel/close buttons
43 bc().setOK(dialog_->button_ok);
44 bc().setCancel(dialog_->button_close);
46 bc().addReadOnly(dialog_->input_key);
47 bc().addReadOnly(dialog_->input_label);
51 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
54 if (!compare(fl_get_input(dialog_->input_key), ""))
55 return ButtonPolicy::SMI_NOOP;
57 return ButtonPolicy::SMI_VALID;
61 void FormBibitem::update()
63 fl_set_input(dialog_->input_key,
64 controller().params().getContents().c_str());
65 fl_set_input(dialog_->input_label,
66 controller().params().getOptions().c_str());
70 void FormBibitem::apply()
72 controller().params().setContents(fl_get_input(dialog_->input_key));
73 controller().params().setOptions(fl_get_input(dialog_->input_label));