aboutsummaryrefslogtreecommitdiff
path: root/src/menu.cc
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2009-01-05 17:12:43 -0300
committerJorge Arellano Cid <jcid@dillo.org>2009-01-05 17:12:43 -0300
commitf7fc073ac0de5326cffee25fd3e94c4d0b385136 (patch)
treeec3b76e4436c6266369151308155705c822b66ea /src/menu.cc
parent58e0045791b62f309066e446a314cd26bc277a8b (diff)
Added a right-click menu to the form submit button (allows to show hiddens)
Diffstat (limited to 'src/menu.cc')
-rw-r--r--src/menu.cc33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/menu.cc b/src/menu.cc
index a95ed0ec..002d970f 100644
--- a/src/menu.cc
+++ b/src/menu.cc
@@ -250,6 +250,29 @@ static void Menu_form_reset_cb(Widget*, void *v_form)
}
}
+/*
+ * Toggle display of 'hidden' form controls.
+ */
+static void Menu_form_hiddens_cb(Widget *w, void *user_data)
+{
+ void *v_form = w->parent()->user_data();
+ bool visible = *((bool *) user_data);
+
+ if (popup_bw && popup_bw->Docs) {
+ if (dList_find_custom(popup_bw->PageUrls, popup_url,
+ (dCompareFunc)a_Url_cmp)){
+ /* HTML page is still there */
+ int n = dList_length(popup_bw->Docs);
+ if (n == 1) {
+ a_Html_form_display_hiddens(dList_nth_data(popup_bw->Docs, 0),
+ v_form, !visible);
+ } else if (n > 1) {
+ MSG ("Menu_form_hiddens_cb multiple Docs not implemented\n");
+ }
+ }
+ }
+}
+
/*
* Validate URL with the W3C
*/
@@ -493,9 +516,11 @@ void a_Menu_image_popup(BrowserWindow *bw, const DilloUrl *url,
* Form popup menu (construction & popup)
*/
void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url,
- void *formptr)
+ void *formptr, bool_t hidvis)
{
static PopupMenu *pm = 0;
+ static Item *hiddens_item = 0;
+ static bool hiddens_visible;
popup_bw = bw;
a_Url_free(popup_url);
@@ -507,10 +532,16 @@ void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url,
i->callback(Menu_form_submit_cb);
pm->add(i = new Item("Reset form"));
i->callback(Menu_form_reset_cb);
+ pm->add(hiddens_item = new Item(""));
+ hiddens_item->callback(Menu_form_hiddens_cb);
+ hiddens_item->user_data(&hiddens_visible);
pm->type(PopupMenu::POPUP123);
}
pm->user_data(formptr);
+ hiddens_visible = hidvis;
+ hiddens_item->label(hiddens_visible ? "Hide hiddens": "Show hiddens");
+
a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
}