Permalink
Browse files

Initial import of wxWebKitCtrl sources and htmlctrl (right now wxWebK…

…it) sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
  • Loading branch information...
kollivier committed May 19, 2004
1 parent a1ae109 commit 2c990ba6d4f88e18e6666f61efe55c7a8b5cc948
View
@@ -0,0 +1,129 @@
/////////////////////////////////////////////////////////////////////////////
// Name: webkit.h
// Purpose: wxWebKitCtrl - embeddable web kit control
// Author: Jethro Grassie / Kevin Ollivier
// Modified by:
// Created: 2004-4-16
// RCS-ID: $Id$
// Copyright: (c) Jethro Grassie / Kevin Ollivier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WEBKIT_H
#define _WX_WEBKIT_H
#ifdef __GNUG__
#pragma interface "webkit.h"
#endif
#if !defined(__WXMAC__) && !defined(__WXCOCOA__)
#error "wxWebKitCtrl not implemented for this platform"
#endif
#ifdef __WXCOCOA
#include <WebKit/WebKit.h>
#endif
#include "wx/control.h"
// ----------------------------------------------------------------------------
// Web Kit Control
// ----------------------------------------------------------------------------
class wxWebKitCtrl : public wxControl
{
public:
DECLARE_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 = wxString("default_webkit_name"))
{
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 = wxString("default_webkit_name"));
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(wxString& source, const wxString& baseUrl = wxString(""));
//we need to resize the webview when the control size changes
//void OnSize(wxSizeEvent &event);
protected:
DECLARE_EVENT_TABLE()
private:
wxWindow *m_parent;
wxWindowID m_windowID;
wxString m_currentURL;
wxString m_pageTitle;
void* m_webView;
//It should be WebView, but WebView is Cocoa only, so any class which included
//this header would have to link to Cocoa, so for now use void* instead.
};
// ----------------------------------------------------------------------------
// 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
};
class wxWebKitStateChangedEvent : public wxCommandEvent
{
DECLARE_DYNAMIC_CLASS( wxWebKitStateChangedEvent )
public:
int GetState() { return m_state; }
void SetState(const int state) { m_state = state; }
wxString GetURL() { return m_url; }
void SetURL(const wxString& url) { m_url = url; }
wxWebKitStateChangedEvent( wxWindow* win = (wxWindow*) NULL );
wxEvent *Clone(void) const { return new wxWebKitStateChangedEvent(*this); }
protected:
int m_state;
wxString m_url;
};
typedef void (wxEvtHandler::*wxWebKitStateChangedEventFunction)(wxWebKitStateChangedEvent&);
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_LOCAL_EVENT_TYPE(wxEVT_WEBKIT_STATE_CHANGED, -1)
END_DECLARE_EVENT_TYPES()
#define EVT_WEBKIT_STATE_CHANGED(func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBKIT_STATE_CHANGED, \
-1, \
-1, \
(wxObjectEventFunction) \
(wxWebKitStateChangedEventFunction) & func, \
(wxObject *) NULL ),
#endif // _WX_WEBKIT_H_
@@ -0,0 +1,168 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.1.4 (http://bakefile.sourceforge.net)
# Do not modify, all changes will be overwritten!
# =========================================================================
@MAKE_SET@
prefix = @prefix@
exec_prefix = @exec_prefix@
INSTALL = @INSTALL@
EXEEXT = @EXEEXT@
RESCOMP = @RESCOMP@
SETFILE = @SETFILE@
NM = @NM@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
LDFLAGS_GUI = @LDFLAGS_GUI@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
TOOLKIT = @TOOLKIT@
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
TOOLKIT_VERSION = @TOOLKIT_VERSION@
TOOLCHAIN_NAME = @TOOLCHAIN_NAME@
EXTRALIBS = @EXTRALIBS@
EXTRALIBS_GUI = @EXTRALIBS_GUI@
HOST_SUFFIX = @HOST_SUFFIX@
SAMPLES_RPATH_FLAG = @SAMPLES_RPATH_FLAG@
SAMPLES_RPATH_POSTLINK = @SAMPLES_RPATH_POSTLINK@
### Variables: ###
DESTDIR =
WX_VERSION = 2.5.1
LIBDIRNAME = $(top_builddir)lib
HTMLCTRL_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) -I$(srcdir) \
$(__DLLFLAG_p) -I$(srcdir)/../../../samples $(CPPFLAGS) $(CXXFLAGS)
HTMLCTRL_OBJECTS = \
$(__htmlctrl___win32rc) \
$(__htmlctrl_os2_lib_res) \
htmlctrl_htmlctrl.o
### Conditionally set variables: ###
@COND_DEPS_TRACKING_0@CXXC = $(CXX)
@COND_DEPS_TRACKING_1@CXXC = $(top_builddir)./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_DEBUG_FLAG_DEFAULT@WXDEBUGFLAG = d
@COND_DEBUG_FLAG_1@WXDEBUGFLAG = d
@COND_UNICODE_1@WXUNICODEFLAG = u
@COND_WXUNIV_1@WXUNIVNAME = univ
@COND_PLATFORM_MAC_1@__htmlctrl___mac_setfilecmd = \
@COND_PLATFORM_MAC_1@ $(SETFILE) -a C htmlctrl$(EXEEXT)
@COND_PLATFORM_MAC_1@__htmlctrl___mac_rezcmd = $(__MACOSX_RESOURCES_p_1)
@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_1 = -d __WXUNIVERSAL__
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_2 = --define __WXUNIVERSAL__
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
@COND_SHARED_1@__DLLFLAG_p_1 = -d WXUSINGDLL
@COND_SHARED_1@__DLLFLAG_p_2 = --define WXUSINGDLL
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_PLATFORM_WIN32_1@__htmlctrl___win32rc = htmlctrl_sample_rc.o
@COND_PLATFORM_OS2_1@__htmlctrl_os2_lib_res = \
@COND_PLATFORM_OS2_1@ $(top_srcdir)/include/wx/os2/wx.res
@COND_PLATFORM_MACOSX_1@__htmlctrl_bundle___depname = htmlctrl_bundle
@COND_TOOLKIT_COCOA@____htmlctrl_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ htmlctrl.app/Contents/PkgInfo
@COND_TOOLKIT_MAC@____htmlctrl_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ htmlctrl.app/Contents/PkgInfo
COND_MONOLITHIC_0___WXLIB_CORE_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)_core-2.5$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)
@COND_MONOLITHIC_0@__WXLIB_BASE_p = \
@COND_MONOLITHIC_0@ -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)-2.5$(HOST_SUFFIX)
COND_MONOLITHIC_1___WXLIB_MONO_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)-2.5$(HOST_SUFFIX)
@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)
@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)$(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)$(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)$(HOST_SUFFIX)
@COND_WXUSE_ZLIB_BUILTIN@__LIB_ZLIB_p = \
@COND_WXUSE_ZLIB_BUILTIN@ -lwxzlib$(WXDEBUGFLAG)$(HOST_SUFFIX)
@COND_WXUSE_ODBC_BUILTIN@__LIB_ODBC_p = \
@COND_WXUSE_ODBC_BUILTIN@ -lwxodbc$(WXDEBUGFLAG)$(HOST_SUFFIX)
@COND_WXUSE_REGEX_BUILTIN@__LIB_REGEX_p = \
@COND_WXUSE_REGEX_BUILTIN@ -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(HOST_SUFFIX)
@COND_WXUSE_EXPAT_BUILTIN@__LIB_EXPAT_p = \
@COND_WXUSE_EXPAT_BUILTIN@ -lwxexpat$(WXDEBUGFLAG)$(HOST_SUFFIX)
COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1 = $(RESCOMP) -d __DARWIN__ -t APPL -d \
__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) -i $(srcdir) $(__DLLFLAG_p_1) -i \
$(srcdir)/../../../samples -i $(top_srcdir)/include -o htmlctrl$(EXEEXT) \
Carbon.r $(LIBDIRNAME)/libwx_$(TOOLCHAIN_NAME).1.r sample.r
@COND_TOOLKIT_MAC@__MACOSX_RESOURCES_p_1 = $(COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1)
### Targets: ###
all: htmlctrl$(EXEEXT) $(__htmlctrl_bundle___depname)
install: all
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f htmlctrl$(EXEEXT)
rm -rf htmlctrl.app
distclean: clean
rm -f configure 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) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_ZLIB_p) $(__LIB_ODBC_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS) $(EXTRALIBS_GUI)
$(__htmlctrl___mac_rezcmd)
$(__htmlctrl___mac_setfilecmd)
$(__htmlctrl___os2_emxbindcmd)
$(SAMPLES_RPATH_POSTLINK)
htmlctrl.app/Contents/PkgInfo: htmlctrl$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.plist.in $(LIBDIRNAME)/libwx_$(TOOLCHAIN_NAME).1.rsrc $(top_srcdir)/src/mac/carbon/wxmac.icns
mkdir -p htmlctrl.app/Contents
mkdir -p htmlctrl.app/Contents/MacOS
mkdir -p htmlctrl.app/Contents/Resources
sed -e "s/IDENTIFIER/`echo $(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`/" \
-e "s/EXECUTABLE/htmlctrl/" \
-e "s/VERSION/$(WX_VERSION)/" \
$(top_srcdir)/src/mac/carbon/Info.plist.in >htmlctrl.app/Contents/Info.plist
echo -n "APPL????" >htmlctrl.app/Contents/PkgInfo
ln -f htmlctrl$(EXEEXT) htmlctrl.app/Contents/MacOS/htmlctrl
cp -f $(LIBDIRNAME)/libwx_$(TOOLCHAIN_NAME).1.rsrc htmlctrl.app/Contents/Resources/htmlctrl.rsrc
cp -f $(top_srcdir)/src/mac/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
$(RESCOMP) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_2) --include-dir $(srcdir) $(__DLLFLAG_p_2) --include-dir $(srcdir)/../../../samples --include-dir $(top_srcdir)/include
htmlctrl_htmlctrl.o: $(srcdir)/htmlctrl.cpp
$(CXXC) -c -o $@ $(HTMLCTRL_CXXFLAGS) $<
# Include dependency info, if present:
@IF_GNU_MAKE@-include .deps/*.d
.PHONY: all install uninstall clean distclean htmlctrl_bundle
@@ -0,0 +1,14 @@
<?xml version="1.0" ?>
<!-- $Id$ -->
<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>
Oops, something went wrong.

0 comments on commit 2c990ba

Please sign in to comment.