]> git.saurik.com Git - wxWidgets.git/commitdiff
Merge in from trunk r67662 to r64801
authorSteve Lamerton <steve.lamerton@gmail.com>
Mon, 25 Jul 2011 16:54:53 +0000 (16:54 +0000)
committerSteve Lamerton <steve.lamerton@gmail.com>
Mon, 25 Jul 2011 16:54:53 +0000 (16:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

46 files changed:
build/bakefiles/build_cfg.bkl
build/bakefiles/common.bkl
build/bakefiles/config.bkl
build/bakefiles/files.bkl
build/bakefiles/monolithic.bkl
build/bakefiles/multilib.bkl
build/bakefiles/wxpresets/presets/wx.bkl
build/bakefiles/wxwin.py
configure.in
docs/doxygen/groups/class_web.h [new file with mode: 0644]
docs/doxygen/mainpages/libs.h
include/msvc/wx/setup.h
include/wx/dlimpexp.h
include/wx/gtk/webview_webkit.h [new file with mode: 0644]
include/wx/msw/chkconf.h
include/wx/msw/missing.h
include/wx/msw/panel.h
include/wx/msw/setup0.h
include/wx/msw/webview_ie.h [new file with mode: 0644]
include/wx/osx/webview_webkit.h [new file with mode: 0644]
include/wx/setup_inc.h
include/wx/webview.h [new file with mode: 0644]
interface/wx/webview.h [new file with mode: 0644]
locale/it.po
samples/samples.bkl
samples/web/makefile.vc [new file with mode: 0644]
samples/web/refresh.xpm [new file with mode: 0644]
samples/web/stop.xpm [new file with mode: 0644]
samples/web/web.bkl [new file with mode: 0644]
samples/web/web.cpp [new file with mode: 0644]
samples/web/wxlogo.xpm [new file with mode: 0644]
src/common/webview.cpp [new file with mode: 0644]
src/gtk/webview_webkit.cpp [new file with mode: 0644]
src/msw/panel.cpp
src/msw/webview_ie.cpp [new file with mode: 0644]
src/osx/webview_webkit.mm [new file with mode: 0644]
tests/controls/webtest.cpp [new file with mode: 0644]
tests/makefile.bcc
tests/makefile.gcc
tests/makefile.vc
tests/makefile.wat
tests/test.bkl
tests/test_test_gui.dsp
tests/test_vc7_test_gui.vcproj
tests/test_vc8_test_gui.vcproj
tests/test_vc9_test_gui.vcproj

index 00b2d33f5cd5677e452ac894eccbab10ed5cf020..b9e973b09ea69b14dc64b62a512dbeeff808b22f 100644 (file)
@@ -39,6 +39,7 @@
                 @echo USE_THREADS=$(USE_THREADS) >>$(BUILD_CFG_FILE)
                 @echo USE_GUI=$(USE_GUI) >>$(BUILD_CFG_FILE)
                 @echo USE_HTML=$(USE_HTML) >>$(BUILD_CFG_FILE)
+                @echo USE_WEB=$(USE_WEB) >>$(BUILD_CFG_FILE)
                 @echo USE_MEDIA=$(USE_MEDIA) >>$(BUILD_CFG_FILE)
                 @echo USE_OPENGL=$(USE_OPENGL) >>$(BUILD_CFG_FILE)
                 @echo USE_QA=$(USE_QA) >>$(BUILD_CFG_FILE)
index 8948042f2bdb687f87da1a303f0952a89965c46b..8de09ff2a74f0843af42892043e4b17ec9fd0750 100644 (file)
     <set var="WXLIB_STC">
         <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('stc')))</if>
     </set>
-
+    <set var="WXLIB_WEB">
+        <if cond="MONOLITHIC=='0'">$(mk.evalExpr(wxwin.mkLibName('web')))</if>
+    </set>
     <set var="WXLIB_MONO">
         <if cond="MONOLITHIC=='1'">$(mk.evalExpr(wxwin.mkLibName('mono')))</if>
     </set>
index ee14b32871d42795f06272bb34c1a0484e64e15f..4d57319cceb0f0957bf1e77c48510d76cb7f10c3 100644 (file)
@@ -200,6 +200,14 @@ Default is to use debug CRT if and only if BUILD==debug.
         </description>
     </option>
 
+    <option name="USE_WEB">
+        <values>0,1</values>
+        <default-value>1</default-value>
+        <description>
+            Build wxWeb library (USE_GUI must be 1)?
+        </description>
+    </option>
+    
     <option name="USE_MEDIA">
         <values>0,1</values>
         <default-value>1</default-value>
@@ -372,6 +380,7 @@ to run the tests, include CppUnit library here.
         <option name="EXTRALIBS"/>
         <option name="EXTRALIBS_XML"/>
         <option name="EXTRALIBS_HTML"/>
+        <option name="EXTRALIBS_WEB"/>
         <option name="EXTRALIBS_MEDIA"/>
         <option name="EXTRALIBS_GUI"/>
         <option name="EXTRALIBS_OPENGL"/>
@@ -432,6 +441,7 @@ it if SHARED=1 unless you know what you are doing.
         <set var="EXTRALIBS"/>
         <set var="EXTRALIBS_XML"/>
         <set var="EXTRALIBS_HTML"/>
+        <set var="EXTRALIBS_WEB"/>
         <set var="EXTRALIBS_MEDIA"/>
         <set var="EXTRALIBS_GUI"/>
         <set var="EXTRALIBS_OPENGL">
@@ -480,6 +490,7 @@ Set the version of your Mingw installation here.
         <set var="USE_RICHTEXT">1</set>
         <set var="USE_STC">1</set>
         <set var="USE_HTML">1</set>
+        <set var="USE_WEB">1</set>
         <set var="USE_MEDIA">1</set>
         <set var="USE_XRC">1</set>
         <set var="USE_OPENGL">1</set>
index 02dbf51f0948cbd07d2d2ddf3b6f2bce8044a3d2..2aed8c9f3ad7a79cfb28005c2f84cb31e128bfef 100644 (file)
@@ -3345,7 +3345,29 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     $(MSW_HTML_HDR)
 </set>
 
+<!-- ====================================================================== -->
+<!--                                wxWEB                                   -->
+<!-- ====================================================================== -->
 
+<set var="WEB_SRC_PLATFORM">
+    <if cond="TOOLKIT=='MSW'">src/msw/webview_ie.cpp</if>
+    <if cond="PLATFORM_UNIX=='1'">src/gtk/webview_webkit.cpp</if>
+    <if cond="PLATFORM_MACOSX=='1'">src/osx/webview_webkit.mm</if>
+</set>
+<set var="WEB_SRC" hints="files">
+    $(WEB_SRC_PLATFORM)
+    src/common/webview.cpp
+</set>
+
+<set var="WEB_HDR_PLATFORM" hints="files">
+    <if cond="TOOLKIT=='MSW'">wx/msw/webview_ie.h</if>
+    <if cond="PLATFORM_UNIX=='1'">wx/gtk/webview_webkit.h</if>
+    <if cond="PLATFORM_MACOSX=='1'">wx/osx/webview_webkit.h</if>
+</set>
+<set var="WEB_HDR" hints="files">
+    $(WEB_HDR_PLATFORM)
+    wx/webview.h
+</set>
 
 <!-- ====================================================================== -->
 <!--                                wxXRC                                   -->
@@ -3948,7 +3970,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
             $(GUI_CORE_HEADERS)
             $(ADVANCED_HDR) $(MEDIA_HDR) $(HTML_HDR)
             $(OPENGL_HDR) $(QA_HDR) $(XRC_HDR) $(AUI_HDR) $(PROPGRID_HDR)
-            $(RIBBON_HDR) $(RICHTEXT_HDR) $(STC_HDR)
+            $(RIBBON_HDR) $(RICHTEXT_HDR) $(STC_HDR) ${WEB_HDR}
         </if>
     </set>
 
index 1ad6d4af0247504f858b61d2b918b3fb4eca0b9e..f02411eab1947bbbc833e6595a62892a924c4bc6 100644 (file)
@@ -4,7 +4,7 @@
 
     <set var="MONOLIB_GUI_SRC">
         <if cond="USE_GUI=='1'">
-            $(CORE_SRC) $(ADVANCED_SRC) $(MEDIA_SRC) $(HTML_SRC) $(QA_SRC)
+            $(CORE_SRC) $(ADVANCED_SRC) $(MEDIA_SRC) $(HTML_SRC) $(WEB_SRC) $(QA_SRC)
             $(XRC_SRC) $(AUI_SRC) $(PROPGRID_SRC) $(RIBBON_SRC) $(RICHTEXT_SRC)
             $(STC_SRC)
         </if>
@@ -25,6 +25,7 @@
         <define>WXMAKINGDLL</define>
         <ldlibs>$(EXTRALIBS_XML)</ldlibs>
         <ldlibs>$(EXTRALIBS_HTML)</ldlibs>
+        <ldlibs>$(EXTRALIBS_WEB)</ldlibs>
         <ldlibs>$(EXTRALIBS_MEDIA)</ldlibs>
         <ldlibs>$(PLUGIN_MONOLIB_EXTRALIBS)</ldlibs>
         <library>$(wxscintilla_library_link)</library>
index 2217008017f15536611ce72967e0f32246559d67..748bf64c7c6a4fed7bf946bf9363394af2a7ec6d 100644 (file)
 
     <set var="MSVC6PRJ_MERGED_TARGETS_MULTILIB" append="1">html=htmllib+htmldll</set>
 
+    <!-- ================================================================ -->
+    <!--                               wxWEB                              -->
+    <!-- ================================================================ -->
+
+    <dll id="webdll" template="wx_dll"
+         cond="SHARED=='1' and USE_GUI=='1' and USE_WEB=='1' and MONOLITHIC=='0'">
+        <define>WXUSINGDLL</define>
+        <define>WXMAKINGDLL_WEB</define>
+        <sources>$(WEB_SRC)</sources>
+        <library>coredll</library>
+        <library>basedll</library>
+        <msvc-headers>$(WEB_HDR)</msvc-headers>
+    </dll>
+
+    <lib id="weblib" template="wx_lib"
+         cond="SHARED=='0' and USE_GUI=='1' and USE_WEB=='1' and MONOLITHIC=='0'">
+        <sources>$(WEB_SRC)</sources>
+        <msvc-headers>$(WEB_HDR)</msvc-headers>
+    </lib>
+
+    <wxshortcut id="wxweb" cond="MONOLITHIC=='0' and USE_WEB=='1'"/>
+
+    <set var="MSVC6PRJ_MERGED_TARGETS_MULTILIB" append="1">web=weblib+webdll</set>
+
     <!-- ================================================================ -->
     <!--                             OpenGL                               -->
     <!-- ================================================================ -->
index ec262c9e096e1843d20a7c56a83940f0f3a768d8..ca51a0deeb28c7ba70b204c2cfdc56e55dc990b6 100644 (file)
         <wx-lib>xml</wx-lib>
         <wx-lib>core</wx-lib>
         <wx-lib>base</wx-lib>
+        <wx-lib>web</wx-lib>
 
 -->
 
                          tag definitions.
     -->
     <set var="WX_LIB_LIST">
-        base core net xml xrc html adv media gl qa aui ribbon propgrid richtext stc
+        base core net xml xrc html adv media gl qa aui ribbon propgrid richtext stc web
     </set>
 
     <!-- if you define this variable to 0 before including wx presets, the
index 8f5cb31f8a7393ee432474f7a19671e6c8b29ccd..0cdf3a45d6416242aa135f5b517f2fd28b4ea7ff 100644 (file)
@@ -39,12 +39,12 @@ def mk_wxid(id):
 
 
 # All libs that are part of the main library:
-MAIN_LIBS = ['mono', 'base', 'core', 'adv', 'html', 'xml', 'net',
+MAIN_LIBS = ['mono', 'base', 'core', 'adv', 'html', 'xml', 'net', 'web',
              'media', 'qa', 'xrc', 'aui', 'ribbon', 'propgrid', 'richtext', 'stc']
 # List of library names/ids for categories with different names:
 LIBS_NOGUI = ['xml', 'net']
 LIBS_GUI   = ['core', 'adv', 'html', 'gl', 'qa', 'xrc', 'media',
-              'aui', 'propgrid', 'richtext', 'stc', 'ribbon']
+              'aui', 'propgrid', 'richtext', 'stc', 'ribbon', 'web']
 # Additional libraries that must be linked in:
 EXTRALIBS = {
     'gl' : '$(EXTRALIBS_OPENGL)',
index f2a5156351455c0763d3010d5bb81e6aebdaa0e3..9c35b151ce440821df6cbf64325673bd60814edc 100644 (file)
@@ -848,6 +848,7 @@ WX_ARG_FEATURE(richtext,    [  --enable-richtext       use wxRichTextCtrl], wxUS
 WX_ARG_FEATURE(postscript,  [  --enable-postscript     use wxPostscriptDC device context (default for gtk+)], wxUSE_POSTSCRIPT)
 WX_ARG_FEATURE(printarch,   [  --enable-printarch      use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
 WX_ARG_FEATURE(svg,         [  --enable-svg            use wxSVGFileDC device context], wxUSE_SVG)
+WX_ARG_FEATURE(web,         [  --enable-web            use wxWeb library], wxUSE_WEB)
 
 dnl wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter
 dnl can't be disabled, don't even provide an option to do it
@@ -1041,6 +1042,7 @@ WX_ARG_FEATURE(dragimage,   [  --enable-dragimage      use wxDragImage], wxUSE_D
 WX_ARG_FEATURE(accessibility,[  --enable-accessibility  enable accessibility support], wxUSE_ACCESSIBILITY)
 WX_ARG_FEATURE(uiactionsim,  [  --enable-uiactionsim    use wxUIActionSimulator (experimental)], wxUSE_UIACTIONSIMULATOR)
 WX_ARG_FEATURE(dctransform,  [  --enable-dctransform    use wxDC::SetTransformMatrix and related], wxUSE_DC_TRANSFORM_MATRIX)
+WX_ARG_FEATURE(webviewwebkit,[  --enable-webview-webkit use wxWebView WebKit backend], wxUSE_WEBVIEW_WEBKIT)
 
 dnl ---------------------------------------------------------------------------
 dnl support for image formats that do not rely on external library
@@ -1065,6 +1067,7 @@ WX_ARG_FEATURE(ps-in-msw,   [  --enable-ps-in-msw      use PS printing in wxMSW
 WX_ARG_FEATURE(ownerdrawn,  [  --enable-ownerdrawn     use owner drawn controls (Win32 and OS/2 only)], wxUSE_OWNER_DRAWN)
 WX_ARG_FEATURE(uxtheme,     [  --enable-uxtheme        enable support for Windows XP themed look (Win32 only)], wxUSE_UXTHEME)
 WX_ARG_FEATURE(wxdib,       [  --enable-wxdib          use wxDIB class (Win32 only)], wxUSE_DIB)
+WX_ARG_FEATURE(webviewie,   [  --enable-webview-ie     use wxWebView IE backend (Win32 only)], wxUSE_WEBVIEW_IE)
 
 dnl this one is not really MSW-specific but it exists mainly to be turned off
 dnl under MSW, it should be off by default on the other platforms
@@ -7350,6 +7353,74 @@ if test "$wxUSE_RICHTEXT" = "yes"; then
     SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS richtext"
 fi
 
+USE_WEB=0
+if test "$wxUSE_WEB" = "yes"; then
+   AC_DEFINE(wxUSE_WEB)
+   USE_WEB=1
+   SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS web"
+
+   if test "$wxUSE_WEBVIEW_WEBKIT" = "yes" -a "$wxUSE_GTK" = 1; then
+       AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
+       AC_MSG_CHECKING([for webkitgtk libraries])
+       WX_PATH_FIND_LIBRARIES([$SEARCH_LIB],webkitgtk-1.0)
+       if test "$ac_find_libraries" != "" ; then
+           WX_LINK_PATH_EXIST([$ac_find_libraries],[$LDFLAGS])
+           if test "$ac_path_to_link" != " -L/usr/lib" ; then
+               LDFLAGS="$LDFLAGS $ac_path_to_link"
+           fi
+           GUI_TK_LIBRARY="$GUI_TK_LIBRARY -lwebkitgtk-1.0"
+           AC_MSG_RESULT([yes])
+       else
+           AC_MSG_RESULT([no])
+           AC_MSG_WARN([libwebkitgtk-1.0 not found; disabling webkit backend])
+           wxUSE_WEBVIEW_WEBKIT="no"
+       fi
+
+       AC_MSG_CHECKING(for webkitgtk includes)
+       WX_PATH_FIND_INCLUDES([$SEARCH_INCLUDE /usr/include/webkit-1.0], webkit/webkit.h)
+       if test "$ac_find_includes" != "" ; then
+           AC_MSG_RESULT(found in $ac_find_includes)
+           WX_INCLUDE_PATH_EXIST($ac_find_includes, $CPPFLAGS)
+           CPPFLAGS="$ac_path_to_include $CPPFLAGS"
+       else
+           AC_MSG_RESULT([not found])
+       fi
+       dnl we also depend on libsoup
+       AC_MSG_CHECKING(for libsoup includes)
+       WX_PATH_FIND_INCLUDES([$SEARCH_INCLUDE /usr/include/libsoup-2.4], libsoup/soup.h)
+       if test "$ac_find_includes" != "" ; then
+           AC_MSG_RESULT(found in $ac_find_includes)
+           WX_INCLUDE_PATH_EXIST($ac_find_includes, $CPPFLAGS)
+           CPPFLAGS="$ac_path_to_include $CPPFLAGS"
+       else
+           AC_MSG_RESULT([not found])
+       fi
+   fi
+
+    if test "$wxUSE_WEBVIEW_WEBKIT" = "yes" -a "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
+        old_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="-x objective-c++ $CPPFLAGS"
+        AC_CHECK_HEADER([WebKit/HIWebView.h],
+                        [
+                           AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
+                           WEBKIT_LINK="-framework WebKit"
+                        ],
+                        [
+                           AC_MSG_WARN([WebKit headers not found; disabling wxWebView WebKit])
+                           wxUSE_WEBVIEW_WEBKIT=no
+                        ],
+                        [
+                           #include <Carbon/Carbon.h>
+                           #include <WebKit/WebKit.h>
+                        ])
+        CPPFLAGS="$old_CPPFLAGS"
+    elif test "$wxUSE_OLD_COCOA" = 1; then
+        AC_DEFINE(wxUSE_WEBVIEW_WEBKIT)
+    else
+        wxUSE_WEBVIEW_WEBKIT=no
+    fi
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl wxImage options
 dnl ---------------------------------------------------------------------------
@@ -7732,6 +7803,10 @@ if test "$wxUSE_GUI" = "yes"; then
     if test "$wxUSE_STC" = "yes" ; then
         BUILT_WX_LIBS="stc $BUILT_WX_LIBS"
     fi
+    if test "$wxUSE_WEB" = "yes" ; then
+        STD_GUI_LIBS="web $STD_GUI_LIBS"
+        BUILT_WX_LIBS="web $BUILT_WX_LIBS"
+    fi
     if test "$wxUSE_XRC" = "yes" ; then
         STD_GUI_LIBS="xrc $STD_GUI_LIBS"
         BUILT_WX_LIBS="xrc $BUILT_WX_LIBS"
diff --git a/docs/doxygen/groups/class_web.h b/docs/doxygen/groups/class_web.h
new file mode 100644 (file)
index 0000000..210bc88
--- /dev/null
@@ -0,0 +1,18 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        class_web.h
+// Purpose:     Web classes group docs
+// Author:      wxWidgets team
+// RCS-ID:      $Id$
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+
+@defgroup group_class_web Web
+@ingroup group_class
+
+The wxWeb library is a set of classes for viewing complex web documents and 
+for internet browsing. It is built around a series of backends, and exposes
+common functions for them.
+
+*/
\ No newline at end of file
index 88c682f776a7d058803e79cc0d3f0e5d01b98c15..27e1c24191acc4a530ea9280ef623406ae992e24 100644 (file)
@@ -39,6 +39,7 @@ digraph Dependancies
     wxRichText [fillcolor = green, URL = "\ref page_libs_wxrichtext"];
     wxSTC      [fillcolor = green, URL = "\ref page_libs_wxstc"];
     wxXRC      [fillcolor = green, URL = "\ref page_libs_wxxrc"];
+    wxWeb      [fillcolor = green, URL = "\ref page_libs_wxweb"];
 
     wxCore -> wxBase;
     wxNet -> wxBase;
@@ -55,6 +56,7 @@ digraph Dependancies
     wxRichText -> wxAdvanced; wxRichText -> wxHTML; wxRichText -> wxXML;
     wxSTC -> wxCore;
     wxXRC -> wxAdvanced; wxXRC -> wxHTML; wxXRC -> wxXML;
+    wxWeb -> wxCore;
 }
 @enddot
 
@@ -202,5 +204,11 @@ text editor. See <http://www.scintilla.org/> for more info about Scintilla.
 
 Requires @ref page_libs_wxcore, @ref page_libs_wxbase.
 
+@section page_libs_wxweb wxWeb
+
+The wxWeb library contains the wxWebView control.
+
+Requires @ref page_libs_wxcore, @ref page_libs_wxbase.
+
 */
 
index 99362ff09a7a92f117c4482c1d3168e086213d9e..796e97d7c614a5f8a3a2c393a516fa6ef636f340 100644 (file)
         #pragma comment(lib, wxMSW_LIB_NAME("stc"))
         #pragma comment(lib, wx3RD_PARTY_LIB_NAME("scintilla"))
     #endif
+    #if wxUSE_WEB && !defined(wxNO_WEB_LIB)
+        #pragma comment(lib, wxMSW_LIB_NAME("web"))
+    #endif
 #endif // wxUSE_GUI
 
 
index d6c7522d844633025c070e31d5e133f48d7248c0..12e98fea543a9a91d44db51ec3404ea126c4a1dd 100644 (file)
 #    define WXMAKINGDLL_RICHTEXT
 #    define WXMAKINGDLL_MEDIA
 #    define WXMAKINGDLL_STC
+#    define WXMAKINGDLL_WEB
 #endif /* WXMAKINGDLL */
 
 /*
 #    define WXDLLIMPEXP_DATA_STC(type) type
 #endif
 
+#ifdef WXMAKINGDLL_WEB
+#    define WXDLLIMPEXP_WEB WXEXPORT
+#    define WXDLLIMPEXP_DATA_WEB(type) WXEXPORT type
+#elif defined(WXUSINGDLL)
+#    define WXDLLIMPEXP_WEB WXIMPORT
+#    define WXDLLIMPEXP_DATA_WEB(type) WXIMPORT type
+#else /* not making nor using DLL */
+#    define WXDLLIMPEXP_WEB
+#    define WXDLLIMPEXP_DATA_WEB(type) type
+#endif
+
 /*
    GCC warns about using __attribute__ (and also __declspec in mingw32 case) on
    forward declarations while MSVC complains about forward declarations without
     #define WXDLLIMPEXP_FWD_RICHTEXT
     #define WXDLLIMPEXP_FWD_MEDIA
     #define WXDLLIMPEXP_FWD_STC
+    #define WXDLLIMPEXP_FWD_WEB
 #else
     #define WXDLLIMPEXP_FWD_BASE      WXDLLIMPEXP_BASE
     #define WXDLLIMPEXP_FWD_NET       WXDLLIMPEXP_NET
     #define WXDLLIMPEXP_FWD_RICHTEXT  WXDLLIMPEXP_RICHTEXT
     #define WXDLLIMPEXP_FWD_MEDIA     WXDLLIMPEXP_MEDIA
     #define WXDLLIMPEXP_FWD_STC       WXDLLIMPEXP_STC
+    #define WXDLLIMPEXP_FWD_WEB       WXDLLIMPEXP_WEB
 #endif
 
 /* for backwards compatibility, define suffix-less versions too */
diff --git a/include/wx/gtk/webview_webkit.h b/include/wx/gtk/webview_webkit.h
new file mode 100644 (file)
index 0000000..3dc9acc
--- /dev/null
@@ -0,0 +1,185 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        include/gtk/wx/webview.h
+// Purpose:     GTK webkit backend for web view component
+// Author:      Robert Roebling, Marianne Gagnon
+// Id:          $Id$
+// Copyright:   (c) 2010 Marianne Gagnon, 1998 Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_WEBKITCTRL_H_
+#define _WX_GTK_WEBKITCTRL_H_
+
+#include "wx/setup.h"
+
+#if wxUSE_WEBVIEW_WEBKIT
+
+#include "webkit/webkit.h"
+#include "wx/sharedptr.h"
+#include "wx/webview.h"
+
+//A set of hash function so we can map wxWebHistoryItems to WebKitWebHistoryItems
+class SharedPtrHash
+{
+public:
+    SharedPtrHash() { }
+
+    unsigned long operator()( const wxSharedPtr<wxWebHistoryItem> & item ) const
+    {
+        
+        return wxPointerHash()(item.get());
+    }
+    SharedPtrHash& operator=(const SharedPtrHash&) { return *this; }
+};
+
+class SharedPtrEqual
+{
+public:
+    SharedPtrEqual() { }
+    bool operator()( const wxSharedPtr<wxWebHistoryItem> & a,
+                     const wxSharedPtr<wxWebHistoryItem> & b ) const
+    {
+        return wxPointerEqual()(a.get(), b.get());
+    }
+
+    SharedPtrEqual& operator=(const SharedPtrEqual&) { return *this; }
+};
+
+WX_DECLARE_HASH_MAP(wxSharedPtr<wxWebHistoryItem>, WebKitWebHistoryItem*,
+                    SharedPtrHash, SharedPtrEqual, HistoryItemHash);
+
+//-----------------------------------------------------------------------------
+// wxWebViewWebKit
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_WEB wxWebViewWebKit : public wxWebView
+{
+public:
+    wxWebViewWebKit() { Init(); }
+
+    wxWebViewWebKit(wxWindow *parent,
+           wxWindowID id = wxID_ANY,
+           const wxString& url = wxWebViewDefaultURLStr,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize, long style = 0,
+           const wxString& name = wxWebViewNameStr)
+    {
+        Init();
+
+        Create(parent, id, url, pos, size, style, name);
+    }
+
+    virtual bool Create(wxWindow *parent,
+           wxWindowID id = wxID_ANY,
+           const wxString& url = wxWebViewDefaultURLStr,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize, long style = 0,
+           const wxString& name = wxWebViewNameStr);
+
+    virtual bool Enable( bool enable = true );
+
+    // implementation
+    // --------------
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+    // helper to allow access to protected member from GTK callback
+    void MoveWindow(int x, int y, int width, int height)
+    {
+        DoMoveWindow(x, y, width, height);
+    }
+
+    void ZoomIn();
+    void ZoomOut();
+    void SetWebkitZoom(float level);
+    float GetWebkitZoom();
+
+    virtual void Stop();
+    virtual void LoadUrl(const wxString& url);
+    virtual void GoBack();
+    virtual void GoForward();
+    virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
+    virtual bool CanGoBack();
+    virtual bool CanGoForward();
+    virtual void ClearHistory();
+    virtual void EnableHistory(bool enable = true);
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory();
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory();
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item);
+    virtual wxString GetCurrentURL();
+    virtual wxString GetCurrentTitle();
+    virtual wxString GetPageSource();
+    virtual wxString GetPageText();
+    //We do not want to hide the other overloads
+    using wxWebView::SetPage;
+    virtual void SetPage(const wxString& html, const wxString& baseUrl);
+    virtual void Print();
+    virtual bool IsBusy();
+
+    void SetZoomType(wxWebViewZoomType);
+    wxWebViewZoomType GetZoomType() const;
+    bool CanSetZoomType(wxWebViewZoomType) const;
+    virtual wxWebViewZoom GetZoom();
+    virtual void SetZoom(wxWebViewZoom);
+
+    //Clipboard functions
+    virtual bool CanCut();
+    virtual bool CanCopy();
+    virtual bool CanPaste();
+    virtual void Cut();
+    virtual void Copy();
+    virtual void Paste();
+
+    //Undo / redo functionality
+    virtual bool CanUndo();
+    virtual bool CanRedo();
+    virtual void Undo();
+    virtual void Redo();
+
+    //Editing functions
+    virtual void SetEditable(bool enable = true);
+    virtual bool IsEditable();
+
+    //Selection
+    virtual void DeleteSelection();
+    virtual bool HasSelection();
+    virtual void SelectAll();
+    virtual wxString GetSelectedText();
+    virtual wxString GetSelectedSource();
+    virtual void ClearSelection();
+
+    virtual void RunScript(const wxString& javascript);
+
+    /** FIXME: hack to work around signals being received too early */
+    bool m_ready;
+
+
+    /** TODO: check if this can be made private
+     * The native control has a getter to check for busy state, but except in
+     * very recent versions of webkit this getter doesn't say everything we need
+     * (namely it seems to stay indefinitely busy when loading is cancelled by
+     * user)
+     */
+    bool m_busy;
+
+protected:
+
+    virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+private:
+
+    // focus event handler: calls GTKUpdateBitmap()
+    void GTKOnFocus(wxFocusEvent& event);
+
+    GtkWidget *web_view;
+    gint m_historyLimit;
+    HistoryItemHash m_historyMap;
+
+    // FIXME: try to get DECLARE_DYNAMIC_CLASS macros & stuff right
+    //DECLARE_DYNAMIC_CLASS(wxWebViewWebKit)
+};
+
+#endif // if wxHAVE_WEB_BACKEND_GTK_WEBKIT
+
+#endif
index 5643870029123b1a65f06f9c275e3a98641388fd..90518a77ae9dbd5b6c323778fa8db9f4d142a2b5 100644 (file)
 #           define wxUSE_MEDIACTRL 0
 #       endif
 #   endif
+#    if wxUSE_WEB
+#       ifdef wxABORT_ON_CONFIG_ERROR
+#           error "wxWebView requires wxActiveXContainer under MSW"
+#       else
+#           undef wxUSE_WEB
+#           define wxUSE_WEB 0
+#       endif
+#   endif
 #endif /* !wxUSE_ACTIVEX */
 
 #if !wxUSE_THREADS
 #   endif
 #endif /* !wxUSE_THREADS */
 
+
+#if !wxUSE_OLE_AUTOMATION
+#    if wxUSE_WEB
+#       ifdef wxABORT_ON_CONFIG_ERROR
+#           error "wxWebView requires wxUSE_OLE_AUTOMATION under MSW"
+#       else
+#           undef wxUSE_WEB
+#           define wxUSE_WEB 0
+#       endif
+#   endif
+#endif /* !wxUSE_OLE_AUTOMATION */
+
 #if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT
 #   undef wxUSE_POSTSCRIPT
 #   define wxUSE_POSTSCRIPT 1
index 95157acc1b2079fc9593b65a2a984177996fa117..16e4621baadc7011c232103a25586f85b1115f95 100644 (file)
@@ -514,6 +514,77 @@ typedef struct
 
 #endif
 
+#endif
+
+// Various definitions are missing from mingw
+// Used by webview_ie.cpp
+#ifdef __MINGW32__
+typedef enum CommandStateChangeConstants {
+    CSC_UPDATECOMMANDS = (int) 0xFFFFFFFF,
+    CSC_NAVIGATEFORWARD = 0x1,
+    CSC_NAVIGATEBACK = 0x2
+} CommandStateChangeConstants;
+
+#define DISPID_COMMANDSTATECHANGE 105
+#define DISPID_NAVIGATECOMPLETE2 252
+#define DISPID_NAVIGATEERROR 271
+#define DISPID_NEWWINDOW3 273
+#define INET_E_ERROR_FIRST 0x800C0002L
+#define INET_E_INVALID_URL 0x800C0002L
+#define INET_E_NO_SESSION 0x800C0003L
+#define INET_E_CANNOT_CONNECT 0x800C0004L
+#define INET_E_RESOURCE_NOT_FOUND 0x800C0005L
+#define INET_E_OBJECT_NOT_FOUND 0x800C0006L
+#define INET_E_DATA_NOT_AVAILABLE 0x800C0007L
+#define INET_E_DOWNLOAD_FAILURE 0x800C0008L
+#define INET_E_AUTHENTICATION_REQUIRED 0x800C0009L
+#define INET_E_NO_VALID_MEDIA 0x800C000AL
+#define INET_E_CONNECTION_TIMEOUT 0x800C000BL
+#define INET_E_INVALID_REQUEST 0x800C000CL
+#define INET_E_UNKNOWN_PROTOCOL 0x800C000DL
+#define INET_E_SECURITY_PROBLEM 0x800C000EL
+#define INET_E_CANNOT_LOAD_DATA 0x800C000FL
+#define INET_E_CANNOT_INSTANTIATE_OBJECT 0x800C0010L
+#define INET_E_QUERYOPTION_UNKNOWN 0x800C0013L
+#define INET_E_REDIRECT_FAILED 0x800C0014L
+#define INET_E_REDIRECT_TO_DIR 0x800C0015L
+#define INET_E_CANNOT_LOCK_REQUEST 0x800C0016L
+#define INET_E_USE_EXTEND_BINDING 0x800C0017L
+#define INET_E_TERMINATED_BIND 0x800C0018L
+#define INET_E_INVALID_CERTIFICATE 0x800C0019L
+#define INET_E_CODE_DOWNLOAD_DECLINED 0x800C0100L
+#define INET_E_RESULT_DISPATCHED 0x800C0200L
+#define INET_E_CANNOT_REPLACE_SFP_FILE 0x800C0300L
+#define INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY 0x800C0500L
+#define INET_E_CODE_INSTALL_SUPPRESSED 0x800C0400L
+
+#define REFRESH_NORMAL 0
+#define REFRESH_COMPLETELY 3
+#endif
+
+// For Visual C++ 6 and MinGW32. Used by webview_ie.cpp
+
+#if defined (__MINGW32__) || (_MSC_VER < 1300)
+enum
+{
+    OLECMDID_OPTICAL_ZOOM = 63
+}
+#endif
+
+#ifndef INET_E_INVALID_CERTIFICATE
+#define INET_E_INVALID_CERTIFICATE 0x800C0019L
+#endif
+
+#ifndef INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY
+#define INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY 0x800C0500L
+#endif
+
+#ifndef INET_E_CODE_INSTALL_SUPPRESSED
+#define INET_E_CODE_INSTALL_SUPPRESSED 0x800C0400L
+#endif
+
+#ifndef DISPID_NEWWINDOW3
+#define DISPID_NEWWINDOW3 273
 #endif
 
  /*
index 4761192d66dd594f60a01a669a2cd920c69682e2..13a39dcf664ec41475ff69b02c7eeb97b764c88d 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:     wxMSW-specific wxPanel class.
 // Author:      Vadim Zeitlin
 // Created:     2011-03-18
-// RCS-ID:      $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
+// RCS-ID:      $Id$
 // Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
index 04a5c132b798d4be6952b3de7eb287de1e333127..28ce71eaf7fd335e01550391de7b141364f9e44d 100644 (file)
 // Recommended setting: 1
 #define wxUSE_STC 1
 
+// Use wxWidget's web viewing classes
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_WEB 1
+
+// Use the IE wxWebView backend
+//
+// Default is 1 on MSW
+//
+// Recommended setting: 1
+#ifdef __WXMSW__
+#define wxUSE_WEBVIEW_IE 1
+#else
+#define wxUSE_WEBVIEW_IE 0
+#endif
+
 
 // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced
 // 2D drawing API.  (Still somewhat experimental)
diff --git a/include/wx/msw/webview_ie.h b/include/wx/msw/webview_ie.h
new file mode 100644 (file)
index 0000000..935f2c6
--- /dev/null
@@ -0,0 +1,225 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        include/wx/msw/webviewie.h
+// Purpose:     wxMSW IE wxWebView backend
+// Author:      Marianne Gagnon
+// Id:          $Id$
+// Copyright:   (c) 2010 Marianne Gagnon, Steven Lamerton
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef wxWebViewIE_H
+#define wxWebViewIE_H
+
+#include "wx/setup.h"
+
+#if wxUSE_WEBVIEW_IE
+
+#include "wx/control.h"
+#include "wx/webview.h"
+#include "wx/msw/ole/automtn.h"
+#include "wx/msw/ole/activex.h"
+#include "wx/sharedptr.h"
+#include "wx/vector.h"
+
+struct IHTMLDocument2;
+
+class wxFSFile;
+class wxFileSystem;
+
+class WXDLLIMPEXP_WEB wxWebViewIE : public wxWebView
+{
+public:
+
+    wxWebViewIE() {}
+
+    wxWebViewIE(wxWindow* parent,
+           wxWindowID id,
+           const wxString& url = wxWebViewDefaultURLStr,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           long style = 0,
+           const wxString& name = wxWebViewNameStr)
+   {
+       Create(parent, id, url, pos, size, style, name);
+   }
+
+    bool Create(wxWindow* parent,
+           wxWindowID id,
+           const wxString& url = wxWebViewDefaultURLStr,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           long style = 0,
+           const wxString& name = wxWebViewNameStr);
+
+    virtual void LoadUrl(const wxString& url);
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item);
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory();
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory();
+
+    virtual bool CanGoForward();
+    virtual bool CanGoBack();
+    virtual void GoBack();
+    virtual void GoForward();
+    virtual void ClearHistory();
+    virtual void EnableHistory(bool enable = true);
+    virtual void Stop();
+    virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
+
+    virtual wxString GetPageSource();
+    virtual wxString GetPageText();
+
+    virtual bool IsBusy();
+    virtual wxString GetCurrentURL();
+    virtual wxString GetCurrentTitle();
+
+    virtual void SetZoomType(wxWebViewZoomType);
+    virtual wxWebViewZoomType GetZoomType() const;
+    virtual bool CanSetZoomType(wxWebViewZoomType) const;
+
+    virtual void Print();
+
+    virtual void SetPage(const wxString& html, const wxString& baseUrl);
+
+    virtual wxWebViewZoom GetZoom();
+    virtual void SetZoom(wxWebViewZoom zoom);
+
+    //Clipboard functions
+    virtual bool CanCut();
+    virtual bool CanCopy();
+    virtual bool CanPaste();
+    virtual void Cut();
+    virtual void Copy();
+    virtual void Paste();
+
+    //Undo / redo functionality
+    virtual bool CanUndo();
+    virtual bool CanRedo();
+    virtual void Undo();
+    virtual void Redo();
+
+    //Editing functions
+    virtual void SetEditable(bool enable = true);
+    virtual bool IsEditable();
+
+    //Selection
+    virtual void SelectAll();
+    virtual bool HasSelection();
+    virtual void DeleteSelection();
+    virtual wxString GetSelectedText();
+    virtual wxString GetSelectedSource();
+    virtual void ClearSelection();
+
+    virtual void RunScript(const wxString& javascript);
+
+    // ---- IE-specific methods
+
+    // FIXME: I seem to be able to access remote webpages even in offline mode...
+    bool IsOfflineMode();
+    void SetOfflineMode(bool offline);
+
+    wxWebViewZoom GetIETextZoom();
+    void SetIETextZoom(wxWebViewZoom level);
+
+    wxWebViewZoom GetIEOpticalZoom();
+    void SetIEOpticalZoom(wxWebViewZoom level);
+
+    void onActiveXEvent(wxActiveXEvent& evt);
+    void onEraseBg(wxEraseEvent&) {}
+
+    DECLARE_EVENT_TABLE();
+
+private:
+    wxActiveXContainer* m_container;
+    wxAutomationObject m_ie;
+    IWebBrowser2* m_webBrowser;
+    DWORD m_dwCookie;
+
+    //We store the current zoom type;
+    wxWebViewZoomType m_zoomType;
+
+    /** The "Busy" property of IWebBrowser2 does not always return busy when
+     *  we'd want it to; this variable may be set to true in cases where the
+     *  Busy property is false but should be true.
+     */
+    bool m_isBusy;
+    //We manage our own history, the history list contains the history items 
+    //which are added as documentcomplete events arrive, unless we are loading
+    //an item from the history. The position is stored as an int, and reflects
+    //where we are in the history list.
+    wxVector<wxSharedPtr<wxWebHistoryItem> > m_historyList;
+    int m_historyPosition;
+    bool m_historyLoadingFromList;
+    bool m_historyEnabled;
+
+    //Generic helper functions for IHtmlDocument commands
+    bool CanExecCommand(wxString command);
+    void ExecCommand(wxString command);
+    IHTMLDocument2* GetDocument();
+
+};
+
+class VirtualProtocol : public IInternetProtocol
+{
+protected:
+    ULONG m_refCount;
+    IInternetProtocolSink* m_protocolSink;
+    wxString m_html;
+    VOID * fileP;
+
+    wxFSFile* m_file;
+    wxFileSystem* m_fileSys;
+
+public:
+    VirtualProtocol();
+    ~VirtualProtocol();
+
+    //IUnknown
+    ULONG STDMETHODCALLTYPE AddRef();
+    HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
+    ULONG STDMETHODCALLTYPE Release();
+
+    //IInternetProtocolRoot
+    HRESULT STDMETHODCALLTYPE Abort(HRESULT WXUNUSED(hrReason), 
+                                    DWORD WXUNUSED(dwOptions))
+                                   { return E_NOTIMPL; }
+    HRESULT STDMETHODCALLTYPE Continue(PROTOCOLDATA *WXUNUSED(pProtocolData))
+                                       { return S_OK; }
+    HRESULT STDMETHODCALLTYPE Resume() { return S_OK; }
+    HRESULT STDMETHODCALLTYPE Start(LPCWSTR szUrl, 
+                                    IInternetProtocolSink *pOIProtSink,
+                                    IInternetBindInfo *pOIBindInfo, 
+                                    DWORD grfPI, 
+                                    HANDLE_PTR dwReserved);
+    HRESULT STDMETHODCALLTYPE Suspend() { return S_OK; }
+    HRESULT STDMETHODCALLTYPE Terminate(DWORD WXUNUSED(dwOptions)) { return S_OK; }
+
+    //IInternetProtocol
+    HRESULT STDMETHODCALLTYPE LockRequest(DWORD WXUNUSED(dwOptions)) 
+                                          { return S_OK; }
+    HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead);
+    HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER WXUNUSED(dlibMove), 
+                                   DWORD WXUNUSED(dwOrigin), 
+                                   ULARGE_INTEGER* WXUNUSED(plibNewPosition)) 
+                                   { return E_FAIL; }
+    HRESULT STDMETHODCALLTYPE UnlockRequest() { return S_OK; }
+};
+
+class ClassFactory : public IClassFactory
+{
+private:
+    ULONG m_refCount;
+public:
+    //IUnknown
+    ULONG STDMETHODCALLTYPE AddRef();
+    HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
+    ULONG STDMETHODCALLTYPE Release();
+
+    //IClassFactory
+    HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown* pUnkOuter, 
+                                             REFIID riid, void** ppvObject);
+    HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock);
+};
+
+#endif // wxUSE_WEBVIEW_IE
+
+#endif // wxWebViewIE_H
diff --git a/include/wx/osx/webview_webkit.h b/include/wx/osx/webview_webkit.h
new file mode 100644 (file)
index 0000000..975bee5
--- /dev/null
@@ -0,0 +1,165 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        include/wx/osx/webkit.h
+// Purpose:     wxWebViewWebKit - embeddable web kit control,
+//                             OS X implementation of web view component
+// Author:      Jethro Grassie / Kevin Ollivier / Marianne Gagnon
+// Modified by:
+// Created:     2004-4-16
+// RCS-ID:      $Id$
+// Copyright:   (c) Jethro Grassie / Kevin Ollivier / Marianne Gagnon
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WEBKIT_H
+#define _WX_WEBKIT_H
+
+#include "wx/setup.h"
+
+#if wxUSE_WEBKIT && (defined(__WXMAC__) || defined(__WXCOCOA__))
+
+#include "wx/control.h"
+#include "wx/webview.h"
+
+// ----------------------------------------------------------------------------
+// Web Kit Control
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_WEB wxWebViewWebKit : public wxWebView
+{
+public:
+    wxDECLARE_DYNAMIC_CLASS(wxWebViewWebKit);
+
+    wxWebViewWebKit() {}
+    wxWebViewWebKit(wxWindow *parent,
+                    wxWindowID winID = wxID_ANY,
+                    const wxString& strURL = wxWebViewDefaultURLStr,
+                    const wxPoint& pos = wxDefaultPosition,
+                    const wxSize& size = wxDefaultSize, long style = 0,
+                    const wxString& name = wxWebViewNameStr)
+    {
+        Create(parent, winID, strURL, pos, size, style, name);
+    }
+    bool Create(wxWindow *parent,
+                wxWindowID winID = wxID_ANY,
+                const wxString& strURL = wxWebViewDefaultURLStr,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize, long style = 0,
+                const wxString& name = wxWebViewNameStr);
+    virtual ~wxWebViewWebKit();
+
+    void InternalLoadURL(const wxString &url);
+
+    virtual bool CanGoBack();
+    virtual bool CanGoForward();
+    virtual void GoBack();
+    virtual void GoForward();
+    virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
+    virtual void Stop();
+    virtual wxString GetPageSource();
+    virtual wxString GetPageText() { return ""; }
+    virtual void SetPageTitle(const wxString& title) { m_pageTitle = title; }
+    virtual wxString GetPageTitle(){ return m_pageTitle; }
+
+    virtual void SetPage(const wxString& html, const wxString& baseUrl);
+
+    virtual void Print();
+
+    virtual void LoadUrl(const wxString& url);
+    virtual wxString GetCurrentURL();
+    virtual wxString GetCurrentTitle();
+    virtual wxWebViewZoom GetZoom();
+    virtual void SetZoom(wxWebViewZoom zoom);
+
+    virtual void SetZoomType(wxWebViewZoomType zoomType);
+    virtual wxWebViewZoomType GetZoomType() const;
+    virtual bool CanSetZoomType(wxWebViewZoomType type) const;
+
+    virtual bool IsBusy() { return m_busy; }
+    
+    //History functions
+    virtual void ClearHistory() {}
+    virtual void EnableHistory(bool enable = true) {}
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory()
+            { return wxVector<wxSharedPtr<wxWebHistoryItem> >() }
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory() 
+            { return wxVector<wxSharedPtr<wxWebHistoryItem> >() }
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item) {}
+    
+    //Undo / redo functionality
+    virtual bool CanUndo() { return false; }
+    virtual bool CanRedo() { return false; }
+    virtual void Undo() {}
+    virtual void Redo() {}
+
+    //Clipboard functions
+    virtual bool CanCut() { return false; }
+    virtual bool CanCopy() { return false; }
+    virtual bool CanPaste() { return false; }
+    virtual void Cut();
+    virtual void Copy();
+    virtual void Paste();
+    
+    //Editing functions
+    virtual void SetEditable(bool enable = true);
+    virtual bool IsEditable();
+    
+    //Selection
+    virtual void DeleteSelection();
+    virtual bool HasSelection() { return false };
+    virtual void SelectAll() {};
+    virtual wxString GetSelectedText();
+    virtual wxString GetSelectedSource() { return ""; }
+    virtual void ClearSelection() {}
+    
+    void RunScript(const wxString& javascript);
+
+    // ---- methods not from the parent (common) interface
+    bool  CanGetPageSource();
+
+    void  SetScrollPos(int pos);
+    int   GetScrollPos();
+
+    wxString GetSelection();
+
+    bool  CanIncreaseTextSize();
+    void  IncreaseTextSize();
+    bool  CanDecreaseTextSize();
+    void  DecreaseTextSize();
+
+    float GetWebkitZoom();
+    void  SetWebkitZoom(float zoom);
+
+    // don't hide base class virtuals
+    virtual void SetScrollPos( int orient, int pos, bool refresh = true )
+        { return wxControl::SetScrollPos(orient, pos, refresh); }
+    virtual int GetScrollPos( int orient ) const
+        { return wxControl::GetScrollPos(orient); }
+
+    //we need to resize the webview when the control size changes
+    void OnSize(wxSizeEvent &event);
+    void OnMove(wxMoveEvent &event);
+    void OnMouseEvents(wxMouseEvent &event);
+
+    bool m_busy;
+
+protected:
+    DECLARE_EVENT_TABLE()
+    void MacVisibilityChanged();
+
+private:
+    wxWindow *m_parent;
+    wxWindowID m_windowID;
+    wxString m_pageTitle;
+
+    struct objc_object *m_webView;
+
+    // we may use this later to setup our own mouse events,
+    // so leave it in for now.
+    void* m_webKitCtrlEventHandler;
+    //It should be WebView*, but WebView is an Objective-C class
+    //TODO: look into using DECLARE_WXCOCOA_OBJC_CLASS rather than this.
+};
+
+#endif // wxUSE_WEBKIT
+
+#endif // _WX_WEBKIT_H_
index e85a56bf4c6037efcb8384c258ce6d3f329afabd..22f38675a23086cedb452f5d81806f9c9efe9d05 100644 (file)
 // Recommended setting: 1
 #define wxUSE_STC 1
 
+// Use wxWidget's web viewing classes
+//
+// Default is 1
+//
+// Recommended setting: 1
+#define wxUSE_WEB 1
+
+// Use the IE wxWebView backend
+//
+// Default is 1 on MSW
+//
+// Recommended setting: 1
+#ifdef __WXMSW__
+#define wxUSE_WEBVIEW_IE 1
+#else
+#define wxUSE_WEBVIEW_IE 0
+#endif
+
+// Use the WebKit wxWebView backend
+//
+// Default is 1 on GTK and OSX
+//
+// Recommended setting: 1
+#if defined(__WXGTK__) || defined(__WXOSX__)
+#define wxUSE_WEBVIEW_WEBKIT 1
+#else
+#define wxUSE_WEBVIEW_WEBKIT 0
+#endif
 
 // Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced
 // 2D drawing API.  (Still somewhat experimental)
diff --git a/include/wx/webview.h b/include/wx/webview.h
new file mode 100644 (file)
index 0000000..ed94c82
--- /dev/null
@@ -0,0 +1,424 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        webview.h
+// Purpose:     Common interface and events for web view component
+// Author:      Marianne Gagnon
+// Id:          $Id$
+// Copyright:   (c) 2010 Marianne Gagnon
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WEB_VIEW_H_
+#define _WX_WEB_VIEW_H_
+
+#include "wx/setup.h"
+
+#if wxUSE_WEB
+
+#include <wx/control.h>
+#include <wx/event.h>
+#include <wx/sstream.h>
+#include "wx/sharedptr.h"
+#include "wx/vector.h"
+
+class WXDLLIMPEXP_WEB wxWebHistoryItem
+{
+public:
+    wxWebHistoryItem(const wxString& url, const wxString& title) : 
+                     m_url(url), m_title(title) {}
+    wxString GetUrl() { return m_url; }
+    wxString GetTitle() { return m_title; }
+
+private:
+    wxString m_url, m_title;
+};
+
+/**
+ * Zoom level in web view component
+ */
+enum wxWebViewZoom
+{
+    wxWEB_VIEW_ZOOM_TINY,
+    wxWEB_VIEW_ZOOM_SMALL,
+    wxWEB_VIEW_ZOOM_MEDIUM,
+    wxWEB_VIEW_ZOOM_LARGE,
+    wxWEB_VIEW_ZOOM_LARGEST
+};
+
+/**
+ * The type of zooming that the web view control can perform
+ */
+enum wxWebViewZoomType
+{
+    /** The entire layout scales when zooming, including images */
+    wxWEB_VIEW_ZOOM_TYPE_LAYOUT,
+    /** Only the text changes in size when zooming, images and other layout
+      * elements retain their initial size */
+    wxWEB_VIEW_ZOOM_TYPE_TEXT
+};
+
+/** Types of errors that can cause navigation to fail */
+enum wxWebNavigationError
+{
+    /** Connection error (timeout, etc.) */
+    wxWEB_NAV_ERR_CONNECTION,
+    /** Invalid certificate */
+    wxWEB_NAV_ERR_CERTIFICATE,
+    /** Authentication required */
+    wxWEB_NAV_ERR_AUTH,
+    /** Other security error */
+    wxWEB_NAV_ERR_SECURITY,
+    /** Requested resource not found */
+    wxWEB_NAV_ERR_NOT_FOUND,
+    /** Invalid request/parameters (e.g. bad URL, bad protocol,
+      * unsupported resource type) */
+    wxWEB_NAV_ERR_REQUEST,
+    /** The user cancelled (e.g. in a dialog) */
+    wxWEB_NAV_ERR_USER_CANCELLED,
+    /** Another (exotic) type of error that didn't fit in other categories*/
+    wxWEB_NAV_ERR_OTHER
+};
+
+/** Type of refresh */
+enum wxWebViewReloadFlags
+{
+    /** Default reload, will access cache */
+    wxWEB_VIEW_RELOAD_DEFAULT,
+    /** Reload the current view without accessing the cache */
+    wxWEB_VIEW_RELOAD_NO_CACHE 
+};
+
+
+/**
+ * List of available backends for wxWebView
+ */
+enum wxWebViewBackend
+{
+    /** Value that may be passed to wxWebView to let it pick an appropriate
+     * engine for the current platform*/
+    wxWEB_VIEW_BACKEND_DEFAULT,
+
+    /** The WebKit web engine */
+    wxWEB_VIEW_BACKEND_WEBKIT,
+
+    /** Use Microsoft Internet Explorer as web engine */
+    wxWEB_VIEW_BACKEND_IE
+};
+
+extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[];
+extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[];
+
+class WXDLLIMPEXP_WEB wxWebView : public wxControl
+{
+public:
+
+    /**
+     *  Creation function for two-step creation.
+     */
+    virtual bool Create(wxWindow* parent,
+           wxWindowID id,
+           const wxString& url,
+           const wxPoint& pos,
+           const wxSize& size,
+           long style,
+           const wxString& name) = 0;
+
+    /**
+     * Factory function to create a new wxWebView for two-step creation
+     * (you need to call wxWebView::Create on the returned object)
+     * @param backend which web engine to use as backend for wxWebView
+     * @return the created wxWebView, or NULL if the requested backend is
+     *         not available
+     */
+    static wxWebView* New(wxWebViewBackend backend = wxWEB_VIEW_BACKEND_DEFAULT);
+
+    // TODO: clarify what styles can do, or remove this flag
+    /**
+     * Factory function to create a new wxWebView
+     * @param parent parent window to create this view in
+     * @param id ID of this control
+     * @param url URL to load by default in the web view
+     * @param pos position to create this control at
+     *            (you may use wxDefaultPosition if you use sizers)
+     * @param size size to create this control with
+     *             (you may use wxDefaultSize if you use sizers)
+     * @param backend which web engine to use as backend for wxWebView
+     * @return the created wxWebView, or NULL if the requested backend
+     *         is not available
+     */
+    static wxWebView* New(wxWindow* parent,
+           wxWindowID id,
+           const wxString& url = wxWebViewDefaultURLStr,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           wxWebViewBackend backend = wxWEB_VIEW_BACKEND_DEFAULT,
+           long style = 0,
+           const wxString& name = wxWebViewNameStr);
+
+
+    /** Get whether it is possible to navigate back in the history of
+      * visited pages
+      */
+    virtual bool CanGoBack() = 0;
+
+    /** Get whether it is possible to navigate forward in the history of
+      * visited pages
+      */
+    virtual bool CanGoForward() = 0;
+
+    /** Navigate back in the history of visited pages.
+      * Only valid if CanGoBack() returned true.
+      */
+    virtual void GoBack() = 0;
+
+    /** Navigate forwardin the history of visited pages.
+      * Only valid if CanGoForward() returned true.
+      */
+    virtual void GoForward() = 0;
+
+    /**
+     * Load a HTMl document (web page) from a URL
+     * @param url the URL where the HTML document to display can be found
+     * @note web engines generally report errors asynchronously, so if you wish
+     *       to know whether loading the URL was successful, register to receive
+     *       navigation error events
+     */
+    virtual void LoadUrl(const wxString& url) = 0;
+
+    virtual void ClearHistory() = 0;
+    virtual void EnableHistory(bool enable = true) = 0;
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory() = 0;
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory() = 0;
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item) = 0;
+
+    /**
+     * Stop the current page loading process, if any.
+     * May trigger an error event of type wxWEB_NAV_ERR_USER_CANCELLED.
+     * TODO: make wxWEB_NAV_ERR_USER_CANCELLED errors uniform across ports.
+     */
+    virtual void Stop() = 0;
+
+    /**
+     * Reload the currently displayed URL.
+     * @param flags A bit array that may optionnally contain reload options
+     */
+    virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT) = 0;
+
+
+    /**
+     * Get the URL of the currently displayed document
+     */
+    virtual wxString GetCurrentURL() = 0;
+
+    /**
+     * Get the title of the current web page, or its URL/path if title is not
+     * available
+     */
+    virtual wxString GetCurrentTitle() = 0;
+
+    // TODO: handle choosing a frame when calling GetPageSource()?
+    /**
+     * Get the HTML source code of the currently displayed document
+     * @return the HTML source code, or an empty string if no page is currently
+     *         shown
+     */
+    virtual wxString GetPageSource() = 0;
+    virtual wxString GetPageText() = 0;
+
+   /**
+     * Get the zoom factor of the page
+     * @return How much the HTML document is zoomed (scaleed)
+     */
+    virtual wxWebViewZoom GetZoom() = 0;
+
+    /**
+     * Set the zoom factor of the page
+     * @param zoom How much to zoom (scale) the HTML document
+     */
+    virtual void SetZoom(wxWebViewZoom zoom) = 0;
+
+    /**
+     * Set how to interpret the zoom factor
+     * @param zoomType how the zoom factor should be interpreted by the
+     *                 HTML engine
+     * @note invoke    canSetZoomType() first, some HTML renderers may not
+     *                 support all zoom types
+     */
+    virtual void SetZoomType(wxWebViewZoomType zoomType) = 0;
+
+    /**
+     * Get how the zoom factor is currently interpreted
+     * @return how the zoom factor is currently interpreted by the HTML engine
+     */
+    virtual wxWebViewZoomType GetZoomType() const = 0;
+
+    /**
+     * Retrieve whether the current HTML engine supports a type of zoom
+     * @param type the type of zoom to test
+     * @return whether this type of zoom is supported by this HTML engine
+     *         (and thus can be set through setZoomType())
+     */
+    virtual bool CanSetZoomType(wxWebViewZoomType type) const = 0;
+
+    // TODO: allow 'SetPage' to find files (e.g. images) from a virtual file
+    // system if possible
+    /**
+     * Set the displayed page source to the contents of the given string
+     * @param html    the string that contains the HTML data to display
+     * @param baseUrl URL assigned to the HTML data, to be used to resolve
+     *                relative paths, for instance
+     */
+    virtual void SetPage(const wxString& html, const wxString& baseUrl) = 0;
+
+    /**
+     * Set the displayed page source to the contents of the given stream
+     * @param html    the stream to read HTML data from
+     * @param baseUrl URL assigned to the HTML data, to be used to resolve
+     *                relative paths, for instance
+     */
+    virtual void SetPage(wxInputStream& html, wxString baseUrl)
+    {
+        wxStringOutputStream stream;
+        stream.Write(html);
+        SetPage(stream.GetString(), baseUrl);
+    }
+
+    virtual void SetEditable(bool enable = true) = 0;
+    virtual bool IsEditable() = 0;
+
+    virtual void SelectAll() = 0;
+    virtual bool HasSelection() = 0;
+    virtual void DeleteSelection() = 0;
+    virtual wxString GetSelectedText() = 0;
+    virtual wxString GetSelectedSource() = 0;
+    virtual void ClearSelection() = 0;
+
+    virtual void RunScript(const wxString& javascript) = 0;
+
+    // TODO:
+    //     void EnableJavascript(bool enabled);             // maybe?
+    //       // maybe?
+
+    //     void SetScrollPos(int pos);                      // maybe?
+    //     int GetScrollPos();                              // maybe?
+
+    //     wxString GetStatusText();                        // maybe?
+    //     void SetStatusText(wxString text);               // maybe?
+    //     * status text changed event?
+    //     * title changed event?
+
+    //    virtual bool IsOfflineMode() = 0;                 // maybe?
+    //     virtual void SetOfflineMode(bool offline) = 0;   // maybe?
+
+    /**
+     * Opens a print dialog so that the user may print the currently
+     * displayed page.
+     */
+    virtual void Print() = 0;
+
+    /**
+     * Returns whether the web control is currently busy (e.g. loading a page)
+     */
+    virtual bool IsBusy() = 0;
+
+    //Clipboard functions
+    virtual bool CanCut() = 0;
+    virtual bool CanCopy() = 0;
+    virtual bool CanPaste() = 0;
+    virtual void Cut() = 0;
+    virtual void Copy() = 0;
+    virtual void Paste() = 0;
+
+    //Undo / redo functionality
+    virtual bool CanUndo() = 0;
+    virtual bool CanRedo() = 0;
+    virtual void Undo() = 0;
+    virtual void Redo() = 0;
+};
+
+class WXDLLIMPEXP_WEB wxWebNavigationEvent : public wxCommandEvent
+{
+public:
+    wxWebNavigationEvent() {}
+    wxWebNavigationEvent(wxEventType type, int id, const wxString url,
+                         const wxString target, bool canVeto)
+        : wxCommandEvent(type, id)
+    {
+        m_url = url;
+        m_target = target;
+        m_vetoed = false;
+        m_canVeto = canVeto;
+    }
+
+    /**
+     *  Get the URL being visited
+     */
+    const wxString& GetURL() const { return m_url; }
+
+    /**
+     * Get the target (frame or window) in which the URL that caused this event
+     * is viewed, or an empty string if not available.
+     */
+    const wxString& GetTarget() const { return m_target; }
+
+    // default copy ctor, assignment operator and dtor are ok
+    virtual wxEvent* Clone() const { return new wxWebNavigationEvent(*this); }
+
+    /** Get whether this event may be vetoed (stopped/prevented). Only
+      *  meaningful for events fired before navigation takes place.
+      */
+    bool CanVeto() const { return m_canVeto; }
+
+    /** Whether this event was vetoed (stopped/prevented). Only meaningful for
+     *  events fired before navigation takes place.
+     */
+    bool IsVetoed() const { return m_vetoed; }
+
+    /** Veto (prevent/stop) this event. Only meaningful for events fired
+     *  before navigation takes place. Only valid if CanVeto() returned true.
+     */
+    void Veto() { wxASSERT(m_canVeto); m_vetoed = true; }
+
+private:
+    wxString m_url;
+    wxString m_target;
+    bool m_canVeto;
+    bool m_vetoed;
+
+    wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWebNavigationEvent);
+};
+
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_WEB, wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
+
+typedef void (wxEvtHandler::*wxWebNavigationEventFunction)
+             (wxWebNavigationEvent&);
+
+#define wxWebNavigationEventHandler(func) \
+    wxEVENT_HANDLER_CAST(wxWebNavigationEventFunction, func)
+
+#define EVT_WEB_VIEW_NAVIGATING(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATING, id, \
+                     wxHtmlNavigatingEventHandler(fn))
+
+#define EVT_WEB_VIEW_NAVIGATED(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NAVIGATED, id, \
+                     wxHtmlNavigatingEventHandler(fn))
+
+#define EVT_WEB_VIEW_LOADED(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_LOADED, id, \
+                     wxHtmlNavigatingEventHandler(fn))
+
+#define EVT_WEB_VIEW_ERRROR(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_ERROR, id, \
+                     wxHtmlNavigatingEventHandler(fn))
+
+#define EVT_WEB_VIEW_NEWWINDOW(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, id, \
+                     wxHtmlNavigatingEventHandler(fn))
+
+#endif // wxUSE_WEB
+
+#endif // _WX_WEB_VIEW_H_
diff --git a/interface/wx/webview.h b/interface/wx/webview.h
new file mode 100644 (file)
index 0000000..7d5f96d
--- /dev/null
@@ -0,0 +1,569 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        webview.h
+// Purpose:     interface of wxWebView
+// Author:      wxWidgets team
+// RCS-ID:      $Id$
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+    Zoom levels availiable in wxWebView
+*/
+enum wxWebViewZoom
+{
+    wxWEB_VIEW_ZOOM_TINY,
+    wxWEB_VIEW_ZOOM_SMALL,
+    wxWEB_VIEW_ZOOM_MEDIUM, //!< default size
+    wxWEB_VIEW_ZOOM_LARGE,
+    wxWEB_VIEW_ZOOM_LARGEST
+};
+
+/**
+    The type of zooming that the web view control can perform
+*/
+enum wxWebViewZoomType
+{
+    /** 
+        The entire layout scales when zooming, including images 
+    */
+    wxWEB_VIEW_ZOOM_TYPE_LAYOUT,
+    /** 
+        Only the text changes in size when zooming, images and other layout
+        elements retain their initial size 
+    */
+    wxWEB_VIEW_ZOOM_TYPE_TEXT
+};
+
+/** 
+    Types of errors that can cause navigation to fail
+*/
+enum wxWebNavigationError
+{
+    /** Connection error (timeout, etc.) */
+    wxWEB_NAV_ERR_CONNECTION,
+    /** Invalid certificate */
+    wxWEB_NAV_ERR_CERTIFICATE,
+    /** Authentication required */
+    wxWEB_NAV_ERR_AUTH,
+    /** Other security error */
+    wxWEB_NAV_ERR_SECURITY,
+    /** Requested resource not found */
+    wxWEB_NAV_ERR_NOT_FOUND,
+    /** Invalid request/parameters (e.g. bad URL, bad protocol,
+        unsupported resource type) */
+    wxWEB_NAV_ERR_REQUEST,
+    /** The user cancelled (e.g. in a dialog) */
+    wxWEB_NAV_ERR_USER_CANCELLED,
+    /** Another (exotic) type of error that didn't fit in other categories*/
+    wxWEB_NAV_ERR_OTHER
+};
+
+/** 
+    Type of refresh 
+*/
+enum wxWebViewReloadFlags
+{
+    /** Default reload, will access cache */
+    wxWEB_VIEW_RELOAD_DEFAULT,
+    /** Reload the current view without accessing the cache */
+    wxWEB_VIEW_RELOAD_NO_CACHE 
+};
+
+
+/**
+ * List of available backends for wxWebView
+ */
+enum wxWebViewBackend
+{
+    /** Value that may be passed to wxWebView to let it pick an appropriate
+     * engine for the current platform*/
+    wxWEB_VIEW_BACKEND_DEFAULT,
+
+    /** The WebKit web engine */
+    wxWEB_VIEW_BACKEND_WEBKIT,
+
+    /** Use Microsoft Internet Explorer as web engine */
+    wxWEB_VIEW_BACKEND_IE
+};
+
+/**
+    @class wxWebHistoryItem
+  
+    A simple class that contains the URL and title of an element of the history
+    of a wxWebView. 
+   
+    @library{wxweb}
+    @category{web}
+    
+    @see wxWebView
+ */
+class wxWebHistoryItem
+{
+public:
+    /**
+        Construtor.
+    */
+    wxWebHistoryItem(const wxString& url, const wxString& title);
+    
+    /**
+        @return The url of the page.
+    */
+    wxString GetUrl();
+    
+    /**
+        @return The title of the page.
+    */
+    wxString GetTitle();
+};
+
+/**
+    @class wxWebView
+  
+    This control may be used to render web (HTML / CSS / javascript) documents.
+    Capabilities of the HTML renderer will depend upon the backed.
+
+    @c wxWEB_VIEW_BACKEND_IE uses the the Trident rendering engine, which 
+    is also used by Internet Explorer. It is important to note that by default 
+    it emulates Internet Explorer 7, this can be chaged with a registry 
+    setting, see 
+    <a href="http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation">
+    this</a> article for more information.
+  
+    Note that errors are generally reported asynchronously though the
+    @c wxEVT_COMMAND_WEB_VIEW_ERROR event described below.
+  
+    @beginEventEmissionTable{wxWebNavigationEvent}
+    @event{EVT_WEB_VIEW_NAVIGATING(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATING event, generated before trying
+       to get a resource. This event may be vetoed to prevent navigating to this
+       resource. Note that if the displayed HTML document has several frames, one
+       such event will be generated per frame.
+    @event{EVT_WEB_VIEW_NAVIGATED(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATED event generated after it was
+       confirmed that a resource would be requested. This event may not be vetoed.
+       Note that if the displayed HTML document has several frames, one such event
+       will be generated per frame.
+    @event{EVT_WEB_VIEW_LOADED(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_LOADED event generated when the document
+       is fully loaded and displayed. Note that if the displayed HTML document has 
+       several frames, one such event will be generated per frame.
+    @event{EVT_WEB_VIEW_ERRROR(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation
+       error occurs.
+       The integer associated with this event will be a wxWebNavigationError item.
+       The string associated with this event may contain a backend-specific more
+       precise error message/code.
+    @event{EVT_WEB_VIEW_NEWWINDOW(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_NEWWINDOW event, generated when a new
+       window is created. You must handle this event if you want anything to 
+       happen, for example to load the page in a new window or tab.
+    @endEventTable
+   
+    @library{wxweb}
+    @category{ctrl,web}
+ */
+class wxWebView : public wxControl
+{
+public:
+
+    /**
+        Creation function for two-step creation.
+    */
+    virtual bool Create(wxWindow* parent,
+                        wxWindowID id,
+                        const wxString& url,
+                        const wxPoint& pos,
+                        const wxSize& size,
+                        long style,
+                        const wxString& name) = 0;
+
+    /**
+        Factory function to create a new wxWebView for two-step creation
+        (you need to call wxWebView::Create on the returned object)
+        @param backend which web engine to use as backend for wxWebView
+        @return the created wxWebView, or NULL if the requested backend is
+                not available
+     */
+    static wxWebView* New(wxWebViewBackend backend = wxWEB_VIEW_BACKEND_DEFAULT);
+
+    /**
+        Factory function to create a new wxWebView
+        @param parent parent window to create this view in
+        @param id ID of this control
+        @param url URL to load by default in the web view
+        @param pos position to create this control at
+               (you may use wxDefaultPosition if you use sizers)
+        @param size size to create this control with
+               (you may use wxDefaultSize if you use sizers)
+        @param backend which web engine to use as backend for wxWebView
+        @return the created wxWebView, or NULL if the requested backend
+                is not available
+    */
+    static wxWebView* New(wxWindow* parent,
+           wxWindowID id,
+           const wxString& url = wxWebViewDefaultURLStr,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           wxWebViewBackend backend = wxWEB_VIEW_BACKEND_DEFAULT,
+           long style = 0,
+           const wxString& name = wxWebViewNameStr);
+
+    /**
+        Get the title of the current web page, or its URL/path if title is not
+        available.
+    */
+    virtual wxString GetCurrentTitle() = 0;
+
+   /**
+        Get the URL of the currently displayed document.
+    */
+    virtual wxString GetCurrentURL() = 0;
+
+    /**
+        Get the HTML source code of the currently displayed document.
+        @return The HTML source code, or an empty string if no page is currently
+                shown.
+    */
+    virtual wxString GetPageSource() = 0;
+    
+    /**
+        Get the text of the current page.
+    */
+    virtual wxString GetPageText() = 0;
+    
+    /**
+        Returns whether the web control is currently busy (e.g. loading a page).
+    */
+    virtual bool IsBusy() = 0;
+
+    /**
+        Returns whether the web control is currently editable
+    */
+    virtual bool IsEditable() = 0;
+
+    /**
+        Load a web page from a URL
+        @param url The URL of the page to be loaded.
+        @note Web engines generally report errors asynchronously, so if you wish
+            to know whether loading the URL was successful, register to receive
+            navigation error events.
+    */
+    virtual void LoadUrl(const wxString& url) = 0;
+
+    /**
+        Opens a print dialog so that the user may print the currently
+        displayed page.
+    */
+    virtual void Print() = 0;
+
+    /**
+        Reload the currently displayed URL.
+        @param flags A bit array that may optionally contain reload options.
+    */
+    virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT) = 0;
+    
+    /**
+        Runs the given javascript code. 
+    */
+    virtual void RunScript(const wxString& javascript) = 0;
+    
+    /**
+        Set the editable property of the web control. Enabling allows the user
+        to edit the page even if the @c contenteditable attribute is not set.
+        The exact capabilities vary with the backend being used.
+    */
+    virtual void SetEditable(bool enable = true) = 0;
+
+    /**
+        Set the displayed page source to the contents of the given string.
+        @param html    The string that contains the HTML data to display.
+        @param baseUrl URL assigned to the HTML data, to be used to resolve
+                    relative paths, for instance.
+    */
+    virtual void SetPage(const wxString& html, const wxString& baseUrl) = 0;
+
+    /**
+        Set the displayed page source to the contents of the given stream.
+        @param html    The stream to read HTML data from.
+        @param baseUrl URL assigned to the HTML data, to be used to resolve
+                    relative paths, for instance.
+    */
+    virtual void SetPage(wxInputStream& html, wxString baseUrl);
+
+    /**
+        Stop the current page loading process, if any.
+        May trigger an error event of type @c wxWEB_NAV_ERR_USER_CANCELLED.
+        TODO: make @c wxWEB_NAV_ERR_USER_CANCELLED errors uniform across ports.
+    */
+    virtual void Stop() = 0;
+
+    /**
+        @name Clipboard
+    */
+
+    /**
+        Returns @true if the current selection can be copied.
+    */
+    virtual bool CanCopy() = 0;
+
+    /**
+        Returns @true if the current selection can be cut.
+    */
+    virtual bool CanCut() = 0;
+
+    /**
+        Returns @true if data can be pasted.
+    */
+    virtual bool CanPaste() = 0;
+
+    /**
+        Copies the current selection. 
+    */
+    virtual void Copy() = 0;
+
+    /**
+        Cuts the current selection.
+    */
+    virtual void Cut() = 0;
+
+    /**
+        Pastes the current data.
+    */
+    virtual void Paste() = 0;
+
+    /**
+        @name History
+    */
+
+    /** 
+        Returns @true if it is possible to navigate backward in the history of
+        visited pages.
+    */
+    virtual bool CanGoBack() = 0;
+
+    /** 
+        Returns @true if it is possible to navigate forward in the history of
+        visited pages.
+    */
+    virtual bool CanGoForward() = 0;
+
+    /**
+        Clear the history, this will also remove the visible page.
+    */
+    virtual void ClearHistory() = 0;
+
+    /**
+        Enable or disable the history. This will also clear the history.
+    */
+    virtual void EnableHistory(bool enable = true) = 0;
+
+    /**
+        Returns a list of items in the back history. The first item in the
+        vector is the first page that was loaded by the control.
+    */
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetBackwardHistory() = 0;
+
+    /**
+        Returns a list of items in the forward history. The first item in the 
+        vector is the next item in the history with respect to the curently 
+        loaded page.
+    */
+    virtual wxVector<wxSharedPtr<wxWebHistoryItem> > GetForwardHistory() = 0;
+
+    /** 
+        Navigate back in the history of visited pages.
+        Only valid if CanGoBack() returns true.
+    */
+    virtual void GoBack() = 0;
+
+    /**
+        Navigate forward in the history of visited pages.
+        Only valid if CanGoForward() returns true.
+    */
+    virtual void GoForward() = 0;
+
+    /**
+        Loads a history item. 
+    */
+    virtual void LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item) = 0;
+    
+    /**
+        @name Selection
+    */
+    
+    /**
+        Clears the current selection. 
+    */
+    virtual void ClearSelection() = 0;
+    
+    /**
+        Deletes the current selection. Note that for @c wxWEB_VIEW_BACKEND_WEBKIT
+        the selection must be editable, either through SetEditable or the 
+        correct HTML attribute.
+    */
+    virtual void DeleteSelection() = 0;
+    
+    /**
+        Returns the currently selected source, if any.
+    */
+    virtual wxString GetSelectedSource() = 0;
+    
+    /**
+        Returns the currently selected text, if any.
+    */
+    virtual wxString GetSelectedText() = 0;
+
+    /**
+        Returns @true if there is a current selection.
+    */
+    virtual bool HasSelection() = 0;
+
+    /**
+        Selects the entire page.
+    */
+    virtual void SelectAll() = 0;
+
+    /**
+        @name Undo / Redo
+    */
+
+    /**
+        Returns @true if there is an action to redo.
+    */
+    virtual bool CanRedo() = 0;
+
+    /**
+        Returns @true if there is an action to undo.
+    */
+    virtual bool CanUndo() = 0;
+
+    /**
+        Redos the last action.
+    */
+    virtual void Redo() = 0;
+
+    /**
+        Undos the last action.
+    */
+    virtual void Undo() = 0;
+
+    /**
+        @name Zoom
+    */
+
+    /**
+        Retrieve whether the current HTML engine supports a zoom type.
+        @param type The zoom type to test.
+        @return Whether this type of zoom is supported by this HTML engine
+                (and thus can be set through SetZoomType()).
+    */
+    virtual bool CanSetZoomType(wxWebViewZoomType type) const = 0;
+
+    /**
+        Get the zoom factor of the page.
+        @return The current level of zoom.
+    */
+    virtual wxWebViewZoom GetZoom() = 0;
+
+    /**
+        Get how the zoom factor is currently interpreted.
+        @return How the zoom factor is currently interpreted by the HTML engine.
+    */
+    virtual wxWebViewZoomType GetZoomType() const = 0;
+
+    /**
+        Set the zoom factor of the page.
+        @param zoom How much to zoom (scale) the HTML document.
+    */
+    virtual void SetZoom(wxWebViewZoom zoom) = 0;
+
+    /**
+        Set how to interpret the zoom factor.
+        @param zoomType How the zoom factor should be interpreted by the
+                        HTML engine.
+        @note invoke    CanSetZoomType() first, some HTML renderers may not
+                        support all zoom types.
+    */
+    virtual void SetZoomType(wxWebViewZoomType zoomType) = 0;
+};
+
+
+
+
+/**
+    @class wxWebNavigationEvent
+
+    A navigation  event holds information about events associated with 
+    wxWebView objects.
+
+    @beginEventEmissionTable{wxWebNavigationEvent}
+    @event{EVT_WEB_VIEW_NAVIGATING(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATING event, generated before trying
+       to get a resource. This event may be vetoed to prevent navigating to this
+       resource. Note that if the displayed HTML document has several frames, one
+       such event will be generated per frame.
+    @event{EVT_WEB_VIEW_NAVIGATED(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_NAVIGATED event generated after it was
+       confirmed that a resource would be requested. This event may not be vetoed.
+       Note that if the displayed HTML document has several frames, one such event
+       will be generated per frame.
+    @event{EVT_WEB_VIEW_LOADED(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_LOADED event generated when the document
+       is fully loaded and displayed. Note that if the displayed HTML document has 
+       several frames, one such event will be generated per frame.
+    @event{EVT_WEB_VIEW_ERRROR(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_ERROR event generated when a navigation
+       error occurs.
+       The integer associated with this event will be a wxWebNavigationError item.
+       The string associated with this event may contain a backend-specific more
+       precise error message/code.
+    @event{EVT_WEB_VIEW_NEWWINDOW(id, func)}
+       Process a @c wxEVT_COMMAND_WEB_VIEW_NEWWINDOW event, generated when a new
+       window is created. You must handle this event if you want anything to 
+       happen, for example to load the page in a new window or tab.
+    @endEventTable
+
+    @library{wxweb}
+    @category{events,web}
+
+    @see wxWebView
+*/
+class wxWebNavigationEvent : public wxCommandEvent
+{
+public:
+    wxWebNavigationEvent();
+    wxWebNavigationEvent(wxEventType type, int id, const wxString href,
+                         const wxString target, bool canVeto);
+
+    /**
+        Get the name of the target frame which the url of this event
+        has been or will be loaded into. This may return an emptry string
+        if the frame is not avaliable.
+    */
+    const wxString& GetTarget() const;
+
+    /**
+        Get the URL being visited
+    */
+    const wxString& GetURL() const;
+
+    virtual wxEvent* Clone() const;
+
+    /** 
+        Get whether this event may be vetoed (stopped/prevented). Only
+        meaningful for events fired before navigation takes place.
+     */
+    bool CanVeto() const;
+
+    /** 
+        Whether this event was vetoed (stopped/prevented). Only meaningful for
+        events fired before navigation takes place or new window events.
+     */
+    bool IsVetoed() const;
+
+    /** 
+        Veto (prevent/stop) this event. Only meaningful for events fired
+        before navigation takes place. Only valid if CanVeto() returned true.
+     */
+    void Veto();
+};
\ No newline at end of file
index 6f54ffb989b0be4825bee99468f06aef855f391f..a6261966ac84128300ebe8445c544979fd15fe6e 100644 (file)
@@ -1,6 +1,6 @@
 msgid ""
 msgstr ""
-"Project-Id-Version: $Id: it.po 53333 2008-04-24 07:58:37Z VS $\n"
+"Project-Id-Version: $Id$\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2010-05-31 16:38+0200\n"
 "PO-Revision-Date: 2011-06-16 14:21+0100\n"
index 5073244c206199e7055ea096ee415b5c6e0ded59..88e97bdef82caa8db48cf193cc297498ecf7ed8e 100644 (file)
@@ -87,6 +87,7 @@
     <subproject id="uiaction" template="sub"/>
     <subproject id="validate" template="sub"/>
     <subproject id="vscroll" template="sub"/>
+    <subproject id="web" template="sub"/>
     <subproject id="widgets" template="sub"/>
     <subproject id="wizard" template="sub"/>
     <subproject id="wrapsizer" template="sub"/>
diff --git a/samples/web/makefile.vc b/samples/web/makefile.vc
new file mode 100644 (file)
index 0000000..760886f
--- /dev/null
@@ -0,0 +1,364 @@
+# =========================================================================
+#     This makefile was generated by
+#     Bakefile 0.2.9 (http://www.bakefile.org)
+#     Do not modify, all changes will be overwritten!
+# =========================================================================
+
+!include <../../build/msw/config.vc>
+
+# -------------------------------------------------------------------------
+# Do not modify the rest of this file!
+# -------------------------------------------------------------------------
+
+### Variables: ###
+
+WX_RELEASE_NODOT = 29
+COMPILER_PREFIX = vc
+OBJS = \
+       $(COMPILER_PREFIX)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)$(DIR_SUFFIX_CPU)
+LIBDIRNAME = \
+       .\..\..\lib\$(COMPILER_PREFIX)$(DIR_SUFFIX_CPU)_$(LIBTYPE_SUFFIX)$(CFG)
+SETUPHDIR = \
+       $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
+WEB_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
+       $(__DEBUGINFO_0) /Fd$(OBJS)\web.pdb $(____DEBUGRUNTIME_3_p) \
+       $(__OPTIMIZEFLAG_6) $(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) \
+       $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
+       $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
+       $(__MSLU_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include \
+       $(____CAIRO_INCLUDEDIR_FILENAMES_p) /W4 /I. $(__DLLFLAG_p) /D_WINDOWS \
+       /I.\..\..\samples /DNOPCH $(__RTTIFLAG_11) $(__EXCEPTIONSFLAG_12) \
+       $(CPPFLAGS) $(CXXFLAGS)
+WEB_OBJECTS =  \
+       $(OBJS)\web_web.obj
+WEB_RESOURCES =  \
+       $(OBJS)\web_sample.res
+
+### Conditionally set variables: ###
+
+!if "$(USE_GUI)" == "0"
+PORTNAME = base
+!endif
+!if "$(USE_GUI)" == "1"
+PORTNAME = msw
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+WXDEBUGFLAG = d
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "1"
+WXDEBUGFLAG = d
+!endif
+!if "$(UNICODE)" == "1"
+WXUNICODEFLAG = u
+!endif
+!if "$(WXUNIV)" == "1"
+WXUNIVNAME = univ
+!endif
+!if "$(TARGET_CPU)" == "AMD64"
+DIR_SUFFIX_CPU = _amd64
+!endif
+!if "$(TARGET_CPU)" == "IA64"
+DIR_SUFFIX_CPU = _ia64
+!endif
+!if "$(TARGET_CPU)" == "amd64"
+DIR_SUFFIX_CPU = _amd64
+!endif
+!if "$(TARGET_CPU)" == "ia64"
+DIR_SUFFIX_CPU = _ia64
+!endif
+!if "$(SHARED)" == "1"
+WXDLLFLAG = dll
+!endif
+!if "$(SHARED)" == "0"
+LIBTYPE_SUFFIX = lib
+!endif
+!if "$(SHARED)" == "1"
+LIBTYPE_SUFFIX = dll
+!endif
+!if "$(TARGET_CPU)" == "AMD64"
+LINK_TARGET_CPU = /MACHINE:X64
+!endif
+!if "$(TARGET_CPU)" == "IA64"
+LINK_TARGET_CPU = /MACHINE:IA64
+!endif
+!if "$(TARGET_CPU)" == "amd64"
+LINK_TARGET_CPU = /MACHINE:X64
+!endif
+!if "$(TARGET_CPU)" == "ia64"
+LINK_TARGET_CPU = /MACHINE:IA64
+!endif
+!if "$(MONOLITHIC)" == "0"
+EXTRALIBS_FOR_BASE = 
+!endif
+!if "$(MONOLITHIC)" == "1"
+EXTRALIBS_FOR_BASE =  
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
+__DEBUGINFO_0 = /Zi
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
+__DEBUGINFO_0 = 
+!endif
+!if "$(DEBUG_INFO)" == "0"
+__DEBUGINFO_0 = 
+!endif
+!if "$(DEBUG_INFO)" == "1"
+__DEBUGINFO_0 = /Zi
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
+__DEBUGINFO_1 = /DEBUG
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
+__DEBUGINFO_1 = 
+!endif
+!if "$(DEBUG_INFO)" == "0"
+__DEBUGINFO_1 = 
+!endif
+!if "$(DEBUG_INFO)" == "1"
+__DEBUGINFO_1 = /DEBUG
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
+__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
+__DEBUGINFO_2 = 
+!endif
+!if "$(DEBUG_INFO)" == "0"
+__DEBUGINFO_2 = 
+!endif
+!if "$(DEBUG_INFO)" == "1"
+__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+____DEBUGRUNTIME_3_p = /D_DEBUG
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+____DEBUGRUNTIME_3_p = 
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "0"
+____DEBUGRUNTIME_3_p = 
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "1"
+____DEBUGRUNTIME_3_p = /D_DEBUG
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+____DEBUGRUNTIME_3_p_1 = /d _DEBUG
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+____DEBUGRUNTIME_3_p_1 = 
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "0"
+____DEBUGRUNTIME_3_p_1 = 
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "1"
+____DEBUGRUNTIME_3_p_1 = /d _DEBUG
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+__DEBUGRUNTIME_4 = d
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+__DEBUGRUNTIME_4 = 
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "0"
+__DEBUGRUNTIME_4 = 
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "1"
+__DEBUGRUNTIME_4 = d
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+__DEBUGRUNTIME_5 = 
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+__DEBUGRUNTIME_5 = /opt:ref /opt:icf
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "0"
+__DEBUGRUNTIME_5 = /opt:ref /opt:icf
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "1"
+__DEBUGRUNTIME_5 = 
+!endif
+!if "$(BUILD)" == "debug"
+__OPTIMIZEFLAG_6 = /Od
+!endif
+!if "$(BUILD)" == "release"
+__OPTIMIZEFLAG_6 = /O2
+!endif
+!if "$(USE_THREADS)" == "0"
+__THREADSFLAG_9 = L
+!endif
+!if "$(USE_THREADS)" == "1"
+__THREADSFLAG_9 = T
+!endif
+!if "$(RUNTIME_LIBS)" == "dynamic"
+__RUNTIME_LIBS_10 = D
+!endif
+!if "$(RUNTIME_LIBS)" == "static"
+__RUNTIME_LIBS_10 = $(__THREADSFLAG_9)
+!endif
+!if "$(USE_RTTI)" == "0"
+__RTTIFLAG_11 = 
+!endif
+!if "$(USE_RTTI)" == "1"
+__RTTIFLAG_11 = /GR
+!endif
+!if "$(USE_EXCEPTIONS)" == "0"
+__EXCEPTIONSFLAG_12 = 
+!endif
+!if "$(USE_EXCEPTIONS)" == "1"
+__EXCEPTIONSFLAG_12 = /EHsc
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
+__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
+__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
+!endif
+!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
+__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
+__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
+!endif
+!if "$(WXUNIV)" == "1"
+__WXUNIV_DEFINE_p = /D__WXUNIVERSAL__
+!endif
+!if "$(WXUNIV)" == "1"
+__WXUNIV_DEFINE_p_1 = /d __WXUNIVERSAL__
+!endif
+!if "$(DEBUG_FLAG)" == "0"
+__DEBUG_DEFINE_p = /DwxDEBUG_LEVEL=0
+!endif
+!if "$(DEBUG_FLAG)" == "0"
+__DEBUG_DEFINE_p_1 = /d wxDEBUG_LEVEL=0
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+__NDEBUG_DEFINE_p = /DNDEBUG
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "0"
+__NDEBUG_DEFINE_p = /DNDEBUG
+!endif
+!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
+__NDEBUG_DEFINE_p_1 = /d NDEBUG
+!endif
+!if "$(DEBUG_RUNTIME_LIBS)" == "0"
+__NDEBUG_DEFINE_p_1 = /d NDEBUG
+!endif
+!if "$(USE_EXCEPTIONS)" == "0"
+__EXCEPTIONS_DEFINE_p = /DwxNO_EXCEPTIONS
+!endif
+!if "$(USE_EXCEPTIONS)" == "0"
+__EXCEPTIONS_DEFINE_p_1 = /d wxNO_EXCEPTIONS
+!endif
+!if "$(USE_RTTI)" == "0"
+__RTTI_DEFINE_p = /DwxNO_RTTI
+!endif
+!if "$(USE_RTTI)" == "0"
+__RTTI_DEFINE_p_1 = /d wxNO_RTTI
+!endif
+!if "$(USE_THREADS)" == "0"
+__THREAD_DEFINE_p = /DwxNO_THREADS
+!endif
+!if "$(USE_THREADS)" == "0"
+__THREAD_DEFINE_p_1 = /d wxNO_THREADS
+!endif
+!if "$(UNICODE)" == "0"
+__UNICODE_DEFINE_p = /DwxUSE_UNICODE=0
+!endif
+!if "$(UNICODE)" == "1"
+__UNICODE_DEFINE_p = /D_UNICODE
+!endif
+!if "$(UNICODE)" == "0"
+__UNICODE_DEFINE_p_1 = /d wxUSE_UNICODE=0
+!endif
+!if "$(UNICODE)" == "1"
+__UNICODE_DEFINE_p_1 = /d _UNICODE
+!endif
+!if "$(MSLU)" == "1"
+__MSLU_DEFINE_p = /DwxUSE_UNICODE_MSLU=1
+!endif
+!if "$(MSLU)" == "1"
+__MSLU_DEFINE_p_1 = /d wxUSE_UNICODE_MSLU=1
+!endif
+!if "$(USE_CAIRO)" == "1"
+____CAIRO_INCLUDEDIR_FILENAMES_p = /I$(CAIRO_ROOT)\include\cairo
+!endif
+!if "$(USE_CAIRO)" == "1"
+____CAIRO_INCLUDEDIR_FILENAMES_1_p = /i $(CAIRO_ROOT)\include\cairo
+!endif
+!if "$(SHARED)" == "1"
+__DLLFLAG_p = /DWXUSINGDLL
+!endif
+!if "$(SHARED)" == "1"
+__DLLFLAG_p_1 = /d WXUSINGDLL
+!endif
+!if "$(MONOLITHIC)" == "0"
+__WXLIB_WEB_p = \
+       wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_web.lib
+!endif
+!if "$(MONOLITHIC)" == "0"
+__WXLIB_STC_p = \
+       wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc.lib
+!endif
+!if "$(MONOLITHIC)" == "0"
+__WXLIB_ADV_p = \
+       wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv.lib
+!endif
+!if "$(MONOLITHIC)" == "0"
+__WXLIB_CORE_p = \
+       wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
+!endif
+!if "$(MONOLITHIC)" == "0"
+__WXLIB_BASE_p = \
+       wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
+!endif
+!if "$(MONOLITHIC)" == "1"
+__WXLIB_MONO_p = \
+       wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
+!endif
+!if "$(USE_GUI)" == "1"
+__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib
+!endif
+!if "$(USE_GUI)" == "1"
+__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib
+!endif
+!if "$(USE_GUI)" == "1"
+__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib
+!endif
+!if "$(MSLU)" == "1"
+__UNICOWS_LIB_p = unicows.lib
+!endif
+!if "$(USE_CAIRO)" == "1"
+__CAIRO_LIB_p = cairo.lib
+!endif
+!if "$(USE_CAIRO)" == "1"
+____CAIRO_LIBDIR_FILENAMES_p = /LIBPATH:$(CAIRO_ROOT)\lib
+!endif
+
+
+all: $(OBJS)
+$(OBJS):
+       -if not exist $(OBJS) mkdir $(OBJS)
+
+### Targets: ###
+
+all: $(OBJS)\web.exe
+
+clean: 
+       -if exist $(OBJS)\*.obj del $(OBJS)\*.obj
+       -if exist $(OBJS)\*.res del $(OBJS)\*.res
+       -if exist $(OBJS)\*.pch del $(OBJS)\*.pch
+       -if exist $(OBJS)\web.exe del $(OBJS)\web.exe
+       -if exist $(OBJS)\web.ilk del $(OBJS)\web.ilk
+       -if exist $(OBJS)\web.pdb del $(OBJS)\web.pdb
+
+$(OBJS)\web.exe: $(WEB_OBJECTS) $(OBJS)\web_sample.res
+       link /NOLOGO /OUT:$@  $(__DEBUGINFO_1) /pdb:"$(OBJS)\web.pdb" $(__DEBUGINFO_2)  $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
+       $(WEB_OBJECTS) $(WEB_RESOURCES)  $(__WXLIB_WEB_p)  $(__WXLIB_STC_p)  $(__WXLIB_ADV_p)  $(__WXLIB_CORE_p)  $(__WXLIB_BASE_p)  wxscintilla$(WXDEBUGFLAG).lib $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p)  wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib
+<<
+
+$(OBJS)\web_web.obj: .\web.cpp
+       $(CXX) /c /nologo /TP /Fo$@ $(WEB_CXXFLAGS) .\web.cpp
+
+$(OBJS)\web_sample.res: .\..\sample.rc
+       rc /fo$@  /d WIN32 $(____DEBUGRUNTIME_3_p_1) $(__NO_VC_CRTDBG_p_1)  /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\samples /d NOPCH .\..\sample.rc
+
diff --git a/samples/web/refresh.xpm b/samples/web/refresh.xpm
new file mode 100644 (file)
index 0000000..9f584e0
--- /dev/null
@@ -0,0 +1,234 @@
+/* XPM */\r
+static char * refresh_xpm[] = {\r
+"24 24 207 2",\r
+"      c None",\r
+".     c #3162A2",\r
+"+     c #507BB3",\r
+"@     c #6A90C0",\r
+"#     c #7296C4",\r
+"$     c #7397C4",\r
+"%     c #7094C2",\r
+"&     c #648BBD",\r
+"*     c #507CB3",\r
+"=     c #3061A2",\r
+"-     c #8EACD1",\r
+";     c #B3CBE4",\r
+">     c #B7CEE6",\r
+",     c #B8CEE6",\r
+"'     c #B5CDE5",\r
+")     c #B4CBE5",\r
+"!     c #B0C9E3",\r
+"~     c #AEC6E1",\r
+"{     c #9FBBDB",\r
+"]     c #648DBE",\r
+"^     c #2F60A2",\r
+"/     c #3262A4",\r
+"(     c #3364A3",\r
+"_     c #3C6BA8",\r
+":     c #A7C0DD",\r
+"<     c #C1D6EA",\r
+"[     c #BAD0E7",\r
+"}     c #B6CDE5",\r
+"|     c #B6CCE6",\r
+"1     c #B5CDE6",\r
+"2     c #B3CBE5",\r
+"3     c #AFC8E3",\r
+"4     c #AAC5E2",\r
+"5     c #ABC6E2",\r
+"6     c #A0BCDB",\r
+"7     c #4975AF",\r
+"8     c #3666A5",\r
+"9     c #89ACD3",\r
+"0     c #2C5EA0",\r
+"a     c #82A3CB",\r
+"b     c #B5CCE4",\r
+"c     c #7095C3",\r
+"d     c #658CBC",\r
+"e     c #678EBE",\r
+"f     c #7196C2",\r
+"g     c #84A4CC",\r
+"h     c #A9C3E0",\r
+"i     c #B8CFE7",\r
+"j     c #ACC6E3",\r
+"k     c #A0BEDE",\r
+"l     c #9CBCDD",\r
+"m     c #9EBDDE",\r
+"n     c #6C93C1",\r
+"o     c #7B9FCA",\r
+"p     c #ABC7E3",\r
+"q     c #2B5DA0",\r
+"r     c #4976AE",\r
+"s     c #8EADD0",\r
+"t     c #4975AE",\r
+"u     c #3667A6",\r
+"v     c #3666A6",\r
+"w     c #4170AB",\r
+"x     c #5B83B6",\r
+"y     c #9BB9DA",\r
+"z     c #97B9DC",\r
+"A     c #7EA7D3",\r
+"B     c #7CA5D2",\r
+"C     c #88AED6",\r
+"D     c #8AAFD6",\r
+"E     c #A4C1E0",\r
+"F     c #406DAB",\r
+"G     c #4F7BB2",\r
+"H     c #4A77B3",\r
+"I     c #4C79B4",\r
+"J     c #2E5EA2",\r
+"K     c #6F95C3",\r
+"L     c #95B6D9",\r
+"M     c #7FA8D3",\r
+"N     c #76A1D0",\r
+"O     c #709DCE",\r
+"P     c #2B5DA1",\r
+"Q     c #3667A5",\r
+"R     c #4D7AB4",\r
+"S     c #648DC3",\r
+"T     c #4A78B3",\r
+"U     c #3262A2",\r
+"V     c #2C5FA0",\r
+"W     c #6B91C0",\r
+"X     c #97B8DB",\r
+"Y     c #74A0CF",\r
+"Z     c #709ECE",\r
+"`     c #ACC7E3",\r
+" .    c #2D5EA0",\r
+"..    c #3767A6",\r
+"+.    c #5985BD",\r
+"@.    c #78A3D0",\r
+"#.    c #6C9BCC",\r
+"$.    c #AEC9E5",\r
+"%.    c #3263A3",\r
+"&.    c #3768A7",\r
+"*.    c #9BB8DA",\r
+"=.    c #9CB9DA",\r
+"-.    c #9CBADA",\r
+";.    c #9FBBDC",\r
+">.    c #A8C1DF",\r
+",.    c #2D5FA0",\r
+"'.    c #22569B",\r
+").    c #23579C",\r
+"!.    c #21569A",\r
+"~.    c #21559B",\r
+"{.    c #275A9E",\r
+"].    c #3364A4",\r
+"^.    c #24589C",\r
+"/.    c #24579C",\r
+"(.    c #416FAB",\r
+"_.    c #C0D3E8",\r
+":.    c #B8CCE4",\r
+"<.    c #B5CBE3",\r
+"[.    c #AFC7E1",\r
+"}.    c #B0C8E2",\r
+"|.    c #88A9CF",\r
+"1.    c #4471AC",\r
+"2.    c #B9D1E8",\r
+"3.    c #94B6DA",\r
+"4.    c #95B7DB",\r
+"5.    c #A3C1DF",\r
+"6.    c #A4BEDC",\r
+"7.    c #2D60A0",\r
+"8.    c #BBD1E9",\r
+"9.    c #BCD1E8",\r
+"0.    c #416EA9",\r
+"a.    c #3868A7",\r
+"b.    c #BAD1E9",\r
+"c.    c #96B7DB",\r
+"d.    c #98B9DC",\r
+"e.    c #A2C0DF",\r
+"f.    c #AAC4DF",\r
+"g.    c #5F88BA",\r
+"h.    c #80A8D7",\r
+"i.    c #CDDCEC",\r
+"j.    c #7A9FC8",\r
+"k.    c #4273B1",\r
+"l.    c #3465A4",\r
+"m.    c #4371AC",\r
+"n.    c #B9D1E9",\r
+"o.    c #B4CCE5",\r
+"p.    c #9DBCDD",\r
+"q.    c #8EB2D8",\r
+"r.    c #91B3D9",\r
+"s.    c #719AC8",\r
+"t.    c #4171AC",\r
+"u.    c #3A6AA8",\r
+"v.    c #3A75BD",\r
+"w.    c #9CBBDB",\r
+"x.    c #608BC1",\r
+"y.    c #3A6EAD",\r
+"z.    c #4C80BB",\r
+"A.    c #3365A4",\r
+"B.    c #C6DAED",\r
+"C.    c #6F94C1",\r
+"D.    c #8CABD1",\r
+"E.    c #9BBBDD",\r
+"F.    c #6C9ACD",\r
+"G.    c #6596CA",\r
+"H.    c #709DCF",\r
+"I.    c #7AA4D2",\r
+"J.    c #6A96C8",\r
+"K.    c #5885BB",\r
+"L.    c #4F7EB7",\r
+"M.    c #497AB6",\r
+"N.    c #487AB6",\r
+"O.    c #4275B5",\r
+"P.    c #4C7FBB",\r
+"Q.    c #578BC6",\r
+"R.    c #396CAA",\r
+"S.    c #789CC6",\r
+"T.    c #5681B6",\r
+"U.    c #8AAFD7",\r
+"V.    c #77A2D1",\r
+"W.    c #6496CA",\r
+"X.    c #6294C9",\r
+"Y.    c #6395CA",\r
+"Z.    c #5F92C9",\r
+"`.    c #5C8FC7",\r
+" +    c #598DC6",\r
+".+    c #588DC7",\r
+"++    c #4175B2",\r
+"@+    c #31619F",\r
+"#+    c #6089BB",\r
+"$+    c #77A0CE",\r
+"%+    c #6E9CCD",\r
+"&+    c #6696CA",\r
+"*+    c #6193C9",\r
+"=+    c #5F91C8",\r
+"-+    c #5C90C7",\r
+";+    c #5A8EC6",\r
+">+    c #558AC3",\r
+",+    c #4072AF",\r
+"'+    c #27528A",\r
+")+    c #2A5285",\r
+"!+    c #3C6599",\r
+"~+    c #4B77B0",\r
+"{+    c #4E7DB6",\r
+"]+    c #4C7CB7",\r
+"^+    c #4877B2",\r
+"/+    c #3B69A2",\r
+"(+    c #3361A0",\r
+"                                                ",\r
+"            . + @ # $ % & *                     ",\r
+"          = - ; > , ' ) ! ~ { ] ^       / (     ",\r
+"        _ : < [ } | 1 2 3 4 5 > 6 7   8 9 0     ",\r
+"        a b a c d e f g h i j k l m n o p q     ",\r
+"      r s t u v         w x y z A B C D E q     ",\r
+"      F G H I               J K L M N O 4 P     ",\r
+"      Q R S T U               V W X Y Z `  .    ",\r
+"      ..+.                    t L @.Z #.$.0     ",\r
+"      %.                    &.{ *.=.-.;.>.,.    ",\r
+"        '.).!.~.~.{.].      %.^./.^./.).'.      ",\r
+"      (._.:.<.[.}.|.V                     ].    ",\r
+"      1.2.3.4.5.6.7.                      %.    ",\r
+"      1.8.X l 9.0.                      a.(     ",\r
+"      1.b.c.d.e.f.g.              h.i.j.k.l.    ",\r
+"      m.n.o.p.3.q.r.s.t.u.      v.w.x.y.z.A.    ",\r
+"      m.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.      ",\r
+"      (.S.    T.U.V.W.X.Y.Y.X.Z.`. +.+++        ",\r
+"      ].        @+#+$+%+&+*+=+-+;+>+,+          ",\r
+"                  '+)+!+~+{+]+^+/+(+            ",\r
+"                                                ",\r
+"                                                ",\r
+"                                                ",\r
+"                                                "};\r
diff --git a/samples/web/stop.xpm b/samples/web/stop.xpm
new file mode 100644 (file)
index 0000000..40fb189
--- /dev/null
@@ -0,0 +1,331 @@
+/* XPM */\r
+static char * stop_xpm[] = {\r
+"24 24 304 2",\r
+"      c None",\r
+".     c #920F0F",\r
+"+     c #931212",\r
+"@     c #931111",\r
+"#     c #8F0909",\r
+"$     c #981414",\r
+"%     c #DC6666",\r
+"&     c #F07575",\r
+"*     c #EF7272",\r
+"=     c #EE7171",\r
+"-     c #EE6F6F",\r
+";     c #EE6D6D",\r
+">     c #EE6C6C",\r
+",     c #E46969",\r
+"'     c #980F0F",\r
+")     c #8E0606",\r
+"!     c #EA7B7B",\r
+"~     c #E25858",\r
+"{     c #D84040",\r
+"]     c #D83F3F",\r
+"^     c #D83E3E",\r
+"/     c #D83D3D",\r
+"(     c #D73C3C",\r
+"_     c #D73A3A",\r
+":     c #DD4A4A",\r
+"<     c #EC7272",\r
+"[     c #950909",\r
+"}     c #9A1616",\r
+"|     c #EB7C7C",\r
+"1     c #E15959",\r
+"2     c #D74040",\r
+"3     c #D94444",\r
+"4     c #D94343",\r
+"5     c #D94242",\r
+"6     c #D94141",\r
+"7     c #D93F3F",\r
+"8     c #D73D3D",\r
+"9     c #D73939",\r
+"0     c #DD4747",\r
+"a     c #E96D6D",\r
+"b     c #A21818",\r
+"c     c #9D1717",\r
+"d     c #DC6868",\r
+"e     c #E25959",\r
+"f     c #D94545",\r
+"g     c #D84545",\r
+"h     c #DA4545",\r
+"i     c #D84242",\r
+"j     c #D84141",\r
+"k     c #D63D3D",\r
+"l     c #D73B3B",\r
+"m     c #D63838",\r
+"n     c #DC4747",\r
+"o     c #D95555",\r
+"p     c #9D1414",\r
+"q     c #940909",\r
+"r     c #E15757",\r
+"s     c #DC4848",\r
+"t     c #F64949",\r
+"u     c #D94747",\r
+"v     c #D94646",\r
+"w     c #D73F3F",\r
+"x     c #EA4141",\r
+"y     c #E53D3D",\r
+"z     c #D53A3A",\r
+"A     c #D43838",\r
+"B     c #DB4747",\r
+"C     c #E66161",\r
+"D     c #920606",\r
+"E     c #9D1818",\r
+"F     c #EC7C7C",\r
+"G     c #DF5353",\r
+"H     c #DC4545",\r
+"I     c #F15A5A",\r
+"J     c #EEB2B2",\r
+"K     c #F55757",\r
+"L     c #DB4545",\r
+"M     c #EA4545",\r
+"N     c #F38383",\r
+"O     c #F27979",\r
+"P     c #DC3D3D",\r
+"Q     c #D33838",\r
+"R     c #D13535",\r
+"S     c #D84343",\r
+"T     c #E35C5C",\r
+"U     c #980E0E",\r
+"V     c #BD4949",\r
+"W     c #E25656",\r
+"X     c #D74343",\r
+"Y     c #F44F4F",\r
+"Z     c #EBBFBF",\r
+"`     c #E4EBEB",\r
+" .    c #EBC7C7",\r
+"..    c #F15D5D",\r
+"+.    c #DB4141",\r
+"@.    c #EA4747",\r
+"#.    c #F09C9C",\r
+"$.    c #E4EFEF",\r
+"%.    c #E5DDDD",\r
+"&.    c #FC5858",\r
+"*.    c #D53939",\r
+"=.    c #D13737",\r
+"-.    c #CE3333",\r
+";.    c #B93434",\r
+">.    c #DC4949",\r
+",.    c #E34545",\r
+"'.    c #F48F8F",\r
+").    c #E7E6E6",\r
+"!.    c #E8E9E9",\r
+"~.    c #EDCBCB",\r
+"{.    c #F45A5A",\r
+"].    c #EA4C4C",\r
+"^.    c #F2A3A3",\r
+"/.    c #E9E9E9",\r
+"(.    c #E7E9E9",\r
+"_.    c #F0B0B0",\r
+":.    c #E74848",\r
+"<.    c #CF3636",\r
+"[.    c #CE3535",\r
+"}.    c #D23A3A",\r
+"|.    c #BC4949",\r
+"1.    c #DD4848",\r
+"2.    c #E74444",\r
+"3.    c #F29E9E",\r
+"4.    c #EAE9E9",\r
+"5.    c #EBF0F0",\r
+"6.    c #F0CECE",\r
+"7.    c #F79191",\r
+"8.    c #EAF4F4",\r
+"9.    c #EBECEC",\r
+"0.    c #EFC4C4",\r
+"a.    c #EA4B4B",\r
+"b.    c #D13939",\r
+"c.    c #CF3737",\r
+"d.    c #CD3434",\r
+"e.    c #D13A3A",\r
+"f.    c #B83333",\r
+"g.    c #D73E3E",\r
+"h.    c #E74646",\r
+"i.    c #F59E9E",\r
+"j.    c #EFE8E8",\r
+"k.    c #EEF1F1",\r
+"l.    c #EEF5F5",\r
+"m.    c #F3BABA",\r
+"n.    c #EA5050",\r
+"o.    c #D23B3B",\r
+"p.    c #D03A3A",\r
+"q.    c #CF3939",\r
+"r.    c #CC3535",\r
+"s.    c #CA3131",\r
+"t.    c #B83232",\r
+"u.    c #BD4848",\r
+"v.    c #D83A3A",\r
+"w.    c #F05D5D",\r
+"x.    c #F5BEBE",\r
+"y.    c #F1F2F2",\r
+"z.    c #F2E6E6",\r
+"A.    c #FE7A7A",\r
+"B.    c #CF3434",\r
+"C.    c #C92121",\r
+"D.    c #C61212",\r
+"E.    c #C10707",\r
+"F.    c #C00505",\r
+"G.    c #BE0404",\r
+"H.    c #C30C0C",\r
+"I.    c #B72222",\r
+"J.    c #BC4848",\r
+"K.    c #DC4343",\r
+"L.    c #D73838",\r
+"M.    c #E95A5A",\r
+"N.    c #F8ADAD",\r
+"O.    c #F2F9F9",\r
+"P.    c #F3F3F3",\r
+"Q.    c #F4F2F2",\r
+"R.    c #F3F7F7",\r
+"S.    c #F2D5D5",\r
+"T.    c #F05050",\r
+"U.    c #C30000",\r
+"V.    c #BF0000",\r
+"W.    c #BE0000",\r
+"X.    c #BD0000",\r
+"Y.    c #BB0000",\r
+"Z.    c #C00707",\r
+"`.    c #B71F1F",\r
+" +    c #BC4646",\r
+".+    c #DC4141",\r
+"++    c #D63636",\r
+"@+    c #D63737",\r
+"#+    c #EA5C5C",\r
+"$+    c #F6B9B9",\r
+"%+    c #F4FAFA",\r
+"&+    c #F9C5C5",\r
+"*+    c #FCACAC",\r
+"=+    c #F4F0F0",\r
+"-+    c #F1F6F6",\r
+";+    c #EB5F5F",\r
+">+    c #C00101",\r
+",+    c #B90000",\r
+"'+    c #BF0707",\r
+")+    c #B61D1D",\r
+"!+    c #BC4545",\r
+"~+    c #DA3E3E",\r
+"{+    c #D73535",\r
+"]+    c #D63434",\r
+"^+    c #EA6363",\r
+"/+    c #F5BFBF",\r
+"(+    c #F1F1F1",\r
+"_+    c #F5F6F6",\r
+":+    c #FAC9C9",\r
+"<+    c #DF3C3C",\r
+"[+    c #D21B1B",\r
+"}+    c #FBADAD",\r
+"|+    c #F5F4F4",\r
+"1+    c #F2F2F2",\r
+"2+    c #F1D7D7",\r
+"3+    c #F07373",\r
+"4+    c #B80000",\r
+"5+    c #BD0707",\r
+"6+    c #B61C1C",\r
+"7+    c #B53B3B",\r
+"8+    c #E75D5D",\r
+"9+    c #D63333",\r
+"0+    c #D53333",\r
+"a+    c #D42F2F",\r
+"b+    c #F58686",\r
+"c+    c #F3D4D4",\r
+"d+    c #F2F3F3",\r
+"e+    c #F6D3D3",\r
+"f+    c #E44343",\r
+"g+    c #C40000",\r
+"h+    c #C20000",\r
+"i+    c #D82C2C",\r
+"j+    c #F7B7B7",\r
+"k+    c #F0E9E9",\r
+"l+    c #FA8F8F",\r
+"m+    c #BE0A0A",\r
+"n+    c #B70000",\r
+"o+    c #B60000",\r
+"p+    c #C20C0C",\r
+"q+    c #B41919",\r
+"r+    c #8B0101",\r
+"s+    c #C44848",\r
+"t+    c #EC5F5F",\r
+"u+    c #D52A2A",\r
+"v+    c #D22424",\r
+"w+    c #CE1C1C",\r
+"x+    c #E96969",\r
+"y+    c #FBC4C4",\r
+"z+    c #E44949",\r
+"A+    c #C40101",\r
+"B+    c #C10000",\r
+"C+    c #D53131",\r
+"D+    c #FBBEBE",\r
+"E+    c #F09292",\r
+"F+    c #C00E0E",\r
+"G+    c #B50000",\r
+"H+    c #C71212",\r
+"I+    c #980707",\r
+"J+    c #890101",\r
+"K+    c #B52828",\r
+"L+    c #E63D3D",\r
+"M+    c #C90202",\r
+"N+    c #C70000",\r
+"O+    c #C80505",\r
+"P+    c #D32424",\r
+"Q+    c #C61B1B",\r
+"R+    c #C11111",\r
+"S+    c #C81313",\r
+"T+    c #8C0101",\r
+"U+    c #880000",\r
+"V+    c #BE2E2E",\r
+"W+    c #DC2D2D",\r
+"X+    c #C50000",\r
+"Y+    c #BC0000",\r
+"Z+    c #C30D0D",\r
+"`+    c #CE2424",\r
+" @    c #850000",\r
+".@    c #BE2B2B",\r
+"+@    c #E33434",\r
+"@@    c #C00000",\r
+"#@    c #CC1616",\r
+"$@    c #CB2222",\r
+"%@    c #910404",\r
+"&@    c #790000",\r
+"*@    c #B21D1D",\r
+"=@    c #E03131",\r
+"-@    c #B40000",\r
+";@    c #CD1818",\r
+">@    c #C61F1F",\r
+",@    c #830000",\r
+"'@    c #730000",\r
+")@    c #B92525",\r
+"!@    c #E14444",\r
+"~@    c #E04141",\r
+"{@    c #DF3F3F",\r
+"]@    c #DE3C3C",\r
+"^@    c #DE3A3A",\r
+"/@    c #DE3737",\r
+"(@    c #DD3535",\r
+"_@    c #DD3232",\r
+":@    c #C42121",\r
+"<@    c #7E0000",\r
+"[@    c #720000",\r
+"}@    c #770000",\r
+"              . + + + + + + @ @ #               ",\r
+"            $ % & * * * = - ; > , '             ",\r
+"          ) ! ~ { { { ] ^ / ( _ : < [           ",\r
+"        } | 1 2 3 3 4 5 6 7 ^ 8 9 0 a b         ",\r
+"      c d e 6 f g f h 4 i j 7 k l m n o p       ",\r
+"    q | r 4 f s t u v h i 6 w x y z A B C D     ",\r
+"  E F G w 4 H I J K L f i j M N O P Q R S T U   ",\r
+"  V W / 6 X Y Z `  ...+.j @.#.$.%.&.*.=.-.f ;.  ",\r
+"  V >.7 { i ,.'.).!.~.{.].^./.(._.:.=.<.[.}.;.  ",\r
+"  |.1.^ ] 7 { 2.3.4.5.6.7.8.9.0.a.b.c.[.d.e.f.  ",\r
+"  |.0 ( 8 ^ ] g.h.i.j.k.l.k.m.n.o.p.q.r.s.<.t.  ",\r
+"  u.H v.l ( / / *.w.x.y.y.z.A.B.C.D.E.F.G.H.I.  ",\r
+"  J.K.L.9 _ _ _ M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`.  ",\r
+"   +.+++@+L.@+#+$+O.%+&+*+=+-+S.;+>+X.Y.,+'+)+  ",\r
+"  !+~+{+{+]+^+/+(+_+:+<+[+}+|+1+2+3+Y.,+4+5+6+  ",\r
+"  7+8+9+0+a+b+c+d+e+f+g+h+i+j+P.k+l+m+n+o+p+q+  ",\r
+"  r+s+t+u+v+w+x+y+z+A+h+B+X.C+D+E+F+n+G+H+v+I+  ",\r
+"    J+K+L+M+N+O+P+A+h+B+V.X.Y.Q+R+4+o+S+v+T+    ",\r
+"      U+V+W+N+X+U.h+B+V.X.Y+Y.,+4+o+Z+`+T+      ",\r
+"         @.@+@A+h+@@W.X.Y+Y.,+4+G+#@$@%@        ",\r
+"          &@*@=@V.Y+Y.,+4+o+G+-@;@>@,@          ",\r
+"            '@)@!@~@{@]@^@/@(@_@:@<@            ",\r
+"              [@&@&@&@&@&@&@&@&@}@              ",\r
+"                                                "};\r
diff --git a/samples/web/web.bkl b/samples/web/web.bkl
new file mode 100644 (file)
index 0000000..285b059
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" ?>\r
+<!-- $Id: widgets.bkl 59311 2009-03-04 11:47:32Z FM $ -->\r
+<makefile>\r
+\r
+    <include file="../../build/bakefiles/common_samples.bkl"/>\r
+\r
+    <exe id="web" template="wx_sample" template_append="wx_append">\r
+        <sources>\r
+            web.cpp\r
+        </sources>\r
+        <headers></headers>\r
+        <wx-lib>web</wx-lib>\r
+        <wx-lib>stc</wx-lib>       \r
+        <wx-lib>adv</wx-lib>\r
+        <wx-lib>core</wx-lib>\r
+        <wx-lib>base</wx-lib>\r
+        <win32-res>../sample.rc</win32-res>\r
+               \r
+               <if cond="OUT_OF_TREE_MAKEFILES=='0'">\r
+            <sys-lib>$(LIB_SCINTILLA)</sys-lib>\r
+        </if>\r
+    </exe>\r
+\r
+</makefile>\r
diff --git a/samples/web/web.cpp b/samples/web/web.cpp
new file mode 100644 (file)
index 0000000..b65cc81
--- /dev/null
@@ -0,0 +1,679 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        web.cpp
+// Purpose:     wxWebView sample
+// Author:      Marianne Gagnon
+// Id:          $Id$
+// Copyright:   (c) 2010 Marianne Gagnon, Steven Lamerton
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+#include <wx/artprov.h>
+#include <wx/notifmsg.h>
+#include <wx/settings.h>
+#include <wx/webview.h>
+#include <wx/infobar.h>
+
+#if !defined(__WXMSW__) && !defined(__WXPM__)
+    #include "../sample.xpm"
+#endif
+
+#if wxUSE_STC
+#include <wx/stc/stc.h> 
+#else
+#error "wxStyledTextControl is needed by this sample"
+#endif
+
+#include "stop.xpm"
+#include "refresh.xpm"
+#include "wxlogo.xpm"
+
+class WebApp : public wxApp
+{
+public:
+    virtual bool OnInit();
+};
+
+class WebFrame : public wxFrame
+{
+public:
+    WebFrame();
+
+    void OnAnimationTimer(wxTimerEvent& evt);
+    void UpdateState();
+    void OnUrl(wxCommandEvent& evt);
+    void OnBack(wxCommandEvent& evt);
+    void OnForward(wxCommandEvent& evt);
+    void OnStop(wxCommandEvent& evt);
+    void OnReload(wxCommandEvent& evt);
+    void OnClearHistory(wxCommandEvent& evt);
+    void OnEnableHistory(wxCommandEvent& evt);
+    void OnNavigationRequest(wxWebNavigationEvent& evt);
+    void OnNavigationComplete(wxWebNavigationEvent& evt);
+    void OnDocumentLoaded(wxWebNavigationEvent& evt);
+    void OnNewWindow(wxWebNavigationEvent& evt);
+    void OnViewSourceRequest(wxCommandEvent& evt);
+    void OnToolsClicked(wxCommandEvent& evt);
+    void OnSetZoom(wxCommandEvent& evt);
+    void OnError(wxWebNavigationEvent& evt);
+    void OnPrint(wxCommandEvent& evt);
+    void OnCut(wxCommandEvent& evt);
+    void OnCopy(wxCommandEvent& evt);
+    void OnPaste(wxCommandEvent& evt);
+    void OnUndo(wxCommandEvent& evt);
+    void OnRedo(wxCommandEvent& evt);
+    void OnMode(wxCommandEvent& evt);
+    void OnZoomLayout(wxCommandEvent& evt);
+
+private:
+    wxTextCtrl* m_url;
+    wxWebView* m_browser;
+
+    wxToolBar* m_toolbar;
+    wxToolBarToolBase* m_toolbar_back;
+    wxToolBarToolBase* m_toolbar_forward;
+    wxToolBarToolBase* m_toolbar_stop;
+    wxToolBarToolBase* m_toolbar_reload;
+    wxToolBarToolBase* m_toolbar_tools;
+
+    wxMenu* m_tools_menu;
+    wxMenuItem* m_tools_layout;
+    wxMenuItem* m_tools_tiny;
+    wxMenuItem* m_tools_small;
+    wxMenuItem* m_tools_medium;
+    wxMenuItem* m_tools_large;
+    wxMenuItem* m_tools_largest;
+    wxMenuItem* m_tools_handle_navigation;
+    wxMenuItem* m_tools_handle_new_window;
+    wxMenuItem* m_tools_enable_history;
+    wxMenuItem* m_edit_cut;
+    wxMenuItem* m_edit_copy;
+    wxMenuItem* m_edit_paste;
+    wxMenuItem* m_edit_undo;
+    wxMenuItem* m_edit_redo;
+    wxMenuItem* m_edit_mode;
+
+    wxTimer* m_timer;
+    int m_animation_angle;
+
+    wxInfoBar *m_info;
+    wxStaticText* m_info_text;
+};
+
+class SourceViewDialog : public wxDialog
+{
+public:
+    SourceViewDialog(wxWindow* parent, wxString source);
+};
+
+IMPLEMENT_APP(WebApp)
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+bool WebApp::OnInit()
+{
+    if ( !wxApp::OnInit() )
+        return false;
+
+    WebFrame *frame = new WebFrame();
+    frame->Show();
+
+    return true;
+}
+
+WebFrame::WebFrame() : wxFrame(NULL, wxID_ANY, "wxWebView Sample")
+{
+    // set the frame icon
+    SetIcon(wxICON(sample));
+    SetTitle("wxWebView Sample");
+
+    m_timer = NULL;
+    m_animation_angle = 0;
+
+
+    wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
+
+    // Create the toolbar
+    m_toolbar = CreateToolBar(wxTB_TEXT);
+    m_toolbar->SetToolBitmapSize(wxSize(32, 32));
+    wxBitmap back = wxArtProvider::GetBitmap(wxART_GO_BACK , wxART_TOOLBAR);
+    wxBitmap forward = wxArtProvider::GetBitmap(wxART_GO_FORWARD , wxART_TOOLBAR);
+    #ifdef __WXGTK__
+        wxBitmap stop = wxArtProvider::GetBitmap("gtk-stop", wxART_TOOLBAR);
+    #else 
+        wxBitmap stop = wxBitmap(stop_xpm);
+    #endif
+    #ifdef __WXGTK__
+        wxBitmap refresh = wxArtProvider::GetBitmap("gtk-refresh", wxART_TOOLBAR);
+    #else 
+        wxBitmap refresh = wxBitmap(refresh_xpm);
+    #endif
+
+    m_toolbar_back = m_toolbar->AddTool(wxID_ANY, _("Back"), back);
+    m_toolbar_forward = m_toolbar->AddTool(wxID_ANY, _("Forward"), forward);
+    m_toolbar_stop = m_toolbar->AddTool(wxID_ANY, _("Stop"), stop);
+    m_toolbar_reload = m_toolbar->AddTool(wxID_ANY, _("Reload"),  refresh);
+    m_url = new wxTextCtrl(m_toolbar, wxID_ANY, wxT(""),  wxDefaultPosition, wxSize(400, -1), wxTE_PROCESS_ENTER );
+    m_toolbar->AddControl(m_url, _("URL"));
+    m_toolbar_tools = m_toolbar->AddTool(wxID_ANY, _("Menu"), wxBitmap(wxlogo_xpm));
+
+    m_toolbar->Realize();
+
+    // Create the info panel
+    m_info = new wxInfoBar(this);
+    topsizer->Add(m_info, wxSizerFlags().Expand());
+
+    // Create the webview
+    m_browser = wxWebView::New(this, wxID_ANY, "http://www.wxwidgets.org");
+    topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
+
+    SetSizer(topsizer);
+
+    //Set a more sensible size for web browsing
+    SetSize(wxSize(800, 600));
+
+    // Create a log window
+    new wxLogWindow(this, _("Logging"));
+
+    // Create the Tools menu
+    m_tools_menu = new wxMenu();
+    wxMenuItem* print = m_tools_menu->Append(wxID_ANY , _("Print"));
+    wxMenuItem* viewSource = m_tools_menu->Append(wxID_ANY , _("View Source"));
+    m_tools_menu->AppendSeparator();
+    m_tools_layout = m_tools_menu->AppendCheckItem(wxID_ANY, _("Use Layout Zoom"));
+    m_tools_tiny = m_tools_menu->AppendCheckItem(wxID_ANY, _("Tiny"));
+    m_tools_small = m_tools_menu->AppendCheckItem(wxID_ANY, _("Small"));
+    m_tools_medium = m_tools_menu->AppendCheckItem(wxID_ANY, _("Medium"));
+    m_tools_large = m_tools_menu->AppendCheckItem(wxID_ANY, _("Large"));
+    m_tools_largest = m_tools_menu->AppendCheckItem(wxID_ANY, _("Largest"));
+    m_tools_menu->AppendSeparator();
+    m_tools_handle_navigation = m_tools_menu->AppendCheckItem(wxID_ANY, _("Handle Navigation"));
+    m_tools_handle_new_window = m_tools_menu->AppendCheckItem(wxID_ANY, _("Handle New Windows"));
+    m_tools_menu->AppendSeparator();
+    wxMenuItem* clearhist =  m_tools_menu->Append(wxID_ANY, _("Clear History"));
+    m_tools_enable_history = m_tools_menu->AppendCheckItem(wxID_ANY, _("Enable History"));
+
+    //Create an editing menu
+    wxMenu* editmenu = new wxMenu();
+    m_edit_cut = editmenu->Append(wxID_ANY, _("Cut"));
+    m_edit_copy = editmenu->Append(wxID_ANY, _("Copy"));
+    m_edit_paste = editmenu->Append(wxID_ANY, _("Paste"));
+    editmenu->AppendSeparator();
+    m_edit_undo = editmenu->Append(wxID_ANY, _("Undo"));
+    m_edit_redo = editmenu->Append(wxID_ANY, _("Redo"));
+    editmenu->AppendSeparator();
+    m_edit_mode = editmenu->AppendCheckItem(wxID_ANY, _("Edit Mode"));
+
+    m_tools_menu->AppendSeparator();
+    m_tools_menu->AppendSubMenu(editmenu, "Edit");
+
+    //By default we want to handle navigation and new windows
+    m_tools_handle_navigation->Check();
+    m_tools_handle_new_window->Check();
+    m_tools_enable_history->Check();
+    if(!m_browser->CanSetZoomType(wxWEB_VIEW_ZOOM_TYPE_LAYOUT))
+        m_tools_layout->Enable(false);
+
+
+    // Connect the toolbar events
+    Connect(m_toolbar_back->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
+            wxCommandEventHandler(WebFrame::OnBack), NULL, this );
+    Connect(m_toolbar_forward->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
+            wxCommandEventHandler(WebFrame::OnForward), NULL, this );
+    Connect(m_toolbar_stop->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
+            wxCommandEventHandler(WebFrame::OnStop), NULL, this );
+    Connect(m_toolbar_reload->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
+            wxCommandEventHandler(WebFrame::OnReload),NULL, this );
+    Connect(m_toolbar_tools->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
+            wxCommandEventHandler(WebFrame::OnToolsClicked), NULL, this );
+
+    Connect(m_url->GetId(), wxEVT_COMMAND_TEXT_ENTER, 
+            wxCommandEventHandler(WebFrame::OnUrl), NULL, this );
+
+    // Connect the webview events
+    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
+            wxWebNavigationEventHandler(WebFrame::OnNavigationRequest), NULL, this);
+    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
+            wxWebNavigationEventHandler(WebFrame::OnNavigationComplete), NULL, this);
+    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_LOADED,
+            wxWebNavigationEventHandler(WebFrame::OnDocumentLoaded), NULL, this);     
+    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_ERROR,
+            wxWebNavigationEventHandler(WebFrame::OnError), NULL, this);
+    Connect(m_browser->GetId(), wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
+            wxWebNavigationEventHandler(WebFrame::OnNewWindow), NULL, this);
+
+    // Connect the menu events
+    Connect(viewSource->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+           wxCommandEventHandler(WebFrame::OnViewSourceRequest),  NULL, this );
+    Connect(print->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnPrint),  NULL, this );
+    Connect(m_tools_layout->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnZoomLayout),  NULL, this );
+    Connect(m_tools_tiny->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
+    Connect(m_tools_small->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
+    Connect(m_tools_medium->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
+    Connect(m_tools_large->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
+    Connect(m_tools_largest->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
+    Connect(clearhist->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnClearHistory),  NULL, this );
+    Connect(m_tools_enable_history->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnEnableHistory),  NULL, this );
+    Connect(m_edit_cut->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnCut),  NULL, this );
+    Connect(m_edit_copy->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnCopy),  NULL, this );
+    Connect(m_edit_paste->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnPaste),  NULL, this );
+    Connect(m_edit_undo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnUndo),  NULL, this );
+    Connect(m_edit_redo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnRedo),  NULL, this );
+    Connect(m_edit_mode->GetId(), wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(WebFrame::OnMode),  NULL, this );
+}
+
+void WebFrame::OnAnimationTimer(wxTimerEvent& evt)
+{
+    m_animation_angle += 15;
+    if (m_animation_angle > 360) m_animation_angle -= 360;
+    
+    wxBitmap image(24, 24);    
+    {
+        wxMemoryDC dc;
+        dc.SelectObject(image);
+        dc.SetBackground(wxBrush(wxColour(255,0,255)));
+        dc.Clear();
+        
+        if (m_animation_angle >= 0 && m_animation_angle <= 180)
+        {
+            dc.SetBrush(*wxYELLOW_BRUSH);
+            dc.SetPen(*wxYELLOW_PEN);
+            dc.DrawCircle(16 - int(sin(m_animation_angle*0.01745f /* convert to radians */)*14.0f),
+            16 + int(cos(m_animation_angle*0.01745f /* convert to radians */)*14.0f), 3 );
+        }
+        
+        dc.DrawBitmap(wxBitmap(wxlogo_xpm), 0, 0, true);
+        
+        if (m_animation_angle > 180)
+        {
+            dc.SetBrush(*wxYELLOW_BRUSH);
+            dc.SetPen(*wxYELLOW_PEN);
+            dc.DrawCircle(16 - int(sin(m_animation_angle*0.01745f /* convert to radians */)*14.0f),
+            16 + int(cos(m_animation_angle*0.01745f /* convert to radians */)*14.0f), 3 );
+        }
+    }  
+    image.SetMask(new wxMask(image, wxColour(255,0,255)));
+    m_toolbar->SetToolNormalBitmap(m_toolbar_tools->GetId(), image);
+}
+
+/**
+  * Method that retrieves the current state from the web control and updates the GUI
+  * the reflect this current state.
+  */
+void WebFrame::UpdateState()
+{
+    m_toolbar->EnableTool( m_toolbar_back->GetId(), m_browser->CanGoBack() );
+    m_toolbar->EnableTool( m_toolbar_forward->GetId(), m_browser->CanGoForward() );
+    
+    if (m_browser->IsBusy())
+    {
+        if (m_timer == NULL)
+        {
+            m_timer = new wxTimer(this);
+            this->Connect(wxEVT_TIMER, wxTimerEventHandler(WebFrame::OnAnimationTimer), NULL, this);
+        }
+        m_timer->Start(100); // start animation timer
+        
+        m_toolbar->EnableTool( m_toolbar_stop->GetId(), true );    
+    }
+    else
+    {
+        if (m_timer != NULL) m_timer->Stop(); // stop animation timer
+        m_toolbar->SetToolNormalBitmap(m_toolbar_tools->GetId(), wxBitmap(wxlogo_xpm));
+        m_toolbar->EnableTool( m_toolbar_stop->GetId(), false );            
+    }
+    
+    SetTitle( m_browser->GetCurrentTitle() );
+    m_url->SetValue( m_browser->GetCurrentURL() );
+}
+
+/**
+  * Callback invoked when user entered an URL and pressed enter
+  */
+void WebFrame::OnUrl(wxCommandEvent& evt)
+{
+    m_browser->LoadUrl( m_url->GetValue() );
+    UpdateState();
+}
+
+/**
+    * Callback invoked when user pressed the "back" button
+    */
+void WebFrame::OnBack(wxCommandEvent& evt)
+{
+    m_browser->GoBack();
+    UpdateState();
+}
+
+/**
+  * Callback invoked when user pressed the "forward" button
+  */
+void WebFrame::OnForward(wxCommandEvent& evt)
+{
+    m_browser->GoForward();
+    UpdateState();
+}
+
+/**
+  * Callback invoked when user pressed the "stop" button
+  */
+void WebFrame::OnStop(wxCommandEvent& evt)
+{
+    m_browser->Stop();
+    UpdateState();
+}
+
+/**
+  * Callback invoked when user pressed the "reload" button
+  */
+void WebFrame::OnReload(wxCommandEvent& evt)
+{
+    m_browser->Reload();
+    UpdateState();
+}
+
+void WebFrame::OnClearHistory(wxCommandEvent& evt)
+{
+    m_browser->ClearHistory();
+    UpdateState();
+}
+
+void WebFrame::OnEnableHistory(wxCommandEvent& evt)
+{
+    m_browser->EnableHistory(m_tools_enable_history->IsChecked());
+    UpdateState();
+}
+
+void WebFrame::OnCut(wxCommandEvent& evt)
+{
+    m_browser->Cut();
+}
+
+void WebFrame::OnCopy(wxCommandEvent& evt)
+{
+    m_browser->Copy();
+}
+
+void WebFrame::OnPaste(wxCommandEvent& evt)
+{
+    m_browser->Paste();
+}
+
+void WebFrame::OnUndo(wxCommandEvent& evt)
+{
+    m_browser->Undo();
+}
+
+void WebFrame::OnRedo(wxCommandEvent& evt)
+{
+    m_browser->Redo();
+}
+
+void WebFrame::OnMode(wxCommandEvent& evt)
+{
+    m_browser->SetEditable(m_edit_mode->IsChecked());
+}
+
+
+/**
+  * Callback invoked when there is a request to load a new page (for instance
+  * when the user clicks a link)
+  */
+void WebFrame::OnNavigationRequest(wxWebNavigationEvent& evt)
+{
+    wxLogMessage("%s", "Navigation request to '" + evt.GetURL() + "' (target='" +
+    evt.GetTarget() + "')");
+    
+    wxASSERT(m_browser->IsBusy());
+
+    //If we don't want to handle navigation then veto the event and navigation
+    //will not take place
+    if(!m_tools_handle_navigation->IsChecked())
+        evt.Veto();
+
+    UpdateState();
+}
+
+/**
+  * Callback invoked when a navigation request was accepted
+  */
+void WebFrame::OnNavigationComplete(wxWebNavigationEvent& evt)
+{
+    wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
+    UpdateState();
+}
+
+/**
+  * Callback invoked when a page is finished loading
+  */
+void WebFrame::OnDocumentLoaded(wxWebNavigationEvent& evt)
+{
+    //Only notify if the document is the main frame, not a subframe
+    if(evt.GetURL() == m_browser->GetCurrentURL())
+        wxLogMessage("%s", "Document loaded; url='" + evt.GetURL() + "'");
+    UpdateState();
+}
+
+/**
+  * On new window, we veto to stop extra windows appearing
+  */
+void WebFrame::OnNewWindow(wxWebNavigationEvent& evt)
+{
+    wxLogMessage("%s", "New window; url='" + evt.GetURL() + "'");
+
+    //If we handle new window events then just load them in this window as we 
+    //are a single window browser
+    if(m_tools_handle_new_window->IsChecked())
+        m_browser->LoadUrl(evt.GetURL());
+
+    UpdateState();
+}
+
+/**
+  * Invoked when user selects the "View Source" menu item
+  */
+void WebFrame::OnViewSourceRequest(wxCommandEvent& evt)
+{
+    SourceViewDialog dlg(this, m_browser->GetPageSource());
+    dlg.ShowModal();
+}
+
+/**
+  * Invoked when user selects the "Menu" item
+  */
+void WebFrame::OnToolsClicked(wxCommandEvent& evt)
+{
+    if(m_browser->GetCurrentURL() == "")
+        return;
+
+    m_tools_tiny->Check(false);
+    m_tools_small->Check(false); 
+    m_tools_medium->Check(false);
+    m_tools_large->Check(false);
+    m_tools_largest->Check(false);
+
+    wxWebViewZoom zoom = m_browser->GetZoom();
+    switch (zoom)
+    {
+    case wxWEB_VIEW_ZOOM_TINY:
+        m_tools_tiny->Check();
+        break;
+    case wxWEB_VIEW_ZOOM_SMALL:
+        m_tools_small->Check();
+        break;
+    case wxWEB_VIEW_ZOOM_MEDIUM:
+        m_tools_medium->Check();
+        break;
+    case wxWEB_VIEW_ZOOM_LARGE:
+        m_tools_large->Check();
+        break;
+    case wxWEB_VIEW_ZOOM_LARGEST:
+        m_tools_largest->Check();
+        break;
+    }
+
+    m_edit_cut->Enable(m_browser->CanCut());
+    m_edit_copy->Enable(m_browser->CanCopy());
+    m_edit_paste->Enable(m_browser->CanPaste());
+
+    m_edit_undo->Enable(m_browser->CanUndo());
+    m_edit_redo->Enable(m_browser->CanRedo());
+    
+    wxPoint position = ScreenToClient( wxGetMousePosition() );
+    PopupMenu(m_tools_menu, position.x, position.y);
+}
+
+/**
+  * Invoked when user selects the zoom size in the menu
+  */
+void WebFrame::OnSetZoom(wxCommandEvent& evt)
+{
+    if (evt.GetId() == m_tools_tiny->GetId())
+    {
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_TINY);
+    }
+    else if (evt.GetId() == m_tools_small->GetId())
+    {
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_SMALL);
+    }
+    else if (evt.GetId() == m_tools_medium->GetId())
+    {
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_MEDIUM);
+    }
+    else if (evt.GetId() == m_tools_large->GetId())
+    {
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_LARGE);
+    }
+    else if (evt.GetId() == m_tools_largest->GetId())
+    {
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_LARGEST);
+    }
+    else
+    {
+        wxFAIL;
+    }
+}
+
+void WebFrame::OnZoomLayout(wxCommandEvent& evt)
+{
+    if(m_tools_layout->IsChecked())
+        m_browser->SetZoomType(wxWEB_VIEW_ZOOM_TYPE_LAYOUT);
+    else
+        m_browser->SetZoomType(wxWEB_VIEW_ZOOM_TYPE_TEXT);
+}
+
+/**
+  * Callback invoked when a loading error occurs
+  */
+void WebFrame::OnError(wxWebNavigationEvent& evt)
+{
+    wxString errorCategory;
+    switch (evt.GetInt())
+    {
+    case  wxWEB_NAV_ERR_CONNECTION:
+        errorCategory = "wxWEB_NAV_ERR_CONNECTION";
+        break;
+        
+    case wxWEB_NAV_ERR_CERTIFICATE:
+        errorCategory = "wxWEB_NAV_ERR_CERTIFICATE";
+        break;
+        
+    case wxWEB_NAV_ERR_AUTH:
+        errorCategory = "wxWEB_NAV_ERR_AUTH";
+        break;
+        
+    case wxWEB_NAV_ERR_SECURITY:
+        errorCategory = "wxWEB_NAV_ERR_SECURITY";
+        break;
+        
+    case wxWEB_NAV_ERR_NOT_FOUND:
+        errorCategory = "wxWEB_NAV_ERR_NOT_FOUND";
+        break;
+        
+    case wxWEB_NAV_ERR_REQUEST:
+        errorCategory = "wxWEB_NAV_ERR_REQUEST";
+        break;
+        
+    case wxWEB_NAV_ERR_USER_CANCELLED:
+        errorCategory = "wxWEB_NAV_ERR_USER_CANCELLED";
+        break;
+        
+    case wxWEB_NAV_ERR_OTHER:
+        errorCategory = "wxWEB_NAV_ERR_OTHER";
+        break;
+    }
+    
+    wxLogMessage("Error; url='" + evt.GetURL() + "', error='" + errorCategory + "' (" + evt.GetString() + ")");
+    
+    //Show the info bar with an error
+    m_info->ShowMessage(_("An error occurred loading ") + evt.GetURL() + "\n" +
+    "'" + errorCategory + "' (" + evt.GetString() + ")", wxICON_ERROR);
+    
+    UpdateState();
+}
+
+/**
+  * Invoked when user selects "Print" from the menu
+  */
+void WebFrame::OnPrint(wxCommandEvent& evt)
+{
+    m_browser->Print();
+}
+
+SourceViewDialog::SourceViewDialog(wxWindow* parent, wxString source) :
+                  wxDialog(parent, wxID_ANY, "Source Code",
+                           wxDefaultPosition, wxSize(700,500),
+                           wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
+{
+    wxStyledTextCtrl* text = new wxStyledTextCtrl(this, wxID_ANY);
+    text->SetMarginWidth(1, 30);
+    text->SetMarginType(1, wxSTC_MARGIN_NUMBER); 
+    text->SetText(source);
+
+    text->StyleClearAll();
+    text->SetLexer(wxSTC_LEX_HTML);
+    text->StyleSetForeground(wxSTC_H_DOUBLESTRING, wxColour(255,0,0));
+    text->StyleSetForeground(wxSTC_H_SINGLESTRING, wxColour(255,0,0));
+    text->StyleSetForeground(wxSTC_H_ENTITY, wxColour(255,0,0));
+    text->StyleSetForeground(wxSTC_H_TAG, wxColour(0,150,0));
+    text->StyleSetForeground(wxSTC_H_TAGUNKNOWN, wxColour(0,150,0));
+    text->StyleSetForeground(wxSTC_H_ATTRIBUTE, wxColour(0,0,150));
+    text->StyleSetForeground(wxSTC_H_ATTRIBUTEUNKNOWN, wxColour(0,0,150));
+    text->StyleSetForeground(wxSTC_H_COMMENT, wxColour(150,150,150));
+
+    wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
+    sizer->Add(text, 1, wxEXPAND);
+    SetSizer(sizer);
+}
diff --git a/samples/web/wxlogo.xpm b/samples/web/wxlogo.xpm
new file mode 100644 (file)
index 0000000..6dba640
--- /dev/null
@@ -0,0 +1,84 @@
+/* XPM */\r
+static char * wxlogo_xpm[] = {\r
+"24 24 57 1",\r
+"      c None",\r
+".     c #000006",\r
+"+     c #00003F",\r
+"@     c #00003C",\r
+"#     c #000034",\r
+"$     c #000000",\r
+"%     c #00000E",\r
+"&     c #000085",\r
+"*     c #000079",\r
+"=     c #000081",\r
+"-     c #000070",\r
+";     c #00000D",\r
+">     c #8686CB",\r
+",     c #FFFFFF",\r
+"'     c #000078",\r
+")     c #000080",\r
+"!     c #00006F",\r
+"~     c #7F7FC7",\r
+"{     c #00007F",\r
+"]     c #000083",\r
+"^     c #000088",\r
+"/     c #000076",\r
+"(     c #000047",\r
+"_     c #000040",\r
+":     c #EDED00",\r
+"<     c #FFFF00",\r
+"[     c #202000",\r
+"}     c #0E0000",\r
+"|     c #7F0000",\r
+"1     c #770000",\r
+"2     c #7E0000",\r
+"3     c #E0E000",\r
+"4     c #FFFF88",\r
+"5     c #FFFF3F",\r
+"6     c #1E1E00",\r
+"7     c #1F0000",\r
+"8     c #FF0000",\r
+"9     c #FFFF80",\r
+"0     c #1E0000",\r
+"a     c #FF8686",\r
+"b     c #00000F",\r
+"c     c #000082",\r
+"d     c #FFFF7F",\r
+"e     c #FF7F7F",\r
+"f     c #000007",\r
+"g     c #000044",\r
+"h     c #00003E",\r
+"i     c #00001F",\r
+"j     c #DE0000",\r
+"k     c #E00000",\r
+"l     c #C30000",\r
+"m     c #DEDE00",\r
+"n     c #DD0000",\r
+"o     c #DDDD00",\r
+"p     c #EAEA00",\r
+"q     c #780000",\r
+"r     c #680000",\r
+"                        ",\r
+"                        ",\r
+"                        ",\r
+"                        ",\r
+"      .+@@@@@@@#$       ",\r
+"      %&*======-$       ",\r
+"      ;>,')))))!$       ",\r
+"      ;~,')){]^/        ",\r
+"      ;~,'))=(%;$$$$$$$$",\r
+"      ;~,'))=_:<<<<<<<<[",\r
+"}|1112;~,'))=_345<<<<<<6",\r
+"788888;>,'))=_3,9<<<<<<6",\r
+"0a,888b&*===c_3,d<<<<<<6",\r
+"0e,888fg__h@@i3,d<<<<<<6",\r
+"0e,888jkkl$  $m,d<<<<<<6",\r
+"0e,888888n$  $o,9<<<<<<6",\r
+"0e,888888n$  $o45<<<<<<6",\r
+"0a,888888n$  $p<<<<<<<<[",\r
+"788888888k$   $$$$$$$$$$",\r
+"}|qqqqqqqr$             ",\r
+"                        ",\r
+"                        ",\r
+"                        ",\r
+"                        "};\r
diff --git a/src/common/webview.cpp b/src/common/webview.cpp
new file mode 100644 (file)
index 0000000..8c69bb9
--- /dev/null
@@ -0,0 +1,113 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        webview.cpp
+// Purpose:     Common interface and events for web view component
+// Author:      Marianne Gagnon
+// Id:          $Id$
+// Copyright:   (c) 2010 Marianne Gagnon
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if wxUSE_WEB
+
+#if defined(__BORLANDC__)
+    #pragma hdrstop
+#endif
+
+#include "wx/webview.h"
+
+#include "wx/osx/webview_webkit.h"
+#include "wx/gtk/webview_webkit.h"
+#include "wx/msw/webview_ie.h"
+
+// DLL options compatibility check:
+#include "wx/app.h"
+WX_CHECK_BUILD_OPTIONS("wxWEB")
+
+extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewNameStr[] = "wxWebView";
+extern WXDLLIMPEXP_DATA_WEB(const char) wxWebViewDefaultURLStr[] = "about:blank";
+
+IMPLEMENT_DYNAMIC_CLASS(wxWebNavigationEvent, wxCommandEvent)
+
+wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATING, wxWebNavigationEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NAVIGATED, wxWebNavigationEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_LOADED, wxWebNavigationEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_ERROR, wxWebNavigationEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_WEB_VIEW_NEWWINDOW, wxWebNavigationEvent );
+
+// static
+wxWebView* wxWebView::New(wxWebViewBackend backend)
+{
+    switch (backend)
+    {
+        #if defined(wxUSE_WEBVIEW_WEBKIT) && \
+           (defined(__WXGTK__) || defined(__WXOSX__))
+        case wxWEB_VIEW_BACKEND_WEBKIT:
+            return new wxWebViewWebKit();
+        #endif
+
+        #if wxUSE_WEBVIEW_IE
+        case wxWEB_VIEW_BACKEND_IE:
+            return new wxWebViewIE();
+        #endif
+
+        case wxWEB_VIEW_BACKEND_DEFAULT:
+
+            #if defined(wxUSE_WEBVIEW_WEBKIT) && \
+               (defined(__WXGTK__) || defined(__WXOSX__))
+            return new wxWebViewWebKit();
+            #endif
+
+            #if wxUSE_WEBVIEW_IE
+            return new wxWebViewIE();
+            #endif
+
+        // fall-through intended
+        default:
+            return NULL;
+    }
+}
+
+// static
+wxWebView* wxWebView::New(wxWindow* parent,
+       wxWindowID id,
+       const wxString& url,
+       const wxPoint& pos,
+       const wxSize& size,
+       wxWebViewBackend backend,
+       long style,
+       const wxString& name)
+{
+    switch (backend)
+    {
+        #if defined(wxUSE_WEBVIEW_WEBKIT) && \
+           (defined(__WXGTK__) || defined(__WXOSX__))
+        case wxWEB_VIEW_BACKEND_WEBKIT:
+            return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
+        #endif
+
+        #if wxUSE_WEBVIEW_IE
+        case wxWEB_VIEW_BACKEND_IE:
+            return new wxWebViewIE(parent, id, url, pos, size, style, name);
+        #endif
+
+        case wxWEB_VIEW_BACKEND_DEFAULT:
+
+            #if defined(wxUSE_WEBVIEW_WEBKIT) && \
+               (defined(__WXGTK__) || defined(__WXOSX__))
+            return new wxWebViewWebKit(parent, id, url, pos, size, style, name);
+            #endif
+
+            #if wxUSE_WEBVIEW_IE
+            return new wxWebViewIE(parent, id, url, pos, size, style, name);
+            #endif
+
+        // fall-through intended
+        default:
+            return NULL;
+    }
+}
+
+#endif // wxUSE_WEB
diff --git a/src/gtk/webview_webkit.cpp b/src/gtk/webview_webkit.cpp
new file mode 100644 (file)
index 0000000..36b3eac
--- /dev/null
@@ -0,0 +1,813 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/gtk/webview_webkit.cpp
+// Purpose:     GTK WebKit backend for web view component
+// Author:      Marianne Gagnon, Robert Roebling
+// Id:          $Id$
+// Copyright:   (c) 2010 Marianne Gagnon, 1998 Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if wxUSE_WEBVIEW_WEBKIT
+
+#include "wx/stockitem.h"
+#include "wx/gtk/webview_webkit.h"
+#include "wx/gtk/control.h"
+#include "wx/gtk/private.h"
+#include "webkit/webkit.h"
+
+// ----------------------------------------------------------------------------
+// GTK callbacks
+// ----------------------------------------------------------------------------
+
+extern "C"
+{
+
+static void
+wxgtk_webview_webkit_load_status(GtkWidget* widget, 
+                                 GParamSpec*,
+                                 wxWebViewWebKit *webKitCtrl)
+{
+    if (!webKitCtrl->m_ready) return;
+
+    wxString url = webKitCtrl->GetCurrentURL();
+
+    WebKitLoadStatus status;
+    g_object_get(G_OBJECT(widget), "load-status", &status, NULL);
+
+    wxString target; // TODO: get target (if possible)
+
+    if (status == WEBKIT_LOAD_FINISHED)
+    {
+        webKitCtrl->m_busy = false;
+        wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED,
+                                       webKitCtrl->GetId(),
+                                       url, target, false);
+
+        if (webKitCtrl && webKitCtrl->GetEventHandler())
+            webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
+    }
+    else if (status ==  WEBKIT_LOAD_COMMITTED)
+    {
+        webKitCtrl->m_busy = true;
+        wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
+                                       webKitCtrl->GetId(),
+                                       url, target, false);
+
+        if (webKitCtrl && webKitCtrl->GetEventHandler())
+            webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
+    }
+}
+
+static gboolean
+wxgtk_webview_webkit_navigation(WebKitWebView*,
+                                WebKitWebFrame *frame,
+                                WebKitNetworkRequest *request,
+                                WebKitWebNavigationAction*,
+                                WebKitWebPolicyDecision *policy_decision,
+                                wxWebViewWebKit *webKitCtrl)
+{
+    webKitCtrl->m_busy = true;
+
+    const gchar* uri = webkit_network_request_get_uri(request);
+
+    wxString target = webkit_web_frame_get_name (frame);
+    wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
+                                   webKitCtrl->GetId(),
+                                   wxString( uri, wxConvUTF8 ),
+                                   target,
+                                   true);
+
+    if (webKitCtrl && webKitCtrl->GetEventHandler())
+        webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
+
+    if (thisEvent.IsVetoed())
+    {
+        webKitCtrl->m_busy = false;
+        webkit_web_policy_decision_ignore(policy_decision);
+        return TRUE;
+    }
+    else
+    {
+        return FALSE;
+    }
+}
+
+static gboolean
+wxgtk_webview_webkit_error(WebKitWebView*,
+                           WebKitWebFrame*,
+                           gchar *uri,
+                           gpointer web_error,
+                           wxWebViewWebKit* webKitWindow)
+{
+    webKitWindow->m_busy = false;
+    wxWebNavigationError type = wxWEB_NAV_ERR_OTHER;
+
+    GError* error = (GError*)web_error;
+    wxString description(error->message, wxConvUTF8);
+
+    if (strcmp(g_quark_to_string(error->domain), "soup_http_error_quark") == 0)
+    {
+        switch (error->code)
+        {
+            case SOUP_STATUS_CANCELLED:
+                type = wxWEB_NAV_ERR_USER_CANCELLED;
+                break;
+
+            case SOUP_STATUS_CANT_RESOLVE:
+            case SOUP_STATUS_NOT_FOUND:
+                type = wxWEB_NAV_ERR_NOT_FOUND;
+                break;
+
+            case SOUP_STATUS_CANT_RESOLVE_PROXY:
+            case SOUP_STATUS_CANT_CONNECT:
+            case SOUP_STATUS_CANT_CONNECT_PROXY:
+            case SOUP_STATUS_SSL_FAILED:
+            case SOUP_STATUS_IO_ERROR:
+                type = wxWEB_NAV_ERR_CONNECTION;
+                break;
+
+            case SOUP_STATUS_MALFORMED:
+            //case SOUP_STATUS_TOO_MANY_REDIRECTS:
+                type = wxWEB_NAV_ERR_REQUEST;
+                break;
+
+            //case SOUP_STATUS_NO_CONTENT:
+            //case SOUP_STATUS_RESET_CONTENT:
+
+            case SOUP_STATUS_BAD_REQUEST:
+                type = wxWEB_NAV_ERR_REQUEST;
+                break;
+
+            case SOUP_STATUS_UNAUTHORIZED:
+            case SOUP_STATUS_FORBIDDEN:
+                type = wxWEB_NAV_ERR_AUTH;
+                break;
+
+            case SOUP_STATUS_METHOD_NOT_ALLOWED:
+            case SOUP_STATUS_NOT_ACCEPTABLE:
+                type = wxWEB_NAV_ERR_SECURITY;
+                break;
+
+            case SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED:
+                type = wxWEB_NAV_ERR_AUTH;
+                break;
+
+            case SOUP_STATUS_REQUEST_TIMEOUT:
+                type = wxWEB_NAV_ERR_CONNECTION;
+                break;
+
+            //case SOUP_STATUS_PAYMENT_REQUIRED:
+            case SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE:
+            case SOUP_STATUS_REQUEST_URI_TOO_LONG:
+            case SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE:
+                type = wxWEB_NAV_ERR_REQUEST;
+                break;
+
+            case SOUP_STATUS_BAD_GATEWAY:
+            case SOUP_STATUS_SERVICE_UNAVAILABLE:
+            case SOUP_STATUS_GATEWAY_TIMEOUT:
+                type = wxWEB_NAV_ERR_CONNECTION;
+                break;
+
+            case SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED:
+                type = wxWEB_NAV_ERR_REQUEST;
+                break;
+            //case SOUP_STATUS_INSUFFICIENT_STORAGE:
+            //case SOUP_STATUS_NOT_EXTENDED:
+        }
+    }
+    else if (strcmp(g_quark_to_string(error->domain),
+                    "webkit-network-error-quark") == 0)
+    {
+        switch (error->code)
+        {
+            //WEBKIT_NETWORK_ERROR_FAILED:
+            //WEBKIT_NETWORK_ERROR_TRANSPORT:
+
+            case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL:
+                type = wxWEB_NAV_ERR_REQUEST;
+                break;
+
+            case WEBKIT_NETWORK_ERROR_CANCELLED:
+                type = wxWEB_NAV_ERR_USER_CANCELLED;
+                break;
+
+            case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST:
+                type = wxWEB_NAV_ERR_NOT_FOUND;
+                break;
+        }
+    }
+    else if (strcmp(g_quark_to_string(error->domain),
+                    "webkit-policy-error-quark") == 0)
+    {
+        switch (error->code)
+        {
+            //case WEBKIT_POLICY_ERROR_FAILED:
+            //case WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE:
+            //case WEBKIT_POLICY_ERROR_CANNOT_SHOW_URL:
+            //case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
+            case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT:
+                type = wxWEB_NAV_ERR_SECURITY;
+                break;
+        }
+    }
+    /*
+    webkit_plugin_error_quark
+    else
+    {
+        printf("Error domain %s\n", g_quark_to_string(error->domain));
+    }
+    */
+
+    wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
+                                   webKitWindow->GetId(),
+                                   uri,
+                                   wxEmptyString,
+                                   false);
+    thisEvent.SetString(description);
+    thisEvent.SetInt(type);
+
+    if (webKitWindow && webKitWindow->GetEventHandler())
+    {
+        webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
+    }
+
+    return FALSE;
+}
+
+static gboolean
+wxgtk_webview_webkit_new_window(WebKitWebView*,
+                                WebKitWebFrame *frame,
+                                WebKitNetworkRequest *request,
+                                WebKitWebNavigationAction*,
+                                WebKitWebPolicyDecision *policy_decision,
+                                wxWebViewWebKit *webKitCtrl)
+{
+    const gchar* uri = webkit_network_request_get_uri(request);
+
+    wxString target = webkit_web_frame_get_name (frame);
+    wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
+                                   webKitCtrl->GetId(),
+                                   wxString( uri, wxConvUTF8 ),
+                                   target,
+                                   true);
+
+    if (webKitCtrl && webKitCtrl->GetEventHandler())
+        webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
+
+    if (thisEvent.IsVetoed())
+    {
+        webkit_web_policy_decision_ignore(policy_decision);
+    }
+    else
+    {
+        webkit_web_policy_decision_use(policy_decision);
+    }
+    return TRUE;
+}
+
+} // extern "C"
+
+//-----------------------------------------------------------------------------
+// wxWebViewWebKit
+//-----------------------------------------------------------------------------
+
+//IMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxControl)
+
+bool wxWebViewWebKit::Create(wxWindow *parent,
+                      wxWindowID id,
+                      const wxString &url,
+                      const wxPoint& pos,
+                      const wxSize& size,
+                      long style,
+                      const wxString& name)
+{
+    m_ready = false;
+    m_busy = false;
+
+    if (!PreCreation( parent, pos, size ) ||
+        !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+    {
+        wxFAIL_MSG( wxT("wxWebViewWebKit creation failed") );
+        return false;
+    }
+
+    GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+    web_view = webkit_web_view_new ();
+    g_object_ref(web_view); // TODO: check memory management
+
+    m_widget = scrolled_window;
+    g_object_ref(m_widget); // TODO: check memory management
+
+    /* Place the WebKitWebView in the GtkScrolledWindow */
+    gtk_container_add (GTK_CONTAINER (scrolled_window), web_view);
+    gtk_widget_show(m_widget);
+    gtk_widget_show(web_view);
+
+    g_signal_connect_after(web_view, "notify::load-status",
+                           G_CALLBACK(wxgtk_webview_webkit_load_status),
+                           this);
+    g_signal_connect_after(web_view, "navigation-policy-decision-requested",
+                           G_CALLBACK(wxgtk_webview_webkit_navigation),
+                           this);
+    g_signal_connect_after(web_view, "load-error", 
+                           G_CALLBACK(wxgtk_webview_webkit_error),
+                           this);
+
+    g_signal_connect_after(web_view, "new-window-policy-decision-requested",
+                           G_CALLBACK(wxgtk_webview_webkit_new_window), this);
+
+    m_parent->DoAddChild( this );
+
+    PostCreation(size);
+
+    /* Open a webpage */
+    webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), url);
+
+    //Get the initial history limit so we can enable and disable it later
+    WebKitWebBackForwardList* history;
+    history = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(web_view));
+    m_historyLimit = webkit_web_back_forward_list_get_limit(history);
+
+    m_ready = true;
+
+    return true;
+}
+
+bool wxWebViewWebKit::Enable( bool enable )
+{
+    if (!wxControl::Enable(enable))
+        return false;
+
+    gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+
+    //if (enable)
+    //    GTKFixSensitivity();
+
+    return true;
+}
+
+GdkWindow*
+wxWebViewWebKit::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
+{
+    GdkWindow* window = gtk_widget_get_parent_window(m_widget);
+    return window;
+}
+
+void wxWebViewWebKit::ZoomIn()
+{
+    webkit_web_view_zoom_in (WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::ZoomOut()
+{
+    webkit_web_view_zoom_out (WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::SetWebkitZoom(float level)
+{
+    webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(web_view), level);
+}
+
+float wxWebViewWebKit::GetWebkitZoom()
+{
+    return webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Stop()
+{
+     webkit_web_view_stop_loading (WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags)
+{
+    if (flags & wxWEB_VIEW_RELOAD_NO_CACHE)
+    {
+        webkit_web_view_reload_bypass_cache (WEBKIT_WEB_VIEW(web_view));
+    }
+    else
+    {
+        webkit_web_view_reload (WEBKIT_WEB_VIEW(web_view));
+    }
+}
+
+void wxWebViewWebKit::LoadUrl(const wxString& url)
+{
+    webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web_view), wxGTK_CONV(url));
+}
+
+
+void wxWebViewWebKit::GoBack()
+{
+    webkit_web_view_go_back (WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::GoForward()
+{
+    webkit_web_view_go_forward (WEBKIT_WEB_VIEW(web_view));
+}
+
+
+bool wxWebViewWebKit::CanGoBack()
+{
+    return webkit_web_view_can_go_back (WEBKIT_WEB_VIEW(web_view));
+}
+
+
+bool wxWebViewWebKit::CanGoForward()
+{
+    return webkit_web_view_can_go_forward (WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::ClearHistory()
+{
+    WebKitWebBackForwardList* history;
+    history = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(web_view));
+    webkit_web_back_forward_list_clear(history);
+}
+
+void wxWebViewWebKit::EnableHistory(bool enable)
+{
+    WebKitWebBackForwardList* history;
+    history = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(web_view));
+    if(enable)
+    {
+        webkit_web_back_forward_list_set_limit(history, m_historyLimit);
+    }
+    else
+    {
+        webkit_web_back_forward_list_set_limit(history, 0);
+    }
+}
+
+wxVector<wxSharedPtr<wxWebHistoryItem> > wxWebViewWebKit::GetBackwardHistory()
+{
+    wxVector<wxSharedPtr<wxWebHistoryItem> > backhist; 
+    WebKitWebBackForwardList* history;
+    history = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(web_view));
+    GList* list = webkit_web_back_forward_list_get_back_list_with_limit(history, 
+                                                                        m_historyLimit);
+    //We need to iterate in reverse to get the order we desire
+    for(int i = g_list_length(list) - 1; i >= 0 ; i--)
+    {
+        WebKitWebHistoryItem* gtkitem = (WebKitWebHistoryItem*)g_list_nth_data(list, i);
+        wxSharedPtr<wxWebHistoryItem> item(new wxWebHistoryItem(
+                                           webkit_web_history_item_get_uri(gtkitem),
+                                           webkit_web_history_item_get_title(gtkitem)));
+        backhist.push_back(item);
+        m_historyMap[item] = gtkitem;
+    }
+    return backhist;
+}
+
+wxVector<wxSharedPtr<wxWebHistoryItem> > wxWebViewWebKit::GetForwardHistory()
+{
+    wxVector<wxSharedPtr<wxWebHistoryItem> > forwardhist; 
+    WebKitWebBackForwardList* history;
+    history = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(web_view));
+    GList* list = webkit_web_back_forward_list_get_forward_list_with_limit(history, 
+                                                                           m_historyLimit);
+    for(guint i = 0; i < g_list_length(list); i++)
+    {
+        WebKitWebHistoryItem* gtkitem = (WebKitWebHistoryItem*)g_list_nth_data(list, i);
+        wxSharedPtr<wxWebHistoryItem> item(new wxWebHistoryItem(
+                                           webkit_web_history_item_get_uri(gtkitem),
+                                           webkit_web_history_item_get_title(gtkitem)));
+        forwardhist.push_back(item);
+        m_historyMap[item] = gtkitem;
+    }
+    return forwardhist;
+}
+
+void wxWebViewWebKit::LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item)
+{
+    WebKitWebHistoryItem* gtkitem = m_historyMap[item];
+    if(gtkitem)
+    {
+        WebKitWebBackForwardList* history;
+        history = webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(web_view));
+        webkit_web_back_forward_list_go_to_item(history, gtkitem);
+    }
+}
+
+bool wxWebViewWebKit::CanCut()
+{
+    return webkit_web_view_can_cut_clipboard(WEBKIT_WEB_VIEW(web_view));
+}
+
+bool wxWebViewWebKit::CanCopy()
+{
+    return webkit_web_view_can_copy_clipboard(WEBKIT_WEB_VIEW(web_view));
+}
+
+bool wxWebViewWebKit::CanPaste()
+{
+    return webkit_web_view_can_paste_clipboard(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Cut()
+{
+    webkit_web_view_cut_clipboard(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Copy()
+{
+    webkit_web_view_copy_clipboard(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Paste()
+{
+    webkit_web_view_paste_clipboard(WEBKIT_WEB_VIEW(web_view));
+}
+
+bool wxWebViewWebKit::CanUndo()
+{
+    return webkit_web_view_can_undo(WEBKIT_WEB_VIEW(web_view));
+}
+
+bool wxWebViewWebKit::CanRedo()
+{
+    return webkit_web_view_can_redo(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Undo()
+{
+    webkit_web_view_undo(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::Redo()
+{
+    webkit_web_view_redo(WEBKIT_WEB_VIEW(web_view));
+}
+
+wxString wxWebViewWebKit::GetCurrentURL()
+{
+    // FIXME: check which encoding the web kit control uses instead of
+    // assuming UTF8 (here and elsewhere too)
+    return wxString::FromUTF8(webkit_web_view_get_uri(
+                                WEBKIT_WEB_VIEW(web_view)));
+}
+
+
+wxString wxWebViewWebKit::GetCurrentTitle()
+{
+    return wxString::FromUTF8(webkit_web_view_get_title(
+                                WEBKIT_WEB_VIEW(web_view)));
+}
+
+
+wxString wxWebViewWebKit::GetPageSource()
+{
+    WebKitWebFrame* frame = webkit_web_view_get_main_frame(
+        WEBKIT_WEB_VIEW(web_view));
+    WebKitWebDataSource* src = webkit_web_frame_get_data_source (frame);
+
+    // TODO: check encoding with
+    // const gchar*
+    // webkit_web_data_source_get_encoding(WebKitWebDataSource *data_source);
+    return wxString(webkit_web_data_source_get_data (src)->str, wxConvUTF8);
+}
+
+
+wxWebViewZoom wxWebViewWebKit::GetZoom()
+{
+    float zoom = GetWebkitZoom();
+
+    // arbitrary way to map float zoom to our common zoom enum
+    if (zoom <= 0.65)
+    {
+        return wxWEB_VIEW_ZOOM_TINY;
+    }
+    else if (zoom > 0.65 && zoom <= 0.90)
+    {
+        return wxWEB_VIEW_ZOOM_SMALL;
+    }
+    else if (zoom > 0.90 && zoom <= 1.15)
+    {
+        return wxWEB_VIEW_ZOOM_MEDIUM;
+    }
+    else if (zoom > 1.15 && zoom <= 1.45)
+    {
+        return wxWEB_VIEW_ZOOM_LARGE;
+    }
+    else if (zoom > 1.45)
+    {
+        return wxWEB_VIEW_ZOOM_LARGEST;
+    }
+
+    // to shut up compilers, this can never be reached logically
+    wxASSERT(false);
+    return wxWEB_VIEW_ZOOM_MEDIUM;
+}
+
+
+void wxWebViewWebKit::SetZoom(wxWebViewZoom zoom)
+{
+    // arbitrary way to map our common zoom enum to float zoom
+    switch (zoom)
+    {
+        case wxWEB_VIEW_ZOOM_TINY:
+            SetWebkitZoom(0.6f);
+            break;
+
+        case wxWEB_VIEW_ZOOM_SMALL:
+            SetWebkitZoom(0.8f);
+            break;
+
+        case wxWEB_VIEW_ZOOM_MEDIUM:
+            SetWebkitZoom(1.0f);
+            break;
+
+        case wxWEB_VIEW_ZOOM_LARGE:
+            SetWebkitZoom(1.3);
+            break;
+
+        case wxWEB_VIEW_ZOOM_LARGEST:
+            SetWebkitZoom(1.6);
+            break;
+
+        default:
+            wxASSERT(false);
+    }
+}
+
+void wxWebViewWebKit::SetZoomType(wxWebViewZoomType type)
+{
+    webkit_web_view_set_full_content_zoom(WEBKIT_WEB_VIEW(web_view),
+                                          (type == wxWEB_VIEW_ZOOM_TYPE_LAYOUT ?
+                                          TRUE : FALSE));
+}
+
+wxWebViewZoomType wxWebViewWebKit::GetZoomType() const
+{
+    gboolean fczoom = webkit_web_view_get_full_content_zoom(
+            WEBKIT_WEB_VIEW(web_view));
+
+    if (fczoom) return wxWEB_VIEW_ZOOM_TYPE_LAYOUT;
+    else        return wxWEB_VIEW_ZOOM_TYPE_TEXT;
+}
+
+bool wxWebViewWebKit::CanSetZoomType(wxWebViewZoomType) const
+{
+    // this port supports all zoom types
+    return true;
+}
+
+void wxWebViewWebKit::SetPage(const wxString& html, const wxString& baseUri)
+{
+    webkit_web_view_load_string (WEBKIT_WEB_VIEW(web_view),
+                                 html.mb_str(wxConvUTF8),
+                                 "text/html",
+                                 "UTF-8",
+                                 baseUri.mb_str(wxConvUTF8));
+}
+
+void wxWebViewWebKit::Print()
+{
+    WebKitWebFrame* frame = webkit_web_view_get_main_frame(
+            WEBKIT_WEB_VIEW(web_view));
+    webkit_web_frame_print (frame);
+
+    // GtkPrintOperationResult  webkit_web_frame_print_full
+    //      (WebKitWebFrame *frame,
+    //       GtkPrintOperation *operation,
+    //       GtkPrintOperationAction action,
+    //       GError **error);
+
+}
+
+
+bool wxWebViewWebKit::IsBusy()
+{
+    return m_busy;
+
+    // This code looks nice but returns true after a page was cancelled
+    /*
+    WebKitLoadStatus status = webkit_web_view_get_load_status
+            (WEBKIT_WEB_VIEW(web_view));
+
+
+#if WEBKIT_CHECK_VERSION(1,1,16)
+    // WEBKIT_LOAD_FAILED is new in webkit 1.1.16
+    if (status == WEBKIT_LOAD_FAILED)
+    {
+        return false;
+    }
+#endif
+    if (status == WEBKIT_LOAD_FINISHED)
+    {
+        return false;
+    }
+
+    return true;
+     */
+}
+
+void wxWebViewWebKit::SetEditable(bool enable)
+{
+    webkit_web_view_set_editable(WEBKIT_WEB_VIEW(web_view), enable);
+}
+
+bool wxWebViewWebKit::IsEditable()
+{
+    return webkit_web_view_get_editable(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::DeleteSelection()
+{
+    webkit_web_view_delete_selection(WEBKIT_WEB_VIEW(web_view));
+}
+
+bool wxWebViewWebKit::HasSelection()
+{
+    return webkit_web_view_has_selection(WEBKIT_WEB_VIEW(web_view));
+}
+
+void wxWebViewWebKit::SelectAll()
+{
+    webkit_web_view_select_all(WEBKIT_WEB_VIEW(web_view));
+}
+
+wxString wxWebViewWebKit::GetSelectedText()
+{
+    WebKitDOMDocument* doc; 
+    WebKitDOMDOMWindow* win;
+    WebKitDOMDOMSelection* sel;
+    WebKitDOMRange* range;
+
+    doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(web_view));
+    win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc));
+    sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win));
+    range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel), 
+                                                  0, NULL);
+    return wxString(webkit_dom_range_get_text(WEBKIT_DOM_RANGE(range)), 
+                    wxConvUTF8);
+}
+
+wxString wxWebViewWebKit::GetSelectedSource()
+{
+    WebKitDOMDocument* doc; 
+    WebKitDOMDOMWindow* win;
+    WebKitDOMDOMSelection* sel;
+    WebKitDOMRange* range;
+    WebKitDOMElement* div;
+    WebKitDOMDocumentFragment* clone;
+    WebKitDOMHTMLElement* html;
+
+    doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(web_view));
+    win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc));
+    sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win));
+    range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel), 
+                                                  0, NULL);
+    div = webkit_dom_document_create_element(WEBKIT_DOM_DOCUMENT(doc), "div", NULL);
+
+    clone = webkit_dom_range_clone_contents(WEBKIT_DOM_RANGE(range), NULL);
+    webkit_dom_node_append_child(&div->parent_instance, &clone->parent_instance, NULL);
+    html = (WebKitDOMHTMLElement*)div;
+
+    return wxString(webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(html)), 
+                    wxConvUTF8);
+}
+
+void wxWebViewWebKit::ClearSelection()
+{
+    WebKitDOMDocument* doc; 
+    WebKitDOMDOMWindow* win;
+    WebKitDOMDOMSelection* sel;
+
+    doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(web_view));
+    win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc));
+    sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win));
+    webkit_dom_dom_selection_remove_all_ranges(WEBKIT_DOM_DOM_SELECTION(sel));
+
+}
+
+wxString wxWebViewWebKit::GetPageText()
+{
+    WebKitDOMDocument* doc; 
+    WebKitDOMHTMLElement* body;
+
+    doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(web_view));
+    body = webkit_dom_document_get_body(WEBKIT_DOM_DOCUMENT(doc));
+    return wxString(webkit_dom_html_element_get_inner_text(WEBKIT_DOM_HTML_ELEMENT(body)), 
+                    wxConvUTF8);
+}
+
+void wxWebViewWebKit::RunScript(const wxString& javascript)
+{
+    webkit_web_view_execute_script(WEBKIT_WEB_VIEW(web_view), 
+                                   javascript.mb_str(wxConvUTF8));
+}
+
+// static
+wxVisualAttributes
+wxWebViewWebKit::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+     return GetDefaultAttributesFromGTKWidget(webkit_web_view_new);
+}
+
+
+#endif // wxHAVE_WEB_BACKEND_GTK_WEBKIT
index c502caf9f5655145b01dddde65365ce11ed00b91..be95de10b3ef796b0edcd87ec5484f957a1228ff 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:     Implementation of wxMSW-specific wxPanel class.
 // Author:      Vadim Zeitlin
 // Created:     2011-03-18
-// RCS-ID:      $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $
+// RCS-ID:      $Id$
 // Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp
new file mode 100644 (file)
index 0000000..4905e5d
--- /dev/null
@@ -0,0 +1,1145 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/msw/webview_ie.cpp
+// Purpose:     wxMSW wxWebViewIE class implementation for web view component
+// Author:      Marianne Gagnon
+// Id:          $Id$
+// Copyright:   (c) 2010 Marianne Gagnon, Steven Lamerton
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if defined(__BORLANDC__)
+    #pragma hdrstop
+#endif
+
+#include "wx/msw/webview_ie.h"
+
+#if wxUSE_WEBVIEW_IE
+
+#include <olectl.h>
+#include <oleidl.h>
+#include <exdispid.h>
+#include <exdisp.h>
+#include <mshtml.h>
+#include "wx/msw/registry.h"
+#include "wx/msw/missing.h"
+#include "wx/filesys.h"
+
+//We link to urlmon as it is required for CoInternetGetSession
+#pragma comment(lib, "urlmon")
+
+//Taken from wx/filesys.cpp
+static wxString EscapeFileNameCharsInURL(const char *in)
+{
+    wxString s;
+
+    for ( const unsigned char *p = (const unsigned char*)in; *p; ++p )
+    {
+        const unsigned char c = *p;
+
+        if ( c == '/' || c == '-' || c == '.' || c == '_' || c == '~' ||
+             (c >= '0' && c <= '9') ||
+             (c >= 'a' && c <= 'z') ||
+             (c >= 'A' && c <= 'Z') )
+        {
+            s << c;
+        }
+        else
+        {
+            s << wxString::Format("%%%02x", c);
+        }
+    }
+
+    return s;
+}
+
+BEGIN_EVENT_TABLE(wxWebViewIE, wxControl)
+    EVT_ACTIVEX(wxID_ANY, wxWebViewIE::onActiveXEvent)
+    EVT_ERASE_BACKGROUND(wxWebViewIE::onEraseBg)
+END_EVENT_TABLE()
+
+bool wxWebViewIE::Create(wxWindow* parent,
+           wxWindowID id,
+           const wxString& url,
+           const wxPoint& pos,
+           const wxSize& size,
+           long style,
+           const wxString& name)
+{
+    if (!wxControl::Create(parent, id, pos, size, style,
+                           wxDefaultValidator, name))
+    {
+        return false;
+    }
+
+    m_webBrowser = NULL;
+    m_isBusy = false;
+    m_historyLoadingFromList = false;
+    m_historyEnabled = true;
+    m_historyPosition = -1;
+    m_zoomType = wxWEB_VIEW_ZOOM_TYPE_TEXT;
+
+    if (::CoCreateInstance(CLSID_WebBrowser, NULL,
+                           CLSCTX_INPROC_SERVER, // CLSCTX_INPROC,
+                           IID_IWebBrowser2 , (void**)&m_webBrowser) != 0)
+    {
+        wxLogError("Failed to initialize IE, CoCreateInstance returned an error");
+        return false;
+    }
+
+    m_ie.SetDispatchPtr(m_webBrowser); // wxAutomationObject will release itself
+
+    m_webBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
+    m_webBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
+    //m_webBrowser->put_Silent(VARIANT_FALSE);
+
+    //We register a custom handler for the file protocol so we can handle
+    //Virtual file systems
+    ClassFactory* cf = new ClassFactory;
+    IInternetSession* session;
+    if(CoInternetGetSession(0, &session, 0) != S_OK)
+        return false;
+    HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol, L"file", 0, NULL, 0);
+    if(FAILED(hr))
+        return false; 
+
+    m_container = new wxActiveXContainer(this, IID_IWebBrowser2, m_webBrowser);
+
+    SetBackgroundStyle(wxBG_STYLE_PAINT);
+    SetDoubleBuffered(true);
+    LoadUrl(url);
+    return true;
+}
+
+
+void wxWebViewIE::LoadUrl(const wxString& url)
+{
+    m_ie.CallMethod("Navigate", (BSTR) url.wc_str(), NULL, NULL, NULL, NULL);
+}
+
+void wxWebViewIE::SetPage(const wxString& html, const wxString& baseUrl)
+{
+    BSTR bstr = SysAllocString(html.wc_str());
+
+    // Creates a new one-dimensional array
+    SAFEARRAY *psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1);
+    if (psaStrings != NULL)
+    {
+        VARIANT *param;
+
+        HRESULT hr = SafeArrayAccessData(psaStrings, (LPVOID*)&param);
+        param->vt = VT_BSTR;
+        param->bstrVal = bstr;
+        hr = SafeArrayUnaccessData(psaStrings);
+
+        IHTMLDocument2* document = GetDocument();
+        document->write(psaStrings);
+        document->Release();
+
+        // SafeArrayDestroy calls SysFreeString for each BSTR
+        SafeArrayDestroy(psaStrings);
+
+        //We send the events when we are done to mimic webkit
+        //Navigated event
+        wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
+                                   GetId(), baseUrl, "", false);
+        event.SetEventObject(this);
+        HandleWindowEvent(event);
+
+        //Document complete event
+        event.SetEventType(wxEVT_COMMAND_WEB_VIEW_LOADED);
+        event.SetEventObject(this);
+        HandleWindowEvent(event);
+    }
+    else
+    {
+        wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL");
+    }
+
+}
+
+wxString wxWebViewIE::GetPageSource()
+{
+    IHTMLDocument2* document = GetDocument();
+    IHTMLElement *bodyTag = NULL;
+    IHTMLElement *htmlTag = NULL;
+    wxString source;
+    HRESULT hr = document->get_body(&bodyTag);
+    if(SUCCEEDED(hr))
+    {
+        hr = bodyTag->get_parentElement(&htmlTag);
+        if(SUCCEEDED(hr))
+        {
+            BSTR bstr;
+            htmlTag->get_outerHTML(&bstr);
+            source = wxString(bstr);
+            htmlTag->Release();
+        }
+        bodyTag->Release();
+    }
+
+    document->Release();
+    return source;
+}
+
+wxWebViewZoom wxWebViewIE::GetZoom()
+{
+    if(m_zoomType == wxWEB_VIEW_ZOOM_TYPE_LAYOUT)
+        return GetIEOpticalZoom();
+    else if(m_zoomType == wxWEB_VIEW_ZOOM_TYPE_TEXT)
+        return GetIETextZoom();
+    else
+        wxFAIL;
+
+    //Dummy return to stop compiler warnings
+    return wxWEB_VIEW_ZOOM_MEDIUM;
+
+}
+
+void wxWebViewIE::SetZoom(wxWebViewZoom zoom)
+{
+    if(m_zoomType == wxWEB_VIEW_ZOOM_TYPE_LAYOUT)
+        SetIEOpticalZoom(zoom);
+    else if(m_zoomType == wxWEB_VIEW_ZOOM_TYPE_TEXT)
+        SetIETextZoom(zoom);
+    else
+        wxFAIL;
+}
+
+void wxWebViewIE::SetIETextZoom(wxWebViewZoom level)
+{
+    //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
+    //is 0 to 4 so the check is unnecessary, these match exactly with the
+    //enum values
+    VARIANT zoomVariant;
+    VariantInit (&zoomVariant);
+    V_VT(&zoomVariant) = VT_I4;
+    V_I4(&zoomVariant) = level;
+
+    HRESULT result = m_webBrowser->ExecWB(OLECMDID_ZOOM,
+                                          OLECMDEXECOPT_DONTPROMPTUSER,
+                                          &zoomVariant, NULL);
+    wxASSERT(result == S_OK);
+}
+
+wxWebViewZoom wxWebViewIE::GetIETextZoom()
+{
+    VARIANT zoomVariant;
+    VariantInit (&zoomVariant);
+    V_VT(&zoomVariant) = VT_I4;
+
+    HRESULT result = m_webBrowser->ExecWB(OLECMDID_ZOOM,
+                                          OLECMDEXECOPT_DONTPROMPTUSER,
+                                          NULL, &zoomVariant);
+    wxASSERT(result == S_OK);
+
+    //We can safely cast here as we know that the range matches our enum
+    return static_cast<wxWebViewZoom>(V_I4(&zoomVariant));
+}
+
+void wxWebViewIE::SetIEOpticalZoom(wxWebViewZoom level)
+{
+    //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
+    //is 10 to 1000 so the check is unnecessary
+    VARIANT zoomVariant;
+    VariantInit (&zoomVariant);
+    V_VT(&zoomVariant) = VT_I4;
+
+    //We make a somewhat arbitray map here, taken from values used by webkit
+    switch(level)
+    {
+        case wxWEB_VIEW_ZOOM_TINY:
+            V_I4(&zoomVariant) = 60;
+            break;
+        case wxWEB_VIEW_ZOOM_SMALL:
+            V_I4(&zoomVariant) = 80;
+            break;
+        case wxWEB_VIEW_ZOOM_MEDIUM:
+            V_I4(&zoomVariant) = 100;
+            break;
+        case wxWEB_VIEW_ZOOM_LARGE:
+            V_I4(&zoomVariant) = 130;
+            break;
+        case wxWEB_VIEW_ZOOM_LARGEST:
+            V_I4(&zoomVariant) = 160;
+            break;
+        default:
+            wxFAIL;
+    }
+
+    HRESULT result = m_webBrowser->ExecWB((OLECMDID)OLECMDID_OPTICAL_ZOOM,
+                                          OLECMDEXECOPT_DODEFAULT,
+                                          &zoomVariant,
+                                          NULL);
+    wxASSERT(result == S_OK);
+}
+
+wxWebViewZoom wxWebViewIE::GetIEOpticalZoom()
+{
+    VARIANT zoomVariant;
+    VariantInit (&zoomVariant);
+    V_VT(&zoomVariant) = VT_I4;
+
+    HRESULT result = m_webBrowser->ExecWB((OLECMDID)OLECMDID_OPTICAL_ZOOM,
+                                          OLECMDEXECOPT_DODEFAULT, NULL,
+                                          &zoomVariant);
+    wxASSERT(result == S_OK);
+
+    const int zoom = V_I4(&zoomVariant);
+
+    //We make a somewhat arbitray map here, taken from values used by webkit
+    if (zoom <= 65)
+    {
+        return wxWEB_VIEW_ZOOM_TINY;
+    }
+    else if (zoom > 65 && zoom <= 90)
+    {
+        return wxWEB_VIEW_ZOOM_SMALL;
+    }
+    else if (zoom > 90 && zoom <= 115)
+    {
+        return wxWEB_VIEW_ZOOM_MEDIUM;
+    }
+    else if (zoom > 115 && zoom <= 145)
+    {
+        return wxWEB_VIEW_ZOOM_LARGE;
+    }
+    else /*if (zoom > 145) */ //Using else removes a compiler warning
+    {
+        return wxWEB_VIEW_ZOOM_LARGEST;
+    }
+}
+
+void wxWebViewIE::SetZoomType(wxWebViewZoomType type)
+{
+    m_zoomType = type;
+}
+
+wxWebViewZoomType wxWebViewIE::GetZoomType() const
+{
+    return m_zoomType;
+}
+
+bool wxWebViewIE::CanSetZoomType(wxWebViewZoomType type) const
+{
+    //IE 6 and below only support text zoom, so check the registry to see what
+    //version we actually have
+    wxRegKey key(wxRegKey::HKLM, "Software\\Microsoft\\Internet Explorer");
+    wxString value;
+    key.QueryValue("Version", value);
+
+    long version = wxAtoi(value.Left(1));
+    if(version <= 6 && type == wxWEB_VIEW_ZOOM_TYPE_LAYOUT)
+        return false;
+    else
+        return true;
+}
+
+void wxWebViewIE::Print()
+{
+    m_webBrowser->ExecWB(OLECMDID_PRINTPREVIEW,
+                         OLECMDEXECOPT_DODEFAULT, NULL, NULL);
+}
+
+bool wxWebViewIE::CanGoBack()
+{
+    if(m_historyEnabled)
+        return m_historyPosition > 0;
+    else
+        return false;
+}
+
+bool wxWebViewIE::CanGoForward()
+{
+    if(m_historyEnabled)
+        return m_historyPosition != static_cast<int>(m_historyList.size()) - 1;
+    else
+        return false;
+}
+
+void wxWebViewIE::LoadHistoryItem(wxSharedPtr<wxWebHistoryItem> item)
+{
+    int pos = -1;
+    for(unsigned int i = 0; i < m_historyList.size(); i++)
+    {
+        //We compare the actual pointers to find the correct item
+        if(m_historyList[i].get() == item.get())
+            pos = i;
+    }
+    wxASSERT_MSG(pos != static_cast<int>(m_historyList.size()),
+                 "invalid history item");
+    m_historyLoadingFromList = true;
+    LoadUrl(item->GetUrl());
+    m_historyPosition = pos;
+}
+
+wxVector<wxSharedPtr<wxWebHistoryItem> > wxWebViewIE::GetBackwardHistory()
+{
+    wxVector<wxSharedPtr<wxWebHistoryItem> > backhist;
+    //As we don't have std::copy or an iterator constructor in the wxwidgets
+    //native vector we construct it by hand
+    for(int i = 0; i < m_historyPosition; i++)
+    {
+        backhist.push_back(m_historyList[i]);
+    }
+    return backhist;
+}
+
+wxVector<wxSharedPtr<wxWebHistoryItem> > wxWebViewIE::GetForwardHistory()
+{
+    wxVector<wxSharedPtr<wxWebHistoryItem> > forwardhist;
+    //As we don't have std::copy or an iterator constructor in the wxwidgets
+    //native vector we construct it by hand
+    for(int i = m_historyPosition + 1; i < static_cast<int>(m_historyList.size()); i++)
+    {
+        forwardhist.push_back(m_historyList[i]);
+    }
+    return forwardhist;
+}
+
+void wxWebViewIE::GoBack()
+{
+    LoadHistoryItem(m_historyList[m_historyPosition - 1]);
+}
+
+void wxWebViewIE::GoForward()
+{
+    LoadHistoryItem(m_historyList[m_historyPosition + 1]);
+}
+
+void wxWebViewIE::Stop()
+{
+    m_ie.CallMethod("Stop");
+}
+
+void wxWebViewIE::ClearHistory()
+{
+    m_historyList.clear();
+    m_historyPosition = -1;
+}
+
+void wxWebViewIE::EnableHistory(bool enable)
+{
+    m_historyEnabled = enable;
+    m_historyList.clear();
+    m_historyPosition = -1;
+}
+
+void wxWebViewIE::Reload(wxWebViewReloadFlags flags)
+{
+    VARIANTARG level;
+    VariantInit(&level);
+    V_VT(&level) = VT_I2;
+
+    switch(flags)
+    {
+        case wxWEB_VIEW_RELOAD_DEFAULT:
+            V_I2(&level) = REFRESH_NORMAL;
+            break;
+        case wxWEB_VIEW_RELOAD_NO_CACHE:
+            V_I2(&level) = REFRESH_COMPLETELY;
+            break;
+        default:
+            wxFAIL_MSG("Unexpected reload type");
+    }
+
+    m_webBrowser->Refresh2(&level);
+}
+
+bool wxWebViewIE::IsOfflineMode()
+{
+    wxVariant out = m_ie.GetProperty("Offline");
+
+    wxASSERT(out.GetType() == "bool");
+
+    return out.GetBool();
+}
+
+void wxWebViewIE::SetOfflineMode(bool offline)
+{
+    // FIXME: the wxWidgets docs do not really document what the return
+    //        parameter of PutProperty is
+    const bool success = m_ie.PutProperty("Offline", (offline ?
+                                                      VARIANT_TRUE :
+                                                      VARIANT_FALSE));
+    wxASSERT(success);
+}
+
+bool wxWebViewIE::IsBusy()
+{
+    if (m_isBusy) return true;
+
+    wxVariant out = m_ie.GetProperty("Busy");
+
+    wxASSERT(out.GetType() == "bool");
+
+    return out.GetBool();
+}
+
+wxString wxWebViewIE::GetCurrentURL()
+{
+    wxVariant out = m_ie.GetProperty("LocationURL");
+
+    wxASSERT(out.GetType() == "string");
+    return out.GetString();
+}
+
+wxString wxWebViewIE::GetCurrentTitle()
+{
+    IHTMLDocument2* document = GetDocument();
+    BSTR title;
+
+    document->get_nameProp(&title);
+    document->Release();
+    return wxString(title);
+}
+
+bool wxWebViewIE::CanCut()
+{
+    return CanExecCommand("Cut");
+}
+
+bool wxWebViewIE::CanCopy()
+{
+    return CanExecCommand("Copy");
+}
+bool wxWebViewIE::CanPaste()
+{
+    return CanExecCommand("Paste");
+}
+
+void wxWebViewIE::Cut()
+{
+    ExecCommand("Cut");
+}
+
+void wxWebViewIE::Copy()
+{
+    ExecCommand("Copy");
+}
+
+void wxWebViewIE::Paste()
+{
+    ExecCommand("Paste");
+}
+
+bool wxWebViewIE::CanUndo()
+{
+    return CanExecCommand("Undo");
+}
+bool wxWebViewIE::CanRedo()
+{
+    return CanExecCommand("Redo");
+}
+
+void wxWebViewIE::Undo()
+{
+    ExecCommand("Undo");
+}
+
+void wxWebViewIE::Redo()
+{
+    ExecCommand("Redo");
+}
+
+void wxWebViewIE::SetEditable(bool enable)
+{
+    IHTMLDocument2* document = GetDocument();
+    if( enable )
+        document->put_designMode(SysAllocString(L"On"));
+    else
+        document->put_designMode(SysAllocString(L"Off"));
+
+    document->Release();
+}
+
+bool wxWebViewIE::IsEditable()
+{
+    IHTMLDocument2* document = GetDocument();
+    BSTR mode;
+    document->get_designMode(&mode);
+    document->Release();
+    if(wxString(mode) == "On")
+        return true;
+    else
+        return false;
+}
+
+void wxWebViewIE::SelectAll()
+{
+    ExecCommand("SelectAll");
+}
+
+bool wxWebViewIE::HasSelection()
+{
+    IHTMLDocument2* document = GetDocument();
+    IHTMLSelectionObject* selection;
+    wxString sel;
+    HRESULT hr = document->get_selection(&selection);
+    if(SUCCEEDED(hr))
+    {
+        BSTR type;
+        selection->get_type(&type);
+        sel = wxString(type);
+        selection->Release();
+    }
+    document->Release();
+    return sel != "None";
+}
+
+void wxWebViewIE::DeleteSelection()
+{
+    ExecCommand("Delete");
+}
+
+wxString wxWebViewIE::GetSelectedText()
+{
+    IHTMLDocument2* document = GetDocument();
+    IHTMLSelectionObject* selection;
+    wxString selected;
+    HRESULT hr = document->get_selection(&selection);
+    if(SUCCEEDED(hr))
+    {
+        IDispatch* disrange;
+        hr = selection->createRange(&disrange);
+        if(SUCCEEDED(hr))
+        {
+            IHTMLTxtRange* range;
+            hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range);
+            if(SUCCEEDED(hr))
+            {
+                BSTR text;
+                range->get_text(&text);
+                selected = wxString(text);
+                range->Release();
+            }
+            disrange->Release();
+        }
+        selection->Release();
+    }
+    document->Release();
+    return selected;
+}
+
+wxString wxWebViewIE::GetSelectedSource()
+{
+    IHTMLDocument2* document = GetDocument();
+    IHTMLSelectionObject* selection;
+    wxString selected;
+    HRESULT hr = document->get_selection(&selection);
+    if(SUCCEEDED(hr))
+    {
+        IDispatch* disrange;
+        hr = selection->createRange(&disrange);
+        if(SUCCEEDED(hr))
+        {
+            IHTMLTxtRange* range;
+            hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range);
+            if(SUCCEEDED(hr))
+            {
+                BSTR text;
+                range->get_htmlText(&text);
+                selected = wxString(text);
+                range->Release();
+            }
+            disrange->Release();
+        }
+        selection->Release();
+    }
+    document->Release();
+    return selected;
+}
+
+void wxWebViewIE::ClearSelection()
+{
+    IHTMLDocument2* document = GetDocument();
+    IHTMLSelectionObject* selection;
+    wxString selected;
+    HRESULT hr = document->get_selection(&selection);
+    if(SUCCEEDED(hr))
+    {
+        selection->empty();
+        selection->Release();
+    }
+    document->Release();
+}
+
+wxString wxWebViewIE::GetPageText()
+{
+    IHTMLDocument2* document = GetDocument();
+    wxString text;
+    IHTMLElement* body;
+    HRESULT hr = document->get_body(&body);
+    if(SUCCEEDED(hr))
+    {
+        BSTR out;
+        body->get_innerText(&out);
+        text = wxString(out);
+        body->Release();
+    }
+    document->Release();
+    return text;
+}
+
+void wxWebViewIE::RunScript(const wxString& javascript)
+{
+    IHTMLDocument2* document = GetDocument();
+    IHTMLWindow2* window;
+    wxString language = "javascript";
+    HRESULT hr = document->get_parentWindow(&window);
+    if(SUCCEEDED(hr))
+    {
+        VARIANT level;
+        VariantInit(&level);
+        V_VT(&level) = VT_EMPTY;
+        window->execScript(SysAllocString(javascript), SysAllocString(language), &level);
+    }
+    document->Release();
+}
+
+bool wxWebViewIE::CanExecCommand(wxString command)
+{
+    IHTMLDocument2* document = GetDocument();
+    VARIANT_BOOL enabled;
+
+    document->queryCommandEnabled(SysAllocString(command.wc_str()), &enabled);
+    document->Release();
+
+    return (enabled == VARIANT_TRUE);
+}
+
+void wxWebViewIE::ExecCommand(wxString command)
+{
+    IHTMLDocument2* document = GetDocument();
+    document->execCommand(SysAllocString(command.wc_str()), VARIANT_FALSE, VARIANT(), NULL);
+    document->Release();
+}
+
+IHTMLDocument2* wxWebViewIE::GetDocument()
+{
+    wxVariant variant = m_ie.GetProperty("Document");
+    IHTMLDocument2* document = (IHTMLDocument2*)variant.GetVoidPtr();
+
+    wxASSERT(document);
+
+    return document;
+}
+
+void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
+{
+    if (m_webBrowser == NULL) return;
+
+    switch (evt.GetDispatchId())
+    {
+        case DISPID_BEFORENAVIGATE2:
+        {
+            m_isBusy = true;
+
+            wxString url = evt[1].GetString();
+            wxString target = evt[3].GetString();
+
+            wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
+                                       GetId(), url, target, true);
+            event.SetEventObject(this);
+            HandleWindowEvent(event);
+
+            if (event.IsVetoed())
+            {
+                wxActiveXEventNativeMSW* nativeParams =
+                    evt.GetNativeParameters();
+                *V_BOOLREF(&nativeParams->pDispParams->rgvarg[0]) = VARIANT_TRUE;
+            }
+
+            // at this point, either the navigation event has been cancelled
+            // and we're not busy, either it was accepted and IWebBrowser2's
+            // Busy property will be true; so we don't need our override
+            // flag anymore.
+            m_isBusy = false;
+
+            break;
+        }
+
+        case DISPID_NAVIGATECOMPLETE2:
+        {
+            wxString url = evt[1].GetString();
+            // TODO: set target parameter if possible
+            wxString target = wxEmptyString;
+            wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
+                                       GetId(), url, target, false);
+            event.SetEventObject(this);
+            HandleWindowEvent(event);
+            break;
+        }
+
+        case DISPID_PROGRESSCHANGE:
+        {
+            // download progress
+            break;
+        }
+
+        case DISPID_DOCUMENTCOMPLETE:
+        {
+            //Only send a complete even if we are actually finished, this brings
+            //the event in to line with webkit
+            READYSTATE rs;
+            m_webBrowser->get_ReadyState( &rs );
+            if(rs != READYSTATE_COMPLETE)
+                break;
+
+            wxString url = evt[1].GetString();
+
+            //As we are complete we also add to the history list, but not if the
+            //page is not the main page, ie it is a subframe
+            if(m_historyEnabled && !m_historyLoadingFromList && url == GetCurrentURL())
+            {
+                //If we are not at the end of the list, then erase everything
+                //between us and the end before adding the new page
+                if(m_historyPosition != static_cast<int>(m_historyList.size()) - 1)
+                {
+                    m_historyList.erase(m_historyList.begin() + m_historyPosition + 1,
+                                        m_historyList.end());
+                }
+                wxSharedPtr<wxWebHistoryItem> item(new wxWebHistoryItem(url, GetCurrentTitle()));
+                m_historyList.push_back(item);
+                m_historyPosition++;
+            }
+            //Reset as we are done now
+            m_historyLoadingFromList = false;
+            // TODO: set target parameter if possible
+            wxString target = wxEmptyString;
+            wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED, GetId(),
+                                       url, target, false);
+            event.SetEventObject(this);
+            HandleWindowEvent(event);
+            break;
+        }
+
+        case DISPID_STATUSTEXTCHANGE:
+        {
+            break;
+        }
+
+        case DISPID_TITLECHANGE:
+        {
+            break;
+        }
+
+        case DISPID_NAVIGATEERROR:
+        {
+            wxWebNavigationError errorType = wxWEB_NAV_ERR_OTHER;
+            wxString errorCode = "?";
+            switch (evt[3].GetLong())
+            {
+            case INET_E_INVALID_URL: // (0x800C0002L or -2146697214)
+                errorCode = "INET_E_INVALID_URL";
+                errorType = wxWEB_NAV_ERR_REQUEST;
+                break;
+            case INET_E_NO_SESSION: // (0x800C0003L or -2146697213)
+                errorCode = "INET_E_NO_SESSION";
+                errorType = wxWEB_NAV_ERR_CONNECTION;
+                break;
+            case INET_E_CANNOT_CONNECT: // (0x800C0004L or -2146697212)
+                errorCode = "INET_E_CANNOT_CONNECT";
+                errorType = wxWEB_NAV_ERR_CONNECTION;
+                break;
+            case INET_E_RESOURCE_NOT_FOUND: // (0x800C0005L or -2146697211)
+                errorCode = "INET_E_RESOURCE_NOT_FOUND";
+                errorType = wxWEB_NAV_ERR_NOT_FOUND;
+                break;
+            case INET_E_OBJECT_NOT_FOUND: // (0x800C0006L or -2146697210)
+                errorCode = "INET_E_OBJECT_NOT_FOUND";
+                errorType = wxWEB_NAV_ERR_NOT_FOUND;
+                break;
+            case INET_E_DATA_NOT_AVAILABLE: // (0x800C0007L or -2146697209)
+                errorCode = "INET_E_DATA_NOT_AVAILABLE";
+                errorType = wxWEB_NAV_ERR_NOT_FOUND;
+                break;
+            case INET_E_DOWNLOAD_FAILURE: // (0x800C0008L or -2146697208)
+                errorCode = "INET_E_DOWNLOAD_FAILURE";
+                errorType = wxWEB_NAV_ERR_CONNECTION;
+                break;
+            case INET_E_AUTHENTICATION_REQUIRED: // (0x800C0009L or -2146697207)
+                errorCode = "INET_E_AUTHENTICATION_REQUIRED";
+                errorType = wxWEB_NAV_ERR_AUTH;
+                break;
+            case INET_E_NO_VALID_MEDIA: // (0x800C000AL or -2146697206)
+                errorCode = "INET_E_NO_VALID_MEDIA";
+                errorType = wxWEB_NAV_ERR_REQUEST;
+                break;
+            case INET_E_CONNECTION_TIMEOUT: // (0x800C000BL or -2146697205)
+                errorCode = "INET_E_CONNECTION_TIMEOUT";
+                errorType = wxWEB_NAV_ERR_CONNECTION;
+                break;
+            case INET_E_INVALID_REQUEST: // (0x800C000CL or -2146697204)
+                errorCode = "INET_E_INVALID_REQUEST";
+                errorType = wxWEB_NAV_ERR_REQUEST;
+                break;
+            case INET_E_UNKNOWN_PROTOCOL: // (0x800C000DL or -2146697203)
+                errorCode = "INET_E_UNKNOWN_PROTOCOL";
+                errorType = wxWEB_NAV_ERR_REQUEST;
+                break;
+            case INET_E_SECURITY_PROBLEM: // (0x800C000EL or -2146697202)
+                errorCode = "INET_E_SECURITY_PROBLEM";
+                errorType = wxWEB_NAV_ERR_SECURITY;
+                break;
+            case INET_E_CANNOT_LOAD_DATA: // (0x800C000FL or -2146697201)
+                errorCode = "INET_E_CANNOT_LOAD_DATA";
+                errorType = wxWEB_NAV_ERR_OTHER;
+                break;
+            case INET_E_CANNOT_INSTANTIATE_OBJECT:
+                // CoCreateInstance will return an error code if this happens,
+                // we'll handle this above.
+                return;
+                break;
+            case INET_E_REDIRECT_FAILED: // (0x800C0014L or -2146697196)
+                errorCode = "INET_E_REDIRECT_FAILED";
+                errorType = wxWEB_NAV_ERR_OTHER;
+                break;
+            case INET_E_REDIRECT_TO_DIR: // (0x800C0015L or -2146697195)
+                errorCode = "INET_E_REDIRECT_TO_DIR";
+                errorType = wxWEB_NAV_ERR_REQUEST;
+                break;
+            case INET_E_CANNOT_LOCK_REQUEST: // (0x800C0016L or -2146697194)
+                errorCode = "INET_E_CANNOT_LOCK_REQUEST";
+                errorType = wxWEB_NAV_ERR_OTHER;
+                break;
+            case INET_E_USE_EXTEND_BINDING: // (0x800C0017L or -2146697193)
+                errorCode = "INET_E_USE_EXTEND_BINDING";
+                errorType = wxWEB_NAV_ERR_OTHER;
+                break;
+            case INET_E_TERMINATED_BIND: // (0x800C0018L or -2146697192)
+                errorCode = "INET_E_TERMINATED_BIND";
+                errorType = wxWEB_NAV_ERR_OTHER;
+                break;
+            case INET_E_INVALID_CERTIFICATE: // (0x800C0019L or -2146697191)
+                errorCode = "INET_E_INVALID_CERTIFICATE";
+                errorType = wxWEB_NAV_ERR_CERTIFICATE;
+                break;
+            case INET_E_CODE_DOWNLOAD_DECLINED: // (0x800C0100L or -2146696960)
+                errorCode = "INET_E_CODE_DOWNLOAD_DECLINED";
+                errorType = wxWEB_NAV_ERR_USER_CANCELLED;
+                break;
+            case INET_E_RESULT_DISPATCHED: // (0x800C0200L or -2146696704)
+                // cancel request cancelled...
+                errorCode = "INET_E_RESULT_DISPATCHED";
+                errorType = wxWEB_NAV_ERR_OTHER;
+                break;
+            case INET_E_CANNOT_REPLACE_SFP_FILE: // (0x800C0300L or -2146696448)
+                errorCode = "INET_E_CANNOT_REPLACE_SFP_FILE";
+                errorType = wxWEB_NAV_ERR_SECURITY;
+                break;
+            case INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY:
+                errorCode = "INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY";
+                errorType = wxWEB_NAV_ERR_SECURITY;
+                break;
+            case INET_E_CODE_INSTALL_SUPPRESSED:
+                errorCode = "INET_E_CODE_INSTALL_SUPPRESSED";
+                errorType = wxWEB_NAV_ERR_SECURITY;
+                break;
+            }
+
+            wxString url = evt[1].GetString();
+            wxString target = evt[2].GetString();
+            wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR, GetId(),
+                                       url, target, false);
+            event.SetEventObject(this);
+            event.SetInt(errorType);
+            event.SetString(errorCode);
+            HandleWindowEvent(event);
+            break;
+        }
+        case DISPID_NEWWINDOW3:
+        {
+            wxString url = evt[4].GetString();
+
+            wxWebNavigationEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
+                                       GetId(), url, wxEmptyString, true);
+            event.SetEventObject(this);
+            HandleWindowEvent(event);
+
+            //We always cancel this event otherwise an Internet Exporer window
+            //is opened for the url
+            wxActiveXEventNativeMSW* nativeParams = evt.GetNativeParameters();
+            *V_BOOLREF(&nativeParams->pDispParams->rgvarg[3]) = VARIANT_TRUE;
+            break;
+        }
+    }
+
+    evt.Skip();
+}
+
+VirtualProtocol::VirtualProtocol()
+{
+    m_refCount = 0;
+    m_file = NULL;
+    m_fileSys = new wxFileSystem;
+}
+
+VirtualProtocol::~VirtualProtocol()
+{
+    wxDELETE(m_fileSys);
+}
+
+ULONG VirtualProtocol::AddRef()
+{
+    m_refCount++;
+    return m_refCount;
+}
+
+HRESULT VirtualProtocol::QueryInterface(REFIID riid, void **ppvObject)
+{
+    if ((riid == IID_IUnknown) || (riid == IID_IInternetProtocol)
+       || (riid == IID_IInternetProtocolRoot))
+    {
+        *ppvObject = this;
+        AddRef();
+        return S_OK;
+    }
+    else
+    {
+        *ppvObject = NULL;
+        return E_POINTER;
+    }
+}
+
+ULONG VirtualProtocol::Release()
+{
+    m_refCount--;
+    if (m_refCount > 0)
+    {
+        return m_refCount;
+    }
+    else
+    {
+        delete this;
+        return 0;
+    }
+}
+
+HRESULT VirtualProtocol::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink,
+                               IInternetBindInfo *pOIBindInfo, DWORD grfPI, 
+                               HANDLE_PTR dwReserved)
+{
+    wxUnusedVar(szUrl);
+    wxUnusedVar(pOIBindInfo);
+    wxUnusedVar(grfPI);
+    wxUnusedVar(dwReserved);
+    m_protocolSink = pOIProtSink;
+    //We have to clean up incoming paths from the webview control as they are
+    //not properly escaped, see also the comment in filesys.cpp line 668
+    wxString path = wxString(szUrl).BeforeFirst(':') +  ":" + 
+                    EscapeFileNameCharsInURL(wxString(szUrl).AfterFirst(':'));
+    path.Replace("///", "/");
+    m_file = m_fileSys->OpenFile(path);
+
+    if(!m_file)
+        return INET_E_RESOURCE_NOT_FOUND;
+
+    //We return the stream length for current and total size as we can always
+    //read the whole file from the stream
+    m_protocolSink->ReportData(BSCF_FIRSTDATANOTIFICATION | 
+                               BSCF_DATAFULLYAVAILABLE |
+                               BSCF_LASTDATANOTIFICATION,
+                               m_file->GetStream()->GetLength(),
+                               m_file->GetStream()->GetLength());
+    return S_OK; 
+}
+
+HRESULT VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRead)
+{
+    //If the file is null we return false to indicte it is finished
+    if(!m_file) 
+        return S_FALSE;
+
+    wxStreamError err = m_file->GetStream()->Read(pv, cb).GetLastError();
+    *pcbRead = m_file->GetStream()->LastRead();
+
+    if(err == wxSTREAM_NO_ERROR)
+    {
+        if(*pcbRead < cb)
+        {
+            wxDELETE(m_file);
+            m_protocolSink->ReportResult(S_OK, 0, NULL);
+        }
+        //As we are not eof there is more data
+        return S_OK;
+    }
+    else if(err == wxSTREAM_EOF)
+    {
+        wxDELETE(m_file);
+        m_protocolSink->ReportResult(S_OK, 0, NULL);
+        //We are eof and so finished
+        return S_OK;
+    }
+    else if(err ==  wxSTREAM_READ_ERROR)
+    {
+        wxDELETE(m_file);
+        return INET_E_DOWNLOAD_FAILURE;
+    }
+    else
+    {
+        //Dummy return to surpress a compiler warning
+        wxFAIL;
+        return INET_E_DOWNLOAD_FAILURE;
+    }
+}
+
+HRESULT ClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid,
+                                     void ** ppvObject)
+{
+    if (pUnkOuter) 
+        return CLASS_E_NOAGGREGATION;
+    VirtualProtocol* vp = new VirtualProtocol;
+    vp->AddRef();
+    HRESULT hr = vp->QueryInterface(riid, ppvObject);
+    vp->Release();
+    return hr;
+
+} 
+
+STDMETHODIMP ClassFactory::LockServer(BOOL fLock)
+{
+    wxUnusedVar(fLock);
+    return S_OK;
+}
+
+ULONG ClassFactory::AddRef(void)
+{
+    m_refCount++;
+    return m_refCount;
+}
+
+HRESULT ClassFactory::QueryInterface(REFIID riid, void **ppvObject)
+{
+    if ((riid == IID_IUnknown) || (riid == IID_IClassFactory))
+    {
+        *ppvObject = this;
+        AddRef();
+        return S_OK;
+    }
+    else
+    {
+        *ppvObject = NULL;
+        return E_POINTER;
+    }
+
+}
+
+ULONG ClassFactory::Release(void)
+{
+    m_refCount--;
+    if (m_refCount > 0)
+    {
+        return m_refCount;
+    }
+    else
+    {
+        delete this;
+        return 0;
+    }
+
+} 
+
+#endif
diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm
new file mode 100644 (file)
index 0000000..ec49602
--- /dev/null
@@ -0,0 +1,1219 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/osx/webview_webkit.mm
+// Purpose:     wxWebViewWebKit - embeddable web kit control,
+//                             OS X implementation of web view component
+// Author:      Jethro Grassie / Kevin Ollivier / Marianne Gagnon
+// Modified by:
+// Created:     2004-4-16
+// RCS-ID:      $Id$
+// Copyright:   (c) Jethro Grassie / Kevin Ollivier / Marianne Gagnon
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// http://developer.apple.com/mac/library/documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/Reference/Reference.html
+
+#include "wx/osx/webview_webkit.h"
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+#if wxHAVE_WEB_BACKEND_OSX_WEBKIT
+
+#ifdef __WXCOCOA__
+#include "wx/cocoa/autorelease.h"
+#else
+#include "wx/osx/private.h"
+
+#include <WebKit/WebKit.h>
+#include <WebKit/HIWebView.h>
+#include <WebKit/CarbonUtils.h>
+#endif
+
+#include <Foundation/NSURLError.h>
+
+// FIXME: find cleaner way to find the wxWidgets ID of a webview than this hack
+#include <map>
+std::map<WebView*, wxWebViewWebKit*> wx_webviewctrls;
+
+#define DEBUG_WEBKIT_SIZING 0
+
+// ----------------------------------------------------------------------------
+// macros
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxControl)
+
+BEGIN_EVENT_TABLE(wxWebViewWebKit, wxControl)
+#if defined(__WXMAC__) && wxOSX_USE_CARBON
+    EVT_SIZE(wxWebViewWebKit::OnSize)
+#endif
+END_EVENT_TABLE()
+
+#if defined(__WXOSX__) && wxOSX_USE_CARBON
+
+// ----------------------------------------------------------------------------
+// Carbon Events handlers
+// ----------------------------------------------------------------------------
+
+// prototype for function in src/osx/carbon/nonownedwnd.cpp
+void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent );
+
+static const EventTypeSpec eventList[] =
+{
+    //{ kEventClassControl, kEventControlTrack } ,
+    { kEventClassMouse, kEventMouseUp },
+    { kEventClassMouse, kEventMouseDown },
+    { kEventClassMouse, kEventMouseMoved },
+    { kEventClassMouse, kEventMouseDragged },
+
+    { kEventClassKeyboard, kEventRawKeyDown } ,
+    { kEventClassKeyboard, kEventRawKeyRepeat } ,
+    { kEventClassKeyboard, kEventRawKeyUp } ,
+    { kEventClassKeyboard, kEventRawKeyModifiersChanged } ,
+
+    { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
+    { kEventClassTextInput, kEventTextInputUpdateActiveInputArea } ,
+
+#if DEBUG_WEBKIT_SIZING == 1
+    { kEventClassControl, kEventControlBoundsChanged } ,
+#endif
+};
+
+// mix this in from window.cpp
+pascal OSStatus wxMacUnicodeTextEventHandler(EventHandlerCallRef handler,
+                                             EventRef event, void *data) ;
+
+// NOTE: This is mostly taken from KeyboardEventHandler in toplevel.cpp, but
+// that expects the data pointer is a top-level window, so I needed to change
+// that in this case. However, once 2.8 is out, we should factor out the common
+// logic among the two functions and merge them.
+static pascal OSStatus wxWebKitKeyEventHandler(EventHandlerCallRef handler,
+                                               EventRef event, void *data)
+{
+    OSStatus result = eventNotHandledErr ;
+    wxMacCarbonEvent cEvent( event ) ;
+
+    wxWebViewWebKit* thisWindow = (wxWebViewWebKit*) data ;
+    wxWindow* focus = thisWindow ;
+
+    unsigned char charCode ;
+    wxChar uniChar[2] ;
+    uniChar[0] = 0;
+    uniChar[1] = 0;
+
+    UInt32 keyCode ;
+    UInt32 modifiers ;
+    Point point ;
+    UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
+
+#if wxUSE_UNICODE
+    ByteCount dataSize = 0 ;
+    if ( GetEventParameter(event, kEventParamKeyUnicodes, typeUnicodeText,
+                           NULL, 0 , &dataSize, NULL ) == noErr)
+    {
+        UniChar buf[2] ;
+        int numChars = dataSize / sizeof( UniChar) + 1;
+
+        UniChar* charBuf = buf ;
+
+        if ( numChars * 2 > 4 )
+            charBuf = new UniChar[ numChars ] ;
+        GetEventParameter(event, kEventParamKeyUnicodes, typeUnicodeText, NULL,
+                          dataSize , NULL , charBuf) ;
+        charBuf[ numChars - 1 ] = 0;
+
+#if SIZEOF_WCHAR_T == 2
+        uniChar = charBuf[0] ;
+#else
+        wxMBConvUTF16 converter ;
+        converter.MB2WC( uniChar , (const char*)charBuf , 2 ) ;
+#endif
+
+        if ( numChars * 2 > 4 )
+            delete[] charBuf ;
+    }
+#endif
+
+    GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL,
+                      sizeof(char), NULL, &charCode );
+    GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL,
+                      sizeof(UInt32), NULL, &keyCode );
+    GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL,
+                      sizeof(UInt32), NULL, &modifiers );
+    GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL,
+                      sizeof(Point), NULL, &point );
+
+    UInt32 message = (keyCode << 8) + charCode;
+    switch ( GetEventKind( event ) )
+    {
+        case kEventRawKeyRepeat :
+        case kEventRawKeyDown :
+        {
+            WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ;
+            WXEVENTHANDLERCALLREF formerHandler =
+                wxTheApp->MacGetCurrentEventHandlerCallRef() ;
+
+            wxTheApp->MacSetCurrentEvent( event , handler ) ;
+            if ( /* focus && */ wxTheApp->MacSendKeyDownEvent(
+                focus, message, modifiers, when, point.h, point.v, uniChar[0]))
+            {
+                result = noErr ;
+            }
+            wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ;
+        }
+        break ;
+
+        case kEventRawKeyUp :
+            if ( /* focus && */ wxTheApp->MacSendKeyUpEvent(
+                focus , message , modifiers , when , point.h , point.v , uniChar[0] ) )
+            {
+                result = noErr ;
+            }
+            break ;
+
+        case kEventRawKeyModifiersChanged :
+            {
+                wxKeyEvent event(wxEVT_KEY_DOWN);
+
+                event.m_shiftDown = modifiers & shiftKey;
+                event.m_controlDown = modifiers & controlKey;
+                event.m_altDown = modifiers & optionKey;
+                event.m_metaDown = modifiers & cmdKey;
+                event.m_x = point.h;
+                event.m_y = point.v;
+
+#if wxUSE_UNICODE
+                event.m_uniChar = uniChar[0] ;
+#endif
+
+                event.SetTimestamp(when);
+                event.SetEventObject(focus);
+
+                if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & controlKey )
+                {
+                    event.m_keyCode = WXK_CONTROL ;
+                    event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & shiftKey )
+                {
+                    event.m_keyCode = WXK_SHIFT ;
+                    event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & optionKey )
+                {
+                    event.m_keyCode = WXK_ALT ;
+                    event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & cmdKey )
+                {
+                    event.m_keyCode = WXK_COMMAND ;
+                    event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+
+                wxApp::s_lastModifiers = modifiers ;
+            }
+            break ;
+
+        default:
+            break;
+    }
+
+    return result ;
+}
+
+static pascal OSStatus wxWebViewWebKitEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+{
+    OSStatus result = eventNotHandledErr ;
+
+    wxMacCarbonEvent cEvent( event ) ;
+
+    ControlRef controlRef ;
+    wxWebViewWebKit* thisWindow = (wxWebViewWebKit*) data ;
+    wxNonOwnedWindow* tlw = NULL;
+    if (thisWindow)
+        tlw = thisWindow->MacGetTopLevelWindow();
+
+    cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ;
+
+    wxWindow* currentMouseWindow = thisWindow ;
+
+    if ( wxApp::s_captureWindow )
+        currentMouseWindow = wxApp::s_captureWindow;
+
+    switch ( GetEventClass( event ) )
+    {
+        case kEventClassKeyboard:
+        {
+            result = wxWebKitKeyEventHandler(handler, event, data);
+            break;
+        }
+
+        case kEventClassTextInput:
+        {
+            result = wxMacUnicodeTextEventHandler(handler, event, data);
+            break;
+        }
+
+        case kEventClassMouse:
+        {
+            switch ( GetEventKind( event ) )
+            {
+                case kEventMouseDragged :
+                case kEventMouseMoved :
+                case kEventMouseDown :
+                case kEventMouseUp :
+                {
+                    wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
+                    SetupMouseEvent( wxevent , cEvent ) ;
+
+                    currentMouseWindow->ScreenToClient( &wxevent.m_x , &wxevent.m_y ) ;
+                    wxevent.SetEventObject( currentMouseWindow ) ;
+                    wxevent.SetId( currentMouseWindow->GetId() ) ;
+
+                    if ( currentMouseWindow->GetEventHandler()->ProcessEvent(wxevent) )
+                    {
+                        result = noErr;
+                    }
+
+                    break; // this should enable WebKit to fire mouse dragged and mouse up events...
+                }
+                default :
+                    break ;
+            }
+        }
+        default:
+            break;
+    }
+
+    result = CallNextEventHandler(handler, event);
+    return result ;
+}
+
+DEFINE_ONE_SHOT_HANDLER_GETTER( wxWebViewWebKitEventHandler )
+
+#endif
+
+//---------------------------------------------------------
+// helper functions for NSString<->wxString conversion
+//---------------------------------------------------------
+
+inline wxString wxStringWithNSString(NSString *nsstring)
+{
+#if wxUSE_UNICODE
+    return wxString([nsstring UTF8String], wxConvUTF8);
+#else
+    return wxString([nsstring lossyCString]);
+#endif // wxUSE_UNICODE
+}
+
+inline NSString* wxNSStringWithWxString(const wxString &wxstring)
+{
+#if wxUSE_UNICODE
+    return [NSString stringWithUTF8String: wxstring.mb_str(wxConvUTF8)];
+#else
+    return [NSString stringWithCString: wxstring.c_str() length:wxstring.Len()];
+#endif // wxUSE_UNICODE
+}
+
+inline int wxNavTypeFromWebNavType(int type){
+    if (type == WebNavigationTypeLinkClicked)
+        return wxWEBKIT_NAV_LINK_CLICKED;
+
+    if (type == WebNavigationTypeFormSubmitted)
+        return wxWEBKIT_NAV_FORM_SUBMITTED;
+
+    if (type == WebNavigationTypeBackForward)
+        return wxWEBKIT_NAV_BACK_NEXT;
+
+    if (type == WebNavigationTypeReload)
+        return wxWEBKIT_NAV_RELOAD;
+
+    if (type == WebNavigationTypeFormResubmitted)
+        return wxWEBKIT_NAV_FORM_RESUBMITTED;
+
+    return wxWEBKIT_NAV_OTHER;
+}
+
+@interface MyFrameLoadMonitor : NSObject
+{
+    wxWebViewWebKit* webKitWindow;
+}
+
+- initWithWxWindow: (wxWebViewWebKit*)inWindow;
+
+@end
+
+@interface MyPolicyDelegate : NSObject
+{
+    wxWebViewWebKit* webKitWindow;
+}
+
+- initWithWxWindow: (wxWebViewWebKit*)inWindow;
+
+@end
+
+// ----------------------------------------------------------------------------
+// creation/destruction
+// ----------------------------------------------------------------------------
+
+bool wxWebViewWebKit::Create(wxWindow *parent,
+                                 wxWindowID winID,
+                                 const wxString& strURL,
+                                 const wxPoint& pos,
+                                 const wxSize& size, long style,
+                                 const wxString& name)
+{
+    m_busy = false;
+    //m_pageTitle = _("Untitled Page");
+
+ //still needed for wxCocoa??
+/*
+    int width, height;
+    wxSize sizeInstance;
+    if (size.x == wxDefaultCoord || size.y == wxDefaultCoord)
+    {
+        m_parent->GetClientSize(&width, &height);
+        sizeInstance.x = width;
+        sizeInstance.y = height;
+    }
+    else
+    {
+        sizeInstance.x = size.x;
+        sizeInstance.y = size.y;
+    }
+*/
+    // now create and attach WebKit view...
+#ifdef __WXCOCOA__
+    wxControl::Create(parent, m_windowID, pos, sizeInstance, style, name);
+    SetSize(pos.x, pos.y, sizeInstance.x, sizeInstance.y);
+
+    wxTopLevelWindowCocoa *topWin = wxDynamicCast(this, wxTopLevelWindowCocoa);
+    NSWindow* nsWin = topWin->GetNSWindow();
+    NSRect rect;
+    rect.origin.x = pos.x;
+    rect.origin.y = pos.y;
+    rect.size.width = sizeInstance.x;
+    rect.size.height = sizeInstance.y;
+    m_webView = (WebView*)[[WebView alloc] initWithFrame:rect
+                                               frameName:@"webkitFrame"
+                                               groupName:@"webkitGroup"];
+    SetNSView(m_webView);
+    [m_cocoaNSView release];
+
+    if(m_parent) m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,sizeInstance);
+#else
+    m_macIsUserPane = false;
+    wxControl::Create(parent, winID, pos, size, style, wxDefaultValidator, name);
+
+#if wxOSX_USE_CARBON
+    m_peer = new wxMacControl(this);
+    WebInitForCarbon();
+    HIWebViewCreate( m_peer->GetControlRefAddr() );
+
+    m_webView = (WebView*) HIWebViewGetWebView( m_peer->GetControlRef() );
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
+    if ( UMAGetSystemVersion() >= 0x1030 )
+        HIViewChangeFeatures( m_peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
+#endif
+    InstallControlEventHandler(m_peer->GetControlRef(),
+                               GetwxWebViewWebKitEventHandlerUPP(),
+                               GetEventTypeCount(eventList), eventList, this,
+                              (EventHandlerRef *)&m_webKitCtrlEventHandler);
+#else
+    NSRect r = wxOSXGetFrameForControl( this, pos , size ) ;
+    m_webView = [[WebView alloc] initWithFrame:r
+                                     frameName:@"webkitFrame"
+                                     groupName:@"webkitGroup"];
+    m_peer = new wxWidgetCocoaImpl( this, m_webView );
+#endif
+
+    wx_webviewctrls[m_webView] = this;
+
+    MacPostControlCreate(pos, size);
+
+#if wxOSX_USE_CARBON
+    HIViewSetVisible( m_peer->GetControlRef(), true );
+#endif
+    [m_webView setHidden:false];
+
+#endif
+
+    // Register event listener interfaces
+    MyFrameLoadMonitor* myFrameLoadMonitor =
+            [[MyFrameLoadMonitor alloc] initWithWxWindow: this];
+
+    [m_webView setFrameLoadDelegate:myFrameLoadMonitor];
+
+    // this is used to veto page loads, etc.
+    MyPolicyDelegate* myPolicyDelegate =
+            [[MyPolicyDelegate alloc] initWithWxWindow: this];
+
+    [m_webView setPolicyDelegate:myPolicyDelegate];
+
+    InternalLoadURL(strURL);
+    return true;
+}
+
+wxWebViewWebKit::~wxWebViewWebKit()
+{
+    MyFrameLoadMonitor* myFrameLoadMonitor = [m_webView frameLoadDelegate];
+    MyPolicyDelegate* myPolicyDelegate = [m_webView policyDelegate];
+    [m_webView setFrameLoadDelegate: nil];
+    [m_webView setPolicyDelegate: nil];
+
+    if (myFrameLoadMonitor)
+        [myFrameLoadMonitor release];
+
+    if (myPolicyDelegate)
+        [myPolicyDelegate release];
+}
+
+// ----------------------------------------------------------------------------
+// public methods
+// ----------------------------------------------------------------------------
+
+void wxWebViewWebKit::InternalLoadURL(const wxString &url)
+{
+    if( !m_webView )
+        return;
+
+    [[m_webView mainFrame] loadRequest:[NSURLRequest requestWithURL:
+            [NSURL URLWithString:wxNSStringWithWxString(url)]]];
+}
+
+bool wxWebViewWebKit::CanGoBack()
+{
+    if ( !m_webView )
+        return false;
+
+    return [m_webView canGoBack];
+}
+
+bool wxWebViewWebKit::CanGoForward()
+{
+    if ( !m_webView )
+        return false;
+
+    return [m_webView canGoForward];
+}
+
+void wxWebViewWebKit::GoBack()
+{
+    if ( !m_webView )
+        return;
+
+    bool result = [(WebView*)m_webView goBack];
+
+    // TODO: return result (if it also exists in other backends...)
+    //return result;
+}
+
+void wxWebViewWebKit::GoForward()
+{
+    if ( !m_webView )
+        return;
+
+    bool result = [(WebView*)m_webView goForward];
+
+    // TODO: return result (if it also exists in other backends...)
+    //return result;
+}
+
+void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags)
+{
+    if ( !m_webView )
+        return;
+
+    if (flags & wxWEB_VIEW_RELOAD_NO_CACHE)
+    {
+        // TODO: test this indeed bypasses the cache
+        [[m_webView preferences] setUsesPageCache:NO];
+        [[m_webView mainFrame] reload];
+        [[m_webView preferences] setUsesPageCache:YES];
+    }
+    else
+    {
+        [[m_webView mainFrame] reload];
+    }
+}
+
+void wxWebViewWebKit::Stop()
+{
+    if ( !m_webView )
+        return;
+
+    [[m_webView mainFrame] stopLoading];
+}
+
+bool wxWebViewWebKit::CanGetPageSource()
+{
+    if ( !m_webView )
+        return false;
+
+    WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
+    return ( [[dataSource representation] canProvideDocumentSource] );
+}
+
+wxString wxWebViewWebKit::GetPageSource()
+{
+
+    if (CanGetPageSource())
+       {
+        WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
+               wxASSERT (dataSource != nil);
+
+               id<WebDocumentRepresentation> representation = [dataSource representation];
+               wxASSERT (representation != nil);
+
+               NSString* source = [representation documentSource];
+               if (source == nil)
+               {
+                       return wxEmptyString;
+               }
+
+        return wxStringWithNSString( source );
+    }
+
+    return wxEmptyString;
+}
+
+wxString wxWebViewWebKit::GetSelection()
+{
+    if ( !m_webView )
+        return wxEmptyString;
+
+    NSString* selectedText = [[m_webView selectedDOMRange] toString];
+    return wxStringWithNSString( selectedText );
+}
+
+bool wxWebViewWebKit::CanIncreaseTextSize()
+{
+    if ( !m_webView )
+        return false;
+
+    if ([m_webView canMakeTextLarger])
+        return true;
+    else
+        return false;
+}
+
+void wxWebViewWebKit::IncreaseTextSize()
+{
+    if ( !m_webView )
+        return;
+
+    if (CanIncreaseTextSize())
+        [m_webView makeTextLarger:(WebView*)m_webView];
+}
+
+bool wxWebViewWebKit::CanDecreaseTextSize()
+{
+    if ( !m_webView )
+        return false;
+
+    if ([m_webView canMakeTextSmaller])
+        return true;
+    else
+        return false;
+}
+
+void wxWebViewWebKit::DecreaseTextSize()
+{
+    if ( !m_webView )
+        return;
+
+    if (CanDecreaseTextSize())
+        [m_webView makeTextSmaller:(WebView*)m_webView];
+}
+
+void wxWebViewWebKit::Print()
+{
+
+    // TODO: allow specifying the "show prompt" parameter in Print() ?
+    bool showPrompt = true;
+
+    if ( !m_webView )
+        return;
+
+    id view = [[[m_webView mainFrame] frameView] documentView];
+    NSPrintOperation *op = [NSPrintOperation printOperationWithView:view
+                                 printInfo: [NSPrintInfo sharedPrintInfo]];
+    if (showPrompt)
+    {
+        [op setShowsPrintPanel: showPrompt];
+        // in my tests, the progress bar always freezes and it stops the whole
+        // print operation. do not turn this to true unless there is a 
+        // workaround for the bug.
+        [op setShowsProgressPanel: false];
+    }
+    // Print it.
+    [op runOperation];
+}
+
+void wxWebViewWebKit::SetEditable(bool enable)
+{
+    if ( !m_webView )
+        return;
+
+    [m_webView setEditable:enable ];
+}
+
+bool wxWebViewWebKit::IsEditable()
+{
+    if ( !m_webView )
+        return false;
+
+    return [m_webView isEditable];
+}
+
+void wxWebViewWebKit::SetZoomType(wxWebViewZoomType zoomType)
+{
+    // there is only one supported zoom type at the moment so this setter
+    // does nothing beyond checking sanity
+    wxASSERT(zoomType == wxWEB_VIEW_ZOOM_TYPE_TEXT);
+}
+
+wxWebViewZoomType wxWebViewWebKit::GetZoomType() const
+{
+    // for now that's the only one that is supported
+    // FIXME: does the default zoom type change depending on webkit versions? :S
+    //        Then this will be wrong
+    return wxWEB_VIEW_ZOOM_TYPE_TEXT;
+}
+
+bool wxWebViewWebKit::CanSetZoomType(wxWebViewZoomType type) const
+{
+    switch (type)
+    {
+        // for now that's the only one that is supported
+        // TODO: I know recent versions of webkit support layout zoom too,
+        //       check if we can support it
+        case wxWEB_VIEW_ZOOM_TYPE_TEXT:
+            return true;
+
+        default:
+            return false;
+    }
+}
+
+int wxWebViewWebKit::GetScrollPos()
+{
+    id result = [[m_webView windowScriptObject]
+                    evaluateWebScript:@"document.body.scrollTop"];
+    return [result intValue];
+}
+
+void wxWebViewWebKit::SetScrollPos(int pos)
+{
+    if ( !m_webView )
+        return;
+
+    wxString javascript;
+    javascript.Printf(wxT("document.body.scrollTop = %d;"), pos);
+    [[m_webView windowScriptObject] evaluateWebScript:
+            (NSString*)wxNSStringWithWxString( javascript )];
+}
+
+wxString wxWebViewWebKit::GetSelectedText()
+{
+    NSString* selection = [[m_webView selectedDOMRange] markupString];
+    if (!selection) return wxEmptyString;
+
+    return wxStringWithNSString(selection);
+}
+
+void wxWebViewWebKit::RunScript(const wxString& javascript)
+{
+    if ( !m_webView )
+        return wxEmptyString;
+
+    [[m_webView windowScriptObject] evaluateWebScript:
+                    (NSString*)wxNSStringWithWxString( javascript )];
+}
+
+void wxWebViewWebKit::OnSize(wxSizeEvent &event)
+{
+#if defined(__WXMAC_) && wxOSX_USE_CARBON
+    // This is a nasty hack because WebKit seems to lose its position when it is
+    // embedded in a control that is not itself the content view for a TLW.
+    // I put it in OnSize because these calcs are not perfect, and in fact are
+    // basically guesses based on reverse engineering, so it's best to give
+    // people the option of overriding OnSize with their own calcs if need be.
+    // I also left some test debugging print statements as a convenience if
+    // a(nother) problem crops up.
+
+    wxWindow* tlw = MacGetTopLevelWindow();
+
+    NSRect frame = [(WebView*)m_webView frame];
+    NSRect bounds = [(WebView*)m_webView bounds];
+
+#if DEBUG_WEBKIT_SIZING
+    fprintf(stderr,"Carbon window x=%d, y=%d, width=%d, height=%d\n",
+            GetPosition().x, GetPosition().y, GetSize().x, GetSize().y);
+    fprintf(stderr, "Cocoa window frame x=%G, y=%G, width=%G, height=%G\n",
+            frame.origin.x, frame.origin.y,
+            frame.size.width, frame.size.height);
+    fprintf(stderr, "Cocoa window bounds x=%G, y=%G, width=%G, height=%G\n",
+            bounds.origin.x, bounds.origin.y,
+            bounds.size.width, bounds.size.height);
+#endif
+
+    // This must be the case that Apple tested with, because well, in this one case
+    // we don't need to do anything! It just works. ;)
+    if (GetParent() == tlw) return;
+
+    // since we no longer use parent coordinates, we always want 0,0.
+    int x = 0;
+    int y = 0;
+
+    HIRect rect;
+    rect.origin.x = x;
+    rect.origin.y = y;
+
+#if DEBUG_WEBKIT_SIZING
+    printf("Before conversion, origin is: x = %d, y = %d\n", x, y);
+#endif
+
+    // NB: In most cases, when calling HIViewConvertRect, what people want is to
+    // use GetRootControl(), and this tripped me up at first. But in fact, what
+    // we want is the root view, because we need to make the y origin relative
+    // to the very top of the window, not its contents, since we later flip
+    // the y coordinate for Cocoa.
+    HIViewConvertRect (&rect, m_peer->GetControlRef(),
+                                HIViewGetRoot(
+                                    (WindowRef) MacGetTopLevelWindowRef()
+                                 ));
+
+    x = (int)rect.origin.x;
+    y = (int)rect.origin.y;
+
+#if DEBUG_WEBKIT_SIZING
+    printf("Moving Cocoa frame origin to: x = %d, y = %d\n", x, y);
+#endif
+
+    if (tlw){
+        //flip the y coordinate to convert to Cocoa coordinates
+        y = tlw->GetSize().y - ((GetSize().y) + y);
+    }
+
+#if DEBUG_WEBKIT_SIZING
+    printf("y = %d after flipping value\n", y);
+#endif
+
+    frame.origin.x = x;
+    frame.origin.y = y;
+    [(WebView*)m_webView setFrame:frame];
+
+    if (IsShown())
+        [(WebView*)m_webView display];
+    event.Skip();
+#endif
+}
+
+void wxWebViewWebKit::MacVisibilityChanged(){
+#if defined(__WXMAC__) && wxOSX_USE_CARBON
+    bool isHidden = !IsControlVisible( m_peer->GetControlRef());
+    if (!isHidden)
+        [(WebView*)m_webView display];
+
+    [m_webView setHidden:isHidden];
+#endif
+}
+
+void wxWebViewWebKit::LoadUrl(const wxString& url)
+{
+    InternalLoadURL(url);
+}
+
+wxString wxWebViewWebKit::GetCurrentURL()
+{
+    return wxStringWithNSString([m_webView mainFrameURL]);
+}
+
+wxString wxWebViewWebKit::GetCurrentTitle()
+{
+    return GetPageTitle();
+}
+
+float wxWebViewWebKit::GetWebkitZoom()
+{
+    return [m_webView textSizeMultiplier];
+}
+
+void wxWebViewWebKit::SetWebkitZoom(float zoom)
+{
+    [m_webView setTextSizeMultiplier:zoom];
+}
+
+wxWebViewZoom wxWebViewWebKit::GetZoom()
+{
+    float zoom = GetWebkitZoom();
+
+    // arbitrary way to map float zoom to our common zoom enum
+    if (zoom <= 0.55)
+    {
+        return wxWEB_VIEW_ZOOM_TINY;
+    }
+    else if (zoom > 0.55 && zoom <= 0.85)
+    {
+        return wxWEB_VIEW_ZOOM_SMALL;
+    }
+    else if (zoom > 0.85 && zoom <= 1.15)
+    {
+        return wxWEB_VIEW_ZOOM_MEDIUM;
+    }
+    else if (zoom > 1.15 && zoom <= 1.45)
+    {
+        return wxWEB_VIEW_ZOOM_LARGE;
+    }
+    else if (zoom > 1.45)
+    {
+        return wxWEB_VIEW_ZOOM_LARGEST;
+    }
+
+    // to shut up compilers, this can never be reached logically
+    wxASSERT(false);
+    return wxWEB_VIEW_ZOOM_MEDIUM;
+}
+
+void wxWebViewWebKit::SetZoom(wxWebViewZoom zoom)
+{
+    // arbitrary way to map our common zoom enum to float zoom
+    switch (zoom)
+    {
+        case wxWEB_VIEW_ZOOM_TINY:
+            SetWebkitZoom(0.4f);
+            break;
+
+        case wxWEB_VIEW_ZOOM_SMALL:
+            SetWebkitZoom(0.7f);
+            break;
+
+        case wxWEB_VIEW_ZOOM_MEDIUM:
+            SetWebkitZoom(1.0f);
+            break;
+
+        case wxWEB_VIEW_ZOOM_LARGE:
+            SetWebkitZoom(1.3);
+            break;
+
+        case wxWEB_VIEW_ZOOM_LARGEST:
+            SetWebkitZoom(1.6);
+            break;
+
+        default:
+            wxASSERT(false);
+    }
+
+}
+
+void wxWebViewWebKit::SetPage(const wxString& src, const wxString& baseUrl)
+{
+   if ( !m_webView )
+        return;
+
+    [[m_webView mainFrame] loadHTMLString:(NSString*)wxNSStringWithWxString(src)
+                                  baseURL:[NSURL URLWithString:
+                                    wxNSStringWithWxString( baseUrl )]];
+}
+
+void wxWebViewWebKit::Cut()
+{
+    if ( !m_webView )
+        return;
+
+    [(WebView*)m_webView cut];
+}
+
+void wxWebViewWebKit::Copy()
+{
+    if ( !m_webView )
+        return;
+
+    [(WebView*)m_webView copy];
+}
+
+void wxWebViewWebKit::Paste()
+{
+    if ( !m_webView )
+        return;
+
+    [(WebView*)m_webView paste];
+}
+
+void wxWebViewWebKit::DeleteSelection()
+{
+    if ( !m_webView )
+        return;
+
+    [(WebView*)m_webView deleteSelection];
+}
+
+//------------------------------------------------------------
+// Listener interfaces
+//------------------------------------------------------------
+
+// NB: I'm still tracking this down, but it appears the Cocoa window
+// still has these events fired on it while the Carbon control is being
+// destroyed. Therefore, we must be careful to check both the existence
+// of the Carbon control and the event handler before firing events.
+
+@implementation MyFrameLoadMonitor
+
+- initWithWxWindow: (wxWebViewWebKit*)inWindow
+{
+    [super init];
+    webKitWindow = inWindow;    // non retained
+    return self;
+}
+
+- (void)webView:(WebView *)sender
+    didStartProvisionalLoadForFrame:(WebFrame *)frame
+{
+       wxASSERT(wx_webviewctrls.find(sender) != wx_webviewctrls.end());
+    wx_webviewctrls[sender]->m_busy = true;
+}
+
+- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame
+{
+       wxASSERT(wx_webviewctrls.find(sender) != wx_webviewctrls.end());
+    wx_webviewctrls[sender]->m_busy = true;
+
+    if (webKitWindow && frame == [sender mainFrame]){
+        NSString *url = [[[[frame dataSource] request] URL] absoluteString];
+        wxString target = wxStringWithNSString([frame name]);
+        wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
+                                       wx_webviewctrls[sender]->GetId(),
+                                       wxStringWithNSString( url ),
+                                       target, false);
+
+        if (webKitWindow && webKitWindow->GetEventHandler())
+            webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
+    }
+}
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+       wxASSERT(wx_webviewctrls.find(sender) != wx_webviewctrls.end());
+    wx_webviewctrls[sender]->m_busy = false;
+
+    if (webKitWindow && frame == [sender mainFrame]){
+        NSString *url = [[[[frame dataSource] request] URL] absoluteString];
+
+        wxString target = wxStringWithNSString([frame name]);
+        wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_LOADED,
+                                       wx_webviewctrls[sender]->GetId(),
+                                       wxStringWithNSString( url ),
+                                       target, false);
+
+        if (webKitWindow && webKitWindow->GetEventHandler())
+            webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
+    }
+}
+
+wxString nsErrorToWxHtmlError(NSError* error, wxWebNavigationError* out)
+{
+    *out = wxWEB_NAV_ERR_OTHER;
+
+    if ([[error domain] isEqualToString:NSURLErrorDomain])
+    {
+        switch ([error code])
+        {
+            case NSURLErrorCannotFindHost:
+            case NSURLErrorFileDoesNotExist:
+            case NSURLErrorRedirectToNonExistentLocation:
+                *out = wxWEB_NAV_ERR_NOT_FOUND;
+                break;
+
+            case NSURLErrorResourceUnavailable:
+            case NSURLErrorHTTPTooManyRedirects:
+            case NSURLErrorDataLengthExceedsMaximum:
+            case NSURLErrorBadURL:
+            case NSURLErrorFileIsDirectory:
+                *out = wxWEB_NAV_ERR_REQUEST;
+                break;
+
+            case NSURLErrorTimedOut:
+            case NSURLErrorDNSLookupFailed:
+            case NSURLErrorNetworkConnectionLost:
+            case NSURLErrorCannotConnectToHost:
+            case NSURLErrorNotConnectedToInternet:
+            //case NSURLErrorInternationalRoamingOff:
+            //case NSURLErrorCallIsActive:
+            //case NSURLErrorDataNotAllowed:
+                *out = wxWEB_NAV_ERR_CONNECTION;
+                break;
+
+            case NSURLErrorCancelled:
+            case NSURLErrorUserCancelledAuthentication:
+                *out = wxWEB_NAV_ERR_USER_CANCELLED;
+                break;
+
+            case NSURLErrorCannotDecodeRawData:
+            case NSURLErrorCannotDecodeContentData:
+            case NSURLErrorBadServerResponse:
+            case NSURLErrorCannotParseResponse:
+                *out = wxWEB_NAV_ERR_REQUEST;
+                break;
+
+            case NSURLErrorUserAuthenticationRequired:
+            case NSURLErrorSecureConnectionFailed:
+            case NSURLErrorClientCertificateRequired:
+                *out = wxWEB_NAV_ERR_AUTH;
+                break;
+
+            case NSURLErrorNoPermissionsToReadFile:
+                               *out = wxWEB_NAV_ERR_SECURITY;
+                break;
+
+            case NSURLErrorServerCertificateHasBadDate:
+            case NSURLErrorServerCertificateUntrusted:
+            case NSURLErrorServerCertificateHasUnknownRoot:
+            case NSURLErrorServerCertificateNotYetValid:
+            case NSURLErrorClientCertificateRejected:
+                *out = wxWEB_NAV_ERR_CERTIFICATE;
+                break;
+        }
+    }
+
+    wxString message = wxStringWithNSString([error localizedDescription]);
+    NSString* detail = [error localizedFailureReason];
+    if (detail != NULL)
+    {
+        message = message + " (" + wxStringWithNSString(detail) + ")";
+    }
+    return message;
+}
+
+- (void)webView:(WebView *)sender didFailLoadWithError:(NSError*) error
+        forFrame:(WebFrame *)frame
+{
+       wxASSERT(wx_webviewctrls.find(sender) != wx_webviewctrls.end());
+    wx_webviewctrls[sender]->m_busy = false;
+
+    if (webKitWindow && frame == [sender mainFrame]){
+        NSString *url = [[[[frame dataSource] request] URL] absoluteString];
+
+        wxWebNavigationError type;
+        wxString description = nsErrorToWxHtmlError(error, &type);
+               wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
+                                              wx_webviewctrls[sender]->GetId(),
+                                       wxStringWithNSString( url ),
+                                       wxEmptyString, false);
+               thisEvent.SetString(description);
+               thisEvent.SetInt(type);
+
+               if (webKitWindow && webKitWindow->GetEventHandler())
+               {
+                       webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
+               }
+    }
+}
+
+- (void)webView:(WebView *)sender
+        didFailProvisionalLoadWithError:(NSError*)error
+                               forFrame:(WebFrame *)frame
+{
+       wxASSERT(wx_webviewctrls.find(sender) != wx_webviewctrls.end());
+    wx_webviewctrls[sender]->m_busy = false;
+
+    if (webKitWindow && frame == [sender mainFrame]){
+        NSString *url = [[[[frame provisionalDataSource] request] URL]
+                            absoluteString];
+
+               wxWebNavigationError type;
+        wxString description = nsErrorToWxHtmlError(error, &type);
+               wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_ERROR,
+                                              wx_webviewctrls[sender]->GetId(),
+                                       wxStringWithNSString( url ),
+                                       wxEmptyString, false);
+               thisEvent.SetString(description);
+               thisEvent.SetInt(type);
+
+               if (webKitWindow && webKitWindow->GetEventHandler())
+                       webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
+    }
+}
+
+- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title
+                                         forFrame:(WebFrame *)frame
+{
+    if (webKitWindow && frame == [sender mainFrame])
+    {
+        webKitWindow->SetPageTitle(wxStringWithNSString( title ));
+    }
+}
+@end
+
+@implementation MyPolicyDelegate
+
+- initWithWxWindow: (wxWebViewWebKit*)inWindow
+{
+    [super init];
+    webKitWindow = inWindow;    // non retained
+    return self;
+}
+
+- (void)webView:(WebView *)sender
+        decidePolicyForNavigationAction:(NSDictionary *)actionInformation
+                                request:(NSURLRequest *)request
+                                  frame:(WebFrame *)frame
+                       decisionListener:(id<WebPolicyDecisionListener>)listener
+{
+    wxUnusedVar(frame);
+
+    wxASSERT(wx_webviewctrls.find(sender) != wx_webviewctrls.end());
+    wx_webviewctrls[sender]->m_busy = true;
+    NSString *url = [[request URL] absoluteString];
+    wxString target = wxStringWithNSString([frame name]);
+    wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
+                                   wx_webviewctrls[sender]->GetId(),
+                                   wxStringWithNSString( url ), target, true);
+
+    if (webKitWindow && webKitWindow->GetEventHandler())
+        webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
+
+    if (thisEvent.IsVetoed())
+    {
+        wx_webviewctrls[sender]->m_busy = false;
+        [listener ignore];
+    }
+    else
+    {
+        [listener use];
+    }
+}
+
+- (void)webView:(WebView *)sender 
+      decidePolicyForNewWindowAction:(NSDictionary *)actionInformation
+                             request:(NSURLRequest *)request
+                        newFrameName:(NSString *)frameName
+                    decisionListener:(id < WebPolicyDecisionListener >)listener
+{
+    wxUnusedVar(actionInformation);
+    
+    wxASSERT(wx_webviewctrls.find(sender) != wx_webviewctrls.end());
+    NSString *url = [[request URL] absoluteString];
+    wxString target = wxStringWithNSString([frame name]);
+    wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
+                                   wx_webviewctrls[sender]->GetId(),
+                                   wxStringWithNSString( url ), target, true);
+
+    if (webKitWindow && webKitWindow->GetEventHandler())
+        webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
+
+    [listener ignore];
+}
+@end
+
+#endif //wxHAVE_WEB_BACKEND_OSX_WEBKIT
diff --git a/tests/controls/webtest.cpp b/tests/controls/webtest.cpp
new file mode 100644 (file)
index 0000000..ae4cfe2
--- /dev/null
@@ -0,0 +1,247 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        tests/controls/webtest.cpp
+// Purpose:     wxWebView unit test
+// Author:      Steven Lamerton
+// Created:     2011-07-08
+// RCS-ID:      $Id$
+// Copyright:   (c) 2011 Steven Lamerton
+///////////////////////////////////////////////////////////////////////////////
+
+#include "testprec.h"
+
+#if wxUSE_WEB
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+#endif // WX_PRECOMP
+
+#include "testableframe.h"
+#include "wx/uiaction.h"
+#include "wx/webview.h"
+#include "asserthelper.h"
+
+class WebTestCase : public CppUnit::TestCase
+{
+public:
+    WebTestCase() { }
+
+    void setUp();
+    void tearDown();
+
+private:
+    CPPUNIT_TEST_SUITE( WebTestCase );
+        CPPUNIT_TEST( Title );
+        CPPUNIT_TEST( Url );
+        CPPUNIT_TEST( History );
+        CPPUNIT_TEST( HistoryEnable );
+        CPPUNIT_TEST( HistoryClear );
+        CPPUNIT_TEST( HistoryList );
+        CPPUNIT_TEST( Editable );
+        CPPUNIT_TEST( Selection );
+        CPPUNIT_TEST( Zoom );
+        CPPUNIT_TEST( RunScript );
+    CPPUNIT_TEST_SUITE_END();
+
+    void Title();
+    void Url();
+    void History();
+    void HistoryEnable();
+    void HistoryClear();
+    void HistoryList();
+    void Editable();
+    void Selection();
+    void Zoom();
+    void RunScript();
+    void LoadUrl(int times = 1);
+
+    wxWebView* m_browser;
+
+    DECLARE_NO_COPY_CLASS(WebTestCase)
+};
+
+// register in the unnamed registry so that these tests are run by default
+CPPUNIT_TEST_SUITE_REGISTRATION( WebTestCase );
+
+// also include in its own registry so that these tests can be run alone
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( WebTestCase, "WebTestCase" );
+
+void WebTestCase::setUp()
+{
+    m_browser = wxWebView::New(wxTheApp->GetTopWindow(), wxID_ANY);
+    //We yield to let the initial page load
+    wxYield();
+}
+
+void WebTestCase::tearDown()
+{
+    wxDELETE(m_browser);
+}
+
+void WebTestCase::LoadUrl(int times)
+{
+    //We alternate between urls as otherwise webkit merges them in the history
+    //we use about and about blank to avoid the need for a network connection
+    for(int i = 0; i < times; i++)
+    {
+        if(i % 2 == 1)
+            m_browser->LoadUrl("about:blank");
+        else
+            m_browser->LoadUrl("about:");
+        wxYield();
+    }
+}
+
+void WebTestCase::Title()
+{
+    CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentTitle());
+
+    //Test title after loading raw html
+    m_browser->SetPage("<html><title>Title</title><body>Text</body></html>", "");
+    wxYield();
+    CPPUNIT_ASSERT_EQUAL("Title", m_browser->GetCurrentTitle());
+
+    //Test title after loading a url, we yield to let events process
+    LoadUrl();
+    CPPUNIT_ASSERT_EQUAL("", m_browser->GetCurrentTitle());
+}
+
+void WebTestCase::Url()
+{
+    CPPUNIT_ASSERT_EQUAL("about:blank", m_browser->GetCurrentURL());
+
+    //After first loading about:blank the next in the sequence is about:
+    LoadUrl();
+    CPPUNIT_ASSERT_EQUAL("about:", m_browser->GetCurrentURL());
+}
+
+void WebTestCase::History()
+{
+    LoadUrl(3);
+
+    CPPUNIT_ASSERT(m_browser->CanGoBack());
+    CPPUNIT_ASSERT(!m_browser->CanGoForward());
+
+    m_browser->GoBack();
+
+    CPPUNIT_ASSERT(m_browser->CanGoBack());
+    CPPUNIT_ASSERT(m_browser->CanGoForward());
+
+    m_browser->GoBack();
+    m_browser->GoBack();
+
+    //We should now be at the start of the history
+    CPPUNIT_ASSERT(!m_browser->CanGoBack());
+    CPPUNIT_ASSERT(m_browser->CanGoForward());
+}
+
+void WebTestCase::HistoryEnable()
+{
+    LoadUrl();
+    m_browser->EnableHistory(false);
+
+    CPPUNIT_ASSERT(!m_browser->CanGoForward());
+    CPPUNIT_ASSERT(!m_browser->CanGoBack());
+
+    LoadUrl();
+
+    CPPUNIT_ASSERT(!m_browser->CanGoForward());
+    CPPUNIT_ASSERT(!m_browser->CanGoBack());
+}
+
+void WebTestCase::HistoryClear()
+{
+    LoadUrl(2);
+
+    //Now we are in the 'middle' of the history
+    m_browser->GoBack();
+    wxYield();
+
+    CPPUNIT_ASSERT(m_browser->CanGoForward());
+    CPPUNIT_ASSERT(m_browser->CanGoBack());
+
+    m_browser->ClearHistory();
+
+    CPPUNIT_ASSERT(!m_browser->CanGoForward());
+    CPPUNIT_ASSERT(!m_browser->CanGoBack());
+}
+
+void WebTestCase::HistoryList()
+{
+    LoadUrl(2);
+    m_browser->GoBack();
+
+    CPPUNIT_ASSERT_EQUAL(1, m_browser->GetBackwardHistory().size());
+    CPPUNIT_ASSERT_EQUAL(1, m_browser->GetForwardHistory().size());
+
+    m_browser->LoadHistoryItem(m_browser->GetForwardHistory()[0]);
+
+    CPPUNIT_ASSERT(!m_browser->CanGoForward());
+    CPPUNIT_ASSERT_EQUAL(2, m_browser->GetBackwardHistory().size());
+}
+
+void WebTestCase::Editable()
+{
+    CPPUNIT_ASSERT(!m_browser->IsEditable());
+
+    m_browser->SetEditable(true);
+
+    CPPUNIT_ASSERT(m_browser->IsEditable());
+
+    m_browser->SetEditable(false);
+
+    CPPUNIT_ASSERT(!m_browser->IsEditable());
+}
+
+void WebTestCase::Selection()
+{
+    m_browser->SetPage("<html><body>Some <strong>strong</strong> text</body></html>", "");
+    wxYield();
+    CPPUNIT_ASSERT(!m_browser->HasSelection());
+
+    m_browser->SelectAll();
+
+    CPPUNIT_ASSERT(m_browser->HasSelection());
+    CPPUNIT_ASSERT_EQUAL("Some strong text", m_browser->GetSelectedText());
+    //We lower case the result as ie returns tags in uppercase
+    CPPUNIT_ASSERT_EQUAL("some <strong>strong</strong> text", 
+                         m_browser->GetSelectedSource().Lower());
+
+    m_browser->ClearSelection();
+    CPPUNIT_ASSERT(!m_browser->HasSelection());  
+}
+
+void WebTestCase::Zoom()
+{
+    if(m_browser->CanSetZoomType(wxWEB_VIEW_ZOOM_TYPE_LAYOUT))
+    {
+        m_browser->SetZoomType(wxWEB_VIEW_ZOOM_TYPE_LAYOUT);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TYPE_LAYOUT, m_browser->GetZoomType());
+
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_TINY);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TINY, m_browser->GetZoom());
+    }
+
+    //Reset the zoom level
+    m_browser->SetZoom(wxWEB_VIEW_ZOOM_MEDIUM);
+
+    if(m_browser->CanSetZoomType(wxWEB_VIEW_ZOOM_TYPE_TEXT))
+    {
+        m_browser->SetZoomType(wxWEB_VIEW_ZOOM_TYPE_TEXT);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TYPE_TEXT, m_browser->GetZoomType());
+
+        m_browser->SetZoom(wxWEB_VIEW_ZOOM_TINY);
+        CPPUNIT_ASSERT_EQUAL(wxWEB_VIEW_ZOOM_TINY, m_browser->GetZoom());
+    }
+}
+
+void WebTestCase::RunScript()
+{
+    m_browser->RunScript("document.write(\"Hello World!\");");
+    CPPUNIT_ASSERT_EQUAL("Hello World!", m_browser->GetPageText());
+}
+
+#endif //wxUSE_WEB
index 3f816730c28f8ec542e88157ccf43477bcab31a4..4dc8feebdb8938074b0a78e85d6813eac84f67ae 100644 (file)
@@ -151,7 +151,7 @@ TEST_GUI_OBJECTS =  \
        $(OBJS)\test_gui_choicebooktest.obj \\r
        $(OBJS)\test_gui_choicetest.obj \\r
        $(OBJS)\test_gui_comboboxtest.obj \\r
-       $(OBJS)\test_gui_datepickerctrltest.obj \
+       $(OBJS)\test_gui_datepickerctrltest.obj \\r
        $(OBJS)\test_gui_frametest.obj \\r
        $(OBJS)\test_gui_gaugetest.obj \\r
        $(OBJS)\test_gui_gridtest.obj \\r
@@ -780,9 +780,9 @@ $(OBJS)\test_gui_choicetest.obj: .\controls\choicetest.cpp
 $(OBJS)\test_gui_comboboxtest.obj: .\controls\comboboxtest.cpp\r
        $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\comboboxtest.cpp\r
 \r
-$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp
-       $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp
-
+$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp\r
+       $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp\r
+\r
 $(OBJS)\test_gui_frametest.obj: .\controls\frametest.cpp\r
        $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\frametest.cpp\r
 \r
index 652df038cad17accb674f756836cbf4e8ad81135..48f40613116235f139f7e9f77db39924468ba4ca 100644 (file)
@@ -144,7 +144,7 @@ TEST_GUI_OBJECTS =  \
        $(OBJS)\test_gui_choicebooktest.o \\r
        $(OBJS)\test_gui_choicetest.o \\r
        $(OBJS)\test_gui_comboboxtest.o \\r
-       $(OBJS)\test_gui_datepickerctrltest.o \
+       $(OBJS)\test_gui_datepickerctrltest.o \\r
        $(OBJS)\test_gui_frametest.o \\r
        $(OBJS)\test_gui_gaugetest.o \\r
        $(OBJS)\test_gui_gridtest.o \\r
@@ -761,9 +761,9 @@ $(OBJS)\test_gui_choicetest.o: ./controls/choicetest.cpp
 $(OBJS)\test_gui_comboboxtest.o: ./controls/comboboxtest.cpp\r
        $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
 \r
-$(OBJS)\test_gui_datepickerctrltest.o: ./controls/datepickerctrltest.cpp
-       $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
-
+$(OBJS)\test_gui_datepickerctrltest.o: ./controls/datepickerctrltest.cpp\r
+       $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
+\r
 $(OBJS)\test_gui_frametest.o: ./controls/frametest.cpp\r
        $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
 \r
index a509e659eed4e66c1b4de9b7ef80b1cc3ad91bd6..c32d4fa9dd1a5229b5672ce0429ca5dfdf2ff39e 100644 (file)
@@ -146,7 +146,7 @@ TEST_GUI_OBJECTS =  \
        $(OBJS)\test_gui_choicebooktest.obj \\r
        $(OBJS)\test_gui_choicetest.obj \\r
        $(OBJS)\test_gui_comboboxtest.obj \\r
-       $(OBJS)\test_gui_datepickerctrltest.obj \
+       $(OBJS)\test_gui_datepickerctrltest.obj \\r
        $(OBJS)\test_gui_frametest.obj \\r
        $(OBJS)\test_gui_gaugetest.obj \\r
        $(OBJS)\test_gui_gridtest.obj \\r
@@ -906,9 +906,9 @@ $(OBJS)\test_gui_choicetest.obj: .\controls\choicetest.cpp
 $(OBJS)\test_gui_comboboxtest.obj: .\controls\comboboxtest.cpp\r
        $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\comboboxtest.cpp\r
 \r
-$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp
-       $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp
-
+$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp\r
+       $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp\r
+\r
 $(OBJS)\test_gui_frametest.obj: .\controls\frametest.cpp\r
        $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\frametest.cpp\r
 \r
index 12fca8172ad8d4383b0b520f81cfe90981420b3b..25630d784ddd3a95813101d79aeea088ed97c9e5 100644 (file)
@@ -390,7 +390,7 @@ TEST_GUI_OBJECTS =  &
        $(OBJS)\test_gui_choicebooktest.obj &\r
        $(OBJS)\test_gui_choicetest.obj &\r
        $(OBJS)\test_gui_comboboxtest.obj &\r
-       $(OBJS)\test_gui_datepickerctrltest.obj &
+       $(OBJS)\test_gui_datepickerctrltest.obj &\r
        $(OBJS)\test_gui_frametest.obj &\r
        $(OBJS)\test_gui_gaugetest.obj &\r
        $(OBJS)\test_gui_gridtest.obj &\r
@@ -820,9 +820,9 @@ $(OBJS)\test_gui_choicetest.obj :  .AUTODEPEND .\controls\choicetest.cpp
 $(OBJS)\test_gui_comboboxtest.obj :  .AUTODEPEND .\controls\comboboxtest.cpp\r
        $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
 \r
-$(OBJS)\test_gui_datepickerctrltest.obj :  .AUTODEPEND .\controls\datepickerctrltest.cpp
-       $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
-
+$(OBJS)\test_gui_datepickerctrltest.obj :  .AUTODEPEND .\controls\datepickerctrltest.cpp\r
+       $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
+\r
 $(OBJS)\test_gui_frametest.obj :  .AUTODEPEND .\controls\frametest.cpp\r
        $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
 \r
index 6530babbb109c7313253b901f7675695ec9b255d..e6d35ee6fdac63adbf2ea259f5f7c9c1b20853d2 100644 (file)
             controls/treebooktest.cpp
             controls/treectrltest.cpp
             controls/virtlistctrltest.cpp
+            controls/webtest.cpp
             controls/windowtest.cpp
             events/clone.cpp
             events/propagation.cpp
             window/setsize.cpp
             xml/xrctest.cpp
         </sources>
+        <wx-lib>web</wx-lib>
         <wx-lib>richtext</wx-lib>
         <wx-lib>media</wx-lib>
         <wx-lib>xrc</wx-lib>
index 4ebfd627270773ac05d22eebf0b1ac04dcd5a2fc..c4f64ae8bd32fbcab93c3131145172f432eeae3d 100644 (file)
@@ -307,10 +307,10 @@ SOURCE=.\config\config.cpp
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\controls\datepickerctrltest.cpp
-# End Source File
-# Begin Source File
-
+SOURCE=.\controls\datepickerctrltest.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\dummy.cpp\r
 # ADD BASE CPP /Yc"testprec.h"\r
 # ADD CPP /Yc"testprec.h"\r
index 344e7b10594117254548dfc5d5ede661f44b4e5a..b598f0dcb616bbda28196e600ec9fac552aa2693 100644 (file)
                                RelativePath=".\config\config.cpp">\r
                        </File>\r
                        <File\r
-                               RelativePath=".\controls\datepickerctrltest.cpp">
-                       </File>
-                       <File
+                               RelativePath=".\controls\datepickerctrltest.cpp">\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\dummy.cpp">\r
                                <FileConfiguration\r
                                        Name="Debug|Win32">\r
index 978c1aa7332da76ce4316b028f3e83f1131e56f9..e9e80d2a0f8a29098d016e884ba76597c6891716 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\controls\datepickerctrltest.cpp"
-                               >
-                       </File>
-                       <File
+                               RelativePath=".\controls\datepickerctrltest.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\dummy.cpp"\r
                                >\r
                                <FileConfiguration\r
index dc18d968728c5c572fad463b44ad53f1fbd8d68e..8680942bcaef041fc4c34a999844aafcd2ca8541 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\controls\datepickerctrltest.cpp"
-                               >
-                       </File>
-                       <File
+                               RelativePath=".\controls\datepickerctrltest.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\dummy.cpp"\r
                                >\r
                                <FileConfiguration\r