3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author Angus Leeming <leeming@lyx.org>
7 * \author John Levon, moz@compsoc.man.ac.uk
11 #pragma implementation
16 #include "ControlBibitem.h"
17 #include "FormBibitem.h"
18 #include "forms/form_bibitem.h"
19 #include FORMS_H_LOCATION
21 #include "support/lstrings.h" // compare
23 typedef FormCB<ControlBibitem, FormDB<FD_bibitem> > base_class;
25 FormBibitem::FormBibitem()
26 : base_class(_("Bibliography Entry"))
30 void FormBibitem::build()
32 dialog_.reset(build_bibitem(this));
34 fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
35 fl_set_input_return(dialog_->input_label, FL_RETURN_CHANGED);
37 setPrehandler(dialog_->input_key);
38 setPrehandler(dialog_->input_label);
40 // Manage the ok, apply, restore and cancel/close buttons
41 bc().setOK(dialog_->button_ok);
42 bc().setCancel(dialog_->button_close);
44 bc().addReadOnly(dialog_->input_key);
45 bc().addReadOnly(dialog_->input_label);
49 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
52 if (!compare(fl_get_input(dialog_->input_key), ""))
53 return ButtonPolicy::SMI_NOOP;
55 return ButtonPolicy::SMI_VALID;
59 void FormBibitem::update()
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());
68 void FormBibitem::apply()
70 controller().params().setContents(fl_get_input(dialog_->input_key));
71 controller().params().setOptions(fl_get_input(dialog_->input_label));