2 * \file xforms/FormIndex.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS
14 #pragma implementation
18 #include "ControlIndex.h"
19 #include "FormIndex.h"
20 #include "forms/form_index.h"
22 #include "support/lstrings.h"
24 #include FORMS_H_LOCATION
26 typedef FormCB<ControlIndex, FormDB<FD_index> > base_class;
28 FormIndex::FormIndex()
29 : base_class(_("Index"))
33 void FormIndex::build()
35 dialog_.reset(build_index(this));
37 fl_set_input_return(dialog_->input_key, FL_RETURN_CHANGED);
38 setPrehandler(dialog_->input_key);
40 // Manage the ok, apply, restore and cancel/close buttons
41 bc().setOK(dialog_->button_ok);
42 bc().setApply(dialog_->button_apply);
43 bc().setCancel(dialog_->button_close);
44 bc().setRestore(dialog_->button_restore);
46 bc().addReadOnly(dialog_->input_key);
50 void FormIndex::update()
52 string const contents = trim(controller().params().getContents());
53 fl_set_input(dialog_->input_key, contents.c_str());
55 bc().valid(!contents.empty());
59 void FormIndex::apply()
61 controller().params().setContents(fl_get_input(dialog_->input_key));