New wxActiveX code from Lindsay and added ability to load page from stream
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
#include "IEHtmlWin.h"
|
#include "IEHtmlWin.h"
|
||||||
#include <wx/strconv.h>
|
#include <wx/strconv.h>
|
||||||
|
#include <wx/string.h>
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
#include <wx/listctrl.h>
|
#include <wx/listctrl.h>
|
||||||
|
#include <wx/mstream.h>
|
||||||
#include <oleidl.h>
|
#include <oleidl.h>
|
||||||
#include <winerror.h>
|
#include <winerror.h>
|
||||||
#include <exdispid.h>
|
#include <exdispid.h>
|
||||||
@@ -35,23 +37,23 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {}
|
FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {}
|
||||||
~FS_DWebBrowserEvents2()
|
~FS_DWebBrowserEvents2()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//IDispatch
|
//IDispatch
|
||||||
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
|
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
|
||||||
{
|
{
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
};
|
};
|
||||||
|
|
||||||
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
|
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
|
||||||
{
|
{
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
};
|
};
|
||||||
|
|
||||||
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
|
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
|
||||||
{
|
{
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,7 +116,7 @@ public:
|
|||||||
WORD wFlags, DISPPARAMS * pDispParams,
|
WORD wFlags, DISPPARAMS * pDispParams,
|
||||||
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
|
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
|
||||||
unsigned int * puArgErr)
|
unsigned int * puArgErr)
|
||||||
{
|
{
|
||||||
if (wFlags & DISPATCH_PROPERTYGET)
|
if (wFlags & DISPATCH_PROPERTYGET)
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
|
|
||||||
@@ -123,21 +125,21 @@ public:
|
|||||||
case DISPID_BEFORENAVIGATE2:
|
case DISPID_BEFORENAVIGATE2:
|
||||||
if (Process(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, STR_ARG(5)))
|
if (Process(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, STR_ARG(5)))
|
||||||
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
||||||
else
|
else
|
||||||
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISPID_NEWWINDOW2:
|
case DISPID_NEWWINDOW2:
|
||||||
if (Process(wxEVT_COMMAND_MSHTML_NEWWINDOW2))
|
if (Process(wxEVT_COMMAND_MSHTML_NEWWINDOW2))
|
||||||
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
||||||
else
|
else
|
||||||
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISPID_PROGRESSCHANGE:
|
case DISPID_PROGRESSCHANGE:
|
||||||
Post(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, "", LONG_ARG(1), LONG_ARG(0));
|
Post(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, "", LONG_ARG(1), LONG_ARG(0));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DISPID_DOCUMENTCOMPLETE:
|
case DISPID_DOCUMENTCOMPLETE:
|
||||||
Post(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, STR_ARG(0));
|
Post(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, STR_ARG(0));
|
||||||
break;
|
break;
|
||||||
@@ -181,7 +183,7 @@ wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id,
|
|||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& name) :
|
const wxString& name) :
|
||||||
wxActiveX(parent, PROGID, id, pos, size, style, name)
|
wxActiveX(parent, PROGID, id, pos, size, style, name)
|
||||||
{
|
{
|
||||||
SetupBrowser();
|
SetupBrowser();
|
||||||
@@ -242,7 +244,8 @@ void wxIEHtmlWin::SetCharset(wxString charset)
|
|||||||
{
|
{
|
||||||
wxAutoOleInterface<IHTMLDocument2> doc(IID_IHTMLDocument2, disp);
|
wxAutoOleInterface<IHTMLDocument2> doc(IID_IHTMLDocument2, disp);
|
||||||
if (doc.Ok())
|
if (doc.Ok())
|
||||||
doc->put_charset((BSTR) (const wchar_t*)charset.wc_str(wxConvUTF8));
|
doc->put_charset((BSTR) (const wchar_t *) charset.wc_str(wxConvUTF8));
|
||||||
|
//doc->put_charset((BSTR) wxConvUTF8.cMB2WC(charset).data());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -284,12 +287,12 @@ private:
|
|||||||
istream *m_is;
|
istream *m_is;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
|
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
|
||||||
{
|
{
|
||||||
wxASSERT(m_is != NULL);
|
wxASSERT(m_is != NULL);
|
||||||
}
|
}
|
||||||
~IStreamAdaptor()
|
~IStreamAdaptor()
|
||||||
{
|
{
|
||||||
delete m_is;
|
delete m_is;
|
||||||
}
|
}
|
||||||
@@ -305,11 +308,37 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IwxStreamAdaptor : public IStreamAdaptorBase
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
wxInputStream *m_is;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
IwxStreamAdaptor(wxInputStream *is) : IStreamAdaptorBase(), m_is(is)
|
||||||
|
{
|
||||||
|
wxASSERT(m_is != NULL);
|
||||||
|
}
|
||||||
|
~IwxStreamAdaptor()
|
||||||
|
{
|
||||||
|
delete m_is;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISequentialStream
|
||||||
|
HRESULT STDMETHODCALLTYPE Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead)
|
||||||
|
{
|
||||||
|
m_is->Read((char *) pv, cb);
|
||||||
|
if (pcbRead)
|
||||||
|
*pcbRead = m_is->LastRead();
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
void wxIEHtmlWin::LoadUrl(const wxString& url)
|
void wxIEHtmlWin::LoadUrl(const wxString& url)
|
||||||
{
|
{
|
||||||
VARIANTARG navFlag, targetFrame, postData, headers;
|
VARIANTARG navFlag, targetFrame, postData, headers;
|
||||||
navFlag.vt = VT_EMPTY;
|
navFlag.vt = VT_EMPTY;
|
||||||
navFlag.vt = VT_I2;
|
navFlag.vt = VT_I2;
|
||||||
navFlag.iVal = navNoReadFromCache;
|
navFlag.iVal = navNoReadFromCache;
|
||||||
targetFrame.vt = VT_EMPTY;
|
targetFrame.vt = VT_EMPTY;
|
||||||
@@ -317,24 +346,38 @@ void wxIEHtmlWin::LoadUrl(const wxString& url)
|
|||||||
headers.vt = VT_EMPTY;
|
headers.vt = VT_EMPTY;
|
||||||
|
|
||||||
HRESULT hret = 0;
|
HRESULT hret = 0;
|
||||||
hret = m_webBrowser->Navigate((BSTR) (const wchar_t*)url.wc_str(wxConvUTF8),
|
hret = m_webBrowser->Navigate((BSTR) (const wchar_t *) url.wc_str(wxConvUTF8),
|
||||||
&navFlag, &targetFrame, &postData, &headers);
|
&navFlag, &targetFrame, &postData, &headers);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class wxOwnedMemInputStream : public wxMemoryInputStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
char *m_data;
|
||||||
|
|
||||||
|
wxOwnedMemInputStream(char *data, size_t len) :
|
||||||
|
wxMemoryInputStream(data, len), m_data(data)
|
||||||
|
{}
|
||||||
|
~wxOwnedMemInputStream()
|
||||||
|
{
|
||||||
|
free(m_data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool wxIEHtmlWin::LoadString(wxString html)
|
bool wxIEHtmlWin::LoadString(wxString html)
|
||||||
{
|
{
|
||||||
string s = html.mb_str(wxConvUTF8);
|
char *data = NULL;
|
||||||
istringstream *is = new istringstream(s);
|
size_t len = html.length();
|
||||||
return LoadStream(is);
|
#ifdef UNICODE
|
||||||
|
len *= 2;
|
||||||
|
#endif
|
||||||
|
data = (char *) malloc(len);
|
||||||
|
memcpy(data, html.c_str(), len);
|
||||||
|
return LoadStream(new wxOwnedMemInputStream(data, len));
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxIEHtmlWin::LoadStream(istream *is)
|
bool wxIEHtmlWin::LoadStream(IStreamAdaptorBase *pstrm)
|
||||||
{
|
{
|
||||||
// wrap reference around stream
|
|
||||||
IStreamAdaptor *pstrm = new IStreamAdaptor(is);
|
|
||||||
pstrm->AddRef();
|
|
||||||
|
|
||||||
wxAutoOleInterface<IStream> strm(pstrm);
|
wxAutoOleInterface<IStream> strm(pstrm);
|
||||||
|
|
||||||
// Document Interface
|
// Document Interface
|
||||||
@@ -361,6 +404,25 @@ bool wxIEHtmlWin::LoadStream(istream *is)
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::LoadStream(istream *is)
|
||||||
|
{
|
||||||
|
// wrap reference around stream
|
||||||
|
IStreamAdaptor *pstrm = new IStreamAdaptor(is);
|
||||||
|
pstrm->AddRef();
|
||||||
|
|
||||||
|
return LoadStream(pstrm);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool wxIEHtmlWin::LoadStream(wxInputStream *is)
|
||||||
|
{
|
||||||
|
// wrap reference around stream
|
||||||
|
IwxStreamAdaptor *pstrm = new IwxStreamAdaptor(is);
|
||||||
|
pstrm->AddRef();
|
||||||
|
|
||||||
|
return LoadStream(pstrm);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
bool wxIEHtmlWin::GoBack()
|
bool wxIEHtmlWin::GoBack()
|
||||||
{
|
{
|
||||||
HRESULT hret = 0;
|
HRESULT hret = 0;
|
||||||
@@ -466,7 +528,7 @@ wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
|
|||||||
|
|
||||||
BSTR text = NULL;
|
BSTR text = NULL;
|
||||||
HRESULT hr = E_FAIL;
|
HRESULT hr = E_FAIL;
|
||||||
|
|
||||||
if (asHTML)
|
if (asHTML)
|
||||||
hr = tr->get_htmlText(&text);
|
hr = tr->get_htmlText(&text);
|
||||||
else
|
else
|
||||||
@@ -508,7 +570,7 @@ wxString wxIEHtmlWin::GetText(bool asHTML)
|
|||||||
// get inner text
|
// get inner text
|
||||||
BSTR text = NULL;
|
BSTR text = NULL;
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
|
|
||||||
if (asHTML)
|
if (asHTML)
|
||||||
hr = body->get_innerHTML(&text);
|
hr = body->get_innerHTML(&text);
|
||||||
else
|
else
|
||||||
@@ -519,5 +581,5 @@ wxString wxIEHtmlWin::GetText(bool asHTML)
|
|||||||
wxString s = text;
|
wxString s = text;
|
||||||
SysFreeString(text);
|
SysFreeString(text);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
@@ -61,8 +61,11 @@ enum wxIEHtmlRefreshLevel
|
|||||||
wxIEHTML_REFRESH_COMPLETELY = 3
|
wxIEHTML_REFRESH_COMPLETELY = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IStreamAdaptorBase;
|
||||||
|
|
||||||
class wxIEHtmlWin : public wxActiveX
|
class wxIEHtmlWin : public wxActiveX
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1,
|
wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -74,6 +77,7 @@ public:
|
|||||||
void LoadUrl(const wxString&);
|
void LoadUrl(const wxString&);
|
||||||
bool LoadString(wxString html);
|
bool LoadString(wxString html);
|
||||||
bool LoadStream(istream *strm);
|
bool LoadStream(istream *strm);
|
||||||
|
bool LoadStream(wxInputStream *is);
|
||||||
|
|
||||||
void SetCharset(wxString charset);
|
void SetCharset(wxString charset);
|
||||||
void SetEditMode(bool seton);
|
void SetEditMode(bool seton);
|
||||||
@@ -92,6 +96,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetupBrowser();
|
void SetupBrowser();
|
||||||
|
bool LoadStream(IStreamAdaptorBase *pstrm);
|
||||||
|
|
||||||
wxAutoOleInterface<IWebBrowser2> m_webBrowser;
|
wxAutoOleInterface<IWebBrowser2> m_webBrowser;
|
||||||
};
|
};
|
||||||
|
@@ -57,6 +57,7 @@ extern PyObject *SWIG_newvarlink(void);
|
|||||||
|
|
||||||
#include "wxPython.h"
|
#include "wxPython.h"
|
||||||
#include "IEHtmlWin.h"
|
#include "IEHtmlWin.h"
|
||||||
|
#include "pyistream.h"
|
||||||
|
|
||||||
|
|
||||||
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||||
@@ -412,6 +413,55 @@ static PyObject *_wrap_wxIEHtmlWin_LoadString(PyObject *self, PyObject *args, Py
|
|||||||
return _resultobj;
|
return _resultobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define wxIEHtmlWin_LoadStream(_swigobj,_swigarg0) (_swigobj->LoadStream(_swigarg0))
|
||||||
|
static PyObject *_wrap_wxIEHtmlWin_LoadStream(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
|
PyObject * _resultobj;
|
||||||
|
bool _result;
|
||||||
|
wxIEHtmlWin * _arg0;
|
||||||
|
wxInputStream * _arg1;
|
||||||
|
PyObject * _argo0 = 0;
|
||||||
|
wxPyInputStream * temp;
|
||||||
|
bool created;
|
||||||
|
PyObject * _obj1 = 0;
|
||||||
|
char *_kwnames[] = { "self","is", NULL };
|
||||||
|
|
||||||
|
self = self;
|
||||||
|
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxIEHtmlWin_LoadStream",_kwnames,&_argo0,&_obj1))
|
||||||
|
return NULL;
|
||||||
|
if (_argo0) {
|
||||||
|
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||||
|
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxIEHtmlWin_p")) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxIEHtmlWin_LoadStream. Expected _wxIEHtmlWin_p.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (SWIG_GetPtrObj(_obj1, (void **) &temp, "_wxPyInputStream_p") == 0) {
|
||||||
|
_arg1 = temp->m_wxis;
|
||||||
|
created = FALSE;
|
||||||
|
} else {
|
||||||
|
_arg1 = wxPyCBInputStream_create(_obj1, FALSE);
|
||||||
|
if (_arg1 == NULL) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
created = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||||
|
_result = (bool )wxIEHtmlWin_LoadStream(_arg0,_arg1);
|
||||||
|
|
||||||
|
wxPyEndAllowThreads(__tstate);
|
||||||
|
if (PyErr_Occurred()) return NULL;
|
||||||
|
} _resultobj = Py_BuildValue("i",_result);
|
||||||
|
{
|
||||||
|
if (created)
|
||||||
|
delete _arg1;
|
||||||
|
}
|
||||||
|
return _resultobj;
|
||||||
|
}
|
||||||
|
|
||||||
#define wxIEHtmlWin_SetCharset(_swigobj,_swigarg0) (_swigobj->SetCharset(_swigarg0))
|
#define wxIEHtmlWin_SetCharset(_swigobj,_swigarg0) (_swigobj->SetCharset(_swigarg0))
|
||||||
static PyObject *_wrap_wxIEHtmlWin_SetCharset(PyObject *self, PyObject *args, PyObject *kwargs) {
|
static PyObject *_wrap_wxIEHtmlWin_SetCharset(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||||
PyObject * _resultobj;
|
PyObject * _resultobj;
|
||||||
@@ -771,6 +821,7 @@ static PyMethodDef iewincMethods[] = {
|
|||||||
{ "wxIEHtmlWin_GetEditMode", (PyCFunction) _wrap_wxIEHtmlWin_GetEditMode, METH_VARARGS | METH_KEYWORDS },
|
{ "wxIEHtmlWin_GetEditMode", (PyCFunction) _wrap_wxIEHtmlWin_GetEditMode, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxIEHtmlWin_SetEditMode", (PyCFunction) _wrap_wxIEHtmlWin_SetEditMode, METH_VARARGS | METH_KEYWORDS },
|
{ "wxIEHtmlWin_SetEditMode", (PyCFunction) _wrap_wxIEHtmlWin_SetEditMode, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxIEHtmlWin_SetCharset", (PyCFunction) _wrap_wxIEHtmlWin_SetCharset, METH_VARARGS | METH_KEYWORDS },
|
{ "wxIEHtmlWin_SetCharset", (PyCFunction) _wrap_wxIEHtmlWin_SetCharset, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
{ "wxIEHtmlWin_LoadStream", (PyCFunction) _wrap_wxIEHtmlWin_LoadStream, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxIEHtmlWin_LoadString", (PyCFunction) _wrap_wxIEHtmlWin_LoadString, METH_VARARGS | METH_KEYWORDS },
|
{ "wxIEHtmlWin_LoadString", (PyCFunction) _wrap_wxIEHtmlWin_LoadString, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "wxIEHtmlWin_LoadUrl", (PyCFunction) _wrap_wxIEHtmlWin_LoadUrl, METH_VARARGS | METH_KEYWORDS },
|
{ "wxIEHtmlWin_LoadUrl", (PyCFunction) _wrap_wxIEHtmlWin_LoadUrl, METH_VARARGS | METH_KEYWORDS },
|
||||||
{ "new_wxIEHtmlWin", (PyCFunction) _wrap_new_wxIEHtmlWin, METH_VARARGS | METH_KEYWORDS },
|
{ "new_wxIEHtmlWin", (PyCFunction) _wrap_new_wxIEHtmlWin, METH_VARARGS | METH_KEYWORDS },
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
%{
|
%{
|
||||||
#include "wxPython.h"
|
#include "wxPython.h"
|
||||||
#include "IEHtmlWin.h"
|
#include "IEHtmlWin.h"
|
||||||
|
#include "pyistream.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
%extern _defs.i
|
%extern _defs.i
|
||||||
%extern misc.i
|
%extern misc.i
|
||||||
%extern events.i
|
%extern events.i
|
||||||
|
%extern streams.i
|
||||||
|
|
||||||
%pragma(python) code = "import wx"
|
%pragma(python) code = "import wx"
|
||||||
|
|
||||||
@@ -101,7 +103,7 @@ public:
|
|||||||
|
|
||||||
void LoadUrl(const wxString&);
|
void LoadUrl(const wxString&);
|
||||||
bool LoadString(wxString html);
|
bool LoadString(wxString html);
|
||||||
/* bool LoadStream(istream *strm); */
|
bool LoadStream(wxInputStream *is);
|
||||||
|
|
||||||
%pragma(python) addtoclass = "Navigate = LoadUrl"
|
%pragma(python) addtoclass = "Navigate = LoadUrl"
|
||||||
|
|
||||||
|
@@ -95,6 +95,9 @@ class wxIEHtmlWinPtr(wxWindowPtr):
|
|||||||
def LoadString(self, *_args, **_kwargs):
|
def LoadString(self, *_args, **_kwargs):
|
||||||
val = apply(iewinc.wxIEHtmlWin_LoadString,(self,) + _args, _kwargs)
|
val = apply(iewinc.wxIEHtmlWin_LoadString,(self,) + _args, _kwargs)
|
||||||
return val
|
return val
|
||||||
|
def LoadStream(self, *_args, **_kwargs):
|
||||||
|
val = apply(iewinc.wxIEHtmlWin_LoadStream,(self,) + _args, _kwargs)
|
||||||
|
return val
|
||||||
def SetCharset(self, *_args, **_kwargs):
|
def SetCharset(self, *_args, **_kwargs):
|
||||||
val = apply(iewinc.wxIEHtmlWin_SetCharset,(self,) + _args, _kwargs)
|
val = apply(iewinc.wxIEHtmlWin_SetCharset,(self,) + _args, _kwargs)
|
||||||
return val
|
return val
|
||||||
|
@@ -31,7 +31,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
class wxActiveX;
|
class wxActiveX;
|
||||||
|
|
||||||
class FrameSite :
|
class FrameSite :
|
||||||
public IOleClientSite,
|
public IOleClientSite,
|
||||||
public IOleInPlaceSiteEx,
|
public IOleInPlaceSiteEx,
|
||||||
public IOleInPlaceFrame,
|
public IOleInPlaceFrame,
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS);
|
STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS);
|
||||||
STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS);
|
STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS);
|
||||||
STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject*, LPCOLESTR);
|
STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject*, LPCOLESTR);
|
||||||
|
|
||||||
//IOleInPlaceFrame
|
//IOleInPlaceFrame
|
||||||
STDMETHODIMP InsertMenus(HMENU, LPOLEMENUGROUPWIDTHS);
|
STDMETHODIMP InsertMenus(HMENU, LPOLEMENUGROUPWIDTHS);
|
||||||
STDMETHODIMP SetMenu(HMENU, HOLEMENU, HWND);
|
STDMETHODIMP SetMenu(HMENU, HOLEMENU, HWND);
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
STDMETHODIMP CanInPlaceActivate();
|
STDMETHODIMP CanInPlaceActivate();
|
||||||
STDMETHODIMP OnInPlaceActivate();
|
STDMETHODIMP OnInPlaceActivate();
|
||||||
STDMETHODIMP OnUIActivate();
|
STDMETHODIMP OnUIActivate();
|
||||||
STDMETHODIMP GetWindowContext(IOleInPlaceFrame**, IOleInPlaceUIWindow**,
|
STDMETHODIMP GetWindowContext(IOleInPlaceFrame**, IOleInPlaceUIWindow**,
|
||||||
LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO);
|
LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO);
|
||||||
STDMETHODIMP Scroll(SIZE);
|
STDMETHODIMP Scroll(SIZE);
|
||||||
STDMETHODIMP OnUIDeactivate(BOOL);
|
STDMETHODIMP OnUIDeactivate(BOOL);
|
||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
STDMETHODIMP GetObject(LPOLESTR, DWORD, IBindCtx*, REFIID, void**);
|
STDMETHODIMP GetObject(LPOLESTR, DWORD, IBindCtx*, REFIID, void**);
|
||||||
STDMETHODIMP GetObjectStorage(LPOLESTR, IBindCtx*, REFIID, void**);
|
STDMETHODIMP GetObjectStorage(LPOLESTR, IBindCtx*, REFIID, void**);
|
||||||
STDMETHODIMP IsRunning(LPOLESTR);
|
STDMETHODIMP IsRunning(LPOLESTR);
|
||||||
|
|
||||||
//IDispatch
|
//IDispatch
|
||||||
STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR**, unsigned int, LCID, DISPID*);
|
STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR**, unsigned int, LCID, DISPID*);
|
||||||
STDMETHODIMP GetTypeInfo(unsigned int, LCID, ITypeInfo**);
|
STDMETHODIMP GetTypeInfo(unsigned int, LCID, ITypeInfo**);
|
||||||
@@ -146,7 +146,7 @@ protected:
|
|||||||
bool m_bInPlaceActive;
|
bool m_bInPlaceActive;
|
||||||
bool m_bUIActive;
|
bool m_bUIActive;
|
||||||
bool m_bWindowless;
|
bool m_bWindowless;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LCID m_nAmbientLocale;
|
LCID m_nAmbientLocale;
|
||||||
@@ -207,7 +207,7 @@ wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id,
|
|||||||
{
|
{
|
||||||
m_bAmbientUserMode = true;
|
m_bAmbientUserMode = true;
|
||||||
m_docAdviseCookie = 0;
|
m_docAdviseCookie = 0;
|
||||||
CreateActiveX((LPOLESTR) (const wchar_t*)progId.wc_str(wxConvUTF8));
|
CreateActiveX((LPOLESTR) (const wchar_t *) progId.wc_str(wxConvUTF8));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxActiveX::~wxActiveX()
|
wxActiveX::~wxActiveX()
|
||||||
@@ -223,14 +223,14 @@ wxActiveX::~wxActiveX()
|
|||||||
};
|
};
|
||||||
m_connections.clear();
|
m_connections.clear();
|
||||||
|
|
||||||
if (m_oleInPlaceObject.Ok())
|
if (m_oleInPlaceObject.Ok())
|
||||||
{
|
{
|
||||||
m_oleInPlaceObject->InPlaceDeactivate();
|
m_oleInPlaceObject->InPlaceDeactivate();
|
||||||
m_oleInPlaceObject->UIDeactivate();
|
m_oleInPlaceObject->UIDeactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_oleObject.Ok())
|
if (m_oleObject.Ok())
|
||||||
{
|
{
|
||||||
if (m_docAdviseCookie != 0)
|
if (m_docAdviseCookie != 0)
|
||||||
m_oleObject->Unadvise(m_docAdviseCookie);
|
m_oleObject->Unadvise(m_docAdviseCookie);
|
||||||
@@ -266,9 +266,19 @@ void wxActiveX::CreateActiveX(REFCLSID clsid)
|
|||||||
GetTypeInfo();
|
GetTypeInfo();
|
||||||
|
|
||||||
// Get IOleObject interface
|
// Get IOleObject interface
|
||||||
hret = m_oleObject.QueryInterface(IID_IOleObject, m_ActiveX);
|
hret = m_oleObject.QueryInterface(IID_IOleObject, m_ActiveX);
|
||||||
wxASSERT(SUCCEEDED(hret));
|
wxASSERT(SUCCEEDED(hret));
|
||||||
// Get IOleInPlaceObject interface
|
|
||||||
|
// document advise
|
||||||
|
m_docAdviseCookie = 0;
|
||||||
|
hret = m_oleObject->Advise(adviseSink, &m_docAdviseCookie);
|
||||||
|
WXOLE_WARN(hret, "m_oleObject->Advise(adviseSink, &m_docAdviseCookie),\"Advise\")");
|
||||||
|
m_oleObject->SetHostNames(L"wxActiveXContainer", NULL);
|
||||||
|
OleSetContainedObject(m_oleObject, TRUE);
|
||||||
|
OleRun(m_oleObject);
|
||||||
|
|
||||||
|
|
||||||
|
// Get IOleInPlaceObject interface
|
||||||
hret = m_oleInPlaceObject.QueryInterface(IID_IOleInPlaceObject, m_ActiveX);
|
hret = m_oleInPlaceObject.QueryInterface(IID_IOleInPlaceObject, m_ActiveX);
|
||||||
wxASSERT(SUCCEEDED(hret));
|
wxASSERT(SUCCEEDED(hret));
|
||||||
|
|
||||||
@@ -292,13 +302,6 @@ void wxActiveX::CreateActiveX(REFCLSID clsid)
|
|||||||
WXOLE_WARN(hret, "CreateActiveX::pPersistStreamInit->InitNew()");
|
WXOLE_WARN(hret, "CreateActiveX::pPersistStreamInit->InitNew()");
|
||||||
};
|
};
|
||||||
|
|
||||||
// document advise
|
|
||||||
m_docAdviseCookie = 0;
|
|
||||||
hret = m_oleObject->Advise(adviseSink, &m_docAdviseCookie);
|
|
||||||
WXOLE_WARN(hret, "m_oleObject->Advise(adviseSink, &m_docAdviseCookie),\"Advise\")");
|
|
||||||
m_oleObject->SetHostNames(L"wxActiveXContainer", NULL);
|
|
||||||
OleSetContainedObject(m_oleObject, TRUE);
|
|
||||||
|
|
||||||
if (! (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST))
|
if (! (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST))
|
||||||
m_oleObject->SetClientSite(m_clientSite);
|
m_oleObject->SetClientSite(m_clientSite);
|
||||||
|
|
||||||
@@ -312,22 +315,26 @@ void wxActiveX::CreateActiveX(REFCLSID clsid)
|
|||||||
posRect.bottom = h;
|
posRect.bottom = h;
|
||||||
|
|
||||||
m_oleObjectHWND = 0;
|
m_oleObjectHWND = 0;
|
||||||
hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
|
|
||||||
WXOLE_WARN(hret, "m_oleInPlaceObject->GetWindow(&m_oleObjectHWND)");
|
if (m_oleInPlaceObject.Ok())
|
||||||
if (SUCCEEDED(hret))
|
{
|
||||||
::SetActiveWindow(m_oleObjectHWND);
|
hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
|
||||||
|
WXOLE_WARN(hret, "m_oleInPlaceObject->GetWindow(&m_oleObjectHWND)");
|
||||||
|
if (SUCCEEDED(hret))
|
||||||
|
::SetActiveWindow(m_oleObjectHWND);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if (! (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME))
|
if (! (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME))
|
||||||
{
|
{
|
||||||
if (w > 0 && h > 0)
|
if (w > 0 && h > 0 && m_oleInPlaceObject.Ok())
|
||||||
m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
|
m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
|
||||||
|
|
||||||
hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, m_clientSite, 0, (HWND)GetHWND(), &posRect);
|
hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, m_clientSite, 0, (HWND)GetHWND(), &posRect);
|
||||||
hret = m_oleObject->DoVerb(OLEIVERB_SHOW, 0, m_clientSite, 0, (HWND)GetHWND(), &posRect);
|
hret = m_oleObject->DoVerb(OLEIVERB_SHOW, 0, m_clientSite, 0, (HWND)GetHWND(), &posRect);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (! m_oleObjectHWND)
|
if (! m_oleObjectHWND && m_oleInPlaceObject.Ok())
|
||||||
{
|
{
|
||||||
hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
|
hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
|
||||||
WXOLE_WARN(hret, "m_oleInPlaceObject->GetWindow(&m_oleObjectHWND)");
|
WXOLE_WARN(hret, "m_oleInPlaceObject->GetWindow(&m_oleObjectHWND)");
|
||||||
@@ -385,13 +392,14 @@ public:
|
|||||||
|
|
||||||
static ActiveXEventMapFlusher s_dummyActiveXEventMapFlusher;
|
static ActiveXEventMapFlusher s_dummyActiveXEventMapFlusher;
|
||||||
|
|
||||||
const wxEventType& RegisterActiveXEvent(wxString eventName)
|
const wxEventType& RegisterActiveXEvent(wxChar *eventName)
|
||||||
{
|
{
|
||||||
ActiveXEventMap::iterator it = sg_eventMap.find(eventName);
|
wxString ev = eventName;
|
||||||
|
ActiveXEventMap::iterator it = sg_eventMap.find(ev);
|
||||||
if (it == sg_eventMap.end())
|
if (it == sg_eventMap.end())
|
||||||
{
|
{
|
||||||
wxEventType *et = new wxEventType(wxNewEventType());
|
wxEventType *et = new wxEventType(wxNewEventType());
|
||||||
sg_eventMap[eventName] = et;
|
sg_eventMap[ev] = et;
|
||||||
|
|
||||||
return *et;
|
return *et;
|
||||||
};
|
};
|
||||||
@@ -479,23 +487,23 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
wxActiveXEvents(wxActiveX *ax) : m_activeX(ax) {}
|
wxActiveXEvents(wxActiveX *ax) : m_activeX(ax) {}
|
||||||
~wxActiveXEvents()
|
~wxActiveXEvents()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//IDispatch
|
//IDispatch
|
||||||
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
|
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
|
||||||
{
|
{
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
};
|
};
|
||||||
|
|
||||||
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
|
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
|
||||||
{
|
{
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
};
|
};
|
||||||
|
|
||||||
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
|
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
|
||||||
{
|
{
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -505,7 +513,7 @@ public:
|
|||||||
WORD wFlags, DISPPARAMS * pDispParams,
|
WORD wFlags, DISPPARAMS * pDispParams,
|
||||||
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
|
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
|
||||||
unsigned int * puArgErr)
|
unsigned int * puArgErr)
|
||||||
{
|
{
|
||||||
if (wFlags & (DISPATCH_PROPERTYGET | DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYPUTREF))
|
if (wFlags & (DISPATCH_PROPERTYGET | DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYPUTREF))
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
|
|
||||||
@@ -516,7 +524,7 @@ public:
|
|||||||
|
|
||||||
int idx = mid->second;
|
int idx = mid->second;
|
||||||
|
|
||||||
|
|
||||||
wxActiveX::FuncX &func = m_activeX->m_events[idx];
|
wxActiveX::FuncX &func = m_activeX->m_events[idx];
|
||||||
|
|
||||||
ActiveXEventMap::iterator it = sg_eventMap.find(func.name);
|
ActiveXEventMap::iterator it = sg_eventMap.find(func.name);
|
||||||
@@ -555,7 +563,7 @@ public:
|
|||||||
if (px.IsOut())
|
if (px.IsOut())
|
||||||
{
|
{
|
||||||
wxVariant& vx = event.m_params[pDispParams->cArgs - i - 1];
|
wxVariant& vx = event.m_params[pDispParams->cArgs - i - 1];
|
||||||
|
|
||||||
VariantToMSWVariant(vx, va);
|
VariantToMSWVariant(vx, va);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -622,15 +630,15 @@ wxVariant& wxActiveXEvent::operator[] (wxString name)
|
|||||||
void wxActiveX::GetTypeInfo()
|
void wxActiveX::GetTypeInfo()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We are currently only interested in the IDispatch interface
|
We are currently only interested in the IDispatch interface
|
||||||
to the control. For dual interfaces (TypeKind = TKIND_INTERFACE)
|
to the control. For dual interfaces (TypeKind = TKIND_INTERFACE)
|
||||||
we should drill down through the inheritance
|
we should drill down through the inheritance
|
||||||
(using TYPEATTR->cImplTypes) and GetRefTypeOfImplType(n)
|
(using TYPEATTR->cImplTypes) and GetRefTypeOfImplType(n)
|
||||||
and retrieve all the func names etc that way, then generate a C++
|
and retrieve all the func names etc that way, then generate a C++
|
||||||
header file for it.
|
header file for it.
|
||||||
|
|
||||||
But we don't do this and probably never will, so if we have a DUAL
|
But we don't do this and probably never will, so if we have a DUAL
|
||||||
interface then we query for the IDispatch
|
interface then we query for the IDispatch
|
||||||
via GetRefTypeOfImplType(-1).
|
via GetRefTypeOfImplType(-1).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -792,11 +800,11 @@ HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *events)
|
|||||||
wxAutoOleInterface<IConnectionPointContainer> cpContainer(IID_IConnectionPointContainer, m_ActiveX);
|
wxAutoOleInterface<IConnectionPointContainer> cpContainer(IID_IConnectionPointContainer, m_ActiveX);
|
||||||
if (! cpContainer.Ok())
|
if (! cpContainer.Ok())
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
HRESULT hret = cpContainer->FindConnectionPoint(riid, cp.GetRef());
|
HRESULT hret = cpContainer->FindConnectionPoint(riid, cp.GetRef());
|
||||||
if (! SUCCEEDED(hret))
|
if (! SUCCEEDED(hret))
|
||||||
return hret;
|
return hret;
|
||||||
|
|
||||||
hret = cp->Advise(events, &adviseCookie);
|
hret = cp->Advise(events, &adviseCookie);
|
||||||
|
|
||||||
if (SUCCEEDED(hret))
|
if (SUCCEEDED(hret))
|
||||||
@@ -857,28 +865,32 @@ void wxActiveX::OnSize(wxSizeEvent& event)
|
|||||||
if (w <= 0 && h <= 0)
|
if (w <= 0 && h <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_oleInPlaceObject)
|
if (m_oleInPlaceObject.Ok())
|
||||||
m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
|
m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
|
||||||
|
|
||||||
// extents are in HIMETRIC units
|
// extents are in HIMETRIC units
|
||||||
SIZEL sz = {w, h};
|
if (m_oleObject.Ok())
|
||||||
PixelsToHimetric(sz);
|
{
|
||||||
|
SIZEL sz = {w, h};
|
||||||
|
PixelsToHimetric(sz);
|
||||||
|
|
||||||
SIZEL sz2;
|
SIZEL sz2;
|
||||||
m_oleObject->GetExtent(DVASPECT_CONTENT, &sz2);
|
|
||||||
if (sz2.cx != sz.cx || sz.cy != sz2.cy)
|
m_oleObject->GetExtent(DVASPECT_CONTENT, &sz2);
|
||||||
m_oleObject->SetExtent(DVASPECT_CONTENT, &sz);
|
if (sz2.cx != sz.cx || sz.cy != sz2.cy)
|
||||||
|
m_oleObject->SetExtent(DVASPECT_CONTENT, &sz);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxActiveX::OnSetFocus(wxFocusEvent& event)
|
void wxActiveX::OnSetFocus(wxFocusEvent& event)
|
||||||
{
|
{
|
||||||
if (m_oleInPlaceActiveObject.Ok())
|
if (m_oleInPlaceActiveObject.Ok())
|
||||||
m_oleInPlaceActiveObject->OnFrameWindowActivate(TRUE);
|
m_oleInPlaceActiveObject->OnFrameWindowActivate(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxActiveX::OnKillFocus(wxFocusEvent& event)
|
void wxActiveX::OnKillFocus(wxFocusEvent& event)
|
||||||
{
|
{
|
||||||
if (m_oleInPlaceActiveObject.Ok())
|
if (m_oleInPlaceActiveObject.Ok())
|
||||||
m_oleInPlaceActiveObject->OnFrameWindowActivate(FALSE);
|
m_oleInPlaceActiveObject->OnFrameWindowActivate(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +910,7 @@ FrameSite::FrameSite(wxActiveX * win)
|
|||||||
m_bAmbientShowHatching = true;
|
m_bAmbientShowHatching = true;
|
||||||
m_bAmbientShowGrabHandles = true;
|
m_bAmbientShowGrabHandles = true;
|
||||||
m_bAmbientAppearance = true;
|
m_bAmbientAppearance = true;
|
||||||
|
|
||||||
m_hDCBuffer = NULL;
|
m_hDCBuffer = NULL;
|
||||||
m_hWndParent = (HWND)m_window->GetHWND();
|
m_hWndParent = (HWND)m_window->GetHWND();
|
||||||
}
|
}
|
||||||
@@ -941,7 +953,7 @@ HRESULT FrameSite::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
|
|||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (pVarResult == NULL)
|
if (pVarResult == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
//The most common case is boolean, use as an initial type
|
//The most common case is boolean, use as an initial type
|
||||||
@@ -1017,7 +1029,7 @@ HRESULT FrameSite::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
|
|||||||
HRESULT FrameSite::GetWindow(HWND * phwnd)
|
HRESULT FrameSite::GetWindow(HWND * phwnd)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleWindow::GetWindow");
|
WXOLE_TRACE("IOleWindow::GetWindow");
|
||||||
if (phwnd == NULL)
|
if (phwnd == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
(*phwnd) = m_hWndParent;
|
(*phwnd) = m_hWndParent;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -1034,7 +1046,7 @@ HRESULT FrameSite::ContextSensitiveHelp(BOOL fEnterMode)
|
|||||||
HRESULT FrameSite::GetBorder(LPRECT lprectBorder)
|
HRESULT FrameSite::GetBorder(LPRECT lprectBorder)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleInPlaceUIWindow::GetBorder");
|
WXOLE_TRACE("IOleInPlaceUIWindow::GetBorder");
|
||||||
if (lprectBorder == NULL)
|
if (lprectBorder == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
return INPLACE_E_NOTOOLSPACE;
|
return INPLACE_E_NOTOOLSPACE;
|
||||||
}
|
}
|
||||||
@@ -1042,7 +1054,7 @@ HRESULT FrameSite::GetBorder(LPRECT lprectBorder)
|
|||||||
HRESULT FrameSite::RequestBorderSpace(LPCBORDERWIDTHS pborderwidths)
|
HRESULT FrameSite::RequestBorderSpace(LPCBORDERWIDTHS pborderwidths)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleInPlaceUIWindow::RequestBorderSpace");
|
WXOLE_TRACE("IOleInPlaceUIWindow::RequestBorderSpace");
|
||||||
if (pborderwidths == NULL)
|
if (pborderwidths == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
return INPLACE_E_NOTOOLSPACE;
|
return INPLACE_E_NOTOOLSPACE;
|
||||||
}
|
}
|
||||||
@@ -1139,9 +1151,9 @@ HRESULT FrameSite::GetWindowContext(IOleInPlaceFrame **ppFrame,
|
|||||||
if (ppFrame == NULL || ppDoc == NULL || lprcPosRect == NULL ||
|
if (ppFrame == NULL || ppDoc == NULL || lprcPosRect == NULL ||
|
||||||
lprcClipRect == NULL || lpFrameInfo == NULL)
|
lprcClipRect == NULL || lpFrameInfo == NULL)
|
||||||
{
|
{
|
||||||
if (ppFrame != NULL)
|
if (ppFrame != NULL)
|
||||||
(*ppFrame) = NULL;
|
(*ppFrame) = NULL;
|
||||||
if (ppDoc != NULL)
|
if (ppDoc != NULL)
|
||||||
(*ppDoc) = NULL;
|
(*ppDoc) = NULL;
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
@@ -1231,7 +1243,7 @@ HRESULT FrameSite::OnInPlaceActivateEx(BOOL * pfNoRedraw, DWORD dwFlags)
|
|||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleInPlaceSiteEx::OnInPlaceActivateEx");
|
WXOLE_TRACE("IOleInPlaceSiteEx::OnInPlaceActivateEx");
|
||||||
OleLockRunning(m_window->m_ActiveX, TRUE, FALSE);
|
OleLockRunning(m_window->m_ActiveX, TRUE, FALSE);
|
||||||
if (pfNoRedraw)
|
if (pfNoRedraw)
|
||||||
(*pfNoRedraw) = FALSE;
|
(*pfNoRedraw) = FALSE;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@@ -1268,9 +1280,9 @@ HRESULT FrameSite::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
|
|||||||
HRESULT FrameSite::GetContainer(LPOLECONTAINER * ppContainer)
|
HRESULT FrameSite::GetContainer(LPOLECONTAINER * ppContainer)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleClientSite::GetContainer");
|
WXOLE_TRACE("IOleClientSite::GetContainer");
|
||||||
if (ppContainer == NULL)
|
if (ppContainer == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
HRESULT hr = QueryInterface(IID_IOleContainer, (void**)(ppContainer));
|
HRESULT hr = QueryInterface(IID_IOleContainer, (void**)(ppContainer));
|
||||||
wxASSERT(SUCCEEDED(hr));
|
wxASSERT(SUCCEEDED(hr));
|
||||||
|
|
||||||
@@ -1323,26 +1335,26 @@ HRESULT FrameSite::LockContainer(BOOL fLock)
|
|||||||
|
|
||||||
//IOleItemContainer
|
//IOleItemContainer
|
||||||
|
|
||||||
HRESULT FrameSite::GetObject(LPOLESTR pszItem, DWORD dwSpeedNeeded,
|
HRESULT FrameSite::GetObject(LPOLESTR pszItem, DWORD dwSpeedNeeded,
|
||||||
IBindCtx * pbc, REFIID riid, void ** ppvObject)
|
IBindCtx * pbc, REFIID riid, void ** ppvObject)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleItemContainer::GetObject");
|
WXOLE_TRACE("IOleItemContainer::GetObject");
|
||||||
if (pszItem == NULL)
|
if (pszItem == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
if (ppvObject == NULL)
|
if (ppvObject == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
*ppvObject = NULL;
|
*ppvObject = NULL;
|
||||||
return MK_E_NOOBJECT;
|
return MK_E_NOOBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT FrameSite::GetObjectStorage(LPOLESTR pszItem, IBindCtx * pbc,
|
HRESULT FrameSite::GetObjectStorage(LPOLESTR pszItem, IBindCtx * pbc,
|
||||||
REFIID riid, void ** ppvStorage)
|
REFIID riid, void ** ppvStorage)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleItemContainer::GetObjectStorage");
|
WXOLE_TRACE("IOleItemContainer::GetObjectStorage");
|
||||||
if (pszItem == NULL)
|
if (pszItem == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
if (ppvStorage == NULL)
|
if (ppvStorage == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
*ppvStorage = NULL;
|
*ppvStorage = NULL;
|
||||||
@@ -1352,7 +1364,7 @@ HRESULT FrameSite::GetObjectStorage(LPOLESTR pszItem, IBindCtx * pbc,
|
|||||||
HRESULT FrameSite::IsRunning(LPOLESTR pszItem)
|
HRESULT FrameSite::IsRunning(LPOLESTR pszItem)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleItemContainer::IsRunning");
|
WXOLE_TRACE("IOleItemContainer::IsRunning");
|
||||||
if (pszItem == NULL)
|
if (pszItem == NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
return MK_E_NOOBJECT;
|
return MK_E_NOOBJECT;
|
||||||
@@ -1417,7 +1429,7 @@ HRESULT FrameSite::ShowPropertyFrame()
|
|||||||
|
|
||||||
//IOleCommandTarget
|
//IOleCommandTarget
|
||||||
|
|
||||||
HRESULT FrameSite::QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds,
|
HRESULT FrameSite::QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds,
|
||||||
OLECMD * prgCmds, OLECMDTEXT * pCmdTet)
|
OLECMD * prgCmds, OLECMDTEXT * pCmdTet)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleCommandTarget::QueryStatus");
|
WXOLE_TRACE("IOleCommandTarget::QueryStatus");
|
||||||
@@ -1436,8 +1448,8 @@ HRESULT FrameSite::QueryStatus(const GUID * pguidCmdGroup, ULONG cCmds,
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT FrameSite::Exec(const GUID * pguidCmdGroup, DWORD nCmdID,
|
HRESULT FrameSite::Exec(const GUID * pguidCmdGroup, DWORD nCmdID,
|
||||||
DWORD nCmdExecOpt, VARIANTARG * pVaIn,
|
DWORD nCmdExecOpt, VARIANTARG * pVaIn,
|
||||||
VARIANTARG * pVaOut)
|
VARIANTARG * pVaOut)
|
||||||
{
|
{
|
||||||
WXOLE_TRACE("IOleCommandTarget::Exec");
|
WXOLE_TRACE("IOleCommandTarget::Exec");
|
||||||
@@ -1592,7 +1604,7 @@ wxString OLEHResultToString(HRESULT hr)
|
|||||||
wxString GetIIDName(REFIID riid)
|
wxString GetIIDName(REFIID riid)
|
||||||
{
|
{
|
||||||
// an association between symbolic name and numeric value of an IID
|
// an association between symbolic name and numeric value of an IID
|
||||||
struct KNOWN_IID
|
struct KNOWN_IID
|
||||||
{
|
{
|
||||||
const IID *pIid;
|
const IID *pIid;
|
||||||
const wxChar *szName;
|
const wxChar *szName;
|
||||||
@@ -1602,7 +1614,7 @@ wxString GetIIDName(REFIID riid)
|
|||||||
#define ADD_KNOWN_IID(name) { &IID_I##name, _T(#name) }
|
#define ADD_KNOWN_IID(name) { &IID_I##name, _T(#name) }
|
||||||
#define ADD_KNOWN_GUID(name) { &name, _T(#name) }
|
#define ADD_KNOWN_GUID(name) { &name, _T(#name) }
|
||||||
|
|
||||||
static const KNOWN_IID aKnownIids[] =
|
static const KNOWN_IID aKnownIids[] =
|
||||||
{
|
{
|
||||||
ADD_KNOWN_IID(AdviseSink),
|
ADD_KNOWN_IID(AdviseSink),
|
||||||
ADD_KNOWN_IID(AdviseSink2),
|
ADD_KNOWN_IID(AdviseSink2),
|
||||||
@@ -1696,9 +1708,9 @@ wxString GetIIDName(REFIID riid)
|
|||||||
#undef ADD_KNOWN_GUID
|
#undef ADD_KNOWN_GUID
|
||||||
|
|
||||||
// try to find the interface in the table
|
// try to find the interface in the table
|
||||||
for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ )
|
for ( size_t ui = 0; ui < WXSIZEOF(aKnownIids); ui++ )
|
||||||
{
|
{
|
||||||
if ( riid == *aKnownIids[ui].pIid )
|
if ( riid == *aKnownIids[ui].pIid )
|
||||||
{
|
{
|
||||||
return aKnownIids[ui].szName;
|
return aKnownIids[ui].szName;
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ template <class I> class wxAutoOleInterface
|
|||||||
};
|
};
|
||||||
|
|
||||||
// copy constructor
|
// copy constructor
|
||||||
explicit wxAutoOleInterface(const wxAutoOleInterface<I>& ti) : m_interface(NULL)
|
wxAutoOleInterface(const wxAutoOleInterface<I>& ti) : m_interface(NULL)
|
||||||
{
|
{
|
||||||
operator = (ti);
|
operator = (ti);
|
||||||
}
|
}
|
||||||
@@ -362,11 +362,11 @@ public:
|
|||||||
wxVariant& operator[] (wxString name);
|
wxVariant& operator[] (wxString name);
|
||||||
};
|
};
|
||||||
|
|
||||||
const wxEventType& RegisterActiveXEvent(wxString eventName);
|
const wxEventType& RegisterActiveXEvent(wxChar *eventName);
|
||||||
|
|
||||||
typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&);
|
typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&);
|
||||||
|
|
||||||
#define EVT_ACTIVEX(id, eventName, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(eventName), id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ),
|
#define EVT_ACTIVEX(id, eventName, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(wxT(eventName)), id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ),
|
||||||
|
|
||||||
//util
|
//util
|
||||||
bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx);
|
bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx);
|
||||||
|
Reference in New Issue
Block a user