Added some optimization methods to wxPython's wxDC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -517,7 +517,7 @@ public:
|
||||
int GetItemCount() const;
|
||||
|
||||
// Gets the number of columns in the list control
|
||||
int GetColumnCount() const { return m_colCount; }
|
||||
int GetColumnCount() const;
|
||||
|
||||
// Retrieves the spacing between icons in pixels.
|
||||
// If small is TRUE, gets the spacing for the small icon
|
||||
|
@@ -818,12 +818,192 @@ public:
|
||||
void CalcBoundingBox(int x, int y);
|
||||
void ResetBoundingBox();
|
||||
|
||||
%addmethods {
|
||||
void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
|
||||
// See below for implementation
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
long GetHDC();
|
||||
#endif
|
||||
|
||||
|
||||
%addmethods {
|
||||
// Draw a point for every set of coordinants in pyPoints, optionally
|
||||
// setting a new pen for each
|
||||
PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) {
|
||||
bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
|
||||
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
|
||||
int numObjs = 0;
|
||||
int numPens = 0;
|
||||
wxPen* pen;
|
||||
PyObject* obj;
|
||||
int x1, y1;
|
||||
int i = 0;
|
||||
|
||||
if (!PySequence_Check(pyPoints)) {
|
||||
goto err0;
|
||||
}
|
||||
if (!PySequence_Check(pyPens)) {
|
||||
goto err1;
|
||||
}
|
||||
numObjs = PySequence_Length(pyPoints);
|
||||
numPens = PySequence_Length(pyPens);
|
||||
|
||||
for (i = 0; i < numObjs; i++) {
|
||||
// Use a new pen?
|
||||
if (i < numPens) {
|
||||
if (isFastPens) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyPens, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyPens, i);
|
||||
}
|
||||
if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
|
||||
goto err1;
|
||||
}
|
||||
|
||||
self->SetPen(*pen);
|
||||
if (!isFastPens)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
// Get the point coordinants
|
||||
if (isFastSeq) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyPoints, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyPoints, i);
|
||||
}
|
||||
if (! _2int_seq_helper(obj, &x1, &y1)) {
|
||||
Py_DECREF(obj);
|
||||
goto err0;
|
||||
}
|
||||
|
||||
// Now draw the point
|
||||
self->DrawPoint(x1, y1);
|
||||
|
||||
if (!isFastSeq)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
||||
err1:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
|
||||
return NULL;
|
||||
err0:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Draw a line for every set of coordinants in pyLines, optionally
|
||||
// setting a new pen for each
|
||||
PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) {
|
||||
bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
|
||||
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
|
||||
int numObjs = 0;
|
||||
int numPens = 0;
|
||||
wxPen* pen;
|
||||
PyObject* obj;
|
||||
int x1, y1, x2, y2;
|
||||
int i = 0;
|
||||
|
||||
if (!PySequence_Check(pyLines)) {
|
||||
goto err0;
|
||||
}
|
||||
if (!PySequence_Check(pyPens)) {
|
||||
goto err1;
|
||||
}
|
||||
numObjs = PySequence_Length(pyLines);
|
||||
numPens = PySequence_Length(pyPens);
|
||||
|
||||
for (i = 0; i < numObjs; i++) {
|
||||
// Use a new pen?
|
||||
if (i < numPens) {
|
||||
if (isFastPens) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyPens, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyPens, i);
|
||||
}
|
||||
if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
|
||||
goto err1;
|
||||
}
|
||||
|
||||
self->SetPen(*pen);
|
||||
if (!isFastPens)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
// Get the line coordinants
|
||||
if (isFastSeq) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyLines, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyLines, i);
|
||||
}
|
||||
if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
|
||||
Py_DECREF(obj);
|
||||
goto err0;
|
||||
}
|
||||
|
||||
// Now draw the line
|
||||
self->DrawLine(x1, y1, x2, y2);
|
||||
|
||||
if (!isFastSeq)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
||||
err1:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
|
||||
return NULL;
|
||||
err0:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%pragma(python) addtoclass = "
|
||||
def DrawPointList(self, points, pens=None):
|
||||
if pens is None:
|
||||
pens = []
|
||||
elif isinstance(pens, wxPenPtr):
|
||||
pens = [pens]
|
||||
elif len(pens) != len(points):
|
||||
raise ValueError('points and pens must have same length')
|
||||
return self._DrawPointList(points, pens)
|
||||
|
||||
def DrawLineList(self, lines, pens=None):
|
||||
if pens is None:
|
||||
pens = []
|
||||
elif isinstance(pens, wxPenPtr):
|
||||
pens = [pens]
|
||||
elif len(pens) != len(lines):
|
||||
raise ValueError('lines and pens must have same length')
|
||||
return self._DrawLineList(lines, pens)
|
||||
"
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
%{
|
||||
static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
|
||||
*x1 = dc->MinX();
|
||||
*y1 = dc->MinY();
|
||||
*x2 = dc->MaxX();
|
||||
*y2 = dc->MaxY();
|
||||
}
|
||||
%}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class wxMemoryDC : public wxDC {
|
||||
|
@@ -893,23 +893,19 @@ static inline bool wxPointFromObjects(PyObject* o1, PyObject* o2, wxPoint* point
|
||||
}
|
||||
|
||||
|
||||
#if PYTHON_API_VERSION < 1009
|
||||
#define PySequence_Fast_GET_ITEM(o, i)\
|
||||
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
|
||||
#endif
|
||||
|
||||
wxPoint* wxPoint_LIST_helper(PyObject* source, int *count) {
|
||||
// Putting all of the declarations here allows
|
||||
// us to put the error handling all in one place.
|
||||
int x;
|
||||
wxPoint* temp;
|
||||
PyObject *o, *o1, *o2;
|
||||
int isFast = PyList_Check(source) || PyTuple_Check(source);
|
||||
bool isFast = PyList_Check(source) || PyTuple_Check(source);
|
||||
|
||||
// The length of the sequence is returned in count.
|
||||
if (!PySequence_Check(source)) {
|
||||
goto error0;
|
||||
}
|
||||
|
||||
// The length of the sequence is returned in count.
|
||||
*count = PySequence_Length(source);
|
||||
if (*count < 0) {
|
||||
goto error0;
|
||||
@@ -1085,6 +1081,99 @@ wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source) {
|
||||
}
|
||||
|
||||
|
||||
wxPen** wxPen_LIST_helper(PyObject* source) {
|
||||
if (!PyList_Check(source)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a list object.");
|
||||
return NULL;
|
||||
}
|
||||
int count = PyList_Size(source);
|
||||
wxPen** temp = new wxPen*[count];
|
||||
if (!temp) {
|
||||
PyErr_SetString(PyExc_MemoryError, "Unable to allocate temporary array");
|
||||
return NULL;
|
||||
}
|
||||
for (int x=0; x<count; x++) {
|
||||
PyObject* o = PyList_GetItem(source, x);
|
||||
if (PyInstance_Check(o)) {
|
||||
wxPen* pt;
|
||||
if (SWIG_GetPtrObj(o, (void **) &pt,"_wxPen_p")) {
|
||||
delete temp;
|
||||
PyErr_SetString(PyExc_TypeError,"Expected _wxPen_p.");
|
||||
return NULL;
|
||||
}
|
||||
temp[x] = pt;
|
||||
}
|
||||
else {
|
||||
delete temp;
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a list of wxPens.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
bool _2int_seq_helper(PyObject* source, int* i1, int* i2) {
|
||||
bool isFast = PyList_Check(source) || PyTuple_Check(source);
|
||||
PyObject *o1, *o2;
|
||||
|
||||
if (!PySequence_Check(source) || PySequence_Length(source) != 2)
|
||||
return FALSE;
|
||||
|
||||
if (isFast) {
|
||||
o1 = PySequence_Fast_GET_ITEM(source, 0);
|
||||
o2 = PySequence_Fast_GET_ITEM(source, 1);
|
||||
}
|
||||
else {
|
||||
o1 = PySequence_GetItem(source, 0);
|
||||
o2 = PySequence_GetItem(source, 1);
|
||||
}
|
||||
|
||||
*i1 = PyInt_AsLong(o1);
|
||||
*i2 = PyInt_AsLong(o2);
|
||||
|
||||
if (! isFast) {
|
||||
Py_DECREF(o1);
|
||||
Py_DECREF(o2);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4) {
|
||||
bool isFast = PyList_Check(source) || PyTuple_Check(source);
|
||||
PyObject *o1, *o2, *o3, *o4;
|
||||
|
||||
if (!PySequence_Check(source) || PySequence_Length(source) != 4)
|
||||
return FALSE;
|
||||
|
||||
if (isFast) {
|
||||
o1 = PySequence_Fast_GET_ITEM(source, 0);
|
||||
o2 = PySequence_Fast_GET_ITEM(source, 1);
|
||||
o3 = PySequence_Fast_GET_ITEM(source, 2);
|
||||
o4 = PySequence_Fast_GET_ITEM(source, 3);
|
||||
}
|
||||
else {
|
||||
o1 = PySequence_GetItem(source, 0);
|
||||
o2 = PySequence_GetItem(source, 1);
|
||||
o3 = PySequence_GetItem(source, 2);
|
||||
o4 = PySequence_GetItem(source, 3);
|
||||
}
|
||||
|
||||
*i1 = PyInt_AsLong(o1);
|
||||
*i2 = PyInt_AsLong(o2);
|
||||
*i3 = PyInt_AsLong(o3);
|
||||
*i4 = PyInt_AsLong(o4);
|
||||
|
||||
if (! isFast) {
|
||||
Py_DECREF(o1);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
Py_DECREF(o4);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@@ -134,6 +134,7 @@ wxPoint* wxPoint_LIST_helper(PyObject* source, int* npoints);
|
||||
wxBitmap** wxBitmap_LIST_helper(PyObject* source);
|
||||
wxString* wxString_LIST_helper(PyObject* source);
|
||||
wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
|
||||
wxPen** wxPen_LIST_helper(PyObject* source);
|
||||
|
||||
bool wxSize_helper(PyObject* source, wxSize** obj);
|
||||
bool wxPoint_helper(PyObject* source, wxPoint** obj);
|
||||
@@ -141,6 +142,15 @@ bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj);
|
||||
bool wxRect_helper(PyObject* source, wxRect** obj);
|
||||
bool wxColour_helper(PyObject* source, wxColour** obj);
|
||||
|
||||
#if PYTHON_API_VERSION < 1009
|
||||
#define PySequence_Fast_GET_ITEM(o, i) \
|
||||
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
|
||||
#endif
|
||||
|
||||
bool _2int_seq_helper(PyObject* source, int* i1, int* i2);
|
||||
bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#ifndef SWIGCODE
|
||||
@@ -1505,6 +1515,7 @@ public:
|
||||
wxPyEndBlockThreads(state); \
|
||||
if (! found) \
|
||||
return PCLASS::CBNAME(e); \
|
||||
return rval; \
|
||||
} \
|
||||
bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
|
||||
return PCLASS::CBNAME(e); \
|
||||
|
@@ -207,6 +207,13 @@ public:
|
||||
private:
|
||||
wxDash* m_dash;
|
||||
};
|
||||
|
||||
static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
|
||||
*x1 = dc->MinX();
|
||||
*y1 = dc->MinY();
|
||||
*x2 = dc->MaxX();
|
||||
*y2 = dc->MaxY();
|
||||
}
|
||||
// Alternate 'constructor'
|
||||
wxMemoryDC* wxMemoryDCFromDC(wxDC* oldDC) {
|
||||
return new wxMemoryDC(oldDC);
|
||||
@@ -9350,6 +9357,73 @@ static PyObject *_wrap_wxDC_ResetBoundingBox(PyObject *self, PyObject *args, PyO
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxDC_GetBoundingBox(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxDC * _arg0;
|
||||
int * _arg1;
|
||||
int temp;
|
||||
int * _arg2;
|
||||
int temp0;
|
||||
int * _arg3;
|
||||
int temp1;
|
||||
int * _arg4;
|
||||
int temp2;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
{
|
||||
_arg1 = &temp;
|
||||
}
|
||||
{
|
||||
_arg2 = &temp0;
|
||||
}
|
||||
{
|
||||
_arg3 = &temp1;
|
||||
}
|
||||
{
|
||||
_arg4 = &temp2;
|
||||
}
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDC_GetBoundingBox",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDC_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDC_GetBoundingBox. Expected _wxDC_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
wxDC_GetBoundingBox(_arg0,_arg1,_arg2,_arg3,_arg4);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyInt_FromLong((long) (*_arg1));
|
||||
_resultobj = t_output_helper(_resultobj, o);
|
||||
}
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyInt_FromLong((long) (*_arg2));
|
||||
_resultobj = t_output_helper(_resultobj, o);
|
||||
}
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyInt_FromLong((long) (*_arg3));
|
||||
_resultobj = t_output_helper(_resultobj, o);
|
||||
}
|
||||
{
|
||||
PyObject *o;
|
||||
o = PyInt_FromLong((long) (*_arg4));
|
||||
_resultobj = t_output_helper(_resultobj, o);
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxDC_GetHDC(_swigobj) (_swigobj->GetHDC())
|
||||
static PyObject *_wrap_wxDC_GetHDC(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -9378,6 +9452,216 @@ static PyObject *_wrap_wxDC_GetHDC(PyObject *self, PyObject *args, PyObject *kwa
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject * wxDC__DrawPointList(wxDC *self,PyObject * pyPoints,PyObject * pyPens) {
|
||||
bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
|
||||
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
|
||||
int numObjs = 0;
|
||||
int numPens = 0;
|
||||
wxPen* pen;
|
||||
PyObject* obj;
|
||||
int x1, y1;
|
||||
int i = 0;
|
||||
|
||||
if (!PySequence_Check(pyPoints)) {
|
||||
goto err0;
|
||||
}
|
||||
if (!PySequence_Check(pyPens)) {
|
||||
goto err1;
|
||||
}
|
||||
numObjs = PySequence_Length(pyPoints);
|
||||
numPens = PySequence_Length(pyPens);
|
||||
|
||||
for (i = 0; i < numObjs; i++) {
|
||||
// Use a new pen?
|
||||
if (i < numPens) {
|
||||
if (isFastPens) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyPens, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyPens, i);
|
||||
}
|
||||
if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
|
||||
goto err1;
|
||||
}
|
||||
|
||||
self->SetPen(*pen);
|
||||
if (!isFastPens)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
// Get the point coordinants
|
||||
if (isFastSeq) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyPoints, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyPoints, i);
|
||||
}
|
||||
if (! _2int_seq_helper(obj, &x1, &y1)) {
|
||||
Py_DECREF(obj);
|
||||
goto err0;
|
||||
}
|
||||
|
||||
// Now draw the point
|
||||
self->DrawPoint(x1, y1);
|
||||
|
||||
if (!isFastSeq)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
||||
err1:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
|
||||
return NULL;
|
||||
err0:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
|
||||
return NULL;
|
||||
}
|
||||
static PyObject *_wrap_wxDC__DrawPointList(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
PyObject * _result;
|
||||
wxDC * _arg0;
|
||||
PyObject * _arg1;
|
||||
PyObject * _arg2;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
char *_kwnames[] = { "self","pyPoints","pyPens", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxDC__DrawPointList",_kwnames,&_argo0,&_obj1,&_obj2))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDC_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDC__DrawPointList. Expected _wxDC_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = _obj1;
|
||||
}
|
||||
{
|
||||
_arg2 = _obj2;
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
_result = (PyObject *)wxDC__DrawPointList(_arg0,_arg1,_arg2);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
_resultobj = _result;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject * wxDC__DrawLineList(wxDC *self,PyObject * pyLines,PyObject * pyPens) {
|
||||
bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
|
||||
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
|
||||
int numObjs = 0;
|
||||
int numPens = 0;
|
||||
wxPen* pen;
|
||||
PyObject* obj;
|
||||
int x1, y1, x2, y2;
|
||||
int i = 0;
|
||||
|
||||
if (!PySequence_Check(pyLines)) {
|
||||
goto err0;
|
||||
}
|
||||
if (!PySequence_Check(pyPens)) {
|
||||
goto err1;
|
||||
}
|
||||
numObjs = PySequence_Length(pyLines);
|
||||
numPens = PySequence_Length(pyPens);
|
||||
|
||||
for (i = 0; i < numObjs; i++) {
|
||||
// Use a new pen?
|
||||
if (i < numPens) {
|
||||
if (isFastPens) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyPens, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyPens, i);
|
||||
}
|
||||
if (SWIG_GetPtrObj(obj, (void **) &pen, "_wxPen_p")) {
|
||||
goto err1;
|
||||
}
|
||||
|
||||
self->SetPen(*pen);
|
||||
if (!isFastPens)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
// Get the line coordinants
|
||||
if (isFastSeq) {
|
||||
obj = PySequence_Fast_GET_ITEM(pyLines, i);
|
||||
}
|
||||
else {
|
||||
obj = PySequence_GetItem(pyLines, i);
|
||||
}
|
||||
if (! _4int_seq_helper(obj, &x1, &y1, &x2, &y2)) {
|
||||
Py_DECREF(obj);
|
||||
goto err0;
|
||||
}
|
||||
|
||||
// Now draw the line
|
||||
self->DrawLine(x1, y1, x2, y2);
|
||||
|
||||
if (!isFastSeq)
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
||||
err1:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
|
||||
return NULL;
|
||||
err0:
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
|
||||
return NULL;
|
||||
}
|
||||
static PyObject *_wrap_wxDC__DrawLineList(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
PyObject * _result;
|
||||
wxDC * _arg0;
|
||||
PyObject * _arg1;
|
||||
PyObject * _arg2;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
char *_kwnames[] = { "self","pyLines","pyPens", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxDC__DrawLineList",_kwnames,&_argo0,&_obj1,&_obj2))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDC_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDC__DrawLineList. Expected _wxDC_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
_arg1 = _obj1;
|
||||
}
|
||||
{
|
||||
_arg2 = _obj2;
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
_result = (PyObject *)wxDC__DrawLineList(_arg0,_arg1,_arg2);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
_resultobj = _result;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static void *SwigwxMemoryDCTowxDC(void *ptr) {
|
||||
wxMemoryDC *src;
|
||||
wxDC *dest;
|
||||
@@ -11633,7 +11917,10 @@ static PyMethodDef gdicMethods[] = {
|
||||
{ "new_wxScreenDC", (PyCFunction) _wrap_new_wxScreenDC, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxMemoryDC_SelectObject", (PyCFunction) _wrap_wxMemoryDC_SelectObject, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxMemoryDC", (PyCFunction) _wrap_new_wxMemoryDC, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDC__DrawLineList", (PyCFunction) _wrap_wxDC__DrawLineList, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDC__DrawPointList", (PyCFunction) _wrap_wxDC__DrawPointList, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDC_GetHDC", (PyCFunction) _wrap_wxDC_GetHDC, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDC_GetBoundingBox", (PyCFunction) _wrap_wxDC_GetBoundingBox, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDC_ResetBoundingBox", (PyCFunction) _wrap_wxDC_ResetBoundingBox, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDC_CalcBoundingBox", (PyCFunction) _wrap_wxDC_CalcBoundingBox, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDC_SetAxisOrientation", (PyCFunction) _wrap_wxDC_SetAxisOrientation, METH_VARARGS | METH_KEYWORDS },
|
||||
|
@@ -910,11 +910,39 @@ class wxDCPtr(wxObjectPtr):
|
||||
def ResetBoundingBox(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxDC_ResetBoundingBox,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetBoundingBox(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxDC_GetBoundingBox,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def GetHDC(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxDC_GetHDC,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def _DrawPointList(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxDC__DrawPointList,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def _DrawLineList(self, *_args, **_kwargs):
|
||||
val = apply(gdic.wxDC__DrawLineList,(self,) + _args, _kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<C wxDC instance at %s>" % (self.this,)
|
||||
|
||||
def DrawPointList(self, points, pens=None):
|
||||
if pens is None:
|
||||
pens = []
|
||||
elif isinstance(pens, wxPenPtr):
|
||||
pens = [pens]
|
||||
elif len(pens) != len(points):
|
||||
raise ValueError('points and pens must have same length')
|
||||
return self._DrawPointList(points, pens)
|
||||
|
||||
def DrawLineList(self, lines, pens=None):
|
||||
if pens is None:
|
||||
pens = []
|
||||
elif isinstance(pens, wxPenPtr):
|
||||
pens = [pens]
|
||||
elif len(pens) != len(lines):
|
||||
raise ValueError('lines and pens must have same length')
|
||||
return self._DrawLineList(lines, pens)
|
||||
|
||||
class wxDC(wxDCPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
|
@@ -4215,6 +4215,57 @@ static PyObject *_wrap_wxHtmlWindow_LoadPage(PyObject *self, PyObject *args, PyO
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxHtmlWindow_AppendToPage(_swigobj,_swigarg0) (_swigobj->AppendToPage(_swigarg0))
|
||||
static PyObject *_wrap_wxHtmlWindow_AppendToPage(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxPyHtmlWindow * _arg0;
|
||||
wxString * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj1 = 0;
|
||||
char *_kwnames[] = { "self","source", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxHtmlWindow_AppendToPage",_kwnames,&_argo0,&_obj1))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyHtmlWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxHtmlWindow_AppendToPage. Expected _wxPyHtmlWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
#if PYTHON_API_VERSION >= 1009
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
|
||||
return NULL;
|
||||
_arg1 = new wxString(tmpPtr, tmpSize);
|
||||
#else
|
||||
if (!PyString_Check(_obj1)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
_arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
|
||||
#endif
|
||||
}
|
||||
{
|
||||
wxPy_BEGIN_ALLOW_THREADS;
|
||||
_result = (bool )wxHtmlWindow_AppendToPage(_arg0,*_arg1);
|
||||
|
||||
wxPy_END_ALLOW_THREADS;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
{
|
||||
if (_obj1)
|
||||
delete _arg1;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxHtmlWindow_GetOpenedPage(_swigobj) (_swigobj->GetOpenedPage())
|
||||
static PyObject *_wrap_wxHtmlWindow_GetOpenedPage(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
@@ -6211,6 +6262,7 @@ static PyMethodDef htmlcMethods[] = {
|
||||
{ "wxHtmlWindow_GetOpenedPageTitle", (PyCFunction) _wrap_wxHtmlWindow_GetOpenedPageTitle, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxHtmlWindow_GetOpenedAnchor", (PyCFunction) _wrap_wxHtmlWindow_GetOpenedAnchor, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxHtmlWindow_GetOpenedPage", (PyCFunction) _wrap_wxHtmlWindow_GetOpenedPage, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxHtmlWindow_AppendToPage", (PyCFunction) _wrap_wxHtmlWindow_AppendToPage, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxHtmlWindow_LoadPage", (PyCFunction) _wrap_wxHtmlWindow_LoadPage, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxHtmlWindow_SetPage", (PyCFunction) _wrap_wxHtmlWindow_SetPage, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxHtmlWindow__setCallbackInfo", (PyCFunction) _wrap_wxHtmlWindow__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
|
||||
|
@@ -11,13 +11,13 @@ from clip_dnd import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from events import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from events import *
|
||||
import wx
|
||||
class wxPrintDataPtr(wxObjectPtr):
|
||||
def __init__(self,this):
|
||||
|
Reference in New Issue
Block a user