diff options
author | jcid <devnull@localhost> | 2008-09-02 14:41:36 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-09-02 14:41:36 +0200 |
commit | 3e6aed4bf51baf13ff9d3ea2478291ad570ce3d0 (patch) | |
tree | debc683c5fc6ce167acf55f904b81ed6e0d75bd1 /src/form.cc | |
parent | 614a7b0ab6440821a3be0a0693ca7ff6f18d528a (diff) |
- Made forms show their action URL upon enter/leave mouse events (safety).
Diffstat (limited to 'src/form.cc')
-rw-r--r-- | src/form.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/form.cc b/src/form.cc index cbc23af5..c1f9c2fb 100644 --- a/src/form.cc +++ b/src/form.cc @@ -132,6 +132,8 @@ class DilloHtmlReceiver: DilloHtmlReceiver (DilloHtmlForm* form2) { form = form2; } ~DilloHtmlReceiver () { } void activate (dw::core::ui::Resource *resource); + void enter (dw::core::ui::Resource *resource); + void leave (dw::core::ui::Resource *resource); void clicked (dw::core::ui::ButtonResource *resource, int buttonNo, int x, int y); }; @@ -1489,6 +1491,38 @@ void DilloHtmlReceiver::activate (dw::core::ui::Resource *resource) form->eventHandler(resource); } +/* + * Enter a form control, as in "onmouseover". + * For _pressing_ enter in a text control, see activate(). + */ +void DilloHtmlReceiver::enter (dw::core::ui::Resource *resource) +{ + DilloHtml *html = form->html; + DilloHtmlInput *input = form->getInput(resource); + const char *msg = ""; + + if ((input->type == DILLO_HTML_INPUT_SUBMIT) || + (input->type == DILLO_HTML_INPUT_IMAGE) || + (input->type == DILLO_HTML_INPUT_BUTTON_SUBMIT) || + (input->type == DILLO_HTML_INPUT_INDEX) || + ((prefs.enterpress_forces_submit || form->num_entry_fields == 1) && + ((input->type == DILLO_HTML_INPUT_PASSWORD) || + (input->type == DILLO_HTML_INPUT_TEXT)))) { + /* The control can submit form. Show action URL. */ + msg = URL_STR(form->action); + } + a_UIcmd_set_msg(html->bw, msg); +} + +/* + * Leave a form control, or "onmouseout". + */ +void DilloHtmlReceiver::leave (dw::core::ui::Resource *resource) +{ + DilloHtml *html = form->html; + a_UIcmd_set_msg(html->bw, ""); +} + void DilloHtmlReceiver::clicked (dw::core::ui::ButtonResource *resource, int buttonNo, int x, int y) { |