changeset 331:af50ca1de233

Added a location entryfield to the browser and a Go button to help in debugging.
author Brian Smith <brian@dbsoft.org>
date Fri, 25 Oct 2019 17:20:01 -0500
parents e6c6c1ac6fe2
children a23d14994729
files dwib.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dwib.c	Sun Sep 15 20:50:23 2019 -0500
+++ b/dwib.c	Fri Oct 25 17:20:01 2019 -0500
@@ -6644,6 +6644,18 @@
     return FALSE;
 }
 
+/* Handle web go */
+int DWSIGNAL web_go_clicked(HWND button, void *data)
+{
+    HWND html = (HWND)data;
+    HWND location = (HWND)dw_window_get_data(button, "location");
+    char *url = dw_window_get_text(location);
+    
+    dw_html_url(html, url);
+    dw_free(url);
+    return FALSE;
+}
+
 /* Handle loading a web page */
 int DWSIGNAL web_page_clicked(HWND button, void *data)
 {
@@ -6661,6 +6673,7 @@
             HWND vbox = dw_box_new(DW_VERT, 0);
             HWND hbox = dw_box_new(DW_HORZ, 0);
             HWND item = dw_menu_append_item(menuWindows, APP_NAME " Browser", DW_MENU_AUTO, 0, TRUE, FALSE, DW_NOMENU);
+            HWND location = dw_entryfield_new(url, 0);
             
             dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(menu_show_window), DW_POINTER(window));
             dw_window_set_data(window, "dwib_menu", DW_POINTER(item));
@@ -6684,6 +6697,16 @@
             dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0);
             dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_reload_clicked), DW_POINTER(html));
               
+            /* Put in some extra space */
+            dw_box_pack_start(hbox, 0, 5, 1, FALSE, FALSE, 0);
+            dw_box_pack_start(hbox, location, -1, -1, TRUE, FALSE, 0);
+            
+            item = dw_button_new("Go", 0);
+            dw_window_set_data(item, "location", DW_POINTER(location));
+            dw_box_pack_start(hbox, item, -1, -1, FALSE, FALSE, 0);
+            dw_signal_connect(item, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(web_go_clicked), DW_POINTER(html));
+            dw_window_click_default(location, item);
+            
             /* Pack in the HTML widget */
             dw_box_pack_start(vbox, html, 1, 1, TRUE, TRUE, 0);