2 * \file xforms/FormUrl.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
15 #pragma implementation
19 #include "ControlUrl.h"
21 #include "forms/form_url.h"
22 #include FORMS_H_LOCATION
24 typedef FormCB<ControlUrl, FormDB<FD_url> > base_class;
27 : base_class(_("Url"))
33 dialog_.reset(build_url(this));
35 fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
36 fl_set_input_return(dialog_->input_url, FL_RETURN_CHANGED);
38 setPrehandler(dialog_->input_name);
39 setPrehandler(dialog_->input_url);
41 // Manage the ok, apply, restore and cancel/close buttons
42 bc().setOK(dialog_->button_ok);
43 bc().setApply(dialog_->button_apply);
44 bc().setCancel(dialog_->button_close);
45 bc().setRestore(dialog_->button_restore);
47 bc().addReadOnly(dialog_->input_name);
48 bc().addReadOnly(dialog_->input_url);
49 bc().addReadOnly(dialog_->check_html);
53 void FormUrl::update()
55 fl_set_input(dialog_->input_url,
56 controller().params().getContents().c_str());
57 fl_set_input(dialog_->input_name,
58 controller().params().getOptions().c_str());
60 if (controller().params().getCmdName() == "url")
61 fl_set_button(dialog_->check_html, 0);
63 fl_set_button(dialog_->check_html, 1);
69 controller().params().setContents(fl_get_input(dialog_->input_url));
70 controller().params().setOptions(fl_get_input(dialog_->input_name));
72 if (fl_get_button(dialog_->check_html))
73 controller().params().setCmdName("htmlurl");
75 controller().params().setCmdName("url");