Merged the wxPy_newswig branch into the HEAD branch (main trunk)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-11-12 21:34:20 +00:00
parent eb6a4098a0
commit d14a1e2856
987 changed files with 671143 additions and 783083 deletions

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
// Name: printfw.h
// Purpose: Exposing the class definition of wxPyPrintout so it can also
// be used by wxHtmlPrintout. Must be included after wxPython.h
//
// Author: Robin Dunn
//
// Created: 29-Oct-1999
// RCS-ID: $Id$
// Copyright: (c) 1999 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __wxpy_printfw_h
#define __wxpy_printfw_h
#if !wxUSE_PRINTING_ARCHITECTURE
#error wxPython requires the wx printing architecture to be enabled
#endif
class wxPyPrintout : public wxPrintout {
public:
wxPyPrintout(const wxString& title) : wxPrintout(title) {}
DEC_PYCALLBACK_BOOL_INTINT(OnBeginDocument);
DEC_PYCALLBACK__(OnEndDocument);
DEC_PYCALLBACK__(OnBeginPrinting);
DEC_PYCALLBACK__(OnEndPrinting);
DEC_PYCALLBACK__(OnPreparePrinting);
DEC_PYCALLBACK_BOOL_INT_pure(OnPrintPage);
DEC_PYCALLBACK_BOOL_INT(HasPage);
// Since this one would be tough and ugly to do with the Macros...
void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
void base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
PYPRIVATE;
};
#endif

View File

@@ -0,0 +1,151 @@
////////////////////////////////////////////////////////////////////////////
// Name: pyclasses.h
// Purpose: wxPython python-aware classes for redirecting virtual method
// calls for classes located in the core but that need to be
// visible to multiple modules
//
// Author: Robin Dunn
//
// Created: 11-Oct-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __pyclasses_h__
#define __pyclasses_h__
//---------------------------------------------------------------------------
class wxPySizer : public wxSizer {
DECLARE_DYNAMIC_CLASS(wxPySizer);
public:
wxPySizer() : wxSizer() {};
DEC_PYCALLBACK___pure(RecalcSizes);
DEC_PYCALLBACK_wxSize__pure(CalcMin);
PYPRIVATE;
};
//---------------------------------------------------------------------------
class wxPyValidator : public wxValidator {
DECLARE_DYNAMIC_CLASS(wxPyValidator);
public:
wxPyValidator() {
}
~wxPyValidator() {
}
wxObject* Clone() const {
wxPyValidator* ptr = NULL;
wxPyValidator* self = (wxPyValidator*)this;
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(self->m_myInst, "Clone")) {
PyObject* ro;
ro = wxPyCBH_callCallbackObj(self->m_myInst, Py_BuildValue("()"));
if (ro) {
wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxPyValidator"));
Py_DECREF(ro);
}
}
wxPyEndBlockThreads();
// This is very dangerous!!! But is the only way I could find
// to squash a memory leak. Currently it is okay, but if the
// validator architecture in wxWindows ever changes, problems
// could arise.
delete self;
return ptr;
}
DEC_PYCALLBACK_BOOL_WXWIN(Validate);
DEC_PYCALLBACK_BOOL_(TransferToWindow);
DEC_PYCALLBACK_BOOL_(TransferFromWindow);
PYPRIVATE;
};
//---------------------------------------------------------------------------
class wxPyPen : public wxPen {
public:
wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
: wxPen(colour, width, style)
{ m_dash = NULL; }
~wxPyPen();
void SetDashes(int nb_dashes, const wxDash *dash);
private:
wxDash* m_dash;
};
//---------------------------------------------------------------------------
class wxPyTimer : public wxTimer
{
public:
wxPyTimer(wxEvtHandler *owner=NULL, int id = -1)
: wxTimer(owner, id)
{
if (owner == NULL) SetOwner(this);
}
DEC_PYCALLBACK__(Notify);
PYPRIVATE;
};
//---------------------------------------------------------------------------
class wxPyProcess : public wxProcess {
public:
wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
: wxProcess(parent, id)
{}
DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
PYPRIVATE;
};
//---------------------------------------------------------------------------
class wxPyVScrolledWindow;
class wxPyVListBox;
class wxPyHtmlListBox;
class wxPyPanel;
class wxPyPopupTransientWindow;
class wxPyPreviewFrame;
class wxPyWindow;
class wxPyPreviewControlBar;
class wxPyPrintPreview;
class wxPyListCtrl;
class wxPyControl;
class wxPyPrintout;
#ifdef __WXMAC__
class wxPopupWindow;
class wxTaskBarIconEvent;
class wxTaskBarIcon;
class wxToggleButton;
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#endif

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pydrawxxx.h
// Purpose: functions used by the DrawXXXList enhancements added to wxDC
//
// Author: Robin Dunn
//
// Created: 14-Oct-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __pydrawxxx_h__
#define __pydrawxxx_h__
typedef bool (*wxPyDrawListOp_t)(wxDC& dc, PyObject* coords);
PyObject* wxPyDrawXXXList(wxDC& dc, wxPyDrawListOp_t doDraw,
PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes);
bool wxPyDrawXXXPoint(wxDC& dc, PyObject* coords);
bool wxPyDrawXXXLine(wxDC& dc, PyObject* coords);
bool wxPyDrawXXXRectangle(wxDC& dc, PyObject* coords);
bool wxPyDrawXXXEllipse(wxDC& dc, PyObject* coords);
bool wxPyDrawXXXPolygon(wxDC& dc, PyObject* coords);
PyObject* wxPyDrawTextList(wxDC& dc, PyObject* textList, PyObject* pyPoints,
PyObject* foregroundList, PyObject* backgroundList);
#endif

View File

@@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pyistream.h
// Purpose: Classes for managing wxInputStream <--> Python streams
//
// Author: Robin Dunn
//
// Created: 25-Sept-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __PYISTREAM__
#define __PYISTREAM__
//----------------------------------------------------------------------
// Handling of wxInputStreams by Joerg Baumann
// See stream.i for implementations
// C++ class wxPyInputStream to act as base for python class wxInputStream
// You can use it in python like a python file object.
class wxPyInputStream {
public:
// underlying wxInputStream
wxInputStream* m_wxis;
public:
wxPyInputStream(wxInputStream* wxis) : m_wxis(wxis) {}
~wxPyInputStream();
// python file object interface for input files (most of it)
void close();
void flush();
bool eof();
PyObject* read(int size=-1);
PyObject* readline(int size=-1);
PyObject* readlines(int sizehint=-1);
void seek(int offset, int whence=0);
int tell();
/* do these later?
bool isatty();
int fileno();
void truncate(int size=-1);
void write(wxString data);
void writelines(wxStringPtrList);
*/
// wxInputStream methods that may come in handy...
char Peek() { if (m_wxis) return m_wxis->Peek(); else return -1; }
char GetC() { if (m_wxis) return m_wxis->GetC(); else return -1; }
size_t LastRead() { if (m_wxis) return m_wxis->LastRead(); else return 0; }
bool CanRead() { if (m_wxis) return m_wxis->CanRead(); else return FALSE; }
bool Eof() { if (m_wxis) return m_wxis->Eof(); else return FALSE; }
bool Ungetch(char c) { if (m_wxis) return m_wxis->Ungetch(c); else return FALSE; }
unsigned long SeekI(unsigned long pos, wxSeekMode mode)
{ if (m_wxis) return m_wxis->SeekI(pos, mode); else return 0; }
unsigned long TellI() { if (m_wxis) return m_wxis->TellI(); else return 0; }
};
// This is a wxInputStream that wraps a Python file-like
// object and calls the Python methods as needed.
class wxPyCBInputStream : public wxInputStream {
public:
~wxPyCBInputStream();
virtual size_t GetSize() const;
// factory function
static wxPyCBInputStream* create(PyObject *py, bool block=TRUE);
protected:
// can only be created via the factory
wxPyCBInputStream(PyObject *r, PyObject *s, PyObject *t, bool block);
// wxStreamBase methods
virtual size_t OnSysRead(void *buffer, size_t bufsize);
virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
virtual off_t OnSysSeek(off_t off, wxSeekMode mode);
virtual off_t OnSysTell() const;
// helper
static PyObject* getMethod(PyObject* py, char* name);
PyObject* m_read;
PyObject* m_seek;
PyObject* m_tell;
bool m_block;
};
//----------------------------------------------------------------------
#endif

View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pytree.h
// Purpose: Common declarations of tree stuff for wxTreeCtrl in the core
// and wxTreeListCtrl in gizmos
//
// Author: Robin Dunn
//
// Created: 30-April-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __pytree_h__
#define __pytree_h__
class wxPyTreeItemData : public wxTreeItemData {
public:
wxPyTreeItemData(PyObject* obj = NULL) {
if (obj == NULL)
obj = Py_None;
Py_INCREF(obj);
m_obj = obj;
}
~wxPyTreeItemData() {
wxPyBeginBlockThreads();
Py_DECREF(m_obj);
wxPyEndBlockThreads();
}
PyObject* GetData() {
Py_INCREF(m_obj);
return m_obj;
}
void SetData(PyObject* obj) {
wxPyBeginBlockThreads();
Py_DECREF(m_obj);
wxPyEndBlockThreads();
m_obj = obj;
Py_INCREF(obj);
}
PyObject* m_obj;
};
#endif

View File

@@ -0,0 +1,125 @@
////////////////////////////////////////////////////////////////////////////
// Name: wxPython.h
// Purpose: To be used from modules that are not part of the core
// wxPython extension--or from 3rd party apps and modules--in
// order to get access to the wxPython API (some helper
// functions and such) that lives in the wx.core module
//
// Author: Robin Dunn
//
// Created: 14-Dec-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __wxp_export__
#define __wxp_export__
//----------------------------------------------------------------------
#define wxPyUSE_EXPORTED_API
#include "wx/wxPython/wxPython_int.h"
//----------------------------------------------------------------------
// This needs to be called in modules that make calls to any of the functions
// exported by the wxPython API. It sets a static pointer to a structure of
// function pointers located in the wx._core extension module.
static void wxPyCoreAPI_IMPORT() {
wxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import("wx._core", "_wxPyCoreAPI");
if (! wxPyCoreAPIPtr)
wxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import("_core", "_wxPyCoreAPI");
}
// The following macros call functions located in wx._core of the same name
// via the API pointer retrieved above.
#define SWIG_Python_TypeRegister(a) (wxPyCoreAPIPtr->p_SWIG_Python_TypeRegister(a))
#define SWIG_Python_TypeCheck(a,b) (wxPyCoreAPIPtr->p_SWIG_Python_TypeCheck(a,b))
#define SWIG_Python_TypeCast(a,b) (wxPyCoreAPIPtr->p_SWIG_Python_TypeCast(a,b))
#define SWIG_Python_TypeDynamicCast(a,b) (wxPyCoreAPIPtr->p_SWIG_Python_TypeDynamicCast(a,b))
#define SWIG_Python_TypeName(a) (wxPyCoreAPIPtr->p_SWIG_Python_TypeName(a))
#define SWIG_Python_TypeQuery(a) (wxPyCoreAPIPtr->p_SWIG_Python_TypeQuery(a))
#define SWIG_Python_TypeClientData(a,b) (wxPyCoreAPIPtr->p_SWIG_Python_TypeClientData(a,b))
#define SWIG_Python_addvarlink(a,b,c,d) (wxPyCoreAPIPtr->p_SWIG_Python_addvarlink(a,b,c,d))
#define SWIG_Python_ConvertPtr(a,b,c,d) (wxPyCoreAPIPtr->p_SWIG_Python_ConvertPtr(a,b,c,d))
#define SWIG_Python_ConvertPacked(a,b,c,d,e) (wxPyCoreAPIPtr->p_SWIG_Python_ConvertPacked(a,b,c,d,e))
#define SWIG_Python_PackData(a,b,c) (wxPyCoreAPIPtr->p_SWIG_Python_PackData(a,b,c))
#define SWIG_Python_UnpackData(a,b,c) (wxPyCoreAPIPtr->p_SWIG_Python_UnpackData(a,b,c))
#define SWIG_Python_NewPointerObj(a,b,c) (wxPyCoreAPIPtr->p_SWIG_Python_NewPointerObj(a,b,c))
#define SWIG_Python_NewPackedObj(a,b,c) (wxPyCoreAPIPtr->p_SWIG_Python_NewPackedObj(a,b,c))
#define SWIG_Python_InstallConstants(a,b) (wxPyCoreAPIPtr->p_SWIG_Python_InstallConstants(a,b))
#define SWIG_Python_MustGetPtr(a,b,c,d) (wxPyCoreAPIPtr->p_SWIG_Python_MustGetPtr(a,b,c,d))
#define wxPyCheckSwigType(a) (wxPyCoreAPIPtr->p_wxPyCheckSwigType(a))
#define wxPyConstructObject(a,b,c) (wxPyCoreAPIPtr->p_wxPyConstructObject(a,b,c))
#define wxPyConvertSwigPtr(a,b,c) (wxPyCoreAPIPtr->p_wxPyConvertSwigPtr(a,b,c))
#define wxPyMakeSwigPtr(a,b) (wxPyCoreAPIPtr->p_wxPyMakeSwigPtr(a,b))
#define wxPyBeginAllowThreads() (wxPyCoreAPIPtr->p_wxPyBeginAllowThreads())
#define wxPyEndAllowThreads(a) (wxPyCoreAPIPtr->p_wxPyEndAllowThreads(a))
#define wxPyBeginBlockThreads() (wxPyCoreAPIPtr->p_wxPyBeginBlockThreads())
#define wxPyEndBlockThreads() (wxPyCoreAPIPtr->p_wxPyEndBlockThreads())
#define wxPyConstructObject(a,b,c) (wxPyCoreAPIPtr->p_wxPyConstructObject(a,b,c))
#define wxPy_ConvertList(a) (wxPyCoreAPIPtr->p_wxPy_ConvertList(a))
#define wxString_in_helper(a) (wxPyCoreAPIPtr->p_wxString_in_helper(a))
#define Py2wxString(a) (wxPyCoreAPIPtr->p_Py2wxString(a))
#define wx2PyString(a) (wxPyCoreAPIPtr->p_wx2PyString(a))
#define byte_LIST_helper(a) (wxPyCoreAPIPtr->p_byte_LIST_helper(a))
#define int_LIST_helper(a) (wxPyCoreAPIPtr->p_int_LIST_helper(a))
#define long_LIST_helper(a) (wxPyCoreAPIPtr->p_long_LIST_helper(a))
#define string_LIST_helper(a) (wxPyCoreAPIPtr->p_string_LIST_helper(a))
#define wxPoint_LIST_helper(a,b) (wxPyCoreAPIPtr->p_wxPoint_LIST_helper(a, b))
#define wxBitmap_LIST_helper(a) (wxPyCoreAPIPtr->p_wxBitmap_LIST_helper(a))
#define wxString_LIST_helper(a) (wxPyCoreAPIPtr->p_wxString_LIST_helper(a))
#define wxAcceleratorEntry_LIST_helper(a) (wxPyCoreAPIPtr->p_wxAcceleratorEntry_LIST_helper(a))
#define wxSize_helper(a,b) (wxPyCoreAPIPtr->p_wxSize_helper(a,b))
#define wxPoint_helper(a,b) (wxPyCoreAPIPtr->p_wxPoint_helper(a,b))
#define wxRealPoint_helper(a,b) (wxPyCoreAPIPtr->p_wxRealPoint_helper(a,b))
#define wxRect_helper(a,b) (wxPyCoreAPIPtr->p_wxRect_helper(a,b))
#define wxColour_helper(a,b) (wxPyCoreAPIPtr->p_wxColour_helper(a,b))
#define wxPoint2D_helper(a,b) (wxPyCoreAPIPtr->p_wxPoint2D_helper(a,b))
#define wxPySimple_typecheck(a,b,c) (wxPyCoreAPIPtr->p_wxPySimple_typecheck(a,b,c))
#define wxColour_typecheck(a) (wxPyCoreAPIPtr->p_wxColour_typecheck(a))
#define wxPyCBH_setCallbackInfo(a, b, c, d) (wxPyCoreAPIPtr->p_wxPyCBH_setCallbackInfo(a,b,c,d))
#define wxPyCBH_findCallback(a, b) (wxPyCoreAPIPtr->p_wxPyCBH_findCallback(a, b))
#define wxPyCBH_callCallback(a, b) (wxPyCoreAPIPtr->p_wxPyCBH_callCallback(a, b))
#define wxPyCBH_callCallbackObj(a, b) (wxPyCoreAPIPtr->p_wxPyCBH_callCallbackObj(a, b))
#define wxPyCBH_delete(a) (wxPyCoreAPIPtr->p_wxPyCBH_delete(a))
#define wxPyMake_wxObject(a) (wxPyCoreAPIPtr->p_wxPyMake_wxObject(a,TRUE))
#define wxPyMake_wxObject2(a,b) (wxPyCoreAPIPtr->p_wxPyMake_wxObject(a,b))
#define wxPyMake_wxSizer(a) (wxPyCoreAPIPtr->p_wxPyMake_wxSizer(a))
#define wxPyPtrTypeMap_Add(a, b) (wxPyCoreAPIPtr->p_wxPyPtrTypeMap_Add(a, b))
#define wxPy2int_seq_helper(a, b, c) (wxPyCoreAPIPtr->p_wxPy2int_seq_helper(a, b, c))
#define wxPy4int_seq_helper(a, b, c, d, e) (wxPyCoreAPIPtr->p_wxPy4int_seq_helper(a, b, c, d, e))
#define wxArrayString2PyList_helper(a) (wxPyCoreAPIPtr->p_wxArrayString2PyList_helper(a))
#define wxArrayInt2PyList_helper(a) (wxPyCoreAPIPtr->p_wxArrayInt2PyList_helper(a))
#define wxPyClientData_dtor(a) (wxPyCoreAPIPtr->p_wxPyClientData_dtor(a))
#define wxPyUserData_dtor(a) (wxPyCoreAPIPtr->p_wxPyUserData_dtor(a))
#define wxPyOORClientData_dtor(a) (wxPyCoreAPIPtr->p_wxPyOORClientData_dtor(a))
#define wxPyCBInputStream_create(a, b) (wxPyCoreAPIPtr->p_wxPyCBInputStream_create(a, b))
#define wxPyInstance_Check(a) (wxPyCoreAPIPtr->p_wxPyInstance_Check(a))
#define wxPySwigInstance_Check(a) (wxPyCoreAPIPtr->p_wxPySwigInstance_Check(a))
// This one is special. It's the first function called in SWIG generated
// modules, so we'll use it to also import the API.
#define SWIG_Python_newvarlink() (wxPyCoreAPI_IMPORT(), wxPyCoreAPIPtr->p_SWIG_Python_newvarlink())
//----------------------------------------------------------------------
#endif

File diff suppressed because it is too large Load Diff