Added typemap for wxArrayString

Added wxMimeTypesManager and wxFileType

Other updates...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2001-10-30 06:43:54 +00:00
parent 951cd18031
commit b37c7e1dcd
23 changed files with 3072 additions and 155 deletions

View File

@@ -313,10 +313,7 @@ public:
%addmethods {
PyObject* GetFilenames() {
const wxArrayString& strings = self->GetFilenames();
PyObject* list = PyList_New(0);
for (size_t x=0; x<strings.GetCount(); x++)
PyList_Append(list, PyString_FromString(strings[x]));
return list;
return wxArrayString2PyList_helper(strings);
}
}
#ifdef __WXMSW__
@@ -596,11 +593,7 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) {
bool rval = FALSE;
wxPyTState* state = wxPyBeginBlockThreads();
PyObject* list = PyList_New(0);
for (size_t i=0; i<filenames.GetCount(); i++) {
PyObject* str = PyString_FromString(filenames[i].c_str());
PyList_Append(list, str);
}
PyObject* list = wxArrayString2PyList_helper(filenames);
if (m_myInst.findCallback("OnDropFiles"))
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
Py_DECREF(list);

View File

@@ -117,25 +117,13 @@ public:
PyObject* GetFilenames() {
wxArrayString arr;
self->GetFilenames(arr);
size_t count = arr.GetCount();
PyObject* listObj = PyList_New(0);
for(size_t x=0; x<count; x++) {
PyObject* name = PyString_FromString(arr[x]);
PyList_Append(listObj, name);
}
return listObj;
return wxArrayString2PyList_helper(arr);
}
PyObject* GetPaths() {
wxArrayString arr;
self->GetPaths(arr);
size_t count = arr.GetCount();
PyObject* listObj = PyList_New(0);
for(size_t x=0; x<count; x++) {
PyObject* name = PyString_FromString(arr[x]);
PyList_Append(listObj, name);
}
return listObj;
return wxArrayString2PyList_helper(arr);
}
}
};

View File

@@ -1371,10 +1371,10 @@ public:
int horizontalAlignment = wxLEFT,
int verticalAlignment = wxTOP );
// Split a string containing newline chararcters into an array of
// strings and return the number of lines
//
void StringToLines( const wxString& value, wxArrayString& lines );
// // Split a string containing newline chararcters into an array of
// // strings and return the number of lines
// //
// void StringToLines( const wxString& value, wxArrayString& lines );
void GetTextBoxSize( wxDC& dc,
wxArrayString& lines,

View File

@@ -1297,6 +1297,19 @@ bool wxColour_helper(PyObject* source, wxColour** obj) {
//----------------------------------------------------------------------
PyObject* wxArrayString2PyList_helper(const wxArrayString& arr) {
PyObject* list = PyList_New(0);
for (size_t i=0; i < arr.GetCount(); i++) {
PyObject* str = PyString_FromString(arr[i].c_str());
PyList_Append(list, str);
// TODO: Check refcount on str...
}
return list;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------

View File

@@ -151,6 +151,11 @@ bool _2int_seq_helper(PyObject* source, int* i1, int* i2);
bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4);
PyObject* wxArrayString2PyList_helper(const wxArrayString& app);
#define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
//----------------------------------------------------------------------
#ifndef SWIGCODE

View File

@@ -30,6 +30,8 @@
#if wxUSE_WAVE || defined(__WXMSW__)
#include <wx/wave.h>
#endif
#include <wx/mimetype.h>
%}
//----------------------------------------------------------------------
@@ -357,18 +359,12 @@ public:
%addmethods {
PyObject* GetEncodings() {
wxArrayString* arr = self->GetEncodings();
PyObject* list = PyList_New(0);
for (size_t x=0; x<arr->GetCount(); x++)
PyList_Append(list, PyString_FromString((*arr)[x]));
return list;
return wxArrayString2PyList_helper(arr);
}
PyObject* GetFacenames() {
wxArrayString* arr = self->GetFacenames();
PyObject* list = PyList_New(0);
for (size_t x=0; x<arr->GetCount(); x++)
PyList_Append(list, PyString_FromString((*arr)[x]));
return list;
return wxArrayString2PyList_helper(arr);
}
}
};
@@ -514,6 +510,21 @@ public:
void Stop();
};
class wxStopWatch
{
public:
// ctor starts the stop watch
wxStopWatch();
void Start(long t = 0);
void Pause();
void Resume();
// get elapsed time since the last Start() or Pause() in milliseconds
long Time() const;
};
//----------------------------------------------------------------------
//----------------------------------------------------------------------
@@ -913,6 +924,359 @@ public:
%}
//----------------------------------------------------------------------
enum wxMailcapStyle
{
wxMAILCAP_STANDARD = 1,
wxMAILCAP_NETSCAPE = 2,
wxMAILCAP_KDE = 4,
wxMAILCAP_GNOME = 8,
wxMAILCAP_ALL = 15
};
class wxFileTypeInfo
{
public:
// ctors
// a normal item
wxFileTypeInfo(const char *mimeType,
const char *openCmd,
const char *printCmd,
const char *desc);
// the array elements correspond to the parameters of the ctor above in
// the same order
%name(wxFileTypeInfoSequence)wxFileTypeInfo(const wxArrayString& sArray);
// invalid item - use this to terminate the array passed to
// wxMimeTypesManager::AddFallbacks
%name(wxNullFileTypeInfo)wxFileTypeInfo();
// test if this object can be used
bool IsValid() const;
// setters
// set the icon info
void SetIcon(const wxString& iconFile, int iconIndex = 0);
// set the short desc
void SetShortDesc(const wxString& shortDesc);
// accessors
// get the MIME type
const wxString& GetMimeType() const;
// get the open command
const wxString& GetOpenCommand() const;
// get the print command
const wxString& GetPrintCommand() const;
// get the short description (only used under Win32 so far)
const wxString& GetShortDesc() const;
// get the long, user visible description
const wxString& GetDescription() const;
// get the array of all extensions
//const wxArrayString& GetExtensions() const;
%addmethods {
PyObject* GetExtensions() {
wxArrayString& arr = (wxArrayString&)self->GetExtensions();
return wxArrayString2PyList_helper(arr);
}
}
int GetExtensionsCount() const;
// get the icon info
const wxString& GetIconFile() const;
int GetIconIndex() const;
};
class wxFileType
{
public:
// TODO: Make a wxPyMessageParameters with virtual GetParamValue...
// An object of this class must be passed to Get{Open|Print}Command. The
// default implementation is trivial and doesn't know anything at all about
// parameters, only filename and MIME type are used (so it's probably ok for
// Windows where %{param} is not used anyhow)
class MessageParameters
{
public:
// ctors
MessageParameters(const wxString& filename=wxPyEmptyStr,
const wxString& mimetype=wxPyEmptyStr);
// accessors (called by GetOpenCommand)
// filename
const wxString& GetFileName() const;
// mime type
const wxString& GetMimeType() const;;
// override this function in derived class
virtual wxString GetParamValue(const wxString& name) const;
// virtual dtor as in any base class
virtual ~MessageParameters();
};
// ctor from static data
wxFileType(const wxFileTypeInfo& ftInfo);
// return the MIME type for this file type
%addmethods {
PyObject* GetMimeType() {
wxString str;
if (self->GetMimeType(&str))
return PyString_FromString(str.c_str());
else
RETURN_NONE();
}
PyObject* GetMimeTypes() {
wxArrayString arr;
if (self->GetMimeTypes(arr))
return wxArrayString2PyList_helper(arr);
else
RETURN_NONE();
}
}
// Get all extensions associated with this file type
%addmethods {
PyObject* GetExtensions() {
wxArrayString arr;
if (self->GetExtensions(arr))
return wxArrayString2PyList_helper(arr);
else
RETURN_NONE();
}
}
%addmethods {
// Get the icon corresponding to this file type
%new wxIcon* GetIcon() {
wxIcon icon;
if (self->GetIcon(&icon))
return new wxIcon(icon);
else
return NULL;
}
// Get the icon corresponding to this file type, the name of the file
// where this icon resides, and its index in this file if applicable.
PyObject* GetIconInfo() {
wxIcon icon;
wxString iconFile;
int iconIndex;
if (self->GetIcon(&icon, &iconFile, &iconIndex)) {
wxPyTState* state = wxPyBeginBlockThreads();
PyObject* tuple = PyTuple_New(3);
PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon),
"wxIcon", TRUE));
PyTuple_SetItem(tuple, 1, PyString_FromString(iconFile.c_str()));
PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
wxPyEndBlockThreads(state);
return tuple;
}
else
RETURN_NONE();
}
}
%addmethods {
// get a brief file type description ("*.txt" => "text document")
PyObject* GetDescription() {
wxString str;
if (self->GetDescription(&str))
return PyString_FromString(str.c_str());
else
RETURN_NONE();
}
}
// get the command to open/execute the file of given type
%addmethods {
PyObject* GetOpenCommand(const wxString& filename,
const wxString& mimetype=wxPyEmptyStr) {
wxString str;
if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype)))
return PyString_FromString(str.c_str());
else
RETURN_NONE();
}
}
// get the command to print the file of given type
%addmethods {
PyObject* GetPrintCommand(const wxString& filename,
const wxString& mimetype=wxPyEmptyStr) {
wxString str;
if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype)))
return PyString_FromString(str.c_str());
else
RETURN_NONE();
}
}
// Get all commands defined for this file type
%addmethods {
PyObject* GetAllCommands(const wxString& filename,
const wxString& mimetype=wxPyEmptyStr) {
wxArrayString verbs;
wxArrayString commands;
if (self->GetAllCommands(&verbs, &commands,
wxFileType::MessageParameters(filename, mimetype))) {
wxPyTState* state = wxPyBeginBlockThreads();
PyObject* tuple = PyTuple_New(2);
PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
wxPyEndBlockThreads(state);
return tuple;
}
else
RETURN_NONE();
}
}
// set an arbitrary command, ask confirmation if it already exists and
// overwriteprompt is TRUE
bool SetCommand(const wxString& cmd, const wxString& verb,
bool overwriteprompt = TRUE);
bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0);
// remove the association for this filetype from the system MIME database:
// notice that it will only work if the association is defined in the user
// file/registry part, we will never modify the system-wide settings
bool Unassociate();
// operations
// expand a string in the format of GetOpenCommand (which may contain
// '%s' and '%t' format specificators for the file name and mime type
// and %{param} constructions).
static wxString ExpandCommand(const wxString& command,
const MessageParameters& params);
// dtor (not virtual, shouldn't be derived from)
~wxFileType();
};
class wxMimeTypesManager
{
public:
// static helper functions
// -----------------------
// check if the given MIME type is the same as the other one: the
// second argument may contain wildcards ('*'), but not the first. If
// the types are equal or if the mimeType matches wildcard the function
// returns TRUE, otherwise it returns FALSE
static bool IsOfType(const wxString& mimeType, const wxString& wildcard);
// ctor
wxMimeTypesManager();
// loads data from standard files according to the mailcap styles
// specified: this is a bitwise OR of wxMailcapStyle values
//
// use the extraDir parameter if you want to look for files in another
// directory
void Initialize(int mailcapStyle = wxMAILCAP_STANDARD,
const wxString& extraDir = wxEmptyString);
// and this function clears all the data from the manager
void ClearData();
// Database lookup: all functions return a pointer to wxFileType object
// whose methods may be used to query it for the information you're
// interested in. If the return value is !NULL, caller is responsible for
// deleting it.
// get file type from file extension
%new wxFileType *GetFileTypeFromExtension(const wxString& ext);
// get file type from MIME type (in format <category>/<format>)
%new wxFileType *GetFileTypeFromMimeType(const wxString& mimeType);
// other operations: return TRUE if there were no errors or FALSE if there
// were some unreckognized entries (the good entries are always read anyhow)
//
// read in additional file (the standard ones are read automatically)
// in mailcap format (see mimetype.cpp for description)
//
// 'fallback' parameter may be set to TRUE to avoid overriding the
// settings from other, previously parsed, files by this one: normally,
// the files read most recently would override the older files, but with
// fallback == TRUE this won't happen
bool ReadMailcap(const wxString& filename, bool fallback = FALSE);
// read in additional file in mime.types format
bool ReadMimeTypes(const wxString& filename);
// enumerate all known MIME types
%addmethods {
PyObject* EnumAllFileTypes() {
wxArrayString arr;
self->EnumAllFileTypes(arr);
return wxArrayString2PyList_helper(arr);
}
}
// these functions can be used to provide default values for some of the
// MIME types inside the program itself (you may also use
// ReadMailcap(filenameWithDefaultTypes, TRUE /* use as fallback */) to
// achieve the same goal, but this requires having this info in a file).
//
void AddFallback(const wxFileTypeInfo& ft);
// create or remove associations
// create a new association using the fields of wxFileTypeInfo (at least
// the MIME type and the extension should be set)
// if the other fields are empty, the existing values should be left alone
%new wxFileType *Associate(const wxFileTypeInfo& ftInfo);
// undo Associate()
bool Unassociate(wxFileType *ft) ;
// dtor (not virtual, shouldn't be derived from)
~wxMimeTypesManager();
};
%readonly
%{
#if 0
%}
extern wxMimeTypesManager* wxTheMimeTypesManager;
%{
#endif
%}
%readwrite
//----------------------------------------------------------------------
//----------------------------------------------------------------------

View File

@@ -294,11 +294,7 @@ bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) {
bool rval = FALSE;
wxPyTState* state = wxPyBeginBlockThreads();
PyObject* list = PyList_New(0);
for (size_t i=0; i<filenames.GetCount(); i++) {
PyObject* str = PyString_FromString(filenames[i].c_str());
PyList_Append(list, str);
}
PyObject* list = wxArrayString2PyList_helper(filenames);
if (m_myInst.findCallback("OnDropFiles"))
rval = m_myInst.callCallback(Py_BuildValue("(iiO)",x,y,list));
Py_DECREF(list);
@@ -1711,10 +1707,7 @@ static PyObject *_wrap_new_wxFileDataObject(PyObject *self, PyObject *args, PyOb
static PyObject * wxFileDataObject_GetFilenames(wxFileDataObject *self) {
const wxArrayString& strings = self->GetFilenames();
PyObject* list = PyList_New(0);
for (size_t x=0; x<strings.GetCount(); x++)
PyList_Append(list, PyString_FromString(strings[x]));
return list;
return wxArrayString2PyList_helper(strings);
}
static PyObject *_wrap_wxFileDataObject_GetFilenames(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;

View File

@@ -1470,13 +1470,7 @@ static PyObject *_wrap_wxFileDialog_ShowModal(PyObject *self, PyObject *args, Py
static PyObject * wxFileDialog_GetFilenames(wxFileDialog *self) {
wxArrayString arr;
self->GetFilenames(arr);
size_t count = arr.GetCount();
PyObject* listObj = PyList_New(0);
for(size_t x=0; x<count; x++) {
PyObject* name = PyString_FromString(arr[x]);
PyList_Append(listObj, name);
}
return listObj;
return wxArrayString2PyList_helper(arr);
}
static PyObject *_wrap_wxFileDialog_GetFilenames(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -1510,13 +1504,7 @@ static PyObject *_wrap_wxFileDialog_GetFilenames(PyObject *self, PyObject *args,
static PyObject * wxFileDialog_GetPaths(wxFileDialog *self) {
wxArrayString arr;
self->GetPaths(arr);
size_t count = arr.GetCount();
PyObject* listObj = PyList_New(0);
for(size_t x=0; x<count; x++) {
PyObject* name = PyString_FromString(arr[x]);
PyList_Append(listObj, name);
}
return listObj;
return wxArrayString2PyList_helper(arr);
}
static PyObject *_wrap_wxFileDialog_GetPaths(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;

View File

@@ -1459,13 +1459,13 @@ static PyObject *_wrap_new_wxBitmap(PyObject *self, PyObject *args, PyObject *kw
PyObject * _resultobj;
wxBitmap * _result;
wxString * _arg0;
wxBitmapType _arg1;
wxBitmapType _arg1 = (wxBitmapType ) wxBITMAP_TYPE_BMP;
PyObject * _obj0 = 0;
char *_kwnames[] = { "name","type", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:new_wxBitmap",_kwnames,&_obj0,&_arg1))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:new_wxBitmap",_kwnames,&_obj0,&_arg1))
return NULL;
{
#if PYTHON_API_VERSION >= 1009
@@ -1609,13 +1609,13 @@ static PyObject *_wrap_wxBitmap_LoadFile(PyObject *self, PyObject *args, PyObjec
bool _result;
wxBitmap * _arg0;
wxString * _arg1;
long _arg2;
wxBitmapType _arg2 = (wxBitmapType ) wxBITMAP_TYPE_BMP;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","name","flags", NULL };
char *_kwnames[] = { "self","name","type", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOl:wxBitmap_LoadFile",_kwnames,&_argo0,&_obj1,&_arg2))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|i:wxBitmap_LoadFile",_kwnames,&_argo0,&_obj1,&_arg2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -1662,7 +1662,7 @@ static PyObject *_wrap_wxBitmap_SaveFile(PyObject *self, PyObject *args, PyObjec
bool _result;
wxBitmap * _arg0;
wxString * _arg1;
int _arg2;
wxBitmapType _arg2;
wxPalette * _arg3 = (wxPalette *) NULL;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;

View File

@@ -7822,67 +7822,6 @@ static PyObject *_wrap_wxGrid_DrawTextRectangle(PyObject *self, PyObject *args,
return _resultobj;
}
#define wxGrid_StringToLines(_swigobj,_swigarg0,_swigarg1) (_swigobj->StringToLines(_swigarg0,_swigarg1))
static PyObject *_wrap_wxGrid_StringToLines(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxGrid * _arg0;
wxString * _arg1;
wxArrayString * _arg2;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
PyObject * _argo2 = 0;
char *_kwnames[] = { "self","value","lines", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxGrid_StringToLines",_kwnames,&_argo0,&_obj1,&_argo2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxGrid_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxGrid_StringToLines. Expected _wxGrid_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
}
if (_argo2) {
if (_argo2 == Py_None) { _arg2 = NULL; }
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArrayString_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxGrid_StringToLines. Expected _wxArrayString_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxGrid_StringToLines(_arg0,*_arg1,*_arg2);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
#define wxGrid_GetTextBoxSize(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3) (_swigobj->GetTextBoxSize(_swigarg0,_swigarg1,_swigarg2,_swigarg3))
static PyObject *_wrap_wxGrid_GetTextBoxSize(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@@ -7895,7 +7834,7 @@ static PyObject *_wrap_wxGrid_GetTextBoxSize(PyObject *self, PyObject *args, PyO
long temp0;
PyObject * _argo0 = 0;
PyObject * _argo1 = 0;
PyObject * _argo2 = 0;
PyObject * _obj2 = 0;
char *_kwnames[] = { "self","dc","lines", NULL };
self = self;
@@ -7905,7 +7844,7 @@ static PyObject *_wrap_wxGrid_GetTextBoxSize(PyObject *self, PyObject *args, PyO
{
_arg4 = &temp0;
}
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxGrid_GetTextBoxSize",_kwnames,&_argo0,&_argo1,&_argo2))
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxGrid_GetTextBoxSize",_kwnames,&_argo0,&_argo1,&_obj2))
return NULL;
if (_argo0) {
if (_argo0 == Py_None) { _arg0 = NULL; }
@@ -7921,13 +7860,21 @@ static PyObject *_wrap_wxGrid_GetTextBoxSize(PyObject *self, PyObject *args, PyO
return NULL;
}
}
if (_argo2) {
if (_argo2 == Py_None) { _arg2 = NULL; }
else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxArrayString_p")) {
PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of wxGrid_GetTextBoxSize. Expected _wxArrayString_p.");
{
if (! PySequence_Check(_obj2)) {
PyErr_SetString(PyExc_TypeError, "Sequence of strings expected.");
return NULL;
}
}
_arg2 = new wxArrayString;
int i, len=PySequence_Length(_obj2);
for (i=0; i<len; i++) {
PyObject* item = PySequence_GetItem(_obj2, i);
PyObject* str = PyObject_Str(item);
_arg2->Add(PyString_AsString(item));
Py_DECREF(item);
Py_DECREF(str);
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxGrid_GetTextBoxSize(_arg0,*_arg1,*_arg2,_arg3,_arg4);
@@ -7945,6 +7892,10 @@ static PyObject *_wrap_wxGrid_GetTextBoxSize(PyObject *self, PyObject *args, PyO
PyObject *o;
o = PyInt_FromLong((long) (*_arg4));
_resultobj = t_output_helper(_resultobj, o);
}
{
if (_obj2)
delete _arg2;
}
return _resultobj;
}
@@ -14175,7 +14126,6 @@ static PyMethodDef gridcMethods[] = {
{ "wxGrid_EndBatch", (PyCFunction) _wrap_wxGrid_EndBatch, METH_VARARGS | METH_KEYWORDS },
{ "wxGrid_BeginBatch", (PyCFunction) _wrap_wxGrid_BeginBatch, METH_VARARGS | METH_KEYWORDS },
{ "wxGrid_GetTextBoxSize", (PyCFunction) _wrap_wxGrid_GetTextBoxSize, METH_VARARGS | METH_KEYWORDS },
{ "wxGrid_StringToLines", (PyCFunction) _wrap_wxGrid_StringToLines, METH_VARARGS | METH_KEYWORDS },
{ "wxGrid_DrawTextRectangle", (PyCFunction) _wrap_wxGrid_DrawTextRectangle, METH_VARARGS | METH_KEYWORDS },
{ "wxGrid_DrawCellHighlight", (PyCFunction) _wrap_wxGrid_DrawCellHighlight, METH_VARARGS | METH_KEYWORDS },
{ "wxGrid_DeleteCols", (PyCFunction) _wrap_wxGrid_DeleteCols, METH_VARARGS | METH_KEYWORDS },

View File

@@ -958,9 +958,6 @@ class wxGridPtr(wxScrolledWindowPtr):
def DrawTextRectangle(self, *_args, **_kwargs):
val = apply(gridc.wxGrid_DrawTextRectangle,(self,) + _args, _kwargs)
return val
def StringToLines(self, *_args, **_kwargs):
val = apply(gridc.wxGrid_StringToLines,(self,) + _args, _kwargs)
return val
def GetTextBoxSize(self, *_args, **_kwargs):
val = apply(gridc.wxGrid_GetTextBoxSize,(self,) + _args, _kwargs)
return val

File diff suppressed because it is too large Load Diff

View File

@@ -313,6 +313,32 @@ class wxPyTimer(wxPyTimerPtr):
class wxStopWatchPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def Start(self, *_args, **_kwargs):
val = apply(misc2c.wxStopWatch_Start,(self,) + _args, _kwargs)
return val
def Pause(self, *_args, **_kwargs):
val = apply(misc2c.wxStopWatch_Pause,(self,) + _args, _kwargs)
return val
def Resume(self, *_args, **_kwargs):
val = apply(misc2c.wxStopWatch_Resume,(self,) + _args, _kwargs)
return val
def Time(self, *_args, **_kwargs):
val = apply(misc2c.wxStopWatch_Time,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxStopWatch instance at %s>" % (self.this,)
class wxStopWatch(wxStopWatchPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(misc2c.new_wxStopWatch,_args,_kwargs)
self.thisown = 1
class wxLogPtr :
def __init__(self,this):
self.this = this
@@ -726,6 +752,170 @@ class wxWave(wxWavePtr):
class wxFileTypeInfoPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def IsValid(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_IsValid,(self,) + _args, _kwargs)
return val
def SetIcon(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_SetIcon,(self,) + _args, _kwargs)
return val
def SetShortDesc(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_SetShortDesc,(self,) + _args, _kwargs)
return val
def GetMimeType(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetMimeType,(self,) + _args, _kwargs)
return val
def GetOpenCommand(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetOpenCommand,(self,) + _args, _kwargs)
return val
def GetPrintCommand(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetPrintCommand,(self,) + _args, _kwargs)
return val
def GetShortDesc(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetShortDesc,(self,) + _args, _kwargs)
return val
def GetDescription(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetDescription,(self,) + _args, _kwargs)
return val
def GetExtensions(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetExtensions,(self,) + _args, _kwargs)
return val
def GetExtensionsCount(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetExtensionsCount,(self,) + _args, _kwargs)
return val
def GetIconFile(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetIconFile,(self,) + _args, _kwargs)
return val
def GetIconIndex(self, *_args, **_kwargs):
val = apply(misc2c.wxFileTypeInfo_GetIconIndex,(self,) + _args, _kwargs)
return val
def __repr__(self):
return "<C wxFileTypeInfo instance at %s>" % (self.this,)
class wxFileTypeInfo(wxFileTypeInfoPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(misc2c.new_wxFileTypeInfo,_args,_kwargs)
self.thisown = 1
def wxFileTypeInfoSequence(*_args,**_kwargs):
val = wxFileTypeInfoPtr(apply(misc2c.new_wxFileTypeInfoSequence,_args,_kwargs))
val.thisown = 1
return val
def wxNullFileTypeInfo(*_args,**_kwargs):
val = wxFileTypeInfoPtr(apply(misc2c.new_wxNullFileTypeInfo,_args,_kwargs))
val.thisown = 1
return val
class wxFileTypePtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def GetMimeType(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetMimeType,(self,) + _args, _kwargs)
return val
def GetMimeTypes(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetMimeTypes,(self,) + _args, _kwargs)
return val
def GetExtensions(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetExtensions,(self,) + _args, _kwargs)
return val
def GetIcon(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetIcon,(self,) + _args, _kwargs)
if val: val = wxIconPtr(val) ; val.thisown = 1
return val
def GetIconInfo(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetIconInfo,(self,) + _args, _kwargs)
return val
def GetDescription(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetDescription,(self,) + _args, _kwargs)
return val
def GetOpenCommand(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetOpenCommand,(self,) + _args, _kwargs)
return val
def GetPrintCommand(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetPrintCommand,(self,) + _args, _kwargs)
return val
def GetAllCommands(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_GetAllCommands,(self,) + _args, _kwargs)
return val
def SetCommand(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_SetCommand,(self,) + _args, _kwargs)
return val
def SetDefaultIcon(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_SetDefaultIcon,(self,) + _args, _kwargs)
return val
def Unassociate(self, *_args, **_kwargs):
val = apply(misc2c.wxFileType_Unassociate,(self,) + _args, _kwargs)
return val
def __del__(self,misc2c=misc2c):
if self.thisown == 1 :
misc2c.delete_wxFileType(self)
def __repr__(self):
return "<C wxFileType instance at %s>" % (self.this,)
class wxFileType(wxFileTypePtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(misc2c.new_wxFileType,_args,_kwargs)
self.thisown = 1
class wxMimeTypesManagerPtr :
def __init__(self,this):
self.this = this
self.thisown = 0
def Initialize(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_Initialize,(self,) + _args, _kwargs)
return val
def ClearData(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_ClearData,(self,) + _args, _kwargs)
return val
def GetFileTypeFromExtension(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_GetFileTypeFromExtension,(self,) + _args, _kwargs)
if val: val = wxFileTypePtr(val) ; val.thisown = 1
return val
def GetFileTypeFromMimeType(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_GetFileTypeFromMimeType,(self,) + _args, _kwargs)
if val: val = wxFileTypePtr(val) ; val.thisown = 1
return val
def ReadMailcap(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_ReadMailcap,(self,) + _args, _kwargs)
return val
def ReadMimeTypes(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_ReadMimeTypes,(self,) + _args, _kwargs)
return val
def EnumAllFileTypes(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_EnumAllFileTypes,(self,) + _args, _kwargs)
return val
def AddFallback(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_AddFallback,(self,) + _args, _kwargs)
return val
def Associate(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_Associate,(self,) + _args, _kwargs)
if val: val = wxFileTypePtr(val) ; val.thisown = 1
return val
def Unassociate(self, *_args, **_kwargs):
val = apply(misc2c.wxMimeTypesManager_Unassociate,(self,) + _args, _kwargs)
return val
def __del__(self,misc2c=misc2c):
if self.thisown == 1 :
misc2c.delete_wxMimeTypesManager(self)
def __repr__(self):
return "<C wxMimeTypesManager instance at %s>" % (self.this,)
class wxMimeTypesManager(wxMimeTypesManagerPtr):
def __init__(self,*_args,**_kwargs):
self.this = apply(misc2c.new_wxMimeTypesManager,_args,_kwargs)
self.thisown = 1
#-------------- FUNCTION WRAPPERS ------------------
@@ -935,6 +1125,10 @@ wxLog_GetTraceMask = misc2c.wxLog_GetTraceMask
wxLog_IsAllowedTraceMask = misc2c.wxLog_IsAllowedTraceMask
wxFileType_ExpandCommand = misc2c.wxFileType_ExpandCommand
wxMimeTypesManager_IsOfType = misc2c.wxMimeTypesManager_IsOfType
#-------------- VARIABLE WRAPPERS ------------------
@@ -1036,3 +1230,10 @@ wxLOG_Trace = misc2c.wxLOG_Trace
wxLOG_Progress = misc2c.wxLOG_Progress
wxLOG_User = misc2c.wxLOG_User
wxEVT_END_PROCESS = misc2c.wxEVT_END_PROCESS
wxMAILCAP_STANDARD = misc2c.wxMAILCAP_STANDARD
wxMAILCAP_NETSCAPE = misc2c.wxMAILCAP_NETSCAPE
wxMAILCAP_KDE = misc2c.wxMAILCAP_KDE
wxMAILCAP_GNOME = misc2c.wxMAILCAP_GNOME
wxMAILCAP_ALL = misc2c.wxMAILCAP_ALL
cvar = misc2c.cvar
wxTheMimeTypesManager = wxMimeTypesManagerPtr(misc2c.cvar.wxTheMimeTypesManager)

View File

@@ -58,7 +58,9 @@ extern PyObject *SWIG_newvarlink(void);
#include "helpers.h"
#include <wx/sashwin.h>
#include <wx/laywin.h>
#ifndef __WXMAC__
#include <wx/popupwin.h>
#endif
static PyObject* t_output_helper(PyObject* target, PyObject* o) {

View File

@@ -269,6 +269,29 @@
return NULL;
}
//---------------------------------------------------------------------------
// Typemap for wxArrayString from Python sequence objects
%typemap(python,in) wxArrayString& {
if (! PySequence_Check($source)) {
PyErr_SetString(PyExc_TypeError, "Sequence of strings expected.");
return NULL;
}
$target = new wxArrayString;
int i, len=PySequence_Length($source);
for (i=0; i<len; i++) {
PyObject* item = PySequence_GetItem($source, i);
PyObject* str = PyObject_Str(item);
$target->Add(PyString_AsString(item));
Py_DECREF(item);
Py_DECREF(str);
}
}
%typemap(python, freearg) wxArrayString& {
if ($target)
delete $source;
}
//---------------------------------------------------------------------------
// Map T_OUTPUTs for floats to return ints.