3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author Angus Leeming
11 #pragma implementation
15 #include "ControlBibitem.h"
16 #include "FormBibitem.h"
17 #include "form_bibitem.h"
20 #include "support/lstrings.h" // compare
22 FormBibitem::FormBibitem(ControlBibitem & c)
23 : FormBase2<ControlBibitem, FD_form_bibitem>(c, _("Bibliography Entry"))
27 void FormBibitem::build()
29 dialog_.reset(build_bibitem());
31 // Workaround dumb xforms sizing bug
35 fl_set_input_return(dialog_->key, FL_RETURN_CHANGED);
36 fl_set_input_return(dialog_->label, FL_RETURN_CHANGED);
38 // Manage the ok, apply, restore and cancel/close buttons
39 bc().setOK(dialog_->button_ok);
40 bc().setCancel(dialog_->button_cancel);
43 bc().addReadOnly(dialog_->key);
44 bc().addReadOnly(dialog_->label);
48 ButtonPolicy::SMInput FormBibitem::input(FL_OBJECT *, long)
51 if (!compare(fl_get_input(dialog_->key), ""))
52 return ButtonPolicy::SMI_NOOP;
54 return ButtonPolicy::SMI_VALID;
58 void FormBibitem::update()
60 fl_set_input(dialog_->key,
61 controller().params().getContents().c_str());
62 fl_set_input(dialog_->label,
63 controller().params().getOptions().c_str());
67 void FormBibitem::apply()
69 controller().params().setContents(fl_get_input(dialog_->key));
70 controller().params().setOptions(fl_get_input(dialog_->label));