comparison gtk/dw.c @ 587:9e81f23b57ae

If available try to use GtkMozEmbed from Mozilla.or.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 22 May 2005 19:14:15 +0000
parents b9d903cde2f4
children 1b398af1ec38
comparison
equal deleted inserted replaced
586:b9d903cde2f4 587:9e81f23b57ae
26 #include <unistd.h> 26 #include <unistd.h>
27 #include "config.h" 27 #include "config.h"
28 #include <gdk/gdkkeysyms.h> 28 #include <gdk/gdkkeysyms.h>
29 #ifdef USE_IMLIB 29 #ifdef USE_IMLIB
30 #include <gdk_imlib.h> 30 #include <gdk_imlib.h>
31 #endif
32 #ifdef USE_GTKMOZEMBED
33 #include <gtkmozembed.h>
31 #endif 34 #endif
32 #if GTK_MAJOR_VERSION > 1 35 #if GTK_MAJOR_VERSION > 1
33 #include <gdk-pixbuf/gdk-pixbuf.h> 36 #include <gdk-pixbuf/gdk-pixbuf.h>
34 #endif 37 #endif
35 38
9847 * handle: Handle to the window. 9850 * handle: Handle to the window.
9848 * action: One of the DW_HTML_* constants. 9851 * action: One of the DW_HTML_* constants.
9849 */ 9852 */
9850 void dw_html_action(HWND handle, int action) 9853 void dw_html_action(HWND handle, int action)
9851 { 9854 {
9855 #ifdef USE_GTKMOZEMBED
9856 int _locked_by_me = FALSE;
9857
9858 DW_MUTEX_LOCK;
9859 switch(action)
9860 {
9861 case DW_HTML_GOBACK:
9862 gtk_moz_embed_go_back(GTK_MOZ_EMBED(handle));
9863 break;
9864 case DW_HTML_GOFORWARD:
9865 gtk_moz_embed_go_forward(GTK_MOZ_EMBED(handle));
9866 break;
9867 case DW_HTML_GOHOME:
9868 gtk_moz_embed_load_url(GTK_MOZ_EMBED(handle), "http://dwindows.netlabs.org");
9869 break;
9870 case DW_HTML_RELOAD:
9871 gtk_moz_embed_reload(GTK_MOZ_EMBED(handle), 0);
9872 break;
9873 case DW_HTML_STOP:
9874 gtk_moz_embed_stop_load(GTK_MOZ_EMBED(handle));
9875 break;
9876 }
9877 DW_MUTEX_UNLOCK;
9878 #endif
9852 } 9879 }
9853 9880
9854 /* 9881 /*
9855 * Render raw HTML code in the embedded HTML widget.. 9882 * Render raw HTML code in the embedded HTML widget..
9856 * Parameters: 9883 * Parameters:
9860 * Returns: 9887 * Returns:
9861 * 0 on success. 9888 * 0 on success.
9862 */ 9889 */
9863 int dw_html_raw(HWND handle, char *string) 9890 int dw_html_raw(HWND handle, char *string)
9864 { 9891 {
9892 #ifdef USE_GTKMOZEMBED
9893 int _locked_by_me = FALSE;
9894
9895 DW_MUTEX_LOCK;
9896 gtk_moz_embed_render_data(GTK_MOZ_EMBED(handle), string, strlen(string), "", "");
9897 DW_MUTEX_UNLOCK;
9898 return 0;
9899 #endif
9865 return -1; 9900 return -1;
9866 } 9901 }
9867 9902
9868 /* 9903 /*
9869 * Render file or web page in the embedded HTML widget.. 9904 * Render file or web page in the embedded HTML widget..
9874 * Returns: 9909 * Returns:
9875 * 0 on success. 9910 * 0 on success.
9876 */ 9911 */
9877 int dw_html_url(HWND handle, char *url) 9912 int dw_html_url(HWND handle, char *url)
9878 { 9913 {
9914 #ifdef USE_GTKMOZEMBED
9915 int _locked_by_me = FALSE;
9916
9917 DW_MUTEX_LOCK;
9918 gtk_moz_embed_load_url(GTK_MOZ_EMBED(handle), url);
9919 DW_MUTEX_UNLOCK;
9920 return 0;
9921 #endif
9879 return -1; 9922 return -1;
9880 } 9923 }
9881 9924
9882 /* 9925 /*
9883 * Create a new Entryfield window (widget) to be packed. 9926 * Create a new Entryfield window (widget) to be packed.
9885 * text: The default text to be in the entryfield widget. 9928 * text: The default text to be in the entryfield widget.
9886 * id: An ID to be used with dw_window_from_id() or 0L. 9929 * id: An ID to be used with dw_window_from_id() or 0L.
9887 */ 9930 */
9888 HWND dw_html_new(unsigned long id) 9931 HWND dw_html_new(unsigned long id)
9889 { 9932 {
9933 #ifdef USE_GTKMOZEMBED
9934 GtkWidget *widget;
9935 int _locked_by_me = FALSE;
9936
9937 DW_MUTEX_LOCK;
9938 widget = gtk_moz_embed_new();
9939 DW_MUTEX_UNLOCK;
9940 return widget;
9941 #else
9890 return dw_box_new(DW_HORZ, 0); 9942 return dw_box_new(DW_HORZ, 0);
9943 #endif
9891 } 9944 }
9892 9945
9893 /* 9946 /*
9894 * Returns a pointer to a static buffer which containes the 9947 * Returns a pointer to a static buffer which containes the
9895 * current user directory. Or the root directory (C:\ on 9948 * current user directory. Or the root directory (C:\ on