aboutsummaryrefslogtreecommitdiff
path: root/src/menu.cc
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2008-12-25 10:04:24 -0300
committerJorge Arellano Cid <jcid@dillo.org>2008-12-25 10:04:24 -0300
commitc3aeca579c61983bc96d0177806fc48c28c8b825 (patch)
tree2974e8f5a42627d2b6d190fe3c76f8e2e8e0c57e /src/menu.cc
parent022e339b4417b119cc75fcb2cef057bfce41f8e8 (diff)
parent5486bedf18450ae4de413c4174a0175948c95c3e (diff)
merge
Diffstat (limited to 'src/menu.cc')
-rw-r--r--src/menu.cc65
1 files changed, 64 insertions, 1 deletions
diff --git a/src/menu.cc b/src/menu.cc
index ac23117d..54babc0b 100644
--- a/src/menu.cc
+++ b/src/menu.cc
@@ -38,7 +38,7 @@ static DilloUrl *popup_url = NULL;
// Weak reference to the popup's bw
static BrowserWindow *popup_bw = NULL;
// Where to place the filemenu popup
-int popup_x, popup_y;
+static int popup_x, popup_y;
// History popup direction (-1 = back, 1 = forward).
static int history_direction = -1;
// History popup, list of URL-indexes.
@@ -212,6 +212,44 @@ static void Menu_load_images_cb(Widget*, void *user_data)
}
}
+/*
+ * Submit form
+ */
+static void Menu_form_submit_cb(Widget*, void *v_form)
+{
+ 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_submit(dList_nth_data(popup_bw->Docs, 0), v_form);
+ } else if (n > 1) {
+ MSG ("Menu_form_submit_cb multiple Docs not implemented\n");
+ }
+ }
+ }
+}
+
+/*
+ * Reset form
+ */
+static void Menu_form_reset_cb(Widget*, void *v_form)
+{
+ 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_reset(dList_nth_data(popup_bw->Docs, 0), v_form);
+ } else if (n > 1) {
+ MSG ("Menu_form_reset_cb multiple Docs not implemented\n");
+ }
+ }
+ }
+}
+
/*
* Validate URL with the W3C
*/
@@ -452,6 +490,31 @@ 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)
+{
+ static PopupMenu *pm = 0;
+
+ popup_bw = bw;
+ a_Url_free(popup_url);
+ popup_url = a_Url_dup(page_url);
+ if (!pm) {
+ Item *i;
+ pm = new PopupMenu(0,0,0,0,"FORM OPTIONS");
+ pm->add(i = new Item("Submit form"));
+ i->callback(Menu_form_submit_cb);
+ pm->add(i = new Item("Reset form"));
+ i->callback(Menu_form_reset_cb);
+ pm->type(PopupMenu::POPUP123);
+ }
+ pm->user_data(formptr);
+
+ a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
+}
+
+/*
* File popup menu (construction & popup)
*/
void a_Menu_file_popup(BrowserWindow *bw, void *v_wid)