]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormUrl.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / FormUrl.C
1 /**
2  * \file FormUrl.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11
12 #include <config.h>
13
14
15 #include "xformsBC.h"
16 #include "ControlCommand.h"
17 #include "FormUrl.h"
18 #include "forms/form_url.h"
19 #include FORMS_H_LOCATION
20
21 typedef  FormController<ControlCommand, FormView<FD_url> > base_class;
22
23 FormUrl::FormUrl(Dialog & parent)
24         : base_class(parent, _("Url"))
25 {}
26
27
28 void FormUrl::build()
29 {
30         dialog_.reset(build_url(this));
31
32         fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
33         fl_set_input_return(dialog_->input_url,  FL_RETURN_CHANGED);
34
35         setPrehandler(dialog_->input_name);
36         setPrehandler(dialog_->input_url);
37
38         // Manage the ok, apply, restore and cancel/close buttons
39         bcview().setOK(dialog_->button_ok);
40         bcview().setApply(dialog_->button_apply);
41         bcview().setCancel(dialog_->button_close);
42         bcview().setRestore(dialog_->button_restore);
43
44         bcview().addReadOnly(dialog_->input_name);
45         bcview().addReadOnly(dialog_->input_url);
46         bcview().addReadOnly(dialog_->check_html);
47 }
48
49
50 void FormUrl::update()
51 {
52         fl_set_input(dialog_->input_url,
53                      controller().params().getContents().c_str());
54         fl_set_input(dialog_->input_name,
55                      controller().params().getOptions().c_str());
56
57         if (controller().params().getCmdName() == "url")
58                 fl_set_button(dialog_->check_html, 0);
59         else
60                 fl_set_button(dialog_->check_html, 1);
61 }
62
63
64 void FormUrl::apply()
65 {
66         controller().params().setContents(fl_get_input(dialog_->input_url));
67         controller().params().setOptions(fl_get_input(dialog_->input_name));
68
69         if (fl_get_button(dialog_->check_html))
70                 controller().params().setCmdName("htmlurl");
71         else
72                 controller().params().setCmdName("url");
73 }