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

@@ -69,7 +69,7 @@ public:
~wxGLContext();
void SetCurrent();
void SetColour(const char *colour);
void SetColour(const wxString& colour);
void SwapBuffers();
#ifdef __WXGTK__
@@ -151,7 +151,7 @@ public:
%pragma(python) addtomethod = "wxGLCanvasWithContext:val._setOORInfo(self)"
void SetCurrent();
void SetColour(const char *colour);
void SetColour(const wxString& colour);
void SwapBuffers();
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) {
PyObject * _resultobj;
wxGLContext * _arg0;
char * _arg1;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","colour", NULL };
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;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -224,14 +225,23 @@ static PyObject *_wrap_wxGLContext_SetColour(PyObject *self, PyObject *args, PyO
return NULL;
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxGLContext_SetColour(_arg0,_arg1);
wxGLContext_SetColour(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
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) {
PyObject * _resultobj;
wxGLCanvas * _arg0;
char * _arg1;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","colour", NULL };
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;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -558,14 +569,23 @@ static PyObject *_wrap_wxGLCanvas_SetColour(PyObject *self, PyObject *args, PyOb
return NULL;
}
}
{
_arg1 = wxString_in_helper(_obj1);
if (_arg1 == NULL)
return NULL;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
wxGLCanvas_SetColour(_arg0,_arg1);
wxGLCanvas_SetColour(_arg0,*_arg1);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}

View File

@@ -27,15 +27,17 @@
#if wxUSE_GLCANVAS
#ifndef WX_PRECOMP
#include <wx/frame.h>
#include "wx/frame.h"
#include "wx/settings.h"
#include "wx/intl.h"
#include "wx/log.h"
#endif
#include <wx/msw/private.h>
#include <wx/settings.h>
#include <wx/log.h>
#include "wx/msw/private.h"
#include "myglcanvas.h"
const wxChar* wxGLCanvasName = wxT("GLcanvas");
static const wxChar *wxGLCanvasClassName = wxT("wxGLCanvasClass");
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 g = 0.0;
@@ -403,7 +405,6 @@ static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList)
void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
{
int pixelFormat;
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */
1, /* version */
@@ -427,13 +428,13 @@ void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
AdjustPFDForAttributes(pfd, attribList);
pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
int pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
if (pixelFormat == 0) {
wxLogWarning(_("ChoosePixelFormat failed."));
wxLogLastError(_T("ChoosePixelFormat"));
}
else {
if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) {
wxLogWarning(_("SetPixelFormat failed."));
if ( !::SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) ) {
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)
m_glContext->SetColour(colour);
@@ -728,7 +729,7 @@ bool wxGLApp::InitGLVisual(int *attribList)
AdjustPFDForAttributes(pfd, attribList);
// 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) {
wxLogError(_("Failed to initialize OpenGL"));

View File

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