]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormUrl.C
Really dull and boring header shit
[lyx.git] / src / frontends / xforms / FormUrl.C
1 /**
2  * \file xforms/FormUrl.C
3  * See the file COPYING.
4  *
5  * \author Angus Leeming 
6  *
7  * Full author contact details are available in file CREDITS
8  */
9
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "xformsBC.h"
18 #include "ControlUrl.h"
19 #include "FormUrl.h"
20 #include "forms/form_url.h"
21 #include FORMS_H_LOCATION
22
23 typedef FormCB<ControlUrl, FormDB<FD_url> > base_class;
24
25 FormUrl::FormUrl()
26         : base_class(_("Url"))
27 {}
28
29
30 void FormUrl::build()
31 {
32         dialog_.reset(build_url(this));
33
34         fl_set_input_return(dialog_->input_name, FL_RETURN_CHANGED);
35         fl_set_input_return(dialog_->input_url,  FL_RETURN_CHANGED);
36
37         setPrehandler(dialog_->input_name);
38         setPrehandler(dialog_->input_url);
39
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);
45
46         bc().addReadOnly(dialog_->input_name);
47         bc().addReadOnly(dialog_->input_url);
48         bc().addReadOnly(dialog_->check_html);
49 }
50
51
52 void FormUrl::update()
53 {
54         fl_set_input(dialog_->input_url,
55                      controller().params().getContents().c_str());
56         fl_set_input(dialog_->input_name,
57                      controller().params().getOptions().c_str());
58
59         if (controller().params().getCmdName() == "url")
60                 fl_set_button(dialog_->check_html, 0);
61         else
62                 fl_set_button(dialog_->check_html, 1);
63 }
64
65
66 void FormUrl::apply()
67 {
68         controller().params().setContents(fl_get_input(dialog_->input_url));
69         controller().params().setOptions(fl_get_input(dialog_->input_name));
70
71         if (fl_get_button(dialog_->check_html))
72                 controller().params().setCmdName("htmlurl");
73         else
74                 controller().params().setCmdName("url");
75 }