3 * Read the file COPYING
5 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS
12 #pragma implementation
17 #include "ControlBibitem.h"
18 #include "FormBibitem.h"
19 #include "forms/form_bibitem.h"
20 #include FORMS_H_LOCATION
22 #include "support/lstrings.h" // compare
24 typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
26 FormBibitem::FormBibitem()
27 : base_class(_("Bibliography Entry"))
31 void FormBibitem::build()
33 dialog_.reset(build_bibitem(this));
35 fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
36 fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
38 setPrehandler(dialog_->input_key);
39 setPrehandler(dialog_->input_label);
41 // Manage the ok, apply, restore and cancel/close buttons
42 bc().setOK(dialog_->button_ok);
43 bc().setCancel(dialog_->button_close);
45 bc().addReadOnly(dialog_->input_key);
46 bc().addReadOnly(dialog_->input_label);
50 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
53 if (!compare(fl_get_input(dialog_->input_key), ""))
54 return ButtonPolicy::SMI_NOOP;
56 return ButtonPolicy::SMI_VALID;
60 void FormBibitem::update()
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());
69 void FormBibitem::apply()
71 controller().params().setContents(fl_get_input(dialog_->input_key));
72 controller().params().setOptions(fl_get_input(dialog_->input_label));