Merge branch 'macos_wkwebview' of https://github.com/TcT2k/wxWidgets

Use WKWebView for wxWebView Implementation under Apple systems.

See https://github.com/wxWidgets/wxWidgets/pull/2113
This commit is contained in:
Vadim Zeitlin
2021-01-16 16:20:58 +01:00
24 changed files with 394 additions and 2214 deletions

View File

@@ -3336,7 +3336,6 @@ COND_TOOLKIT_MSW_GUI_HDR = \
wx/msw/std.ico wx/msw/std.ico
@COND_TOOLKIT_MSW@GUI_HDR = $(COND_TOOLKIT_MSW_GUI_HDR) @COND_TOOLKIT_MSW@GUI_HDR = $(COND_TOOLKIT_MSW_GUI_HDR)
COND_TOOLKIT_OSX_COCOA_GUI_HDR = \ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \
wx/html/webkit.h \
wx/osx/accel.h \ wx/osx/accel.h \
wx/osx/anybutton.h \ wx/osx/anybutton.h \
wx/osx/app.h \ wx/osx/app.h \
@@ -3443,7 +3442,6 @@ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \
wx/osx/datetimectrl.h wx/osx/datetimectrl.h
@COND_TOOLKIT_OSX_COCOA@GUI_HDR = $(COND_TOOLKIT_OSX_COCOA_GUI_HDR) @COND_TOOLKIT_OSX_COCOA@GUI_HDR = $(COND_TOOLKIT_OSX_COCOA_GUI_HDR)
COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \
wx/html/webkit.h \
wx/osx/accel.h \ wx/osx/accel.h \
wx/osx/anybutton.h \ wx/osx/anybutton.h \
wx/osx/app.h \ wx/osx/app.h \
@@ -13228,7 +13226,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS = \
monodll_textctrl_osx.o \ monodll_textctrl_osx.o \
monodll_tglbtn_osx.o \ monodll_tglbtn_osx.o \
monodll_toolbar_osx.o \ monodll_toolbar_osx.o \
monodll_webkit.o \
monodll_colordlgosx.o \ monodll_colordlgosx.o \
monodll_fontdlgosx.o \ monodll_fontdlgosx.o \
monodll_osx_accel.o \ monodll_osx_accel.o \
@@ -13366,7 +13363,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \
monolib_textctrl_osx.o \ monolib_textctrl_osx.o \
monolib_tglbtn_osx.o \ monolib_tglbtn_osx.o \
monolib_toolbar_osx.o \ monolib_toolbar_osx.o \
monolib_webkit.o \
monolib_colordlgosx.o \ monolib_colordlgosx.o \
monolib_fontdlgosx.o \ monolib_fontdlgosx.o \
monolib_osx_accel.o \ monolib_osx_accel.o \
@@ -13504,7 +13500,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8 = \
coredll_textctrl_osx.o \ coredll_textctrl_osx.o \
coredll_tglbtn_osx.o \ coredll_tglbtn_osx.o \
coredll_toolbar_osx.o \ coredll_toolbar_osx.o \
coredll_webkit.o \
coredll_colordlgosx.o \ coredll_colordlgosx.o \
coredll_fontdlgosx.o \ coredll_fontdlgosx.o \
coredll_osx_accel.o \ coredll_osx_accel.o \
@@ -13642,7 +13637,6 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9 = \
corelib_textctrl_osx.o \ corelib_textctrl_osx.o \
corelib_tglbtn_osx.o \ corelib_tglbtn_osx.o \
corelib_toolbar_osx.o \ corelib_toolbar_osx.o \
corelib_webkit.o \
corelib_colordlgosx.o \ corelib_colordlgosx.o \
corelib_fontdlgosx.o \ corelib_fontdlgosx.o \
corelib_osx_accel.o \ corelib_osx_accel.o \
@@ -20059,12 +20053,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm
@@ -25327,12 +25315,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm
@@ -30676,12 +30658,6 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm
@@ -34933,12 +34909,6 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_toolbar_osx.o: $(srcdir)/src/osx/toolbar_osx.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/toolbar_osx.cpp
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_webkit.o: $(srcdir)/src/html/htmlctrl/webkit/webkit.mm $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/html/htmlctrl/webkit/webkit.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_colordlgosx.o: $(srcdir)/src/osx/carbon/colordlgosx.mm $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/colordlgosx.mm
@@ -37320,9 +37290,6 @@ OSX_CARBON_DIST: ALL_GUI_DIST
$(CP_P) $(MACDIR)/cocoa/*.mm $(DISTDIR)/src/osx/cocoa $(CP_P) $(MACDIR)/cocoa/*.mm $(DISTDIR)/src/osx/cocoa
mkdir $(DISTDIR)/src/osx/iphone mkdir $(DISTDIR)/src/osx/iphone
$(CP_P) $(MACDIR)/iphone/*.mm $(DISTDIR)/src/osx/iphone $(CP_P) $(MACDIR)/iphone/*.mm $(DISTDIR)/src/osx/iphone
mkdir $(DISTDIR)/src/html/htmlctrl
mkdir $(DISTDIR)/src/html/htmlctrl/webkit
$(CP_P) $(WXDIR)/src/html/htmlctrl/webkit/*.mm $(DISTDIR)/src/html/htmlctrl/webkit
mkdir $(DISTDIR)/src/osx/carbon mkdir $(DISTDIR)/src/osx/carbon
$(CP_P) $(MACDIR)/carbon/*.cpp $(DISTDIR)/src/osx/carbon $(CP_P) $(MACDIR)/carbon/*.cpp $(DISTDIR)/src/osx/carbon
$(CP_P) $(MACDIR)/carbon/*.mm $(DISTDIR)/src/osx/carbon $(CP_P) $(MACDIR)/carbon/*.mm $(DISTDIR)/src/osx/carbon

View File

@@ -46,11 +46,6 @@
msvc6prj,msvs2003prj,msvs2005prj,msvs2008prj msvc6prj,msvs2003prj,msvs2005prj,msvs2008prj
</del-formats> </del-formats>
<!-- HtmlCtrl sample is Cocoa only (autoconf format) -->
<del-formats files="../../samples/html/htmlctrl/htmlctrl.bkl">
borland,dmars_smake,dmars,mingw,msvc,msvc6prj,msvs2003prj,msvs2005prj,msvs2008prj,watcom
</del-formats>
<!-- Some samples use MSVC-specific stuff --> <!-- Some samples use MSVC-specific stuff -->
<del-formats files="../../samples/mfc/mfc.bkl"> <del-formats files="../../samples/mfc/mfc.bkl">
autoconf,borland,dmars_smake,dmars,mingw,watcom autoconf,borland,dmars_smake,dmars,mingw,watcom

View File

@@ -2445,7 +2445,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/osx/tglbtn_osx.cpp src/osx/tglbtn_osx.cpp
src/osx/toolbar_osx.cpp src/osx/toolbar_osx.cpp
<!-- wxWebKit files --> <!-- wxWebKit files -->
src/html/htmlctrl/webkit/webkit.mm
<!-- Native color/font dialogs --> <!-- Native color/font dialogs -->
src/osx/carbon/colordlgosx.mm src/osx/carbon/colordlgosx.mm
src/osx/carbon/fontdlgosx.mm src/osx/carbon/fontdlgosx.mm
@@ -2496,7 +2495,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<!-- Header files like wx/osx/foo.h which include wx/osx/carbon/foo.h --> <!-- Header files like wx/osx/foo.h which include wx/osx/carbon/foo.h -->
<set var="OSX_SHARED_HDR" hints="files"> <set var="OSX_SHARED_HDR" hints="files">
<!-- wxWebKit headers --> <!-- wxWebKit headers -->
wx/html/webkit.h
<!-- other shared headers --> <!-- other shared headers -->
wx/osx/accel.h wx/osx/accel.h
wx/osx/anybutton.h wx/osx/anybutton.h

View File

@@ -410,9 +410,6 @@ OSX_CARBON_DIST: ALL_GUI_DIST
$(CP_P) $(MACDIR)/cocoa/*.mm $(DISTDIR)/src/osx/cocoa $(CP_P) $(MACDIR)/cocoa/*.mm $(DISTDIR)/src/osx/cocoa
mkdir $(DISTDIR)/src/osx/iphone mkdir $(DISTDIR)/src/osx/iphone
$(CP_P) $(MACDIR)/iphone/*.mm $(DISTDIR)/src/osx/iphone $(CP_P) $(MACDIR)/iphone/*.mm $(DISTDIR)/src/osx/iphone
mkdir $(DISTDIR)/src/html/htmlctrl
mkdir $(DISTDIR)/src/html/htmlctrl/webkit
$(CP_P) $(WXDIR)/src/html/htmlctrl/webkit/*.mm $(DISTDIR)/src/html/htmlctrl/webkit
mkdir $(DISTDIR)/src/osx/carbon mkdir $(DISTDIR)/src/osx/carbon
$(CP_P) $(MACDIR)/carbon/*.cpp $(DISTDIR)/src/osx/carbon $(CP_P) $(MACDIR)/carbon/*.cpp $(DISTDIR)/src/osx/carbon
$(CP_P) $(MACDIR)/carbon/*.mm $(DISTDIR)/src/osx/carbon $(CP_P) $(MACDIR)/carbon/*.mm $(DISTDIR)/src/osx/carbon

View File

@@ -2323,7 +2323,6 @@ set(OSX_COMMON_SRC
src/osx/tglbtn_osx.cpp src/osx/tglbtn_osx.cpp
src/osx/toolbar_osx.cpp src/osx/toolbar_osx.cpp
# wxWebKit files # wxWebKit files
src/html/htmlctrl/webkit/webkit.mm
# Native color/font dialogs # Native color/font dialogs
src/osx/carbon/colordlgosx.mm src/osx/carbon/colordlgosx.mm
src/osx/carbon/fontdlgosx.mm src/osx/carbon/fontdlgosx.mm
@@ -2373,7 +2372,6 @@ set(OSX_COMMON_SRC
set(OSX_SHARED_HDR set(OSX_SHARED_HDR
# wxWebKit headers # wxWebKit headers
wx/html/webkit.h
# other shared headers # other shared headers
wx/osx/accel.h wx/osx/accel.h
wx/osx/anybutton.h wx/osx/anybutton.h

View File

@@ -75,7 +75,7 @@ if(WIN32)
endif() endif()
if(WXOSX_COCOA) if(WXOSX_COCOA)
wx_lib_link_libraries(wxcore PUBLIC "-framework AudioToolbox") wx_lib_link_libraries(wxcore PUBLIC "-framework AudioToolbox")
if(wxUSE_WEBKIT) if(wxUSE_WEBVIEW)
wx_lib_link_libraries(wxcore PUBLIC "-framework WebKit") wx_lib_link_libraries(wxcore PUBLIC "-framework WebKit")
endif() endif()
endif() endif()

View File

@@ -235,9 +235,6 @@ wx_option(wxUSE_AFM_FOR_POSTSCRIPT "in wxPostScriptDC class use AFM (adobe font
wx_option(wxUSE_PRINTING_ARCHITECTURE "use printing architecture") wx_option(wxUSE_PRINTING_ARCHITECTURE "use printing architecture")
wx_option(wxUSE_SVG "use wxSVGFileDC device context") wx_option(wxUSE_SVG "use wxSVGFileDC device context")
wx_option(wxUSE_WEBVIEW "use wxWebView library") wx_option(wxUSE_WEBVIEW "use wxWebView library")
if(APPLE)
wx_option(wxUSE_WEBKIT "use wxWebKitCtrl (Mac-only, use wxWebView instead)")
endif()
# wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter # wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter
# can't be disabled, don't even provide an option to do it # can't be disabled, don't even provide an option to do it

View File

@@ -25,8 +25,6 @@ wx_list_add_prefix(HELP_DATA_FILES helpfiles/
) )
wx_add_sample(help DATA ${HELP_DATA_FILES} LIBRARIES wxhtml NAME htmlhelp DEPENDS wxUSE_HELP) wx_add_sample(help DATA ${HELP_DATA_FILES} LIBRARIES wxhtml NAME htmlhelp DEPENDS wxUSE_HELP)
wx_add_sample(helpview DATA test.zip LIBRARIES wxhtml DEPENDS wxUSE_HELP) wx_add_sample(helpview DATA test.zip LIBRARIES wxhtml DEPENDS wxUSE_HELP)
#TODO: htmlctrl sample uses outdated definitions
#wx_add_sample(htmlctrl LIBRARIES wxhtml)
wx_add_sample(printing DATA logo6.gif test.htm LIBRARIES wxhtml NAME htmlprinting wx_add_sample(printing DATA logo6.gif test.htm LIBRARIES wxhtml NAME htmlprinting
DEPENDS wxUSE_PRINTING_ARCHITECTURE) DEPENDS wxUSE_PRINTING_ARCHITECTURE)
wx_add_sample(test wx_add_sample(test

View File

@@ -2303,8 +2303,6 @@ OSX_COMMON_SRC =
src/osx/textctrl_osx.cpp src/osx/textctrl_osx.cpp
src/osx/tglbtn_osx.cpp src/osx/tglbtn_osx.cpp
src/osx/toolbar_osx.cpp src/osx/toolbar_osx.cpp
# wxWebKit files
src/html/htmlctrl/webkit/webkit.mm
# Native color/font dialogs # Native color/font dialogs
src/osx/carbon/colordlgosx.mm src/osx/carbon/colordlgosx.mm
src/osx/carbon/fontdlgosx.mm src/osx/carbon/fontdlgosx.mm
@@ -2351,8 +2349,6 @@ OSX_COMMON_SRC =
# Header files like wx/osx/foo.h which include wx/osx/carbon/foo.h # Header files like wx/osx/foo.h which include wx/osx/carbon/foo.h
OSX_SHARED_HDR = OSX_SHARED_HDR =
# wxWebKit headers
wx/html/webkit.h
# other shared headers # other shared headers
wx/osx/accel.h wx/osx/accel.h
wx/osx/anybutton.h wx/osx/anybutton.h

43
configure vendored
View File

@@ -1228,7 +1228,6 @@ enable_richtext
enable_postscript enable_postscript
enable_printarch enable_printarch
enable_svg enable_svg
enable_webkit
enable_webview enable_webview
enable_graphics_ctx enable_graphics_ctx
enable_clipboard enable_clipboard
@@ -2190,7 +2189,6 @@ Optional Features:
--enable-postscript use wxPostscriptDC device context (default for gtk+) --enable-postscript use wxPostscriptDC device context (default for gtk+)
--enable-printarch use printing architecture --enable-printarch use printing architecture
--enable-svg use wxSVGFileDC device context --enable-svg use wxSVGFileDC device context
--enable-webkit use wxWebKitCtrl (Mac-only, use wxWebView instead)
--enable-webview use wxWebView library --enable-webview use wxWebView library
--enable-graphics_ctx use graphics context 2D drawing API --enable-graphics_ctx use graphics context 2D drawing API
--enable-clipboard use wxClipboard class --enable-clipboard use wxClipboard class
@@ -8882,35 +8880,6 @@ fi
eval "$wx_cv_use_svg" eval "$wx_cv_use_svg"
enablestring=
defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then
if test x"$enablestring" = xdisable; then
defaultval=yes
else
defaultval=no
fi
fi
# Check whether --enable-webkit was given.
if test "${enable_webkit+set}" = set; then :
enableval=$enable_webkit;
if test "$enableval" = yes; then
wx_cv_use_webkit='wxUSE_WEBKIT=yes'
else
wx_cv_use_webkit='wxUSE_WEBKIT=no'
fi
else
wx_cv_use_webkit='wxUSE_WEBKIT=${'DEFAULT_wxUSE_WEBKIT":-$defaultval}"
fi
eval "$wx_cv_use_webkit"
enablestring= enablestring=
defaultval=$wxUSE_ALL_FEATURES defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then if test -z "$defaultval"; then
@@ -36839,18 +36808,6 @@ if test "$wxUSE_HTML" = "yes"; then
USE_HTML=1 USE_HTML=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html html/about html/help html/helpview html/printing html/test html/virtual html/widget html/zip htlbox" SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html html/about html/help html/helpview html/printing html/test html/virtual html/widget html/zip htlbox"
fi fi
if test "$wxUSE_WEBKIT" = "yes"; then
if test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
$as_echo "#define wxUSE_WEBKIT 1" >>confdefs.h
WEBKIT_LINK="-framework WebKit"
else
wxUSE_WEBKIT=no
fi
if test "$wxUSE_WEBKIT" = "yes"; then
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html/htmlctrl"
fi
fi
USE_XRC=0 USE_XRC=0
if test "$wxUSE_XRC" = "yes"; then if test "$wxUSE_XRC" = "yes"; then

View File

@@ -810,7 +810,6 @@ 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(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(printarch, [ --enable-printarch use printing architecture], wxUSE_PRINTING_ARCHITECTURE)
WX_ARG_FEATURE(svg, [ --enable-svg use wxSVGFileDC device context], wxUSE_SVG) WX_ARG_FEATURE(svg, [ --enable-svg use wxSVGFileDC device context], wxUSE_SVG)
WX_ARG_FEATURE(webkit, [ --enable-webkit use wxWebKitCtrl (Mac-only, use wxWebView instead)], wxUSE_WEBKIT)
WX_ARG_FEATURE(webview, [ --enable-webview use wxWebView library], wxUSE_WEBVIEW) WX_ARG_FEATURE(webview, [ --enable-webview use wxWebView library], wxUSE_WEBVIEW)
dnl wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter dnl wxDC is implemented in terms of wxGraphicsContext in wxOSX so the latter
@@ -7307,17 +7306,6 @@ if test "$wxUSE_HTML" = "yes"; then
USE_HTML=1 USE_HTML=1
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html html/about html/help html/helpview html/printing html/test html/virtual html/widget html/zip htlbox" SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html html/about html/help html/helpview html/printing html/test html/virtual html/widget html/zip htlbox"
fi fi
if test "$wxUSE_WEBKIT" = "yes"; then
if test "$wxUSE_MAC" = 1 -a "$USE_DARWIN" = 1; then
AC_DEFINE(wxUSE_WEBKIT)
WEBKIT_LINK="-framework WebKit"
else
wxUSE_WEBKIT=no
fi
if test "$wxUSE_WEBKIT" = "yes"; then
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS html/htmlctrl"
fi
fi
USE_XRC=0 USE_XRC=0
if test "$wxUSE_XRC" = "yes"; then if test "$wxUSE_XRC" = "yes"; then

View File

@@ -2790,6 +2790,7 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSRotationGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSPressGestureRecognizer); DECLARE_WXCOCOA_OBJC_CLASS(NSPressGestureRecognizer);
DECLARE_WXCOCOA_OBJC_CLASS(NSTouch); DECLARE_WXCOCOA_OBJC_CLASS(NSTouch);
DECLARE_WXCOCOA_OBJC_CLASS(NSPasteboard); DECLARE_WXCOCOA_OBJC_CLASS(NSPasteboard);
DECLARE_WXCOCOA_OBJC_CLASS(WKWebView);
typedef WX_NSWindow WXWindow; typedef WX_NSWindow WXWindow;
typedef WX_NSView WXWidget; typedef WX_NSView WXWidget;
@@ -2798,6 +2799,7 @@ typedef WX_NSMenu WXHMENU;
typedef WX_NSOpenGLPixelFormat WXGLPixelFormat; typedef WX_NSOpenGLPixelFormat WXGLPixelFormat;
typedef WX_NSOpenGLContext WXGLContext; typedef WX_NSOpenGLContext WXGLContext;
typedef WX_NSPasteboard OSXPasteboard; typedef WX_NSPasteboard OSXPasteboard;
typedef WX_WKWebView OSXWebViewPtr;
#elif wxOSX_USE_IPHONE #elif wxOSX_USE_IPHONE
@@ -2811,7 +2813,6 @@ DECLARE_WXCOCOA_OBJC_CLASS(UIImage);
DECLARE_WXCOCOA_OBJC_CLASS(UIEvent); DECLARE_WXCOCOA_OBJC_CLASS(UIEvent);
DECLARE_WXCOCOA_OBJC_CLASS(NSSet); DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext); DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);
DECLARE_WXCOCOA_OBJC_CLASS(UIWebView);
DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard); DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard);
typedef WX_UIWindow WXWindow; typedef WX_UIWindow WXWindow;
@@ -2820,15 +2821,10 @@ typedef WX_UIImage WXImage;
typedef WX_UIMenu WXHMENU; typedef WX_UIMenu WXHMENU;
typedef WX_EAGLContext WXGLContext; typedef WX_EAGLContext WXGLContext;
typedef WX_NSString WXGLPixelFormat; typedef WX_NSString WXGLPixelFormat;
typedef WX_UIWebView OSXWebViewPtr;
typedef WX_UIPasteboard WXOSXPasteboard; typedef WX_UIPasteboard WXOSXPasteboard;
#endif #endif
#if wxOSX_USE_COCOA_OR_CARBON
DECLARE_WXCOCOA_OBJC_CLASS(WebView);
typedef WX_WebView OSXWebViewPtr;
#endif
#endif /* __WXMAC__ */ #endif /* __WXMAC__ */

View File

@@ -1,242 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/html/webkit.h
// Purpose: wxWebKitCtrl - embeddable web kit control
// Author: Jethro Grassie / Kevin Ollivier
// Modified by:
// Created: 2004-4-16
// Copyright: (c) Jethro Grassie / Kevin Ollivier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WEBKIT_H
#define _WX_WEBKIT_H
#if wxUSE_WEBKIT
#if !defined(__WXMAC__)
#error "wxWebKitCtrl not implemented for this platform"
#endif
#include "wx/control.h"
// ----------------------------------------------------------------------------
// Web Kit Control
// ----------------------------------------------------------------------------
extern WXDLLIMPEXP_DATA_CORE(const char) wxWebKitCtrlNameStr[];
class WXDLLIMPEXP_CORE wxWebKitCtrl : public wxControl
{
public:
wxDECLARE_DYNAMIC_CLASS(wxWebKitCtrl);
wxWebKitCtrl() {}
wxWebKitCtrl(wxWindow *parent,
wxWindowID winID,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxWebKitCtrlNameStr))
{
Create(parent, winID, strURL, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID winID,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxWebKitCtrlNameStr));
virtual ~wxWebKitCtrl();
void LoadURL(const wxString &url);
bool CanGoBack();
bool CanGoForward();
bool GoBack();
bool GoForward();
void Reload();
void Stop();
bool CanGetPageSource();
wxString GetPageSource();
void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString);
wxString GetPageURL(){ return m_currentURL; }
void SetPageTitle(const wxString& title) { m_pageTitle = title; }
wxString GetPageTitle(){ return m_pageTitle; }
// since these worked in 2.6, add wrappers
void SetTitle(const wxString& title) { SetPageTitle(title); }
wxString GetTitle() { return GetPageTitle(); }
wxString GetSelection();
bool CanIncreaseTextSize();
void IncreaseTextSize();
bool CanDecreaseTextSize();
void DecreaseTextSize();
void Print(bool showPrompt = false);
void MakeEditable(bool enable = true);
bool IsEditable();
wxString RunScript(const wxString& javascript);
void SetScrollPos(int pos);
int GetScrollPos();
// don't hide base class virtuals
virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE
{ return wxControl::SetScrollPos(orient, pos, refresh); }
virtual int GetScrollPos( int orient ) const wxOVERRIDE
{ 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);
protected:
wxDECLARE_EVENT_TABLE();
void MacVisibilityChanged() wxOVERRIDE;
private:
wxWindow *m_parent;
wxWindowID m_windowID;
wxString m_currentURL;
wxString m_pageTitle;
OSXWebViewPtr m_webView;
WX_NSObject m_frameLoadMonitor;
WX_NSObject m_policyDelegate;
WX_NSObject m_UIDelegate;
// we may use this later to setup our own mouse events,
// so leave it in for now.
void* m_webKitCtrlEventHandler;
};
// ----------------------------------------------------------------------------
// Web Kit Events
// ----------------------------------------------------------------------------
enum {
wxWEBKIT_STATE_START = 1,
wxWEBKIT_STATE_NEGOTIATING = 2,
wxWEBKIT_STATE_REDIRECTING = 4,
wxWEBKIT_STATE_TRANSFERRING = 8,
wxWEBKIT_STATE_STOP = 16,
wxWEBKIT_STATE_FAILED = 32
};
enum {
wxWEBKIT_NAV_LINK_CLICKED = 1,
wxWEBKIT_NAV_BACK_NEXT = 2,
wxWEBKIT_NAV_FORM_SUBMITTED = 4,
wxWEBKIT_NAV_RELOAD = 8,
wxWEBKIT_NAV_FORM_RESUBMITTED = 16,
wxWEBKIT_NAV_OTHER = 32
};
class WXDLLIMPEXP_CORE wxWebKitBeforeLoadEvent : public wxCommandEvent
{
wxDECLARE_DYNAMIC_CLASS(wxWebKitBeforeLoadEvent);
public:
bool IsCancelled() { return m_cancelled; }
void Cancel(bool cancel = true) { m_cancelled = cancel; }
wxString GetURL() { return m_url; }
void SetURL(const wxString& url) { m_url = url; }
void SetNavigationType(int navType) { m_navType = navType; }
int GetNavigationType() { return m_navType; }
wxWebKitBeforeLoadEvent( wxWindow* win = NULL );
wxEvent *Clone(void) const { return new wxWebKitBeforeLoadEvent(*this); }
protected:
bool m_cancelled;
wxString m_url;
int m_navType;
};
class WXDLLIMPEXP_CORE wxWebKitStateChangedEvent : public wxCommandEvent
{
wxDECLARE_DYNAMIC_CLASS(wxWebKitStateChangedEvent);
public:
int GetState() { return m_state; }
void SetState(int state) { m_state = state; }
wxString GetURL() { return m_url; }
void SetURL(const wxString& url) { m_url = url; }
wxWebKitStateChangedEvent( wxWindow* win = NULL );
wxEvent *Clone(void) const { return new wxWebKitStateChangedEvent(*this); }
protected:
int m_state;
wxString m_url;
};
class WXDLLIMPEXP_CORE wxWebKitNewWindowEvent : public wxCommandEvent
{
wxDECLARE_DYNAMIC_CLASS(wxWebKitNewWindowEvent);
public:
wxString GetURL() const { return m_url; }
void SetURL(const wxString& url) { m_url = url; }
wxString GetTargetName() const { return m_targetName; }
void SetTargetName(const wxString& name) { m_targetName = name; }
wxWebKitNewWindowEvent( wxWindow* win = (wxWindow*)(NULL));
wxEvent *Clone(void) const { return new wxWebKitNewWindowEvent(*this); }
private:
wxString m_url;
wxString m_targetName;
};
typedef void (wxEvtHandler::*wxWebKitStateChangedEventFunction)(wxWebKitStateChangedEvent&);
typedef void (wxEvtHandler::*wxWebKitBeforeLoadEventFunction)(wxWebKitBeforeLoadEvent&);
typedef void (wxEvtHandler::*wxWebKitNewWindowEventFunction)(wxWebKitNewWindowEvent&);
#define wxWebKitStateChangedEventHandler( func ) \
wxEVENT_HANDLER_CAST( wxWebKitStateChangedEventFunction, func )
#define wxWebKitBeforeLoadEventHandler( func ) \
wxEVENT_HANDLER_CAST( wxWebKitBeforeLoadEventFunction, func )
#define wxWebKitNewWindowEventHandler( func ) \
wxEVENT_HANDLER_CAST( wxWebKitNewWindowEventFunction, func )
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WEBKIT_STATE_CHANGED, wxWebKitStateChangedEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WEBKIT_BEFORE_LOAD, wxWebKitBeforeLoadEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_WEBKIT_NEW_WINDOW, wxWebKitNewWindowEvent );
#define EVT_WEBKIT_STATE_CHANGED(func) \
wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_STATE_CHANGED, \
wxID_ANY, \
wxID_ANY, \
wxWebKitStateChangedEventHandler( func ), \
NULL ),
#define EVT_WEBKIT_BEFORE_LOAD(func) \
wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_BEFORE_LOAD, \
wxID_ANY, \
wxID_ANY, \
wxWebKitBeforeLoadEventHandler( func ), \
NULL ),
#define EVT_WEBKIT_NEW_WINDOW(func) \
wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_NEW_WINDOW, \
wxID_ANY, \
wxID_ANY, \
wxWebKitNewWindowEventHandler( func ), \
NULL ),
#endif // wxUSE_WEBKIT
#endif
// _WX_WEBKIT_H_

View File

@@ -25,6 +25,8 @@
// Web Kit Control // Web Kit Control
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
WX_DECLARE_STRING_HASH_MAP(wxSharedPtr<wxWebViewHandler>, wxStringToWebHandlerMap);
class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
{ {
public: public:
@@ -71,7 +73,7 @@ public:
virtual wxWebViewZoomType GetZoomType() const wxOVERRIDE; virtual wxWebViewZoomType GetZoomType() const wxOVERRIDE;
virtual bool CanSetZoomType(wxWebViewZoomType type) const wxOVERRIDE; virtual bool CanSetZoomType(wxWebViewZoomType type) const wxOVERRIDE;
virtual bool IsBusy() const wxOVERRIDE { return m_busy; } virtual bool IsBusy() const wxOVERRIDE;
//History functions //History functions
virtual void ClearHistory() wxOVERRIDE; virtual void ClearHistory() wxOVERRIDE;
@@ -121,54 +123,21 @@ public:
virtual void* GetNativeBackend() const wxOVERRIDE { return m_webView; } virtual void* GetNativeBackend() const wxOVERRIDE { return m_webView; }
// ---- methods not from the parent (common) interface
bool CanGetPageSource() const;
void SetScrollPos(int pos);
int GetScrollPos();
bool CanIncreaseTextSize() const;
void IncreaseTextSize();
bool CanDecreaseTextSize() const;
void DecreaseTextSize();
float GetWebkitZoom() const;
void SetWebkitZoom(float zoom);
// don't hide base class virtuals
virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE
{ return wxControl::SetScrollPos(orient, pos, refresh); }
virtual int GetScrollPos( int orient ) const wxOVERRIDE
{ 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;
bool m_nextNavigationIsNewWindow;
protected: protected:
virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE;
wxDECLARE_EVENT_TABLE(); wxDECLARE_EVENT_TABLE();
void MacVisibilityChanged() wxOVERRIDE;
private: private:
wxWindow *m_parent;
wxWindowID m_windowID;
wxString m_pageTitle;
OSXWebViewPtr m_webView; OSXWebViewPtr m_webView;
wxStringToWebHandlerMap m_handlers;
WX_NSObject m_loadDelegate; WX_NSObject m_navigationDelegate;
WX_NSObject m_policyDelegate;
WX_NSObject m_UIDelegate; WX_NSObject m_UIDelegate;
// we may use this later to setup our own mouse events, bool RunScriptSync(const wxString& javascript, wxString* output = NULL);
// so leave it in for now. bool QueryCommandEnabled(const wxString& command) const;
void* m_webKitCtrlEventHandler; void ExecCommand(const wxString& command);
}; };
class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory

View File

@@ -1,152 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/html/webkit.h
// Purpose: wxWebKitCtrl - embeddable web kit control
// Author: Jethro Grassie / Kevin Ollivier
// Modified by:
// Created: 2004-4-16
// Copyright: (c) Jethro Grassie / Kevin Ollivier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WEBKIT_H
#define _WX_WEBKIT_H
/**
@class wxWebKitCtrl
This control is a native wrapper around the Safari web browsing
engine. This wrapper differs from the one in wxWebView in that this
version supports functionality specific to WebKit, such as having
RunScript return a value, which is a very critical feature in many web
embedding scenarios.
This class is only available on macOS.
**/
class wxWebKitCtrl : public wxControl
{
public:
wxWebKitCtrl();
wxWebKitCtrl(wxWindow *parent,
wxWindowID winid,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxWebKitCtrlNameStr);
bool Create(wxWindow *parent,
wxWindowID winid,
const wxString& strURL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxWebKitCtrlNameStr);
virtual ~wxWebKitCtrl();
void LoadURL(const wxString &url);
bool CanGoBack();
bool CanGoForward();
bool GoBack();
bool GoForward();
void Reload();
void Stop();
bool CanGetPageSource();
wxString GetPageSource();
void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString);
wxString GetPageURL();
void SetPageTitle(const wxString& title);
wxString GetPageTitle();
// since these worked in 2.6, add wrappers
void SetTitle(const wxString& title);
wxString GetTitle();
wxString GetSelection();
bool CanIncreaseTextSize();
void IncreaseTextSize();
bool CanDecreaseTextSize();
void DecreaseTextSize();
void Print(bool showPrompt = false);
void MakeEditable(bool enable = true);
bool IsEditable();
wxString RunScript(const wxString& javascript);
void SetScrollPos(int pos);
int GetScrollPos();
};
// ----------------------------------------------------------------------------
// Web Kit Events
// ----------------------------------------------------------------------------
enum {
wxWEBKIT_STATE_START = 1,
wxWEBKIT_STATE_NEGOTIATING = 2,
wxWEBKIT_STATE_REDIRECTING = 4,
wxWEBKIT_STATE_TRANSFERRING = 8,
wxWEBKIT_STATE_STOP = 16,
wxWEBKIT_STATE_FAILED = 32
};
enum {
wxWEBKIT_NAV_LINK_CLICKED = 1,
wxWEBKIT_NAV_BACK_NEXT = 2,
wxWEBKIT_NAV_FORM_SUBMITTED = 4,
wxWEBKIT_NAV_RELOAD = 8,
wxWEBKIT_NAV_FORM_RESUBMITTED = 16,
wxWEBKIT_NAV_OTHER = 32
};
class wxWebKitBeforeLoadEvent : public wxCommandEvent
{
public:
bool IsCancelled();
void Cancel(bool cancel = true);
wxString GetURL();
void SetURL(const wxString& url);
void SetNavigationType(int navType);
int GetNavigationType();
wxWebKitBeforeLoadEvent( wxWindow* win = 0 );
};
class wxWebKitStateChangedEvent : public wxCommandEvent
{
public:
int GetState();
void SetState(int state);
wxString GetURL();
void SetURL(const wxString& url);
wxWebKitStateChangedEvent( wxWindow* win = 0 );
};
class wxWebKitNewWindowEvent : public wxCommandEvent
{
public:
wxString GetURL() const;
void SetURL(const wxString& url);
wxString GetTargetName() const;
void SetTargetName(const wxString& name);
wxWebKitNewWindowEvent( wxWindow* win = 0 );
};
wxEventType wxEVT_WEBKIT_STATE_CHANGED;
wxEventType wxEVT_WEBKIT_BEFORE_LOAD;
wxEventType wxEVT_WEBKIT_NEW_WINDOW;
#endif
// _WX_WEBKIT_H_

View File

@@ -347,12 +347,13 @@ public:
and under Fedora it is webkitgtk4-devel. All wxWEBVIEW_WEBKIT features are and under Fedora it is webkitgtk4-devel. All wxWEBVIEW_WEBKIT features are
supported except for clearing and enabling / disabling the history. supported except for clearing and enabling / disabling the history.
@par wxWEBVIEW_WEBKIT (OSX) @par wxWEBVIEW_WEBKIT (macOS)
The macOS WebKit backend uses Apple's The macOS WebKit backend uses Apple's
<a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/Reference/Reference.html#//apple_ref/doc/uid/20001903">WebView</a> <a href="https://developer.apple.com/documentation/webkit/wkwebview">WKWebView</a>
class. This backend has full support for custom schemes and virtual file class. This backend has full support for custom schemes and virtual file
systems. systems on macOS 10.13+. In order to use handlers two-step creation has to be used
and RegisterHandler() has to be called before Create().
@section async Asynchronous Notifications @section async Asynchronous Notifications
@@ -565,6 +566,9 @@ public:
/** /**
Registers a custom scheme handler. Registers a custom scheme handler.
@param handler A shared pointer to a wxWebHandler. @param handler A shared pointer to a wxWebHandler.
@note On macOS in order to use handlers two-step creation has to be
used and RegisterHandler() has to be called before Create().
With the other backends it has to be called after Create().
*/ */
virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) = 0; virtual void RegisterHandler(wxSharedPtr<wxWebViewHandler> handler) = 0;
@@ -639,6 +643,8 @@ public:
Set the editable property of the web control. Enabling allows the user 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. to edit the page even if the @c contenteditable attribute is not set.
The exact capabilities vary with the backend being used. The exact capabilities vary with the backend being used.
@note This is not implemented on macOS.
*/ */
virtual void SetEditable(bool enable = true) = 0; virtual void SetEditable(bool enable = true) = 0;
@@ -769,14 +775,14 @@ public:
/** /**
Clear the history, this will also remove the visible page. Clear the history, this will also remove the visible page.
@note This is not implemented on the WebKit2GTK+ backend. @note This is not implemented on the WebKit2GTK+ backend and macOS.
*/ */
virtual void ClearHistory() = 0; virtual void ClearHistory() = 0;
/** /**
Enable or disable the history. This will also clear the history. Enable or disable the history. This will also clear the history.
@note This is not implemented on the WebKit2GTK+ backend. @note This is not implemented on the WebKit2GTK+ backend and macOS.
*/ */
virtual void EnableHistory(bool enable = true) = 0; virtual void EnableHistory(bool enable = true) = 0;

View File

@@ -1,191 +0,0 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.12 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@MAKE_SET@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
INSTALL = @INSTALL@
EXEEXT = @EXEEXT@
WINDRES = @WINDRES@
NM = @NM@
BK_DEPS = @BK_DEPS@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
LIBS = @LIBS@
LDFLAGS_GUI = @LDFLAGS_GUI@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
USE_DPI_AWARE_MANIFEST = @USE_DPI_AWARE_MANIFEST@
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
TOOLKIT = @TOOLKIT@
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
TOOLKIT_VERSION = @TOOLKIT_VERSION@
TOOLCHAIN_FULLNAME = @TOOLCHAIN_FULLNAME@
EXTRALIBS = @EXTRALIBS@
EXTRALIBS_XML = @EXTRALIBS_XML@
EXTRALIBS_GUI = @EXTRALIBS_GUI@
WX_CPPFLAGS = @WX_CPPFLAGS@
WX_CXXFLAGS = @WX_CXXFLAGS@
WX_LDFLAGS = @WX_LDFLAGS@
HOST_SUFFIX = @HOST_SUFFIX@
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
SAMPLES_CXXFLAGS = @SAMPLES_CXXFLAGS@
wx_top_builddir = @wx_top_builddir@
### Variables: ###
DESTDIR =
WX_RELEASE = 3.1
WX_VERSION = $(WX_RELEASE).5
LIBDIRNAME = $(wx_top_builddir)/lib
HTMLCTRL_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) \
-I$(srcdir)/../../../samples $(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) \
$(CXXFLAGS)
HTMLCTRL_OBJECTS = \
$(__htmlctrl___win32rc) \
htmlctrl_htmlctrl.o
### Conditionally set variables: ###
@COND_DEPS_TRACKING_0@CXXC = $(CXX)
@COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX)
@COND_USE_GUI_0@PORTNAME = base
@COND_USE_GUI_1@PORTNAME = $(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
@COND_TOOLKIT_MAC@WXBASEPORT = _carbon
@COND_BUILD_debug@WXDEBUGFLAG = d
@COND_UNICODE_1@WXUNICODEFLAG = u
@COND_WXUNIV_1@WXUNIVNAME = univ
@COND_MONOLITHIC_0@EXTRALIBS_FOR_BASE = $(EXTRALIBS)
@COND_MONOLITHIC_1@EXTRALIBS_FOR_BASE = $(EXTRALIBS) \
@COND_MONOLITHIC_1@ $(EXTRALIBS_XML) $(EXTRALIBS_GUI)
@COND_MONOLITHIC_0@EXTRALIBS_FOR_GUI = $(EXTRALIBS_GUI)
@COND_MONOLITHIC_1@EXTRALIBS_FOR_GUI =
@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p_1 = --define wxDEBUG_LEVEL=0
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI
@COND_USE_RTTI_0@__RTTI_DEFINE_p_1 = --define wxNO_RTTI
@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS
@COND_USE_THREADS_0@__THREAD_DEFINE_p_1 = --define wxNO_THREADS
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
@COND_SHARED_1@__DLLFLAG_p_1 = --define WXUSINGDLL
@COND_PLATFORM_WIN32_1@__WIN32_DPI_MANIFEST_p = \
@COND_PLATFORM_WIN32_1@ --define \
@COND_PLATFORM_WIN32_1@ wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST)
COND_PLATFORM_OS2_1___htmlctrl___os2_emxbindcmd = $(NM) htmlctrl$(EXEEXT) | if \
grep -q pmwin.763 ; then emxbind -ep htmlctrl$(EXEEXT) ; fi
@COND_PLATFORM_OS2_1@__htmlctrl___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___htmlctrl___os2_emxbindcmd)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
@COND_PLATFORM_WIN32_1@__htmlctrl___win32rc = htmlctrl_sample_rc.o
@COND_PLATFORM_MACOSX_1@__htmlctrl_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1@ = htmlctrl.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@__htmlctrl_bundle___depname = htmlctrl_bundle
@COND_TOOLKIT_MAC@____htmlctrl_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ $(__htmlctrl_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____htmlctrl_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_CARBON@ = $(__htmlctrl_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_COCOA@____htmlctrl_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_COCOA@ = $(__htmlctrl_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____htmlctrl_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = $(__htmlctrl_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_COCOA@____htmlctrl_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__htmlctrl_app_Contents_PkgInfo___depname)
COND_MONOLITHIC_0___WXLIB_CORE_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)
COND_MONOLITHIC_0___WXLIB_BASE_p = \
-lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
COND_MONOLITHIC_1___WXLIB_MONO_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)
@COND_MONOLITHIC_1_USE_STC_1@__LIB_SCINTILLA_IF_MONO_p \
@COND_MONOLITHIC_1_USE_STC_1@ = \
@COND_MONOLITHIC_1_USE_STC_1@ -lwxscintilla$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@__LIB_TIFF_p \
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@ = \
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@ -lwxtiff$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@__LIB_JPEG_p \
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@ = \
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@ -lwxjpeg$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@__LIB_PNG_p \
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@ = \
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@ -lwxpng$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_wxUSE_ZLIB_builtin@__LIB_ZLIB_p = \
@COND_wxUSE_ZLIB_builtin@ -lwxzlib$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
COND_wxUSE_REGEX_builtin___LIB_REGEX_p = \
-lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_wxUSE_REGEX_builtin@__LIB_REGEX_p = $(COND_wxUSE_REGEX_builtin___LIB_REGEX_p)
@COND_wxUSE_EXPAT_builtin@__LIB_EXPAT_p = \
@COND_wxUSE_EXPAT_builtin@ -lwxexpat$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
### Targets: ###
all: htmlctrl$(EXEEXT) $(__htmlctrl_bundle___depname)
install:
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f htmlctrl$(EXEEXT)
rm -rf htmlctrl.app
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile
htmlctrl$(EXEEXT): $(HTMLCTRL_OBJECTS) $(__htmlctrl___win32rc)
$(CXX) -o $@ $(HTMLCTRL_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(__htmlctrl___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@htmlctrl.app/Contents/PkgInfo: htmlctrl$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1@ mkdir -p htmlctrl.app/Contents
@COND_PLATFORM_MACOSX_1@ mkdir -p htmlctrl.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1@ mkdir -p htmlctrl.app/Contents/Resources
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ sed -e "s/IDENTIFIER/`echo $(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`/" \
@COND_PLATFORM_MACOSX_1@ -e "s/EXECUTABLE/htmlctrl/" \
@COND_PLATFORM_MACOSX_1@ -e "s/VERSION/$(WX_VERSION)/" \
@COND_PLATFORM_MACOSX_1@ $(top_srcdir)/src/osx/carbon/Info.plist.in >htmlctrl.app/Contents/Info.plist
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >htmlctrl.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ ln -f htmlctrl$(EXEEXT) htmlctrl.app/Contents/MacOS/htmlctrl
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns htmlctrl.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1@htmlctrl_bundle: $(____htmlctrl_BUNDLE_TGT_REF_DEP)
htmlctrl_sample_rc.o: $(srcdir)/../../../samples/sample.rc
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) --include-dir $(srcdir) $(__DLLFLAG_p_1) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
htmlctrl_htmlctrl.o: $(srcdir)/htmlctrl.cpp
$(CXXC) -c -o $@ $(HTMLCTRL_CXXFLAGS) $(srcdir)/htmlctrl.cpp
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean htmlctrl_bundle

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" ?>
<makefile>
<include file="../../../build/bakefiles/common_samples.bkl"/>
<exe id="htmlctrl" template="wx_sample" template_append="wx_append">
<sources>htmlctrl.cpp</sources>
<wx-lib>core</wx-lib>
<wx-lib>base</wx-lib>
</exe>
</makefile>

View File

@@ -1,277 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: htmlctrl.cpp
// Purpose: HtmlCtrl sample
// Author: Julian Smart / Kevin Ollivier
// Modified by:
// Created: 04/16/2004
// Copyright: (c) Julian Smart / Kevin Ollivier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/html/webkit.h"
#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../../sample.xpm"
#endif
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
enum {
ID_BACK = wxID_HIGHEST + 1,
ID_NEXT = wxID_HIGHEST + 2,
ID_RELOAD = wxID_HIGHEST + 3,
ID_URLLIST = wxID_HIGHEST + 4,
ID_STOP = wxID_HIGHEST + 5,
ID_WEBKIT = wxID_HIGHEST + 6,
ID_VIEW_SOURCE = wxID_HIGHEST + 7,
ID_OPEN = wxID_HIGHEST + 8,
ID_SAVE = wxID_HIGHEST + 9,
ID_SET_SOURCE = wxID_HIGHEST + 10
};
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// Define a new application type, each program should derive a class from wxApp
class MyApp : public wxApp
{
public:
// override base class virtuals
// ----------------------------
// this one is called on application startup and is a good place for the app
// initialization (doing it here and not in the ctor allows to have an error
// return: if OnInit() returns false, the application terminates)
virtual bool OnInit() wxOVERRIDE;
};
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
{
public:
// ctor(s)
MyFrame(const wxString& title);
void OnBackButton(wxCommandEvent& myEvent);
void OnNextButton(wxCommandEvent& myEvent);
void OnURLEnter(wxCommandEvent& myEvent);
void OnStopButton(wxCommandEvent& myEvent);
void OnReloadButton(wxCommandEvent& myEvent);
void OnViewSource(wxCommandEvent& myEvent);
void OnSetSource(wxCommandEvent& myEvent);
void OnStateChanged(wxWebKitStateChangedEvent& myEvent);
wxWebKitCtrl* mySafari;
wxTextCtrl* urlText;
private:
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
};
// ----------------------------------------------------------------------------
// event tables and other macros for wxWidgets
// ----------------------------------------------------------------------------
// the event tables connect the wxWidgets events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_BUTTON(ID_BACK, MyFrame::OnBackButton)
EVT_BUTTON(ID_NEXT, MyFrame::OnNextButton)
EVT_BUTTON(ID_STOP, MyFrame::OnStopButton)
EVT_BUTTON(ID_RELOAD, MyFrame::OnReloadButton)
EVT_MENU(ID_VIEW_SOURCE, MyFrame::OnViewSource)
EVT_MENU(ID_SET_SOURCE, MyFrame::OnSetSource)
EVT_TEXT_ENTER(ID_URLLIST, MyFrame::OnURLEnter)
EVT_WEBKIT_STATE_CHANGED(MyFrame::OnStateChanged)
//EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
//EVT_MENU(Minimal_About, MyFrame::OnAbout)
wxEND_EVENT_TABLE()
// Create a new application object: this macro will allow wxWidgets to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also implements the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
wxIMPLEMENT_APP(MyApp);
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// the application class
// ----------------------------------------------------------------------------
// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
// create the main application window
MyFrame *frame = new MyFrame("wxWebKit Sample");
// and show it (the frames, unlike simple controls, are not shown when
// created initially)
frame->Show(true);
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// application would exit immediately.
return true;
}
// ----------------------------------------------------------------------------
// main frame
// ----------------------------------------------------------------------------
// frame constructor
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(500,500))
{
SetIcon(wxICON(sample));
wxMenuBar* myBar = new wxMenuBar();
wxMenu* fileMenu = new wxMenu;
fileMenu->Append(ID_OPEN, _("&Open"));
fileMenu->Append(ID_SAVE, _("&Save"));
myBar->Append(fileMenu, _("&File"));
wxMenu* editMenu = new wxMenu;
editMenu->Append(ID_SET_SOURCE, _("Set Page Source"));
myBar->Append(editMenu, _("&Edit"));
//wxMenu* viewMenu = new wxMenu(_("View"));
//viewMenu->Append(ID_VIEW_SOURCE, _("View Source"));
//myBar->Append(viewMenu, _("View"));
SetMenuBar(myBar);
wxToolBar* myToolbar = CreateToolBar();
wxButton* btnBack = new wxButton(myToolbar, ID_BACK, _("Back"));
myToolbar->AddControl(btnBack);
myToolbar->AddSeparator();
wxButton* btnNext = new wxButton(myToolbar, ID_NEXT, _("Next"));
myToolbar->AddControl(btnNext);
myToolbar->AddSeparator();
wxButton* btnStop = new wxButton(myToolbar, ID_STOP, _("Stop"));
myToolbar->AddControl(btnStop);
myToolbar->AddSeparator();
wxButton* btnReload = new wxButton(myToolbar, ID_RELOAD, _("Reload"));
myToolbar->AddControl(btnReload);
myToolbar->AddSeparator();
urlText = new wxTextCtrl(myToolbar, ID_URLLIST, "http://www.wxwidgets.org", wxDefaultPosition, wxSize(220, -1), wxTE_PROCESS_ENTER);
myToolbar->AddControl(urlText);
myToolbar->AddSeparator();
myToolbar->Realize();
// Testing wxWebKitCtrl inside a panel
#if 1
wxPanel* panel = new wxPanel(this, wxID_ANY);
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
panel->SetSizer(boxSizer);
mySafari = new wxWebKitCtrl(panel, ID_WEBKIT, "http://www.wxwidgets.org", wxDefaultPosition, wxSize(200, 200));
boxSizer->Add(mySafari, 1, wxEXPAND);
wxBoxSizer* frameSizer = new wxBoxSizer(wxVERTICAL);
SetSizer(frameSizer);
frameSizer->Add(panel, 1, wxEXPAND);
#else
mySafari = new wxWebKitCtrl(this, ID_WEBKIT, "http://www.wxwidgets.org", wxDefaultPosition, wxSize(200, 200));
#endif
#if wxUSE_STATUSBAR
CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
}
void MyFrame::OnBackButton(wxCommandEvent& WXUNUSED(myEvent))
{
if (mySafari->CanGoBack())
mySafari->GoBack();
}
void MyFrame::OnNextButton(wxCommandEvent& WXUNUSED(myEvent))
{
if (mySafari->CanGoForward())
mySafari->GoForward();
}
void MyFrame::OnStopButton(wxCommandEvent& WXUNUSED(myEvent))
{
mySafari->Stop();
}
void MyFrame::OnReloadButton(wxCommandEvent& WXUNUSED(myEvent))
{
mySafari->Reload();
}
void MyFrame::OnURLEnter(wxCommandEvent& WXUNUSED(myEvent))
{
mySafari->LoadURL(urlText->GetValue());
}
void MyFrame::OnStateChanged(wxWebKitStateChangedEvent& myEvent)
{
if (GetStatusBar() != NULL)
{
if (myEvent.GetState() == wxWEBKIT_STATE_NEGOTIATING)
{
GetStatusBar()->SetStatusText(_("Contacting ") + myEvent.GetURL());
urlText->SetValue(myEvent.GetURL());
}
else if (myEvent.GetState() == wxWEBKIT_STATE_TRANSFERRING)
{
GetStatusBar()->SetStatusText(_("Loading ") + myEvent.GetURL());
}
else if (myEvent.GetState() == wxWEBKIT_STATE_STOP)
{
GetStatusBar()->SetStatusText(_("Load complete."));
SetTitle(mySafari->GetTitle());
}
else if (myEvent.GetState() == wxWEBKIT_STATE_FAILED)
{
GetStatusBar()->SetStatusText(_("Failed to load ") + myEvent.GetURL());
}
}
}
void MyFrame::OnViewSource(wxCommandEvent& WXUNUSED(myEvent))
{
if (mySafari->CanGetPageSource())
wxMessageBox(mySafari->GetPageSource());
}
void MyFrame::OnSetSource(wxCommandEvent& WXUNUSED(myEvent))
{
if (mySafari)
{
wxString myText = "<HTML><HEAD></HEAD><BODY><P>Hello world!</P></BODY></HTML>";
mySafari->SetPageSource(myText);
}
}

View File

@@ -1,100 +0,0 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.12 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# C++ compiler
CXX = `$(WX_CONFIG) --cxx`
# Standard flags for C++
CXXFLAGS ?=
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=
# Standard linker flags
LDFLAGS ?=
# Location and arguments of wx-config script
WX_CONFIG ?= wx-config
# Port of the wx library to build against [gtk1,gtk2,msw,x11,motif,osx_cocoa,osx_carbon,dfb]
WX_PORT ?= $(shell $(WX_CONFIG) --query-toolkit)
# Use DLL build of wx library to use? [0,1]
WX_SHARED ?= $(shell if test -z `$(WX_CONFIG) --query-linkage`; then echo 1; else echo 0; fi)
# Compile Unicode build of wxWidgets? [0,1]
WX_UNICODE ?= $(shell $(WX_CONFIG) --query-chartype | sed 's/unicode/1/;s/ansi/0/')
# Version of the wx library to build against.
WX_VERSION ?= $(shell $(WX_CONFIG) --query-version | sed -e 's/\([0-9]*\)\.\([0-9]*\)/\1\2/')
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
CPPDEPS = -MT$@ -MF`echo $@ | sed -e 's,\.o$$,.d,'` -MD -MP
WX_VERSION_MAJOR = $(shell echo $(WX_VERSION) | cut -c1,1)
WX_VERSION_MINOR = $(shell echo $(WX_VERSION) | cut -c2,2)
WX_CONFIG_FLAGS = $(WX_CONFIG_UNICODE_FLAG) $(WX_CONFIG_SHARED_FLAG) \
--toolkit=$(WX_PORT) --version=$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
HTMLCTRL_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) \
$(CXXFLAGS)
HTMLCTRL_OBJECTS = \
htmlctrl_htmlctrl.o
### Conditionally set variables: ###
ifeq ($(WX_UNICODE),0)
WX_CONFIG_UNICODE_FLAG = --unicode=no
endif
ifeq ($(WX_UNICODE),1)
WX_CONFIG_UNICODE_FLAG = --unicode=yes
endif
ifeq ($(WX_SHARED),0)
WX_CONFIG_SHARED_FLAG = --static=yes
endif
ifeq ($(WX_SHARED),1)
WX_CONFIG_SHARED_FLAG = --static=no
endif
### Targets: ###
all: test_for_selected_wxbuild htmlctrl
install:
uninstall:
clean:
rm -f ./*.o
rm -f ./*.d
rm -f htmlctrl
test_for_selected_wxbuild:
@$(WX_CONFIG) $(WX_CONFIG_FLAGS)
htmlctrl: $(HTMLCTRL_OBJECTS)
$(CXX) -o $@ $(HTMLCTRL_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs core,base`
htmlctrl_htmlctrl.o: ./htmlctrl.cpp
$(CXX) -c -o $@ $(HTMLCTRL_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all install uninstall clean
# Dependencies tracking:
-include ./*.d

View File

@@ -383,13 +383,21 @@ WebFrame::WebFrame(const wxString& url) :
wxLogMessage("Edge backend not available"); wxLogMessage("Edge backend not available");
} }
#endif #endif
m_browser = wxWebView::New(this, wxID_ANY, url, wxDefaultPosition, wxDefaultSize, backend); m_browser = wxWebView::New(backend);
#ifdef __WXMAC__
// With WKWebView handlers need to be registered before creation
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
#endif
m_browser->Create(this, wxID_ANY, url, wxDefaultPosition, wxDefaultSize);
topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1)); topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
#ifndef __WXMAC__
//We register the wxfs:// protocol for testing purposes //We register the wxfs:// protocol for testing purposes
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs"))); m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
//And the memory: file system //And the memory: file system
m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory"))); m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
#endif
SetSizer(topsizer); SetSizer(topsizer);
@@ -819,8 +827,6 @@ void WebFrame::OnNavigationRequest(wxWebViewEvent& evt)
wxLogMessage("%s", "Navigation request to '" + evt.GetURL() + "' (target='" + wxLogMessage("%s", "Navigation request to '" + evt.GetURL() + "' (target='" +
evt.GetTarget() + "')"); evt.GetTarget() + "')");
wxASSERT(m_browser->IsBusy());
//If we don't want to handle navigation then veto the event and navigation //If we don't want to handle navigation then veto the event and navigation
//will not take place, we also need to stop the loading animation //will not take place, we also need to stop the loading animation
if(!m_tools_handle_navigation->IsChecked()) if(!m_tools_handle_navigation->IsChecked())

View File

@@ -1,588 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/html/htmlctrl/webkit/webkit.mm
// Purpose: wxWebKitCtrl - embeddable web kit control
// Author: Jethro Grassie / Kevin Ollivier
// Modified by:
// Created: 2004-4-16
// Copyright: (c) Jethro Grassie / Kevin Ollivier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/splitter.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#if wxUSE_WEBKIT
#include "wx/osx/private.h"
#include <WebKit/WebKit.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_15
#include <WebKit/HIWebView.h>
#include <WebKit/CarbonUtils.h>
#endif
#include "wx/html/webkit.h"
#define DEBUG_WEBKIT_SIZING 0
extern WXDLLEXPORT_DATA(const char) wxWebKitCtrlNameStr[] = "webkitctrl";
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
wxIMPLEMENT_DYNAMIC_CLASS(wxWebKitCtrl, wxControl);
wxBEGIN_EVENT_TABLE(wxWebKitCtrl, wxControl)
wxEND_EVENT_TABLE()
// ----------------------------------------------------------------------------
// wxWebKit Events
// ----------------------------------------------------------------------------
wxIMPLEMENT_DYNAMIC_CLASS(wxWebKitStateChangedEvent, wxCommandEvent);
wxDEFINE_EVENT( wxEVT_WEBKIT_STATE_CHANGED, wxWebKitStateChangedEvent );
wxWebKitStateChangedEvent::wxWebKitStateChangedEvent( wxWindow* win )
{
SetEventType( wxEVT_WEBKIT_STATE_CHANGED);
if ( win )
{
SetEventObject( win );
SetId(win->GetId());
}
}
wxIMPLEMENT_DYNAMIC_CLASS(wxWebKitBeforeLoadEvent, wxCommandEvent);
wxDEFINE_EVENT( wxEVT_WEBKIT_BEFORE_LOAD, wxWebKitBeforeLoadEvent );
wxWebKitBeforeLoadEvent::wxWebKitBeforeLoadEvent( wxWindow* win )
{
m_cancelled = false;
SetEventType( wxEVT_WEBKIT_BEFORE_LOAD);
if ( win )
{
SetEventObject( win );
SetId(win->GetId());
}
}
wxIMPLEMENT_DYNAMIC_CLASS(wxWebKitNewWindowEvent, wxCommandEvent);
wxDEFINE_EVENT( wxEVT_WEBKIT_NEW_WINDOW, wxWebKitNewWindowEvent );
wxWebKitNewWindowEvent::wxWebKitNewWindowEvent( wxWindow* win )
{
SetEventType( wxEVT_WEBKIT_NEW_WINDOW);
if ( win )
{
SetEventObject( win );
SetId(win->GetId());
}
}
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<WebFrameLoadDelegate>
{
wxWebKitCtrl* webKitWindow;
}
- (id)initWithWxWindow: (wxWebKitCtrl*)inWindow;
@end
@interface MyPolicyDelegate : NSObject<WebPolicyDelegate>
{
wxWebKitCtrl* webKitWindow;
}
- (id)initWithWxWindow: (wxWebKitCtrl*)inWindow;
@end
@interface MyUIDelegate : NSObject<WebUIDelegate>
{
wxWebKitCtrl* webKitWindow;
}
- (id)initWithWxWindow: (wxWebKitCtrl*)inWindow;
@end
// ----------------------------------------------------------------------------
// creation/destruction
// ----------------------------------------------------------------------------
bool wxWebKitCtrl::Create(wxWindow *parent,
wxWindowID winID,
const wxString& strURL,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
const wxString& name)
{
m_currentURL = strURL;
//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...
DontCreatePeer();
wxControl::Create(parent, winID, pos, size, style , validator , name);
NSRect r = wxOSXGetFrameForControl( this, pos , size ) ;
m_webView = [[WebView alloc] initWithFrame:r frameName:@"webkitFrame" groupName:@"webkitGroup"];
SetPeer(new wxWidgetCocoaImpl( this, m_webView ));
MacPostControlCreate(pos, size);
[m_webView setHidden:false];
// Register event listener interfaces
MyFrameLoadMonitor* myFrameLoadMonitor = [[MyFrameLoadMonitor alloc] initWithWxWindow: this];
[m_webView setFrameLoadDelegate:myFrameLoadMonitor];
m_frameLoadMonitor = myFrameLoadMonitor;
// this is used to veto page loads, etc.
MyPolicyDelegate* myPolicyDelegate = [[MyPolicyDelegate alloc] initWithWxWindow: this];
[m_webView setPolicyDelegate:myPolicyDelegate];
m_policyDelegate = myPolicyDelegate;
// this is used to provide printing support for JavaScript
MyUIDelegate* myUIDelegate = [[MyUIDelegate alloc] initWithWxWindow: this];
[m_webView setUIDelegate:myUIDelegate];
m_UIDelegate = myUIDelegate;
LoadURL(m_currentURL);
return true;
}
wxWebKitCtrl::~wxWebKitCtrl()
{
[m_webView setFrameLoadDelegate: nil];
[m_webView setPolicyDelegate: nil];
[m_webView setUIDelegate: nil];
if (m_frameLoadMonitor)
[m_frameLoadMonitor release];
if (m_policyDelegate)
[m_policyDelegate release];
if (m_UIDelegate)
[m_UIDelegate release];
}
// ----------------------------------------------------------------------------
// public methods
// ----------------------------------------------------------------------------
void wxWebKitCtrl::LoadURL(const wxString &url)
{
if( !m_webView )
return;
[[m_webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:wxNSStringWithWxString(url)]]];
m_currentURL = url;
}
bool wxWebKitCtrl::CanGoBack(){
if ( !m_webView )
return false;
return [m_webView canGoBack];
}
bool wxWebKitCtrl::CanGoForward(){
if ( !m_webView )
return false;
return [m_webView canGoForward];
}
bool wxWebKitCtrl::GoBack(){
if ( !m_webView )
return false;
bool result = [(WebView*)m_webView goBack];
return result;
}
bool wxWebKitCtrl::GoForward(){
if ( !m_webView )
return false;
bool result = [(WebView*)m_webView goForward];
return result;
}
void wxWebKitCtrl::Reload(){
if ( !m_webView )
return;
[[m_webView mainFrame] reload];
}
void wxWebKitCtrl::Stop(){
if ( !m_webView )
return;
[[m_webView mainFrame] stopLoading];
}
bool wxWebKitCtrl::CanGetPageSource(){
if ( !m_webView )
return false;
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
return ( [[dataSource representation] canProvideDocumentSource] );
}
wxString wxWebKitCtrl::GetPageSource(){
if (CanGetPageSource()){
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
return wxStringWithNSString( [[dataSource representation] documentSource] );
}
return wxEmptyString;
}
wxString wxWebKitCtrl::GetSelection(){
if ( !m_webView )
return wxEmptyString;
NSString* selectedText = [[m_webView selectedDOMRange] toString];
return wxStringWithNSString( selectedText );
}
bool wxWebKitCtrl::CanIncreaseTextSize(){
if ( !m_webView )
return false;
if ([m_webView canMakeTextLarger])
return true;
else
return false;
}
void wxWebKitCtrl::IncreaseTextSize(){
if ( !m_webView )
return;
if (CanIncreaseTextSize())
[m_webView makeTextLarger:(WebView*)m_webView];
}
bool wxWebKitCtrl::CanDecreaseTextSize(){
if ( !m_webView )
return false;
if ([m_webView canMakeTextSmaller])
return true;
else
return false;
}
void wxWebKitCtrl::DecreaseTextSize(){
if ( !m_webView )
return;
if (CanDecreaseTextSize())
[m_webView makeTextSmaller:(WebView*)m_webView];
}
void wxWebKitCtrl::SetPageSource(const wxString& source, const wxString& baseUrl){
if ( !m_webView )
return;
[[m_webView mainFrame] loadHTMLString:(NSString*)wxNSStringWithWxString( source ) baseURL:[NSURL URLWithString:wxNSStringWithWxString( baseUrl )]];
}
void wxWebKitCtrl::Print(bool showPrompt){
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 wxWebKitCtrl::MakeEditable(bool enable){
if ( !m_webView )
return;
[m_webView setEditable:enable ];
}
bool wxWebKitCtrl::IsEditable(){
if ( !m_webView )
return false;
return [m_webView isEditable];
}
int wxWebKitCtrl::GetScrollPos(){
id result = [[m_webView windowScriptObject] evaluateWebScript:@"document.body.scrollTop"];
return [result intValue];
}
void wxWebKitCtrl::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 wxWebKitCtrl::RunScript(const wxString& javascript){
if ( !m_webView )
return wxEmptyString;
id result = [[m_webView windowScriptObject] evaluateWebScript:(NSString*)wxNSStringWithWxString( javascript )];
NSString* resultAsString;
if ([result isKindOfClass:[NSNumber class]]){
// __NSCFBoolean is a subclass of NSNumber
if (strcmp([result objCType], @encode(BOOL)) == 0){
if ([result boolValue])
resultAsString = @"true";
else
resultAsString = @"false";
}
else
resultAsString = [NSString stringWithFormat:@"%@", result];
}
else if ([result isKindOfClass:[NSString class]])
resultAsString = result;
else if ([result isKindOfClass:[WebScriptObject class]])
resultAsString = [result stringRepresentation];
else
return wxString(); // This can happen, see e.g. #12361.
return wxStringWithNSString( resultAsString );
}
void wxWebKitCtrl::OnSize(wxSizeEvent &event){
event.Skip();
}
void wxWebKitCtrl::MacVisibilityChanged(){
}
//------------------------------------------------------------
// 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
- (id)initWithWxWindow: (wxWebKitCtrl*)inWindow
{
if ( self = [super init] )
{
webKitWindow = inWindow; // non retained
}
return self;
}
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
if (webKitWindow && frame == [sender mainFrame]){
NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString];
wxWebKitStateChangedEvent thisEvent(webKitWindow);
thisEvent.SetState(wxWEBKIT_STATE_NEGOTIATING);
thisEvent.SetURL( wxStringWithNSString( url ) );
if (webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent( thisEvent );
}
}
- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame
{
if (webKitWindow && frame == [sender mainFrame]){
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
wxWebKitStateChangedEvent thisEvent(webKitWindow);
thisEvent.SetState(wxWEBKIT_STATE_TRANSFERRING);
thisEvent.SetURL( wxStringWithNSString( url ) );
if (webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent( thisEvent );
}
}
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{
if (webKitWindow && frame == [sender mainFrame]){
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
wxWebKitStateChangedEvent thisEvent(webKitWindow);
thisEvent.SetState(wxWEBKIT_STATE_STOP);
thisEvent.SetURL( wxStringWithNSString( url ) );
if (webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent( thisEvent );
}
}
- (void)webView:(WebView *)sender didFailLoadWithError:(NSError*) error forFrame:(WebFrame *)frame
{
wxUnusedVar(error);
if (webKitWindow && frame == [sender mainFrame]){
NSString *url = [[[[frame dataSource] request] URL] absoluteString];
wxWebKitStateChangedEvent thisEvent(webKitWindow);
thisEvent.SetState(wxWEBKIT_STATE_FAILED);
thisEvent.SetURL( wxStringWithNSString( url ) );
if (webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent( thisEvent );
}
}
- (void)webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError*) error forFrame:(WebFrame *)frame
{
wxUnusedVar(error);
if (webKitWindow && frame == [sender mainFrame]){
NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString];
wxWebKitStateChangedEvent thisEvent(webKitWindow);
thisEvent.SetState(wxWEBKIT_STATE_FAILED);
thisEvent.SetURL( wxStringWithNSString( url ) );
if (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
- (id)initWithWxWindow: (wxWebKitCtrl*)inWindow
{
if ( self = [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(sender);
wxUnusedVar(frame);
wxWebKitBeforeLoadEvent thisEvent(webKitWindow);
// Get the navigation type.
NSNumber *n = [actionInformation objectForKey:WebActionNavigationTypeKey];
int actionType = [n intValue];
thisEvent.SetNavigationType( wxNavTypeFromWebNavType(actionType) );
NSString *url = [[request URL] absoluteString];
thisEvent.SetURL( wxStringWithNSString( url ) );
if (webKitWindow && webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
if (thisEvent.IsCancelled())
[listener ignore];
else
[listener use];
}
- (void)webView:(WebView *)sender decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request newFrameName:(NSString *)frameName decisionListener:(id < WebPolicyDecisionListener >)listener
{
wxUnusedVar(sender);
wxUnusedVar(actionInformation);
wxWebKitNewWindowEvent thisEvent(webKitWindow);
NSString *url = [[request URL] absoluteString];
thisEvent.SetURL( wxStringWithNSString( url ) );
thisEvent.SetTargetName( wxStringWithNSString( frameName ) );
if (webKitWindow && webKitWindow->GetEventHandler())
webKitWindow->GetEventHandler()->ProcessEvent(thisEvent);
[listener use];
}
@end
@implementation MyUIDelegate
- (id)initWithWxWindow: (wxWebKitCtrl*)inWindow
{
if ( self = [super init] )
{
webKitWindow = inWindow; // non retained
}
return self;
}
- (void)webView:(WebView *)sender printFrameView:(WebFrameView *)frameView
{
wxUnusedVar(sender);
wxUnusedVar(frameView);
webKitWindow->Print(true);
}
@end
#endif //wxUSE_WEBKIT

File diff suppressed because it is too large Load Diff

View File

@@ -123,7 +123,7 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]")
CHECK(m_browser->CanGoForward()); CHECK(m_browser->CanGoForward());
} }
#if !wxUSE_WEBVIEW_WEBKIT2 #if !wxUSE_WEBVIEW_WEBKIT2 && !defined(__WXOSX__)
SECTION("HistoryEnable") SECTION("HistoryEnable")
{ {
LoadUrl(); LoadUrl();
@@ -139,7 +139,7 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]")
} }
#endif #endif
#if !wxUSE_WEBVIEW_WEBKIT2 #if !wxUSE_WEBVIEW_WEBKIT2 && !defined(__WXOSX__)
SECTION("HistoryClear") SECTION("HistoryClear")
{ {
LoadUrl(2); LoadUrl(2);
@@ -174,6 +174,7 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]")
CHECK(m_browser->GetBackwardHistory().size() == 2); CHECK(m_browser->GetBackwardHistory().size() == 2);
} }
#if !defined(__WXOSX__)
SECTION("Editable") SECTION("Editable")
{ {
CHECK(!m_browser->IsEditable()); CHECK(!m_browser->IsEditable());
@@ -186,6 +187,7 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]")
CHECK(!m_browser->IsEditable()); CHECK(!m_browser->IsEditable());
} }
#endif
SECTION("Selection") SECTION("Selection")
{ {
@@ -207,6 +209,7 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]")
CHECK(m_browser->HasSelection()); CHECK(m_browser->HasSelection());
CHECK(m_browser->GetSelectedText() == "Some strong text"); CHECK(m_browser->GetSelectedText() == "Some strong text");
#if !defined(__WXOSX__)
// The web engine doesn't necessarily represent the HTML in the same way as // The web engine doesn't necessarily represent the HTML in the same way as
// we used above, e.g. IE uses upper case for all the tags while WebKit // we used above, e.g. IE uses upper case for all the tags while WebKit
// under OS X inserts plenty of its own <span> tags, so don't test for // under OS X inserts plenty of its own <span> tags, so don't test for
@@ -218,6 +221,7 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]")
("Unexpected selection source: \"%s\"", selSource), ("Unexpected selection source: \"%s\"", selSource),
selSource.Lower().Matches("*some*<strong*strong</strong>*text*") selSource.Lower().Matches("*some*<strong*strong</strong>*text*")
); );
#endif // !defined(__WXOSX__)
m_browser->ClearSelection(); m_browser->ClearSelection();
CHECK(!m_browser->HasSelection()); CHECK(!m_browser->HasSelection());