Merge recent wxPython changes from 2.8 branch to HEAD
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,10 +24,10 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
// See http://tinyurl.com/e5adr for what premultiplying alpha means. It
|
||||
// appears to me that the other platforms are already doing it, so I'll just
|
||||
// automatically do it for wxMSW here.
|
||||
#ifdef __WXMSW__
|
||||
// See http://tinyurl.com/e5adr for what premultiplying alpha means. wxMSW and
|
||||
// wxMac want to have the values premultiplied by the alpha value, but the
|
||||
// other platforms don't. These macros help keep the code clean.
|
||||
#if defined(__WXMSW__) || (defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS)
|
||||
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
|
||||
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p))
|
||||
#else
|
||||
@@ -500,8 +500,8 @@ def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None):
|
||||
expected to contain a series of RGB bytes and be width*height*3
|
||||
bytes long. A buffer object can optionally be supplied for the
|
||||
image's alpha channel data, and it is expected to be width*height
|
||||
bytes long. On Windows the RGB values are 'premultiplied' by the
|
||||
alpha values. (The other platforms do the multiplication
|
||||
bytes long. On Windows and Mac the RGB values are 'premultiplied'
|
||||
by the alpha values. (The other platforms do the multiplication
|
||||
themselves.)
|
||||
|
||||
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
||||
@@ -567,8 +567,8 @@ def BitmapFromBufferRGBA(width, height, dataBuffer):
|
||||
parameter must be a Python object that implements the buffer
|
||||
interface, such as a string, array, etc. The dataBuffer object is
|
||||
expected to contain a series of RGBA bytes (red, green, blue and
|
||||
alpha) and be width*height*4 bytes long. On Windows the RGB
|
||||
values are 'premultiplied' by the alpha values. (The other
|
||||
alpha) and be width*height*4 bytes long. On Windows and Mac the
|
||||
RGB values are 'premultiplied' by the alpha values. (The other
|
||||
platforms do the multiplication themselves.)
|
||||
|
||||
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
||||
|
||||
@@ -35,7 +35,7 @@ Blue (RGB) intensity values, and is used to determine drawing colours,
|
||||
window colours, etc. Valid RGB values are in the range 0 to 255.
|
||||
|
||||
In wxPython there are typemaps that will automatically convert from a
|
||||
colour name, from a '#RRGGBB' colour hex value string, or from a 3
|
||||
colour name, from a '#RRGGBB' colour hex value string, or from a 3 or 4
|
||||
integer tuple to a wx.Colour object when calling C++ methods that
|
||||
expect a wxColour. This means that the following are all
|
||||
equivallent::
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
DocCtorStr(
|
||||
wxColour(byte red=0, byte green=0, byte blue=0, byte alpha=wxALPHA_OPAQUE),
|
||||
"Constructs a colour from red, green and blue values.
|
||||
"Constructs a colour from red, green, blue and alpha values.
|
||||
|
||||
:see: Alternate constructors `wx.NamedColour` and `wx.ColourRGB`.
|
||||
", "");
|
||||
@@ -165,8 +165,8 @@ is returned if the pixel is invalid (on X, unallocated).", "");
|
||||
%extend {
|
||||
KeepGIL(Get);
|
||||
DocAStr(Get,
|
||||
"Get() -> (r, g, b)",
|
||||
"Returns the RGB intensity values as a tuple.", "");
|
||||
"Get(self, bool includeAlpha=False) -> (r,g,b) or (r,g,b,a)",
|
||||
"Returns the RGB intensity values as a tuple, optionally the alpha value as well.", "");
|
||||
PyObject* Get(bool includeAlpha=false) {
|
||||
PyObject* rv = PyTuple_New(includeAlpha ? 4 : 3);
|
||||
int red = -1;
|
||||
|
||||
@@ -242,6 +242,8 @@ static wxPyCoreAPI API = {
|
||||
wxRect2D_helper,
|
||||
wxPosition_helper,
|
||||
|
||||
wxPyCBOutputStream_create,
|
||||
wxPyCBOutputStream_copy,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -93,6 +93,7 @@ typedef unsigned int size_t;
|
||||
typedef unsigned int time_t;
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned long wxUIntPtr;
|
||||
typedef double wxDouble;
|
||||
|
||||
#define wxWindowID int
|
||||
#define wxCoord int
|
||||
@@ -408,6 +409,19 @@ typedef unsigned long wxUIntPtr;
|
||||
%enddef
|
||||
#endif
|
||||
|
||||
#ifdef _DO_FULL_DOCS
|
||||
%define %RenameDocStr(newname, docstr, details, type, decl)
|
||||
%feature("docstring") decl docstr;
|
||||
%rename(newname) decl;
|
||||
type decl
|
||||
%enddef
|
||||
#else
|
||||
%define %RenameDocStr(newname, docstr, details, type, decl)
|
||||
%feature("docstring") decl docstr details;
|
||||
%rename(newname) decl;
|
||||
type decl
|
||||
%enddef
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Generates a base_On* method that just wraps a call to the On*, and mark it
|
||||
@@ -459,6 +473,204 @@ FORWARD_DECLARE(wxIcon, Icon);
|
||||
FORWARD_DECLARE(wxStaticBox, StaticBox);
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// This macro makes a class to wrap a type specific class derived from wxList,
|
||||
// and make it look like a Python sequence, including with iterator support
|
||||
|
||||
%define wxLIST_WRAPPER(ListClass, ItemClass)
|
||||
// first a bit of C++ code...
|
||||
%{
|
||||
class ListClass##_iterator
|
||||
{
|
||||
public:
|
||||
ListClass##_iterator(ListClass::compatibility_iterator start)
|
||||
: m_node(start) {}
|
||||
|
||||
ItemClass* next() {
|
||||
ItemClass* obj = NULL;
|
||||
if (m_node) {
|
||||
obj = m_node->GetData();
|
||||
m_node = m_node->GetNext();
|
||||
}
|
||||
else PyErr_SetString(PyExc_StopIteration, "");
|
||||
return obj;
|
||||
}
|
||||
private:
|
||||
ListClass::compatibility_iterator m_node;
|
||||
};
|
||||
%}
|
||||
|
||||
// Now declare the classes for SWIG
|
||||
|
||||
DocStr(ListClass##_iterator,
|
||||
"This class serves as an iterator for a ListClass object.", "");
|
||||
|
||||
class ListClass##_iterator
|
||||
{
|
||||
public:
|
||||
//ListClass##_iterator();
|
||||
~ListClass_iterator();
|
||||
KeepGIL(next);
|
||||
ItemClass* next();
|
||||
};
|
||||
|
||||
|
||||
DocStr(ListClass,
|
||||
"This class wraps a wxList-based class and gives it a Python
|
||||
sequence-like interface. Sequence operations supported are length,
|
||||
index access and iteration.", "");
|
||||
|
||||
class ListClass
|
||||
{
|
||||
public:
|
||||
//ListClass(); This will always be created by some C++ function
|
||||
~ListClass();
|
||||
|
||||
%extend {
|
||||
KeepGIL(__len__);
|
||||
size_t __len__() {
|
||||
return self->size();
|
||||
}
|
||||
|
||||
KeepGIL(__getitem__);
|
||||
ItemClass* __getitem__(size_t index) {
|
||||
if (index < self->size()) {
|
||||
ListClass::compatibility_iterator node = self->Item(index);
|
||||
if (node) return node->GetData();
|
||||
}
|
||||
PyErr_SetString(PyExc_IndexError, "Invalid list index");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
KeepGIL(__contains__);
|
||||
bool __contains__(const ItemClass* obj) {
|
||||
return self->Find(obj) != NULL;
|
||||
}
|
||||
|
||||
KeepGIL(__iter__);
|
||||
%newobject __iter__;
|
||||
ListClass##_iterator* __iter__() {
|
||||
return new ListClass##_iterator(self->GetFirst());
|
||||
}
|
||||
}
|
||||
%pythoncode {
|
||||
def __repr__(self):
|
||||
return "ListClass: " + repr(list(self))
|
||||
}
|
||||
};
|
||||
%enddef
|
||||
|
||||
|
||||
|
||||
// This macro is similar to the above, but it is to be used when there isn't a
|
||||
// type-specific C++ list class to use. In other words the C++ code is using
|
||||
// a plain wxList and typecasting the node values, so we'll do the same.
|
||||
%define wxUNTYPED_LIST_WRAPPER(ListClass, ItemClass)
|
||||
// first a bit of C++ code...
|
||||
%{
|
||||
class ListClass
|
||||
{
|
||||
public:
|
||||
ListClass(wxList* theList)
|
||||
: m_list(theList) {}
|
||||
~ListClass() {}
|
||||
public:
|
||||
wxList* m_list;
|
||||
};
|
||||
|
||||
class ListClass##_iterator
|
||||
{
|
||||
public:
|
||||
ListClass##_iterator(wxList::compatibility_iterator start)
|
||||
: m_node(start) {}
|
||||
|
||||
ItemClass* next() {
|
||||
ItemClass* obj = NULL;
|
||||
if (m_node) {
|
||||
obj = (ItemClass*)m_node->GetData();
|
||||
m_node = m_node->GetNext();
|
||||
}
|
||||
else PyErr_SetString(PyExc_StopIteration, "");
|
||||
return obj;
|
||||
}
|
||||
private:
|
||||
wxList::compatibility_iterator m_node;
|
||||
};
|
||||
%}
|
||||
|
||||
// Now declare the classes for SWIG
|
||||
|
||||
DocStr(ListClass##_iterator,
|
||||
"This class serves as an iterator for a ListClass object.", "");
|
||||
|
||||
class ListClass##_iterator
|
||||
{
|
||||
public:
|
||||
//ListClass##_iterator();
|
||||
~ListClass_iterator();
|
||||
KeepGIL(next);
|
||||
ItemClass* next();
|
||||
};
|
||||
|
||||
|
||||
DocStr(ListClass,
|
||||
"This class wraps a wxList-based class and gives it a Python
|
||||
sequence-like interface. Sequence operations supported are length,
|
||||
index access and iteration.", "");
|
||||
class ListClass
|
||||
{
|
||||
public:
|
||||
//ListClass(); This will always be created by some C++ function
|
||||
~ListClass();
|
||||
|
||||
%extend {
|
||||
KeepGIL(__len__);
|
||||
size_t __len__() {
|
||||
return self->m_list->size();
|
||||
}
|
||||
|
||||
KeepGIL(__getitem__);
|
||||
ItemClass* __getitem__(size_t index) {
|
||||
if (index < self->m_list->size()) {
|
||||
wxList::compatibility_iterator node = self->m_list->Item(index);
|
||||
if (node) return (ItemClass*)node->GetData();
|
||||
}
|
||||
PyErr_SetString(PyExc_IndexError, "Invalid list index");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
KeepGIL(__contains__);
|
||||
bool __contains__(const ItemClass* obj) {
|
||||
return self->m_list->Find(obj) != NULL;
|
||||
}
|
||||
|
||||
KeepGIL(__iter__);
|
||||
%newobject __iter__;
|
||||
ListClass##_iterator* __iter__() {
|
||||
return new ListClass##_iterator(self->m_list->GetFirst());
|
||||
}
|
||||
}
|
||||
%pythoncode {
|
||||
def __repr__(self):
|
||||
return "ListClass: " + repr(list(self))
|
||||
}
|
||||
};
|
||||
|
||||
// A typemap to handle converting a wxList& return value to this new list
|
||||
// type. To use this just change the return value type in the class
|
||||
// definition to this typedef instead of wxList, then SWIG will use the
|
||||
// typemap.
|
||||
%{
|
||||
typedef wxList ListClass##_t;
|
||||
%}
|
||||
%typemap(out) ListClass##_t& {
|
||||
ListClass* mylist = new ListClass($1);
|
||||
$result = SWIG_NewPointerObj(SWIG_as_voidptr(mylist), SWIGTYPE_p_##ListClass, SWIG_POINTER_OWN );
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
wxPyEndBlockThreads(blocked);
|
||||
|
||||
wxMemoryFSHandler::AddFile(filename, ptr, size);
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
@@ -280,6 +280,26 @@ public:
|
||||
// Add a file to the memory FS
|
||||
%pythoncode { AddFile = staticmethod(MemoryFSHandler_AddFile) }
|
||||
|
||||
%extend {
|
||||
static void AddFileWithMimeType(const wxString& filename,
|
||||
PyObject* data,
|
||||
const wxString& mimetype)
|
||||
{
|
||||
if (! PyString_Check(data)) {
|
||||
wxPyBLOCK_THREADS(PyErr_SetString(PyExc_TypeError,
|
||||
"Expected string object"));
|
||||
return;
|
||||
}
|
||||
|
||||
wxPyBlock_t blocked = wxPyBeginBlockThreads();
|
||||
void* ptr = (void*)PyString_AsString(data);
|
||||
size_t size = PyString_Size(data);
|
||||
wxPyEndBlockThreads(blocked);
|
||||
|
||||
wxMemoryFSHandler::AddFileWithMimeType(filename, ptr, size, mimetype);
|
||||
}
|
||||
}
|
||||
|
||||
bool CanOpen(const wxString& location);
|
||||
%newobject OpenFile;
|
||||
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
|
||||
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
MustHaveApp(wxThread);
|
||||
MustHaveApp(wxThread_IsMain);
|
||||
%inline %{
|
||||
bool wxThread_IsMain() {
|
||||
#ifdef WXP_WITH_THREAD
|
||||
|
||||
@@ -488,6 +488,9 @@ DocStr(wxRect,
|
||||
width and height properties. In wxPython most palces that expect a
|
||||
wx.Rect can also accept a (x,y,width,height) tuple.", "");
|
||||
|
||||
|
||||
%typemap(in) wxRect*;
|
||||
|
||||
class wxRect
|
||||
{
|
||||
public:
|
||||
@@ -777,6 +780,9 @@ usually, but not necessarily, the larger one.", "");
|
||||
%property(Empty, IsEmpty, doc="See `IsEmpty`");
|
||||
};
|
||||
|
||||
%apply wxRect& { wxRect* };
|
||||
|
||||
|
||||
|
||||
MustHaveApp(wxIntersectRect);
|
||||
|
||||
|
||||
@@ -350,9 +350,6 @@ MustHaveApp(wxGraphicsPath);
|
||||
MustHaveApp(wxGraphicsContext);
|
||||
MustHaveApp(wxGCDC);
|
||||
|
||||
typedef double wxDouble;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -642,6 +642,17 @@ string.", "",
|
||||
bool , SaveFile( const wxString& name, const wxString& mimetype ),
|
||||
"Saves an image in the named file.", "",
|
||||
SaveMimeFile);
|
||||
|
||||
DocDeclStrName(
|
||||
bool , SaveFile( wxOutputStream& stream, int type ),
|
||||
"Saves an image in the named file.", "",
|
||||
SaveStream);
|
||||
|
||||
|
||||
DocDeclStrName(
|
||||
bool , SaveFile( wxOutputStream& stream, const wxString& mimetype ),
|
||||
"Saves an image in the named file.", "",
|
||||
SaveMimeStream);
|
||||
|
||||
|
||||
DocDeclStrName(
|
||||
|
||||
@@ -214,7 +214,8 @@ public:
|
||||
void PassMessages(bool bDoPass);
|
||||
bool IsPassingMessages();
|
||||
wxLog *GetOldLog();
|
||||
|
||||
void DetachOldLog();
|
||||
|
||||
%property(OldLog, GetOldLog, doc="See `GetOldLog`");
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
wxLIST_WRAPPER(wxMenuItemList, wxMenuItem);
|
||||
|
||||
|
||||
|
||||
MustHaveApp(wxMenu);
|
||||
|
||||
@@ -169,12 +172,7 @@ public:
|
||||
|
||||
// get the items
|
||||
size_t GetMenuItemCount() const;
|
||||
%extend {
|
||||
PyObject* GetMenuItems() {
|
||||
wxMenuItemList& list = self->GetMenuItems();
|
||||
return wxPy_ConvertList(&list);
|
||||
}
|
||||
}
|
||||
wxMenuItemList& GetMenuItems();
|
||||
|
||||
// search
|
||||
int FindItem(const wxString& item) const;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: _window.i
|
||||
// Name: _panel.i
|
||||
// Purpose: SWIG interface for wxPanel and wxScrolledWindow
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
|
||||
1968
wxPython/src/_richtextbuffer.i
Normal file
1968
wxPython/src/_richtextbuffer.i
Normal file
File diff suppressed because it is too large
Load Diff
1237
wxPython/src/_richtextctrl.i
Normal file
1237
wxPython/src/_richtextctrl.i
Normal file
File diff suppressed because it is too large
Load Diff
102
wxPython/src/_richtexthtml.i
Normal file
102
wxPython/src/_richtexthtml.i
Normal file
@@ -0,0 +1,102 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: _richtexthtml
|
||||
// Purpose: wxRichTextHTMLHandler
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 18-May-2007
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2007 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Not a %module
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <wx/richtext/richtexthtml.h>
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
MAKE_CONST_WXSTRING2(HtmlName, wxT("HTML"));
|
||||
MAKE_CONST_WXSTRING2(HtmlExt, wxT("html"));
|
||||
|
||||
class wxRichTextHTMLHandler: public wxRichTextFileHandler
|
||||
{
|
||||
public:
|
||||
wxRichTextHTMLHandler(const wxString& name = wxPyHtmlName,
|
||||
const wxString& ext = wxPyHtmlExt,
|
||||
int type = wxRICHTEXT_TYPE_HTML);
|
||||
|
||||
DocDeclStr(
|
||||
virtual bool , CanSave() const,
|
||||
"Can we save using this handler?", "");
|
||||
DocDeclStr(
|
||||
virtual bool , CanLoad() const,
|
||||
"Can we load using this handler?", "");
|
||||
DocDeclStr(
|
||||
virtual bool , CanHandle(const wxString& filename) const,
|
||||
"Can we handle this filename (if using files)? By default, checks the
|
||||
extension.", "");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
void , SetTemporaryImageLocations(const wxArrayString& locations),
|
||||
"Set the list of image locations generated by the last operation", "");
|
||||
DocDeclStr(
|
||||
const wxArrayString& , GetTemporaryImageLocations() const,
|
||||
"Get the list of image locations generated by the last operation", "");
|
||||
%property(TemporaryImageLocations, GetTemporaryImageLocations, SetTemporaryImageLocations);
|
||||
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
void , ClearTemporaryImageLocations(),
|
||||
"Clear the image locations generated by the last operation", "");
|
||||
DocDeclStr(
|
||||
bool , DeleteTemporaryImages(),
|
||||
"Delete the in-memory or temporary files generated by the last operation", "");
|
||||
|
||||
|
||||
// DocDeclStr(
|
||||
// static bool , DeleteTemporaryImages(int flags, const wxArrayString& imageLocations),
|
||||
// "Delete the in-memory or temporary files generated by the last operation. This
|
||||
// is a static function that can be used to delete the saved locations from an
|
||||
// earlier operation, for example after the user has viewed the HTML file.", "");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
static void , SetFileCounter(int counter),
|
||||
"Reset the file counter, in case, for example, the same names are required each
|
||||
time", "");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
void , SetTempDir(const wxString& tempDir),
|
||||
"Set the directory for storing temporary files. If empty, the system temporary
|
||||
directory will be used.", "");
|
||||
DocDeclStr(
|
||||
const wxString& , GetTempDir() const,
|
||||
"Get the directory for storing temporary files. If empty, the system temporary
|
||||
directory will be used.", "");
|
||||
%property(TempDir, GetTempDir, SetTempDir);
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
void , SetFontSizeMapping(const wxArrayInt& fontSizeMapping),
|
||||
"Set mapping from point size to HTML font size. There should be 7 elements, one
|
||||
for each HTML font size, each element specifying the maximum point size for
|
||||
that HTML font size. E.g. 8, 10, 13, 17, 22, 29, 100
|
||||
", "");
|
||||
DocDeclStr(
|
||||
wxArrayInt , GetFontSizeMapping() const,
|
||||
"Get mapping deom point size to HTML font size.", "");
|
||||
%property(FontSizeMapping, GetFontSizeMapping, SetFontSizeMapping);
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
67
wxPython/src/_richtextxml.i
Normal file
67
wxPython/src/_richtextxml.i
Normal file
@@ -0,0 +1,67 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: _richtextxml
|
||||
// Purpose: wxRichTextXMLHandler
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 18-May-2007
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2007 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Not a %module
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
#include <wx/richtext/richtextxml.h>
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
MAKE_CONST_WXSTRING2(XmlName, wxT("XML"));
|
||||
MAKE_CONST_WXSTRING2(XmlExt, wxT("xml"));
|
||||
|
||||
|
||||
class wxRichTextXMLHandler: public wxRichTextFileHandler
|
||||
{
|
||||
public:
|
||||
wxRichTextXMLHandler(const wxString& name = wxPyXmlName,
|
||||
const wxString& ext = wxPyXmlExt,
|
||||
int type = wxRICHTEXT_TYPE_XML);
|
||||
|
||||
// #if wxUSE_STREAMS
|
||||
// /// Recursively export an object
|
||||
// bool ExportXML(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextObject& obj, int level);
|
||||
// bool ExportStyleDefinition(wxOutputStream& stream, wxMBConv* convMem, wxMBConv* convFile, wxRichTextStyleDefinition* def, int level);
|
||||
|
||||
// /// Recursively import an object
|
||||
// bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node);
|
||||
// bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node);
|
||||
|
||||
// /// Create style parameters
|
||||
// wxString CreateStyle(const wxTextAttrEx& attr, bool isPara = false);
|
||||
|
||||
// /// Get style parameters
|
||||
// bool GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool isPara = false);
|
||||
// #endif
|
||||
|
||||
/// Can we save using this handler?
|
||||
virtual bool CanSave() const;
|
||||
|
||||
/// Can we load using this handler?
|
||||
virtual bool CanLoad() const;
|
||||
|
||||
|
||||
// bool HasParam(wxXmlNode* node, const wxString& param);
|
||||
// wxXmlNode *GetParamNode(wxXmlNode* node, const wxString& param);
|
||||
// wxString GetNodeContent(wxXmlNode *node);
|
||||
// wxString GetParamValue(wxXmlNode *node, const wxString& param);
|
||||
// wxString GetText(wxXmlNode *node, const wxString& param = wxEmptyString, bool translate = false);
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -169,6 +169,11 @@ border size.", "");
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
wxLIST_WRAPPER( wxSizerItemList, wxSizerItem );
|
||||
|
||||
|
||||
|
||||
DocStr(wxSizerItem,
|
||||
"The wx.SizerItem class is used to track the position, size and other
|
||||
@@ -1247,21 +1252,12 @@ as well.", "");
|
||||
|
||||
|
||||
|
||||
// wxList& GetChildren();
|
||||
%extend {
|
||||
DocAStr(GetChildren,
|
||||
"GetChildren(self) -> list",
|
||||
"Returns a list of all the `wx.SizerItem` objects managed by the sizer.", "");
|
||||
PyObject* GetChildren() {
|
||||
wxSizerItemList& list = self->GetChildren();
|
||||
return wxPy_ConvertList(&list);
|
||||
}
|
||||
}
|
||||
DocStr(GetChildren,
|
||||
"Returns all of the `wx.SizerItem` objects managed by the sizer in a
|
||||
list-like object.", "");
|
||||
wxSizerItemList& GetChildren();
|
||||
|
||||
|
||||
// Manage whether individual windows or subsizers are considered
|
||||
// in the layout calculations or not.
|
||||
|
||||
%extend {
|
||||
DocAStr(Show,
|
||||
"Show(self, item, bool show=True, bool recursive=false) -> bool",
|
||||
|
||||
@@ -32,7 +32,7 @@ given for the Unix, Windows and Mac OS X systems, however please note
|
||||
that these are just examples and the actual values may differ. For
|
||||
example, under Windows the system administrator may change the
|
||||
standard directories locations, i.e. the Windows directory may be
|
||||
named W:\Win2003 instead of the default C:\Windows.
|
||||
named W:/Win2003 instead of the default C:/Windows.
|
||||
|
||||
The strings appname and username should be replaced with the value
|
||||
returned by `wx.App.GetAppName` and the name of the currently logged
|
||||
@@ -85,14 +85,14 @@ absolute path whenever possible.", "");
|
||||
DocDeclStr(
|
||||
virtual wxString , GetConfigDir() const,
|
||||
"Return the directory with system config files: /etc under Unix,
|
||||
'c:\\Documents and Settings\\All Users\\Application Data' under Windows,
|
||||
'c:/Documents and Settings/All Users/Application Data' under Windows,
|
||||
/Library/Preferences for Mac", "");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
virtual wxString , GetUserConfigDir() const,
|
||||
"Return the directory for the user config files: $HOME under Unix,
|
||||
'c:\\Documents and Settings\\username' under Windows, and
|
||||
'c:/Documents and Settings/username' under Windows, and
|
||||
~/Library/Preferences under Mac
|
||||
|
||||
Only use this if you have a single file to put there, otherwise
|
||||
@@ -103,7 +103,7 @@ Only use this if you have a single file to put there, otherwise
|
||||
virtual wxString , GetDataDir() const,
|
||||
"Return the location of the application's global, (i.e. not
|
||||
user-specific,) data files: prefix/share/appname under Unix,
|
||||
'c:\\Program Files\\appname' under Windows,
|
||||
'c:/Program Files/appname' under Windows,
|
||||
appname.app/Contents/SharedSupport app bundle directory under Mac.", "");
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ host-specific. Same as `GetDataDir` except under Unix where it is
|
||||
DocDeclStr(
|
||||
virtual wxString , GetUserDataDir() const,
|
||||
"Return the directory for the user-dependent application data files:
|
||||
$HOME/.appname under Unix, c:\\Documents and
|
||||
Settings\\username\\Application Data\\appname under Windows and
|
||||
$HOME/.appname under Unix, c:/Documents and
|
||||
Settings/username/Application Data/appname under Windows and
|
||||
~/Library/Application Support/appname under Mac", "");
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ Settings\\username\\Application Data\\appname under Windows and
|
||||
with the other machines
|
||||
|
||||
Same as `GetUserDataDir` for all platforms except Windows where it is
|
||||
the 'Local Settings\\Application Data\\appname' directory.", "");
|
||||
the 'Local Settings/Application Data/appname' directory.", "");
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
@@ -168,7 +168,7 @@ standard prefix/share/locale/lang/LC_MESSAGES.)", "");
|
||||
virtual wxString , GetDocumentsDir() const,
|
||||
"Return the Documents directory for the current user.
|
||||
|
||||
C:\Documents and Settings\username\Documents under Windows,
|
||||
C:/Documents and Settings/username/Documents under Windows,
|
||||
$HOME under Unix and ~/Documents under Mac", "");
|
||||
|
||||
DocDeclStr(
|
||||
|
||||
@@ -61,18 +61,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
%typemap(out) wxInputStream* {
|
||||
wxPyInputStream * _ptr = NULL;
|
||||
|
||||
if ($1) {
|
||||
if ($1)
|
||||
_ptr = new wxPyInputStream($1);
|
||||
}
|
||||
$result = wxPyConstructObject(_ptr, wxT("wxPyInputStream"), $owner);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Typemaps for wxOutputStream. We only need in by reference and out by
|
||||
// pointer in this one.
|
||||
|
||||
|
||||
%typemap(in) wxOutputStream& (wxPyOutputStream* temp, bool created) {
|
||||
if (wxPyConvertSwigPtr($input, (void **)&temp, wxT("wxPyOutputStream"))) {
|
||||
$1 = temp->m_wxos;
|
||||
created = false;
|
||||
} else {
|
||||
PyErr_Clear(); // clear the failure of the wxPyConvert above
|
||||
$1 = wxPyCBOutputStream_create($input, false);
|
||||
if ($1 == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "Expected wx.OutputStream or Python file-like object.");
|
||||
SWIG_fail;
|
||||
}
|
||||
created = true;
|
||||
}
|
||||
}
|
||||
%typemap(freearg) wxOutputStream& { if (created$argnum) delete $1; }
|
||||
|
||||
|
||||
%typemap(out) wxOutputStream* {
|
||||
wxPyOutputStream * _ptr = NULL;
|
||||
if ($1)
|
||||
_ptr = new wxPyOutputStream($1);
|
||||
$result = wxPyConstructObject(_ptr, wxT("wxPyOutputStream"), $owner);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum wxSeekMode
|
||||
@@ -107,14 +132,6 @@ public:
|
||||
void seek(int offset, int whence=0);
|
||||
int tell();
|
||||
|
||||
/*
|
||||
bool isatty();
|
||||
int fileno();
|
||||
void truncate(int size=-1);
|
||||
void write(wxString data);
|
||||
void writelines(wxStringPtrList);
|
||||
*/
|
||||
|
||||
char Peek();
|
||||
char GetC();
|
||||
size_t LastRead();
|
||||
@@ -128,43 +145,41 @@ public:
|
||||
|
||||
|
||||
|
||||
// TODO: make a more fully implemented file interface...
|
||||
class wxOutputStream {
|
||||
public:
|
||||
/*
|
||||
void close();
|
||||
void flush();
|
||||
wxString* read(int size=-1);
|
||||
wxString* readline(int size=-1);
|
||||
wxStringPtrList* readlines(int sizehint=-1);
|
||||
void seek(int offset, int whence=0);
|
||||
int tell();
|
||||
bool isatty();
|
||||
int fileno();
|
||||
void truncate(int size=-1);
|
||||
void write(wxString data);
|
||||
void writelines(wxStringPtrList);
|
||||
*/
|
||||
|
||||
%rename(OutputStream) wxPyOutputStream;
|
||||
class wxPyOutputStream
|
||||
{
|
||||
public:
|
||||
%extend {
|
||||
void write(PyObject* obj) {
|
||||
// We use only strings for the streams, not unicode
|
||||
PyObject* str = PyObject_Str(obj);
|
||||
if (! str) {
|
||||
PyErr_SetString(PyExc_TypeError, "Unable to convert to string");
|
||||
return;
|
||||
}
|
||||
self->Write(PyString_AS_STRING(str),
|
||||
PyString_GET_SIZE(str));
|
||||
Py_DECREF(str);
|
||||
wxPyOutputStream(PyObject* p) {
|
||||
wxOutputStream* wxis = wxPyCBOutputStream::create(p);
|
||||
if (wxis)
|
||||
return new wxPyOutputStream(wxis);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
size_t LastWrite() const;
|
||||
~wxPyOutputStream();
|
||||
|
||||
void close();
|
||||
void flush();
|
||||
bool eof();
|
||||
void seek(int offset, int whence=0);
|
||||
int tell();
|
||||
|
||||
void write(PyObject* data);
|
||||
//void writelines(wxStringArray& arr);
|
||||
|
||||
void PutC(char c);
|
||||
size_t LastWrite();
|
||||
unsigned long SeekO(unsigned long pos, wxSeekMode mode = wxFromStart);
|
||||
unsigned long TellO();
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%init %{
|
||||
wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream");
|
||||
wxPyPtrTypeMap_Add("wxOutputStream", "wxPyOutputStream");
|
||||
%}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -24,6 +24,9 @@ MAKE_CONST_WXSTRING(PanelNameStr);
|
||||
%newgroup
|
||||
|
||||
|
||||
wxLIST_WRAPPER(wxWindowList, wxWindow);
|
||||
|
||||
|
||||
DocStr(wxVisualAttributes,
|
||||
"struct containing all the visual attributes of a control", "");
|
||||
|
||||
@@ -124,9 +127,14 @@ Styles
|
||||
deactivate it.
|
||||
|
||||
wx.VSCROLL Use this style to enable a vertical scrollbar.
|
||||
Notice that this style cannot be used with
|
||||
native controls which don't support scrollbars
|
||||
nor with top-level windows in most ports.
|
||||
|
||||
wx.HSCROLL Use this style to enable a horizontal scrollbar.
|
||||
|
||||
The same limitations as for wx.VSCROLL apply to
|
||||
this style.
|
||||
|
||||
wx.ALWAYS_SHOW_SB If a window has scrollbars, disable them
|
||||
instead of hiding them when they are
|
||||
not needed (i.e. when the size of the
|
||||
@@ -990,26 +998,16 @@ before win instead of putting it right after it.", "");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// parent/children relations
|
||||
// -------------------------
|
||||
|
||||
|
||||
//wxWindowList& GetChildren(); // TODO: Do a typemap or a wrapper for wxWindowList
|
||||
%extend {
|
||||
DocStr(GetChildren,
|
||||
"Returns a list of the window's children. NOTE: Currently this is a
|
||||
copy of the child window list maintained by the window, so the return
|
||||
value of this function is only valid as long as the window's children
|
||||
do not change.", "");
|
||||
PyObject* GetChildren() {
|
||||
wxWindowList& list = self->GetChildren();
|
||||
return wxPy_ConvertList(&list);
|
||||
}
|
||||
}
|
||||
"Returns an object containing a list of the window's children. The
|
||||
object provides a Python sequence-like interface over the internal
|
||||
list maintained by the window..", "");
|
||||
wxWindowList& GetChildren();
|
||||
|
||||
|
||||
DocDeclStr(
|
||||
wxWindow *, GetParent() const,
|
||||
@@ -2318,14 +2316,11 @@ MustHaveApp(wxWindow_FromHWND);
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DocStr(GetTopLevelWindows,
|
||||
"Returns a list of the the application's top-level windows, (frames,
|
||||
dialogs, etc.) NOTE: Currently this is a copy of the list maintained
|
||||
by wxWidgets, and so it is only valid as long as no top-level windows
|
||||
are closed or new top-level windows are created.
|
||||
", "");
|
||||
"Returns a list-like object of the the application's top-level windows, (frames,
|
||||
dialogs, etc.)", "");
|
||||
%inline %{
|
||||
PyObject* GetTopLevelWindows() {
|
||||
return wxPy_ConvertList(&wxTopLevelWindows);
|
||||
wxWindowList& GetTopLevelWindows() {
|
||||
return wxTopLevelWindows;
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%define DOCSTRING
|
||||
"The wx.aui moduleis an Advanced User Interface library that aims to
|
||||
"The wx.aui module is an Advanced User Interface library that aims to
|
||||
implement \"cutting-edge\" interface usability and design features so
|
||||
developers can quickly and easily create beautiful and usable
|
||||
application interfaces.
|
||||
|
||||
@@ -712,6 +712,7 @@ Nearly all of the methods of this class are overridable in Python.", "");
|
||||
|
||||
MustHaveApp(wxPyComboPopup);
|
||||
%rename(ComboPopup) wxPyComboPopup;
|
||||
%typemap(out) wxPyComboCtrl* { $result = wxPyMake_wxObject($1, (bool)$owner); }
|
||||
|
||||
class wxPyComboPopup
|
||||
{
|
||||
@@ -851,7 +852,6 @@ is associated with.", "");
|
||||
};
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
%newgroup
|
||||
|
||||
|
||||
@@ -1090,6 +1090,21 @@ void wxPyEndBlockThreads(wxPyBlock_t blocked) {
|
||||
// wxPyInputStream and wxPyCBInputStream methods
|
||||
|
||||
|
||||
static PyObject* wxPyGetMethod(PyObject* py, char* name)
|
||||
{
|
||||
if (!PyObject_HasAttrString(py, name))
|
||||
return NULL;
|
||||
PyObject* o = PyObject_GetAttrString(py, name);
|
||||
if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
|
||||
Py_DECREF(o);
|
||||
return NULL;
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void wxPyInputStream::close() {
|
||||
/* do nothing for now */
|
||||
}
|
||||
@@ -1246,7 +1261,7 @@ void wxPyInputStream::seek(int offset, int whence) {
|
||||
m_wxis->SeekI(offset, wxSeekMode(whence));
|
||||
}
|
||||
|
||||
int wxPyInputStream::tell(){
|
||||
int wxPyInputStream::tell() {
|
||||
if (m_wxis)
|
||||
return m_wxis->TellI();
|
||||
else return 0;
|
||||
@@ -1285,9 +1300,9 @@ wxPyCBInputStream* wxPyCBInputStream::create(PyObject *py, bool block) {
|
||||
wxPyBlock_t blocked = wxPyBlock_t_default;
|
||||
if (block) blocked = wxPyBeginBlockThreads();
|
||||
|
||||
PyObject* read = getMethod(py, "read");
|
||||
PyObject* seek = getMethod(py, "seek");
|
||||
PyObject* tell = getMethod(py, "tell");
|
||||
PyObject* read = wxPyGetMethod(py, "read");
|
||||
PyObject* seek = wxPyGetMethod(py, "seek");
|
||||
PyObject* tell = wxPyGetMethod(py, "tell");
|
||||
|
||||
if (!read) {
|
||||
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
|
||||
@@ -1311,17 +1326,6 @@ wxPyCBInputStream* wxPyCBInputStream_copy(wxPyCBInputStream* other) {
|
||||
return new wxPyCBInputStream(*other);
|
||||
}
|
||||
|
||||
PyObject* wxPyCBInputStream::getMethod(PyObject* py, char* name) {
|
||||
if (!PyObject_HasAttrString(py, name))
|
||||
return NULL;
|
||||
PyObject* o = PyObject_GetAttrString(py, name);
|
||||
if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
|
||||
Py_DECREF(o);
|
||||
return NULL;
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
wxFileOffset wxPyCBInputStream::GetLength() const {
|
||||
wxPyCBInputStream* self = (wxPyCBInputStream*)this; // cast off const
|
||||
@@ -1406,6 +1410,196 @@ wxFileOffset wxPyCBInputStream::OnSysTell() const {
|
||||
return o;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Output stream
|
||||
|
||||
wxPyOutputStream::~wxPyOutputStream()
|
||||
{
|
||||
if (m_wxos)
|
||||
delete m_wxos;
|
||||
}
|
||||
|
||||
void wxPyOutputStream::close()
|
||||
{
|
||||
}
|
||||
|
||||
void wxPyOutputStream::flush()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxPyOutputStream::eof()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxPyOutputStream::seek(int offset, int whence)
|
||||
{
|
||||
if (m_wxos)
|
||||
m_wxos->SeekO(offset, wxSeekMode(whence));
|
||||
}
|
||||
|
||||
int wxPyOutputStream::tell()
|
||||
{
|
||||
if (m_wxos)
|
||||
return m_wxos->TellO();
|
||||
else return 0;
|
||||
}
|
||||
|
||||
void wxPyOutputStream::write(PyObject* data)
|
||||
{
|
||||
if (!m_wxos)
|
||||
return;
|
||||
|
||||
// We use only strings for the streams, not unicode
|
||||
PyObject* str = PyObject_Str(data);
|
||||
if (! str) {
|
||||
PyErr_SetString(PyExc_TypeError, "Unable to convert to string");
|
||||
return;
|
||||
}
|
||||
m_wxos->Write(PyString_AS_STRING(str), PyString_GET_SIZE(str));
|
||||
Py_DECREF(str);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
wxPyCBOutputStream::wxPyCBOutputStream(PyObject *w, PyObject *s, PyObject *t, bool block)
|
||||
: wxOutputStream(), m_write(w), m_seek(s), m_tell(t), m_block(block)
|
||||
{}
|
||||
|
||||
wxPyCBOutputStream::wxPyCBOutputStream(const wxPyCBOutputStream& other)
|
||||
{
|
||||
m_write = other.m_write;
|
||||
m_seek = other.m_seek;
|
||||
m_tell = other.m_tell;
|
||||
m_block = other.m_block;
|
||||
Py_INCREF(m_write);
|
||||
Py_INCREF(m_seek);
|
||||
Py_INCREF(m_tell);
|
||||
}
|
||||
|
||||
|
||||
wxPyCBOutputStream::~wxPyCBOutputStream() {
|
||||
wxPyBlock_t blocked = wxPyBlock_t_default;
|
||||
if (m_block) blocked = wxPyBeginBlockThreads();
|
||||
Py_XDECREF(m_write);
|
||||
Py_XDECREF(m_seek);
|
||||
Py_XDECREF(m_tell);
|
||||
if (m_block) wxPyEndBlockThreads(blocked);
|
||||
}
|
||||
|
||||
|
||||
wxPyCBOutputStream* wxPyCBOutputStream::create(PyObject *py, bool block) {
|
||||
wxPyBlock_t blocked = wxPyBlock_t_default;
|
||||
if (block) blocked = wxPyBeginBlockThreads();
|
||||
|
||||
PyObject* write = wxPyGetMethod(py, "write");
|
||||
PyObject* seek = wxPyGetMethod(py, "seek");
|
||||
PyObject* tell = wxPyGetMethod(py, "tell");
|
||||
|
||||
if (!write) {
|
||||
PyErr_SetString(PyExc_TypeError, "Not a file-like object");
|
||||
Py_XDECREF(write);
|
||||
Py_XDECREF(seek);
|
||||
Py_XDECREF(tell);
|
||||
if (block) wxPyEndBlockThreads(blocked);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (block) wxPyEndBlockThreads(blocked);
|
||||
return new wxPyCBOutputStream(write, seek, tell, block);
|
||||
}
|
||||
|
||||
|
||||
wxPyCBOutputStream* wxPyCBOutputStream_create(PyObject *py, bool block) {
|
||||
return wxPyCBOutputStream::create(py, block);
|
||||
}
|
||||
|
||||
wxPyCBOutputStream* wxPyCBOutputStream_copy(wxPyCBOutputStream* other) {
|
||||
return new wxPyCBOutputStream(*other);
|
||||
}
|
||||
|
||||
|
||||
wxFileOffset wxPyCBOutputStream::GetLength() const {
|
||||
wxPyCBOutputStream* self = (wxPyCBOutputStream*)this; // cast off const
|
||||
if (m_seek && m_tell) {
|
||||
wxFileOffset temp = self->OnSysTell();
|
||||
wxFileOffset ret = self->OnSysSeek(0, wxFromEnd);
|
||||
self->OnSysSeek(temp, wxFromStart);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
return wxInvalidOffset;
|
||||
}
|
||||
|
||||
|
||||
size_t wxPyCBOutputStream::OnSysRead(void *buffer, size_t bufsize) {
|
||||
m_lasterror = wxSTREAM_READ_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t wxPyCBOutputStream::OnSysWrite(const void *buffer, size_t bufsize) {
|
||||
if (bufsize == 0)
|
||||
return 0;
|
||||
|
||||
wxPyBlock_t blocked = wxPyBeginBlockThreads();
|
||||
PyObject* arglist = PyTuple_New(1);
|
||||
PyTuple_SET_ITEM(arglist, 0, PyString_FromStringAndSize((char*)buffer, bufsize));
|
||||
|
||||
PyObject* result = PyEval_CallObject(m_write, arglist);
|
||||
Py_DECREF(arglist);
|
||||
|
||||
if (result != NULL)
|
||||
Py_DECREF(result);
|
||||
else
|
||||
m_lasterror = wxSTREAM_WRITE_ERROR;
|
||||
wxPyEndBlockThreads(blocked);
|
||||
return bufsize;
|
||||
}
|
||||
|
||||
|
||||
wxFileOffset wxPyCBOutputStream::OnSysSeek(wxFileOffset off, wxSeekMode mode) {
|
||||
wxPyBlock_t blocked = wxPyBeginBlockThreads();
|
||||
PyObject* arglist = PyTuple_New(2);
|
||||
|
||||
if (sizeof(wxFileOffset) > sizeof(long))
|
||||
// wxFileOffset is a 64-bit value...
|
||||
PyTuple_SET_ITEM(arglist, 0, PyLong_FromLongLong(off));
|
||||
else
|
||||
PyTuple_SET_ITEM(arglist, 0, PyInt_FromLong(off));
|
||||
|
||||
PyTuple_SET_ITEM(arglist, 1, PyInt_FromLong(mode));
|
||||
|
||||
|
||||
PyObject* result = PyEval_CallObject(m_seek, arglist);
|
||||
Py_DECREF(arglist);
|
||||
Py_XDECREF(result);
|
||||
wxPyEndBlockThreads(blocked);
|
||||
return OnSysTell();
|
||||
}
|
||||
|
||||
|
||||
wxFileOffset wxPyCBOutputStream::OnSysTell() const {
|
||||
wxPyBlock_t blocked = wxPyBeginBlockThreads();
|
||||
PyObject* arglist = Py_BuildValue("()");
|
||||
PyObject* result = PyEval_CallObject(m_tell, arglist);
|
||||
Py_DECREF(arglist);
|
||||
wxFileOffset o = 0;
|
||||
if (result != NULL) {
|
||||
if (PyLong_Check(result))
|
||||
o = PyLong_AsLongLong(result);
|
||||
else
|
||||
o = PyInt_AsLong(result);
|
||||
Py_DECREF(result);
|
||||
};
|
||||
wxPyEndBlockThreads(blocked);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxPyCallback, wxObject);
|
||||
|
||||
@@ -173,6 +173,10 @@ MAKE_INT_ARRAY_TYPEMAPS(styles, styles_field)
|
||||
}
|
||||
|
||||
|
||||
%apply wxRect& { wxRect* };
|
||||
|
||||
|
||||
|
||||
%typemap(in) wxPoint2D& (wxPoint2D temp) {
|
||||
$1 = &temp;
|
||||
if ( ! wxPoint2D_helper($input, &$1)) SWIG_fail;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user