aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2012-11-25 22:22:42 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2012-11-25 22:22:42 +0100
commit3202ed972b013c09e6020fe2d6c4f8e64173fb8a (patch)
tree0f27d0026eb8549e60cbca60c5b632804cb840e5 /src
parent00649e89e89ff0caeb46a42cb0265d8c0c657840 (diff)
parent3cd86e1697e88a5a823315751d01e2d0de548c48 (diff)
merge
Diffstat (limited to 'src')
-rw-r--r--src/form.cc50
-rw-r--r--src/html.cc16
2 files changed, 18 insertions, 48 deletions
diff --git a/src/form.cc b/src/form.cc
index 11f27b47..454b052c 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -177,6 +177,7 @@ public:
void addOption (char *value, bool selected, bool enabled);
void ensureSelection ();
void addOptionsTo (SelectionResource *res);
+ void reset (SelectionResource *res);
void appendValuesTo (Dlist *values, SelectionResource *res);
};
@@ -547,10 +548,11 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize)
if (a_Html_get_attr(html, tag, tagsize, "readonly"))
((EntryResource *) resource)->setEditable(false);
-// /* Maximum length of the text in the entry */
-// if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "maxlength")))
-// gtk_entry_set_max_length(GTK_ENTRY(widget),
-// strtol(attrbuf, NULL, 10));
+ /* Maximum length of the text in the entry */
+ if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "maxlength"))) {
+ int maxlen = strtol(attrbuf, NULL, 10);
+ ((EntryResource *) resource)->setMaxLength(maxlen);
+ }
}
if (prefs.show_tooltip &&
(attrbuf = a_Html_get_attr(html, tag, tagsize, "title"))) {
@@ -982,8 +984,6 @@ void DilloHtmlForm::submit(DilloHtmlInput *active_input, EventButton *event)
}
a_Url_free(url);
}
- // /* now, make the rendered area have its focus back */
- // gtk_widget_grab_focus(GTK_BIN(bw->render_main_scroll)->child);
}
/*
@@ -1764,35 +1764,12 @@ void DilloHtmlInput::reset ()
}
break;
case DILLO_HTML_INPUT_SELECT:
+ case DILLO_HTML_INPUT_SEL_LIST:
if (select != NULL) {
- /* this is in reverse order so that, in case more than one was
- * selected, we get the last one, which is consistent with handling
- * of multiple selected options in the layout code. */
-// for (i = select->num_options - 1; i >= 0; i--) {
-// if (select->options[i].init_val) {
-// gtk_menu_item_activate(GTK_MENU_ITEM
-// (select->options[i].menuitem));
-// Html_select_set_history(input);
-// break;
-// }
-// }
+ SelectionResource *sr = (SelectionResource *) embed->getResource();
+ select->reset(sr);
}
break;
- case DILLO_HTML_INPUT_SEL_LIST:
- if (!select)
- break;
-// for (i = 0; i < select->num_options; i++) {
-// if (select->options[i].init_val) {
-// if (select->options[i].menuitem->state == GTK_STATE_NORMAL)
-// gtk_list_select_child(GTK_LIST(select->menu),
-// select->options[i].menuitem);
-// } else {
-// if (select->options[i].menuitem->state==GTK_STATE_SELECTED)
-// gtk_list_unselect_child(GTK_LIST(select->menu),
-// select->options[i].menuitem);
-// }
-// }
- break;
case DILLO_HTML_INPUT_TEXTAREA:
if (init_str != NULL) {
MultiLineTextResource *textres =
@@ -1874,6 +1851,15 @@ void DilloHtmlSelect::addOptionsTo (SelectionResource *res)
}
}
+void DilloHtmlSelect::reset (SelectionResource *res)
+{
+ int size = options->size ();
+ for (int i = 0; i < size; i++) {
+ DilloHtmlOption *option = options->get (i);
+ res->setItem(i, option->selected);
+ }
+}
+
void DilloHtmlSelect::appendValuesTo (Dlist *values, SelectionResource *res)
{
int size = options->size ();
diff --git a/src/html.cc b/src/html.cc
index 812b5c7c..21c1e3af 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -3023,22 +3023,6 @@ static void Html_tag_open_link(DilloHtml *html, const char *tag, int tagsize)
}
/*
- * Set the history of the menu to be consistent with the active menuitem.
- */
-//static void Html_select_set_history(DilloHtmlInput *input)
-//{
-// int i;
-//
-// for (i = 0; i < input->select->num_options; i++) {
-// if (GTK_CHECK_MENU_ITEM(input->select->options[i].menuitem)->active) {
-// gtk_option_menu_set_history(GTK_OPTION_MENU(input->widget), i);
-// break;
-// }
-// }
-//}
-
-
-/*
* Set the Document Base URI
*/
static void Html_tag_open_base(DilloHtml *html, const char *tag, int tagsize)