Unicode fixes for wxPython

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2002-12-18 06:15:40 +00:00
parent fb7eaf0d7b
commit fbd3b09c78
17 changed files with 233 additions and 186 deletions

View File

@@ -110,8 +110,8 @@ public:
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) { if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
PyObject* dcobj = wxPyMake_wxObject(&dc); PyObject* dcobj = wxPyMake_wxObject(&dc);
PyObject* idobj = wxPyConstructObject((void*)&id, "wxTreeItemId", FALSE); PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), FALSE);
PyObject* recobj= wxPyConstructObject((void*)&rect, "wxRect", FALSE); PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), FALSE);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
Py_DECREF(dcobj); Py_DECREF(dcobj);
Py_DECREF(idobj); Py_DECREF(idobj);

View File

@@ -272,8 +272,8 @@ public:
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) { if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) {
PyObject* dcobj = wxPyMake_wxObject(&dc); PyObject* dcobj = wxPyMake_wxObject(&dc);
PyObject* idobj = wxPyConstructObject((void*)&id, "wxTreeItemId", FALSE); PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), FALSE);
PyObject* recobj= wxPyConstructObject((void*)&rect, "wxRect", FALSE); PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), FALSE);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj));
Py_DECREF(dcobj); Py_DECREF(dcobj);
Py_DECREF(idobj); Py_DECREF(idobj);

View File

@@ -69,7 +69,7 @@ public:
~wxGLContext(); ~wxGLContext();
void SetCurrent(); void SetCurrent();
void SetColour(const char *colour); void SetColour(const wxString& colour);
void SwapBuffers(); void SwapBuffers();
#ifdef __WXGTK__ #ifdef __WXGTK__
@@ -151,7 +151,7 @@ public:
%pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)" %pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
void SetCurrent(); void SetCurrent();
void SetColour(const char *colour); void SetColour(const wxString& colour);
void SwapBuffers(); void SwapBuffers();
wxGLContext* GetContext(); wxGLContext* GetContext();

View File

@@ -210,12 +210,13 @@ static PyObject *_wrap_wxGLContext_SetCurrent(PyObject *self, PyObject *args, Py
static PyObject *_wrap_wxGLContext_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxGLContext_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
wxGLContext * _arg0; wxGLContext * _arg0;
char * _arg1; wxString * _arg1;
PyObject * _argo0 = 0; PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","colour", NULL }; char *_kwnames[] = { "self","colour", NULL };
self = self; self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxGLContext_SetColour",_kwnames,&_argo0,&_arg1)) if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLContext_SetColour",_kwnames,&_argo0,&_obj1))
return NULL; return NULL;
if (_argo0) { if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; } if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -224,14 +225,23 @@ static PyObject *_wrap_wxGLContext_SetColour(PyObject *self, PyObject *args, PyO
return NULL; return NULL;
} }
} }
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
wxGLContext_SetColour(_arg0,_arg1); wxGLContext_SetColour(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL; if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None); } Py_INCREF(Py_None);
_resultobj = Py_None; _resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj; return _resultobj;
} }
@@ -544,12 +554,13 @@ static PyObject *_wrap_wxGLCanvas_SetCurrent(PyObject *self, PyObject *args, PyO
static PyObject *_wrap_wxGLCanvas_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) { static PyObject *_wrap_wxGLCanvas_SetColour(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj; PyObject * _resultobj;
wxGLCanvas * _arg0; wxGLCanvas * _arg0;
char * _arg1; wxString * _arg1;
PyObject * _argo0 = 0; PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","colour", NULL }; char *_kwnames[] = { "self","colour", NULL };
self = self; self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxGLCanvas_SetColour",_kwnames,&_argo0,&_arg1)) if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxGLCanvas_SetColour",_kwnames,&_argo0,&_obj1))
return NULL; return NULL;
if (_argo0) { if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; } if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -558,14 +569,23 @@ static PyObject *_wrap_wxGLCanvas_SetColour(PyObject *self, PyObject *args, PyOb
return NULL; return NULL;
} }
} }
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
wxGLCanvas_SetColour(_arg0,_arg1); wxGLCanvas_SetColour(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL; if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None); } Py_INCREF(Py_None);
_resultobj = Py_None; _resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj; return _resultobj;
} }

View File

@@ -27,15 +27,17 @@
#if wxUSE_GLCANVAS #if wxUSE_GLCANVAS
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include <wx/frame.h> #include "wx/frame.h"
#include "wx/settings.h"
#include "wx/intl.h"
#include "wx/log.h"
#endif #endif
#include <wx/msw/private.h> #include "wx/msw/private.h"
#include <wx/settings.h>
#include <wx/log.h>
#include "myglcanvas.h" #include "myglcanvas.h"
const wxChar* wxGLCanvasName = wxT("GLcanvas");
static const wxChar *wxGLCanvasClassName = wxT("wxGLCanvasClass"); static const wxChar *wxGLCanvasClassName = wxT("wxGLCanvasClass");
static const wxChar *wxGLCanvasClassNameNoRedraw = wxT("wxGLCanvasClassNR"); static const wxChar *wxGLCanvasClassNameNoRedraw = wxT("wxGLCanvasClassNR");
@@ -108,7 +110,7 @@ void wxGLContext::SetCurrent()
*/ */
} }
void wxGLContext::SetColour(const char *colour) void wxGLContext::SetColour(const wxChar *colour)
{ {
float r = 0.0; float r = 0.0;
float g = 0.0; float g = 0.0;
@@ -403,7 +405,6 @@ static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList)
void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC) void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
{ {
int pixelFormat;
PIXELFORMATDESCRIPTOR pfd = { PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */ sizeof(PIXELFORMATDESCRIPTOR), /* size */
1, /* version */ 1, /* version */
@@ -427,13 +428,13 @@ void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
AdjustPFDForAttributes(pfd, attribList); AdjustPFDForAttributes(pfd, attribList);
pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd); int pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
if (pixelFormat == 0) { if (pixelFormat == 0) {
wxLogWarning(_("ChoosePixelFormat failed.")); wxLogLastError(_T("ChoosePixelFormat"));
} }
else { else {
if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) { if ( !::SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) ) {
wxLogWarning(_("SetPixelFormat failed.")); wxLogLastError(_T("SetPixelFormat"));
} }
} }
} }
@@ -527,7 +528,7 @@ void wxGLCanvas::SetCurrent()
} }
} }
void wxGLCanvas::SetColour(const char *colour) void wxGLCanvas::SetColour(const wxChar *colour)
{ {
if (m_glContext) if (m_glContext)
m_glContext->SetColour(colour); m_glContext->SetColour(colour);
@@ -728,7 +729,7 @@ bool wxGLApp::InitGLVisual(int *attribList)
AdjustPFDForAttributes(pfd, attribList); AdjustPFDForAttributes(pfd, attribList);
// use DC for whole (root) screen, since no windows have yet been created // use DC for whole (root) screen, since no windows have yet been created
pixelFormat = ChoosePixelFormat((HDC) ::GetDC(NULL), &pfd); pixelFormat = ChoosePixelFormat(ScreenHDC(), &pfd);
if (pixelFormat == 0) { if (pixelFormat == 0) {
wxLogError(_("Failed to initialize OpenGL")); wxLogError(_("Failed to initialize OpenGL"));

View File

@@ -24,6 +24,7 @@
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <windows.h> #include <windows.h>
#include "wx/msw/winundef.h"
#include <GL/gl.h> #include <GL/gl.h>
@@ -69,7 +70,7 @@ public:
~wxGLContext(); ~wxGLContext();
void SetCurrent(); void SetCurrent();
void SetColour(const char *colour); void SetColour(const wxChar *colour);
void SwapBuffers(); void SwapBuffers();
@@ -83,21 +84,26 @@ public:
wxWindow* m_window; wxWindow* m_window;
}; };
extern const wxChar* wxGLCanvasName;
class wxGLCanvas: public wxWindow class wxGLCanvas: public wxWindow
{ {
DECLARE_CLASS(wxGLCanvas) DECLARE_CLASS(wxGLCanvas)
public: public:
wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette); const wxString& name = wxGLCanvasName, int *attribList = 0, const wxPalette& palette = wxNullPalette);
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL, wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas", const wxSize& size = wxDefaultSize, long style = 0, const wxString&
name = wxGLCanvasName,
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette ); int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1, wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette ); const wxString& name = wxGLCanvasName, int *attribList = 0, const wxPalette& palette = wxNullPalette );
~wxGLCanvas(); ~wxGLCanvas();
@@ -106,7 +112,7 @@ class wxGLCanvas: public wxWindow
const wxPoint& pos, const wxSize& size, long style, const wxString& name); const wxPoint& pos, const wxSize& size, long style, const wxString& name);
void SetCurrent(); void SetCurrent();
void SetColour(const char *colour); void SetColour(const wxChar *colour);
void SwapBuffers(); void SwapBuffers();
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);

View File

@@ -37,23 +37,23 @@ private:
public: public:
FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {} FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {}
virtual ~FS_DWebBrowserEvents2() virtual ~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;
}; };
@@ -72,7 +72,7 @@ public:
m_iewin->GetParent()->AddPendingEvent(event); m_iewin->GetParent()->AddPendingEvent(event);
}; };
bool Process(WXTYPE etype, wxString text = "", long l1 = 0, long l2 = 0) bool Process(WXTYPE etype, wxString text = wxEmptyString, long l1 = 0, long l2 = 0)
{ {
if (! m_iewin || ! m_iewin->GetParent()) if (! m_iewin || ! m_iewin->GetParent())
return true; return true;
@@ -103,7 +103,7 @@ public:
return v.bstrVal; return v.bstrVal;
} }
else else
return ""; return wxEmptyString;
}; };
#define STR_ARG(arg) GetStrArg(pDispParams->rgvarg[arg]) #define STR_ARG(arg) GetStrArg(pDispParams->rgvarg[arg])
@@ -116,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;
@@ -125,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, wxEmptyString, 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;
@@ -183,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();
@@ -287,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;
} }
@@ -314,12 +314,12 @@ private:
wxInputStream *m_is; wxInputStream *m_is;
public: public:
IwxStreamAdaptor(wxInputStream *is) : IStreamAdaptorBase(), m_is(is) IwxStreamAdaptor(wxInputStream *is) : IStreamAdaptorBase(), m_is(is)
{ {
wxASSERT(m_is != NULL); wxASSERT(m_is != NULL);
} }
~IwxStreamAdaptor() ~IwxStreamAdaptor()
{ {
delete m_is; delete m_is;
} }
@@ -338,7 +338,7 @@ public:
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;
@@ -346,8 +346,8 @@ 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 class wxOwnedMemInputStream : public wxMemoryInputStream
@@ -358,7 +358,7 @@ public:
wxOwnedMemInputStream(char *data, size_t len) : wxOwnedMemInputStream(char *data, size_t len) :
wxMemoryInputStream(data, len), m_data(data) wxMemoryInputStream(data, len), m_data(data)
{} {}
~wxOwnedMemInputStream() ~wxOwnedMemInputStream()
{ {
free(m_data); free(m_data);
} }
@@ -524,17 +524,17 @@ wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
{ {
wxAutoOleInterface<IHTMLTxtRange> tr(GetSelRange(m_oleObject)); wxAutoOleInterface<IHTMLTxtRange> tr(GetSelRange(m_oleObject));
if (! tr) if (! tr)
return ""; return wxEmptyString;
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
hr = tr->get_text(&text); hr = tr->get_text(&text);
if (hr != S_OK) if (hr != S_OK)
return ""; return wxEmptyString;
wxString s = text; wxString s = text;
SysFreeString(text); SysFreeString(text);
@@ -545,41 +545,41 @@ wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
wxString wxIEHtmlWin::GetText(bool asHTML) wxString wxIEHtmlWin::GetText(bool asHTML)
{ {
if (! m_webBrowser.Ok()) if (! m_webBrowser.Ok())
return ""; return wxEmptyString;
// get document dispatch interface // get document dispatch interface
IDispatch *iDisp = NULL; IDispatch *iDisp = NULL;
HRESULT hr = m_webBrowser->get_Document(&iDisp); HRESULT hr = m_webBrowser->get_Document(&iDisp);
if (hr != S_OK) if (hr != S_OK)
return ""; return wxEmptyString;
// Query for Document Interface // Query for Document Interface
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp); wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
iDisp->Release(); iDisp->Release();
if (! hd.Ok()) if (! hd.Ok())
return ""; return wxEmptyString;
// get body element // get body element
IHTMLElement *_body = NULL; IHTMLElement *_body = NULL;
hd->get_body(&_body); hd->get_body(&_body);
if (! _body) if (! _body)
return ""; return wxEmptyString;
wxAutoOleInterface<IHTMLElement> body(_body); wxAutoOleInterface<IHTMLElement> body(_body);
// 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
hr = body->get_innerText(&text); hr = body->get_innerText(&text);
if (hr != S_OK) if (hr != S_OK)
return ""; return wxEmptyString;
wxString s = text; wxString s = text;
SysFreeString(text); SysFreeString(text);
return s; return s;
}; };

View File

@@ -33,7 +33,7 @@ END_EVENT_TABLE()
class wxActiveX; class wxActiveX;
class FrameSite : class FrameSite :
public IOleClientSite, public IOleClientSite,
public IOleInPlaceSiteEx, public IOleInPlaceSiteEx,
public IOleInPlaceFrame, public IOleInPlaceFrame,
@@ -60,7 +60,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);
@@ -73,7 +73,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);
@@ -119,7 +119,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**);
@@ -148,7 +148,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;
@@ -225,14 +225,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);
@@ -268,11 +268,11 @@ 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 IViewObject Interface // get IViewObject Interface
hret = m_viewObject.QueryInterface(IID_IViewObject, m_ActiveX); hret = m_viewObject.QueryInterface(IID_IViewObject, m_ActiveX);
wxASSERT(SUCCEEDED(hret)); wxASSERT(SUCCEEDED(hret));
// document advise // document advise
@@ -529,23 +529,23 @@ private:
public: public:
wxActiveXEvents(wxActiveX *ax) : m_activeX(ax) {} wxActiveXEvents(wxActiveX *ax) : m_activeX(ax) {}
virtual ~wxActiveXEvents() virtual ~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;
}; };
@@ -591,7 +591,7 @@ public:
if (px.IsOut()) if (px.IsOut())
{ {
wxVariant& vx = event.m_params[nArg - i - 1]; wxVariant& vx = event.m_params[nArg - i - 1];
VariantToMSWVariant(vx, va); VariantToMSWVariant(vx, va);
}; };
}; };
@@ -605,7 +605,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;
@@ -616,7 +616,7 @@ public:
if (mid == m_activeX->m_eventsIdx.end()) if (mid == m_activeX->m_eventsIdx.end())
return S_OK; return S_OK;
int funcIdx = mid->second; int funcIdx = mid->second;
wxActiveX::FuncX &func = m_activeX->m_events[funcIdx]; wxActiveX::FuncX &func = m_activeX->m_events[funcIdx];
@@ -697,12 +697,12 @@ wxVariant& wxActiveXEvent::operator[] (wxString name)
return m_params[i]; return m_params[i];
}; };
wxString err = "wxActiveXEvent::operator[] invalid name <" + name + ">"; wxString err = wxT("wxActiveXEvent::operator[] invalid name <") + name + wxT(">");
err += "\r\nValid Names = :\r\n"; err += wxT("\r\nValid Names = :\r\n");
for (i = 0; i < m_params.GetCount(); i++) for (i = 0; i < m_params.GetCount(); i++)
{ {
err += m_params[i].GetName(); err += m_params[i].GetName();
err += "\r\n"; err += wxT("\r\n");
}; };
wxASSERT_MSG(false, err); wxASSERT_MSG(false, err);
@@ -713,15 +713,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).
*/ */
@@ -772,12 +772,12 @@ void wxActiveX::GetTypeInfo()
{ {
if (impTypeFlags & IMPLTYPEFLAG_FSOURCE) if (impTypeFlags & IMPLTYPEFLAG_FSOURCE)
{ {
WXOLE_TRACEOUT("Default Event Sink"); WXOLE_TRACEOUT(wxT("Default Event Sink"));
defEventSink = true; defEventSink = true;
} }
else else
{ {
WXOLE_TRACEOUT("Default Interface"); WXOLE_TRACEOUT(wxT("Default Interface"));
} }
}; };
@@ -804,7 +804,7 @@ void wxActiveX::GetTypeInfo(ITypeInfo *ti, bool defEventSink)
if (ta->typekind == TKIND_DISPATCH) if (ta->typekind == TKIND_DISPATCH)
{ {
WXOLE_TRACEOUT("GUID = " << GetIIDName(ta->guid).c_str()); WXOLE_TRACEOUT(wxT("GUID = ") << GetIIDName(ta->guid).c_str());
if (defEventSink) if (defEventSink)
{ {
@@ -831,7 +831,7 @@ void wxActiveX::GetTypeInfo(ITypeInfo *ti, bool defEventSink)
{ {
wxString name = anames[0]; wxString name = anames[0];
WXOLE_TRACEOUT("Name " << i << " = " << name.c_str()); WXOLE_TRACEOUT(wxT("Name ") << i << wxT(" = ") << name.c_str());
SysFreeString(anames[0]); SysFreeString(anames[0]);
if (defEventSink) if (defEventSink)
@@ -901,11 +901,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))
@@ -979,7 +979,7 @@ void wxActiveX::OnSize(wxSizeEvent& event)
m_oleObject->SetExtent(DVASPECT_CONTENT, &sz); m_oleObject->SetExtent(DVASPECT_CONTENT, &sz);
}; };
if (m_oleInPlaceObject.Ok()) if (m_oleInPlaceObject.Ok())
m_oleInPlaceObject->SetObjectRects(&posRect, &posRect); m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
} }
@@ -1002,7 +1002,7 @@ void wxActiveX::OnPaint(wxPaintEvent& event)
::RedrawWindow(m_oleObjectHWND, NULL, NULL, RDW_INTERNALPAINT); ::RedrawWindow(m_oleObjectHWND, NULL, NULL, RDW_INTERNALPAINT);
{ {
RECTL *prcBounds = (RECTL *) &posRect; RECTL *prcBounds = (RECTL *) &posRect;
m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL,
(HDC)dc.GetHDC(), prcBounds, NULL, NULL, 0); (HDC)dc.GetHDC(), prcBounds, NULL, NULL, 0);
} }
} }
@@ -1018,11 +1018,11 @@ void wxActiveX::OnPaint(wxPaintEvent& event)
void wxActiveX::OnMouse(wxMouseEvent& event) void wxActiveX::OnMouse(wxMouseEvent& event)
{ {
if (m_oleObjectHWND == NULL) if (m_oleObjectHWND == NULL)
{ {
wxLogTrace(wxT("no oleInPlaceObject")); wxLogTrace(wxT("no oleInPlaceObject"));
event.Skip(); event.Skip();
return; return;
} }
wxLogTrace(wxT("mouse event")); wxLogTrace(wxT("mouse event"));
@@ -1031,52 +1031,52 @@ void wxActiveX::OnMouse(wxMouseEvent& event)
LPARAM lParam = 0; LPARAM lParam = 0;
LRESULT lResult = 0; LRESULT lResult = 0;
if (event.m_metaDown) if (event.m_metaDown)
wParam |= MK_CONTROL; wParam |= MK_CONTROL;
if (event.m_shiftDown) if (event.m_shiftDown)
wParam |= MK_SHIFT; wParam |= MK_SHIFT;
if (event.m_leftDown) if (event.m_leftDown)
wParam |= MK_LBUTTON; wParam |= MK_LBUTTON;
if (event.m_middleDown) if (event.m_middleDown)
wParam |= MK_MBUTTON; wParam |= MK_MBUTTON;
if (event.m_rightDown) if (event.m_rightDown)
wParam |= MK_RBUTTON; wParam |= MK_RBUTTON;
lParam = event.m_x << 16; lParam = event.m_x << 16;
lParam |= event.m_y; lParam |= event.m_y;
if (event.LeftDown()) if (event.LeftDown())
msg = WM_LBUTTONDOWN; msg = WM_LBUTTONDOWN;
else if (event.LeftDClick()) else if (event.LeftDClick())
msg = WM_LBUTTONDBLCLK; msg = WM_LBUTTONDBLCLK;
else if (event.LeftUp()) else if (event.LeftUp())
msg = WM_LBUTTONUP; msg = WM_LBUTTONUP;
else if (event.MiddleDown()) else if (event.MiddleDown())
msg = WM_MBUTTONDOWN; msg = WM_MBUTTONDOWN;
else if (event.MiddleDClick()) else if (event.MiddleDClick())
msg = WM_MBUTTONDBLCLK; msg = WM_MBUTTONDBLCLK;
else if (event.MiddleUp()) else if (event.MiddleUp())
msg = WM_MBUTTONUP; msg = WM_MBUTTONUP;
else if (event.RightDown()) else if (event.RightDown())
msg = WM_RBUTTONDOWN; msg = WM_RBUTTONDOWN;
else if (event.RightDClick()) else if (event.RightDClick())
msg = WM_RBUTTONDBLCLK; msg = WM_RBUTTONDBLCLK;
else if (event.RightUp()) else if (event.RightUp())
msg = WM_RBUTTONUP; msg = WM_RBUTTONUP;
else if (event.Moving() || event.Dragging()) else if (event.Moving() || event.Dragging())
msg = WM_MOUSEMOVE; msg = WM_MOUSEMOVE;
wxString log; wxString log;
if (msg == 0) if (msg == 0)
{ {
wxLogTrace(wxT("no message")); wxLogTrace(wxT("no message"));
event.Skip(); return; event.Skip(); return;
}; };
if (!::SendMessage(m_oleObjectHWND, msg, wParam, lParam)) if (!::SendMessage(m_oleObjectHWND, msg, wParam, lParam))
{ {
wxLogTrace(wxT("msg not delivered")); wxLogTrace(wxT("msg not delivered"));
event.Skip(); event.Skip();
return; return;
}; };
wxLogTrace(wxT("msg sent")); wxLogTrace(wxT("msg sent"));
@@ -1106,13 +1106,13 @@ long wxActiveX::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
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);
} }
@@ -1132,7 +1132,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();
} }
@@ -1175,7 +1175,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
@@ -1251,7 +1251,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;
@@ -1268,7 +1268,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;
} }
@@ -1276,7 +1276,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;
} }
@@ -1373,9 +1373,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;
} }
@@ -1465,7 +1465,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;
} }
@@ -1502,9 +1502,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));
@@ -1557,26 +1557,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;
@@ -1586,7 +1586,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;
@@ -1651,7 +1651,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");
@@ -1670,8 +1670,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");
@@ -1775,49 +1775,49 @@ wxString OLEHResultToString(HRESULT hr)
switch (hr) switch (hr)
{ {
case S_OK: case S_OK:
return ""; return wxEmptyString;
case OLECMDERR_E_UNKNOWNGROUP: case OLECMDERR_E_UNKNOWNGROUP:
return "The pguidCmdGroup parameter is not NULL but does not specify a recognized command group."; return wxT("The pguidCmdGroup parameter is not NULL but does not specify a recognized command group.");
case OLECMDERR_E_NOTSUPPORTED: case OLECMDERR_E_NOTSUPPORTED:
return "The nCmdID parameter is not a valid command in the group identified by pguidCmdGroup."; return wxT("The nCmdID parameter is not a valid command in the group identified by pguidCmdGroup.");
case OLECMDERR_E_DISABLED: case OLECMDERR_E_DISABLED:
return "The command identified by nCmdID is currently disabled and cannot be executed."; return wxT("The command identified by nCmdID is currently disabled and cannot be executed.");
case OLECMDERR_E_NOHELP: case OLECMDERR_E_NOHELP:
return "The caller has asked for help on the command identified by nCmdID, but no help is available."; return wxT("The caller has asked for help on the command identified by nCmdID, but no help is available.");
case OLECMDERR_E_CANCELED: case OLECMDERR_E_CANCELED:
return "The user canceled the execution of the command."; return wxT("The user canceled the execution of the command.");
case E_INVALIDARG: case E_INVALIDARG:
return "E_INVALIDARG"; return wxT("E_INVALIDARG");
case E_OUTOFMEMORY: case E_OUTOFMEMORY:
return "E_OUTOFMEMORY"; return wxT("E_OUTOFMEMORY");
case E_NOINTERFACE: case E_NOINTERFACE:
return "E_NOINTERFACE"; return wxT("E_NOINTERFACE");
case E_UNEXPECTED: case E_UNEXPECTED:
return "E_UNEXPECTED"; return wxT("E_UNEXPECTED");
case STG_E_INVALIDFLAG: case STG_E_INVALIDFLAG:
return "STG_E_INVALIDFLAG"; return wxT("STG_E_INVALIDFLAG");
case E_FAIL: case E_FAIL:
return "E_FAIL"; return wxT("E_FAIL");
case E_NOTIMPL: case E_NOTIMPL:
return "E_NOTIMPL"; return wxT("E_NOTIMPL");
default: default:
{ {
char buf[64]; wxString buf;
sprintf(buf, "Unknown - 0x%X", hr); buf.Printf(wxT("Unknown - 0x%X"), hr);
return wxString(buf); return buf;
} }
}; };
}; };
@@ -1826,7 +1826,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;
@@ -1836,7 +1836,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),
@@ -1930,9 +1930,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;
} }
@@ -1948,5 +1948,5 @@ wxString GetIIDName(REFIID riid)
return s; return s;
} }
else else
return "StringFromIID() error"; return wxT("StringFromIID() error");
} }

View File

@@ -391,16 +391,17 @@ static PyObject *_wrap_wxPseudoMetaFile_LoadFromMetaFile(PyObject *self, PyObjec
PyObject * _resultobj; PyObject * _resultobj;
bool _result; bool _result;
wxPseudoMetaFile * _arg0; wxPseudoMetaFile * _arg0;
char * _arg1; wxString * _arg1;
double * _arg2; double * _arg2;
double * _arg3; double * _arg3;
PyObject * _argo0 = 0; PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
PyObject * _argo2 = 0; PyObject * _argo2 = 0;
PyObject * _argo3 = 0; PyObject * _argo3 = 0;
char *_kwnames[] = { "self","filename","width","height", NULL }; char *_kwnames[] = { "self","filename","width","height", NULL };
self = self; self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OsOO:wxPseudoMetaFile_LoadFromMetaFile",_kwnames,&_argo0,&_arg1,&_argo2,&_argo3)) if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOOO:wxPseudoMetaFile_LoadFromMetaFile",_kwnames,&_argo0,&_obj1,&_argo2,&_argo3))
return NULL; return NULL;
if (_argo0) { if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; } if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -409,6 +410,11 @@ static PyObject *_wrap_wxPseudoMetaFile_LoadFromMetaFile(PyObject *self, PyObjec
return NULL; return NULL;
} }
} }
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
if (_argo2) { if (_argo2) {
if (_argo2 == Py_None) { _arg2 = NULL; } if (_argo2 == Py_None) { _arg2 = NULL; }
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_double_p")) { else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_double_p")) {
@@ -425,11 +431,15 @@ static PyObject *_wrap_wxPseudoMetaFile_LoadFromMetaFile(PyObject *self, PyObjec
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (bool )wxPseudoMetaFile_LoadFromMetaFile(_arg0,_arg1,_arg2,_arg3); _result = (bool )wxPseudoMetaFile_LoadFromMetaFile(_arg0,*_arg1,_arg2,_arg3);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL; if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result); } _resultobj = Py_BuildValue("i",_result);
{
if (_obj1)
delete _arg1;
}
return _resultobj; return _resultobj;
} }
@@ -5938,12 +5948,13 @@ static PyObject *_wrap_wxPyDrawnShape_LoadFromMetaFile(PyObject *self, PyObject
PyObject * _resultobj; PyObject * _resultobj;
bool _result; bool _result;
wxPyDrawnShape * _arg0; wxPyDrawnShape * _arg0;
char * _arg1; wxString * _arg1;
PyObject * _argo0 = 0; PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","filename", NULL }; char *_kwnames[] = { "self","filename", NULL };
self = self; self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Os:wxPyDrawnShape_LoadFromMetaFile",_kwnames,&_argo0,&_arg1)) if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxPyDrawnShape_LoadFromMetaFile",_kwnames,&_argo0,&_obj1))
return NULL; return NULL;
if (_argo0) { if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; } if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -5952,13 +5963,22 @@ static PyObject *_wrap_wxPyDrawnShape_LoadFromMetaFile(PyObject *self, PyObject
return NULL; return NULL;
} }
} }
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
_result = (bool )wxPyDrawnShape_LoadFromMetaFile(_arg0,_arg1); _result = (bool )wxPyDrawnShape_LoadFromMetaFile(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate); wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL; if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result); } _resultobj = Py_BuildValue("i",_result);
{
if (_obj1)
delete _arg1;
}
return _resultobj; return _resultobj;
} }

View File

@@ -56,7 +56,7 @@ public:
void ScaleTo(double w, double h); void ScaleTo(double w, double h);
void Translate(double x, double y); void Translate(double x, double y);
void Rotate(double x, double y, double theta); void Rotate(double x, double y, double theta);
bool LoadFromMetaFile(char* filename, double *width, double *height); bool LoadFromMetaFile(const wxString& filename, double *width, double *height);
void GetBounds(double *minX, double *minY, double *maxX, double *maxY); void GetBounds(double *minX, double *minY, double *maxX, double *maxY);
void CalculateSize(wxPyDrawnShape* shape); void CalculateSize(wxPyDrawnShape* shape);
@@ -281,7 +281,7 @@ public:
wxPseudoMetaFile& GetMetaFile(); wxPseudoMetaFile& GetMetaFile();
double GetRotation(); double GetRotation();
bool LoadFromMetaFile(char * filename); bool LoadFromMetaFile(const wxString& filename);
void Rotate(double x, double y, double theta); void Rotate(double x, double y, double theta);
void SetClippingRect(const wxRect& rect); void SetClippingRect(const wxRect& rect);
void SetDrawnBackgroundColour(const wxColour& colour); void SetDrawnBackgroundColour(const wxColour& colour);

View File

@@ -291,7 +291,7 @@ wxBitmap wxPyBitmapDataObject::GetBitmap() {
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) { void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
if (m_myInst.findCallback("SetBitmap")) { if (m_myInst.findCallback("SetBitmap")) {
PyObject* bo = wxPyConstructObject((void*)&bitmap, "wxBitmap"); PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"));
m_myInst.callCallback(Py_BuildValue("(O)", bo)); m_myInst.callCallback(Py_BuildValue("(O)", bo));
Py_DECREF(bo); Py_DECREF(bo);
} }

View File

@@ -1102,8 +1102,8 @@ public:
bool found; bool found;
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
if ((found = m_myInst.findCallback("OnCompareItems"))) { if ((found = m_myInst.findCallback("OnCompareItems"))) {
PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId"); PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"));
PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId"); PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"));
rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2)); rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2));
Py_DECREF(o1); Py_DECREF(o1);
Py_DECREF(o2); Py_DECREF(o2);
@@ -1244,7 +1244,7 @@ public:
num = self->GetSelections(array); num = self->GetSelections(array);
for (x=0; x < num; x++) { for (x=0; x < num; x++) {
wxTreeItemId *tii = new wxTreeItemId(array.Item(x)); wxTreeItemId *tii = new wxTreeItemId(array.Item(x));
PyObject* item = wxPyConstructObject((void*)tii, "wxTreeItemId", TRUE); PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), TRUE);
PyList_Append(rval, item); PyList_Append(rval, item);
} }
wxPyEndBlockThreads(); wxPyEndBlockThreads();
@@ -1335,7 +1335,7 @@ public:
if (self->GetBoundingRect(item, rect, textOnly)) { if (self->GetBoundingRect(item, rect, textOnly)) {
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
wxRect* r = new wxRect(rect); wxRect* r = new wxRect(rect);
PyObject* val = wxPyConstructObject((void*)r, "wxRect"); PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"));
wxPyEndBlockThreads(); wxPyEndBlockThreads();
return val; return val;
} }

View File

@@ -70,7 +70,7 @@ PyObject* wxPyMake_##TYPE(TYPE* source) { \
/* Otherwise make a new wrapper for it the old fashioned way and \ /* Otherwise make a new wrapper for it the old fashioned way and \
give it the OOR treatment */ \ give it the OOR treatment */ \
if (! target) { \ if (! target) { \
target = wxPyConstructObject(source, #TYPE, FALSE); \ target = wxPyConstructObject(source, wxT(#TYPE), FALSE); \
if (target) \ if (target) \
source->SetClientObject(new wxPyOORClientData(target)); \ source->SetClientObject(new wxPyOORClientData(target)); \
} \ } \
@@ -571,7 +571,7 @@ public:
PyObject* go = wxPyMake_wxObject(&grid); PyObject* go = wxPyMake_wxObject(&grid);
PyObject* dco = wxPyMake_wxObject(&dc); PyObject* dco = wxPyMake_wxObject(&dc);
PyObject* ao = wxPyMake_wxGridCellAttr(&attr); PyObject* ao = wxPyMake_wxGridCellAttr(&attr);
PyObject* ro = wxPyConstructObject((void*)&rect, "wxRect", 0); PyObject* ro = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro, wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOiii)", go, ao, dco, ro,
row, col, isSelected)); row, col, isSelected));
@@ -856,7 +856,7 @@ public:
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) { if ((found = wxPyCBH_findCallback(m_myInst, "PaintBackground)"))) {
PyObject* ao = wxPyMake_wxGridCellAttr(attr); PyObject* ao = wxPyMake_wxGridCellAttr(attr);
PyObject* ro = wxPyConstructObject((void*)&rectCell, "wxRect", 0); PyObject* ro = wxPyConstructObject((void*)&rectCell, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", ro, ao));

View File

@@ -527,7 +527,7 @@ public:
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxHW_SCROLLBAR_AUTO, long style = wxHW_SCROLLBAR_AUTO,
const wxString& name = "htmlWindow") const wxString& name = wxPyHtmlWindowNameStr)
: wxHtmlWindow(parent, id, pos, size, style, name) {}; : wxHtmlWindow(parent, id, pos, size, style, name) {};
wxPyHtmlWindow() : wxHtmlWindow() {}; wxPyHtmlWindow() : wxHtmlWindow() {};
@@ -563,7 +563,7 @@ void wxPyHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link) {
bool found; bool found;
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) { if ((found = wxPyCBH_findCallback(m_myInst, "OnLinkClicked"))) {
PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo", 0); PyObject* obj = wxPyConstructObject((void*)&link, wxT("wxHtmlLinkInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));
Py_DECREF(obj); Py_DECREF(obj);
} }

View File

@@ -318,7 +318,7 @@ public:
if (dest != wxRect(0,0,0,0)) { if (dest != wxRect(0,0,0,0)) {
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
wxRect* newRect = new wxRect(dest); wxRect* newRect = new wxRect(dest);
obj = wxPyConstructObject((void*)newRect, "wxRect"); obj = wxPyConstructObject((void*)newRect, wxT("wxRect"));
PyObject* one = PyInt_FromLong(1); PyObject* one = PyInt_FromLong(1);
PyObject_SetAttrString(obj, "thisown", one); PyObject_SetAttrString(obj, "thisown", one);
Py_DECREF(one); Py_DECREF(one);

View File

@@ -1257,7 +1257,7 @@ public:
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
PyObject* tuple = PyTuple_New(3); PyObject* tuple = PyTuple_New(3);
PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon), PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon),
"wxIcon", TRUE)); wxT("wxIcon"), TRUE));
#if wxUSE_UNICODE #if wxUSE_UNICODE
PyTuple_SetItem(tuple, 1, PyUnicode_FromUnicode(iconFile.c_str(), iconFile.Len())); PyTuple_SetItem(tuple, 1, PyUnicode_FromUnicode(iconFile.c_str(), iconFile.Len()));
#else #else
@@ -1527,7 +1527,7 @@ public:
wxBitmap rval = wxNullBitmap; wxBitmap rval = wxNullBitmap;
wxPyBeginBlockThreads(); wxPyBeginBlockThreads();
if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) { if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) {
PyObject* so = wxPyConstructObject((void*)&size, "wxSize", 0); PyObject* so = wxPyConstructObject((void*)&size, wxT("wxSize"), 0);
PyObject* ro; PyObject* ro;
wxBitmap* ptr; wxBitmap* ptr;
PyObject* s1, *s2; PyObject* s1, *s2;

View File

@@ -61,7 +61,7 @@
if ($source) { if ($source) {
_ptr = new wxPyInputStream($source); _ptr = new wxPyInputStream($source);
} }
$target = wxPyConstructObject(_ptr, "wxInputStream", TRUE); $target = wxPyConstructObject(_ptr, wxT("wxInputStream"), TRUE);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------