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

@@ -5,19 +5,22 @@
#
# Author: Robin Dunn
#
# Created: 8/8/98
# Created: 8-Aug-1998
# RCS-ID: $Id$
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
import __version__
__version__ = __version__.wxVERSION_STRING
__version__ = __version__.VERSION_STRING
# Ensure the main extension module is loaded, in case the add-on modules
# (such as utils,) are used standalone.
import wxc
# Load the package namespace with the core classes and such
from wx.core import *
# wx.core has a 'wx' symbol for internal use. That's kinda silly for
# this namespace so get rid of it.
del wx
#----------------------------------------------------------------------------

View File

@@ -1,12 +1,12 @@
# This file was generated by setup.py...
wxVERSION_STRING = '2.5.1.0p1'
wxMAJOR_VERSION = 2
wxMINOR_VERSION = 5
wxRELEASE_VERSION = 1
wxSUBREL_VERSION = 0
VERSION_STRING = '2.5.1.0p3'
MAJOR_VERSION = 2
MINOR_VERSION = 5
RELEASE_VERSION = 1
SUBREL_VERSION = 0
wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_VERSION,
wxSUBREL_VERSION, 'p1')
VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION,
SUBREL_VERSION, 'p3')
wxRELEASE_NUMBER = wxRELEASE_VERSION # for compatibility
RELEASE_NUMBER = RELEASE_VERSION # for compatibility

68
wxPython/src/_accel.i Normal file
View File

@@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _accel.i
// Purpose: SWIG interface for wxAcceleratorTable
//
// Author: Robin Dunn
//
// Created: 03-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%typemap(in) (int n, const wxAcceleratorEntry* entries) {
$2 = wxAcceleratorEntry_LIST_helper($input);
if ($2) $1 = PyList_Size($input);
else $1 = 0;
}
%typemap(freearg) wxAcceleratorEntry* entries {
delete [] $1;
}
//---------------------------------------------------------------------------
%newgroup;
class wxAcceleratorEntry {
public:
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0, wxMenuItem *item = NULL);
~wxAcceleratorEntry();
void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL);
void SetMenuItem(wxMenuItem *item);
wxMenuItem *GetMenuItem() const;
int GetFlags();
int GetKeyCode();
int GetCommand();
};
class wxAcceleratorTable : public wxObject {
public:
// Can also accept a list of 3-tuples
wxAcceleratorTable(int n, const wxAcceleratorEntry* entries);
~wxAcceleratorTable();
bool Ok() const;
};
%immutable;
// See also wxPy_ReinitStockObjects in helpers.cpp
const wxAcceleratorTable wxNullAcceleratorTable;
%mutable;
wxAcceleratorEntry *wxGetAccelFromString(const wxString& label);
//---------------------------------------------------------------------------

252
wxPython/src/_app.i Normal file
View File

@@ -0,0 +1,252 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _app.i
// Purpose: SWIG interface for wxApp
//
// Author: Robin Dunn
//
// Created: 9-Aug-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
// TODOs:
//
// 1. Provide another app object that allows FilterEvent to be overloaded.
// 2. Wrap wxAppTraits and allow wxApp::CreateTraits to be overloaded.
//
//---------------------------------------------------------------------------
%newgroup;
%{
%}
enum {
wxPYAPP_ASSERT_SUPPRESS = 1,
wxPYAPP_ASSERT_EXCEPTION = 2,
wxPYAPP_ASSERT_DIALOG = 4,
wxPYAPP_ASSERT_LOG = 8
};
enum
{
wxPRINT_WINDOWS = 1,
wxPRINT_POSTSCRIPT = 2
};
class wxPyApp : public wxEvtHandler {
public:
%addtofunc wxPyApp
"self._setCallbackInfo(self, PyApp)
self._setOORInfo(self)";
%extend {
wxPyApp() {
wxPythonApp = new wxPyApp();
return wxPythonApp;
}
}
~wxPyApp();
void _setCallbackInfo(PyObject* self, PyObject* _class);
// set/get the application name
wxString GetAppName() const;
void SetAppName(const wxString& name);
// set/get the app class name
wxString GetClassName() const;
void SetClassName(const wxString& name);
// set/get the vendor name
const wxString& GetVendorName() const;
void SetVendorName(const wxString& name);
// create the app traits object to which we delegate for everything which
// either should be configurable by the user (then he can change the
// default behaviour simply by overriding CreateTraits() and returning his
// own traits object) or which is GUI/console dependent as then wxAppTraits
// allows us to abstract the differences behind the common fa<EFBFBD>ade
wxAppTraits *GetTraits();
// process all events in the wxPendingEvents list -- it is necessary to
// call this function to process posted events. This happens during each
// event loop iteration.
virtual void ProcessPendingEvents();
// process all currently pending events right now
//
// it is an error to call Yield() recursively unless the value of
// onlyIfNeeded is TRUE
//
// WARNING: this function is dangerous as it can lead to unexpected
// reentrancies (i.e. when called from an event handler it
// may result in calling the same event handler again), use
// with _extreme_ care or, better, don't use at all!
virtual bool Yield(bool onlyIfNeeded = false);
// make sure that idle events are sent again
virtual void WakeUpIdle();
// execute the main GUI loop, the function returns when the loop ends
virtual int MainLoop();
// exit the main loop thus terminating the application
virtual void Exit();
// exit the main GUI loop during the next iteration (i.e. it does not
// stop the program immediately!)
virtual void ExitMainLoop();
// returns TRUE if there are unprocessed events in the event queue
virtual bool Pending();
// process the first event in the event queue (blocks until an event
// apperas if there are none currently)
virtual bool Dispatch();
// this virtual function is called in the GUI mode when the application
// becomes idle and normally just sends wxIdleEvent to all interested
// parties
//
// it should return TRUE if more idle events are needed, FALSE if not
virtual bool ProcessIdle() ;
// Send idle event to window and all subwindows
// Returns TRUE if more idle time is requested.
virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
// Perform standard OnIdle behaviour: call from port's OnIdle
void OnIdle(wxIdleEvent& event);
// return TRUE if our app has focus
virtual bool IsActive() const;
// set the "main" top level window
void SetTopWindow(wxWindow *win);
// return the "main" top level window (if it hadn't been set previously
// with SetTopWindow(), will return just some top level window and, if
// there are none, will return NULL)
virtual wxWindow *GetTopWindow() const;
// control the exit behaviour: by default, the program will exit the
// main loop (and so, usually, terminate) when the last top-level
// program window is deleted. Beware that if you disable this behaviour
// (with SetExitOnFrameDelete(FALSE)), you'll have to call
// ExitMainLoop() explicitly from somewhere.
void SetExitOnFrameDelete(bool flag);
bool GetExitOnFrameDelete() const;
#if 0
// Get display mode that is used use. This is only used in framebuffer
// wxWin ports (such as wxMGL).
virtual wxVideoMode GetDisplayMode() const;
// Set display mode to use. This is only used in framebuffer wxWin
// ports (such as wxMGL). This method should be called from
// wxApp::OnInitGui
virtual bool SetDisplayMode(const wxVideoMode& info);
#endif
// set use of best visual flag (see below)
void SetUseBestVisual( bool flag );
bool GetUseBestVisual() const;
// set/get printing mode: see wxPRINT_XXX constants.
//
// default behaviour is the normal one for Unix: always use PostScript
// printing.
virtual void SetPrintMode(int mode);
int GetPrintMode() const;
// Get/Set OnAssert behaviour. The following flags may be or'd together:
//
// wxPYAPP_ASSERT_SUPPRESS Don't do anything
// wxPYAPP_ASSERT_EXCEPTION Turn it into a Python exception if possible
// wxPYAPP_ASSERT_DIALOG Display a message dialog
// wxPYAPP_ASSERT_LOG Write the assertion info to the wxLog
int GetAssertMode();
void SetAssertMode(int mode);
static bool GetMacSupportPCMenuShortcuts();
static long GetMacAboutMenuItemId();
static long GetMacPreferencesMenuItemId();
static long GetMacExitMenuItemId();
static wxString GetMacHelpMenuTitleName();
static void SetMacSupportPCMenuShortcuts(bool val);
static void SetMacAboutMenuItemId(long val);
static void SetMacPreferencesMenuItemId(long val);
static void SetMacExitMenuItemId(long val);
static void SetMacHelpMenuTitleName(const wxString& val);
// For internal use only
void _BootstrapApp();
#ifdef __WXMSW__
// returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
// wasn't found at all
static int GetComCtl32Version();
#else
%extend {
static int GetComCtl32Version()
{ PyErr_SetNone(PyExc_NotImplementedError); return 0; }
}
#endif
};
//---------------------------------------------------------------------------
%newgroup;
// Force an exit from main loop
void wxExit();
// Yield to other apps/messages
bool wxYield();
bool wxYieldIfNeeded();
bool wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=FALSE);
// Cause the message queue to become empty again
void wxWakeUpIdle();
// Send an event to be processed later
void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
// This is used to cleanup after wxWindows when Python shuts down.
%inline %{
void wxApp_CleanUp() {
__wxPyCleanup();
}
%}
// Return a reference to the current wxApp object.
%inline %{
wxPyApp* wxGetApp() {
return (wxPyApp*)wxTheApp;
}
%}
//---------------------------------------------------------------------------
// Include some extra wxApp related python code here
%pythoncode "_app_ex.py"
//---------------------------------------------------------------------------

183
wxPython/src/_app_ex.py Normal file
View File

@@ -0,0 +1,183 @@
#----------------------------------------------------------------------
class PyOnDemandOutputWindow:
def __init__(self, title = "wxPython: stdout/stderr"):
self.frame = None
self.title = title
self.parent = None
def SetParent(self, parent):
self.parent = parent
def OnCloseWindow(self, event):
if self.frame != None:
self.frame.Destroy()
self.frame = None
self.text = None
# These methods provide the file-like output behaviour.
def write(self, str):
if not wx.Thread_IsMain():
# Aquire the GUI mutex before making GUI calls. Mutex is released
# when locker is deleted at the end of this function.
locker = wx.MutexGuiLocker()
if not self.frame:
self.frame = wx.Frame(self.parent, -1, self.title,
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.text = wxTextCtrl(self.frame, -1, "",
style = wx.TE_MULTILINE | wx.TE_READONLY)
self.frame.SetSize((450, 300))
self.frame.Show(True)
EVT_CLOSE(self.frame, self.OnCloseWindow)
self.text.AppendText(str)
def close(self):
if self.frame != None:
if not wx.Thread_IsMain():
locker = wx.MutexGuiLocker()
self.frame.Close()
#----------------------------------------------------------------------
# The main application class. Derive from this and implement an OnInit
# method that creates a frame and then calls self.SetTopWindow(frame)
_defRedirect = (wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__')
class App(wx.PyApp):
outputWindowClass = PyOnDemandOutputWindow
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False):
wx.PyApp.__init__(self)
if wx.Platform == "__WXMAC__":
try:
import MacOS
if not MacOS.WMAvailable():
print """\
This program needs access to the screen. Please run with 'pythonw',
not 'python', and only when you are logged in on the main display of
your Mac."""
_sys.exit(1)
except:
pass
# This has to be done before OnInit
self.SetUseBestVisual(useBestVisual)
# Set the default handler for SIGINT. This fixes a problem
# where if Ctrl-C is pressed in the console that started this
# app then it will not appear to do anything, (not even send
# KeyboardInterrupt???) but will later segfault on exit. By
# setting the default handler then the app will exit, as
# expected (depending on platform.)
try:
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
except:
pass
# Save and redirect the stdio to a window?
self.stdioWin = None
self.saveStdio = (_sys.stdout, _sys.stderr)
if redirect:
self.RedirectStdio(filename)
# This finishes the initialization of wxWindows and then calls
# the OnInit that should be present in the derived class
self._BootstrapApp()
def __del__(self):
try:
self.RestoreStdio() # Just in case the MainLoop was overridden
except:
pass
def SetTopWindow(self, frame):
if self.stdioWin:
self.stdioWin.SetParent(frame)
wx.PyApp.SetTopWindow(self, frame)
def MainLoop(self):
wx.PyApp.MainLoop(self)
self.RestoreStdio()
def RedirectStdio(self, filename):
if filename:
_sys.stdout = _sys.stderr = open(filename, 'a')
else:
self.stdioWin = self.outputWindowClass()
_sys.stdout = _sys.stderr = self.stdioWin
def RestoreStdio(self):
_sys.stdout, _sys.stderr = self.saveStdio
# change from wxPyApp_ to wxApp_
App_GetMacSupportPCMenuShortcuts = _core.PyApp_GetMacSupportPCMenuShortcuts
App_GetMacAboutMenuItemId = _core.PyApp_GetMacAboutMenuItemId
App_GetMacPreferencesMenuItemId = _core.PyApp_GetMacPreferencesMenuItemId
App_GetMacExitMenuItemId = _core.PyApp_GetMacExitMenuItemId
App_GetMacHelpMenuTitleName = _core.PyApp_GetMacHelpMenuTitleName
App_SetMacSupportPCMenuShortcuts = _core.PyApp_SetMacSupportPCMenuShortcuts
App_SetMacAboutMenuItemId = _core.PyApp_SetMacAboutMenuItemId
App_SetMacPreferencesMenuItemId = _core.PyApp_SetMacPreferencesMenuItemId
App_SetMacExitMenuItemId = _core.PyApp_SetMacExitMenuItemId
App_SetMacHelpMenuTitleName = _core.PyApp_SetMacHelpMenuTitleName
App_GetComCtl32Version = _core.PyApp_GetComCtl32Version
#----------------------------------------------------------------------------
class PySimpleApp(wx.App):
def __init__(self, redirect=False, filename=None):
wx.App.__init__(self, redirect, filename)
def OnInit(self):
wx.InitAllImageHandlers()
return True
class PyWidgetTester(wx.App):
def __init__(self, size = (250, 100)):
self.size = size
wx.App.__init__(self, 0)
def OnInit(self):
self.frame = wxFrame(None, -1, "Widget Tester", pos=(0,0), size=self.size)
self.SetTopWindow(self.frame)
return True
def SetWidget(self, widgetClass, *args):
w = widgetClass(self.frame, *args)
self.frame.Show(True)
#----------------------------------------------------------------------------
# DO NOT hold any other references to this object. This is how we
# know when to cleanup system resources that wxWin is holding. When
# the sys module is unloaded, the refcount on sys.__wxPythonCleanup
# goes to zero and it calls the wxApp_CleanUp function.
class __wxPyCleanup:
def __init__(self):
self.cleanup = _core.App_CleanUp
def __del__(self):
self.cleanup()
_sys.__wxPythonCleanup = __wxPyCleanup()
## # another possible solution, but it gets called too early...
## if sys.version[0] == '2':
## import atexit
## atexit.register(_core.wxApp_CleanUp)
## else:
## sys.exitfunc = _core.wxApp_CleanUp
#----------------------------------------------------------------------------

145
wxPython/src/_artprov.i Normal file
View File

@@ -0,0 +1,145 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _artprov.i
// Purpose: SWIG interface stuff for wxArtProvider
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/artprov.h>
%}
//---------------------------------------------------------------------------
// Art clients
MAKE_CONST_WXSTRING(ART_TOOLBAR);
MAKE_CONST_WXSTRING(ART_MENU);
MAKE_CONST_WXSTRING(ART_FRAME_ICON);
MAKE_CONST_WXSTRING(ART_CMN_DIALOG);
MAKE_CONST_WXSTRING(ART_HELP_BROWSER);
MAKE_CONST_WXSTRING(ART_MESSAGE_BOX);
MAKE_CONST_WXSTRING(ART_OTHER);
// Art IDs
MAKE_CONST_WXSTRING(ART_ADD_BOOKMARK);
MAKE_CONST_WXSTRING(ART_DEL_BOOKMARK);
MAKE_CONST_WXSTRING(ART_HELP_SIDE_PANEL);
MAKE_CONST_WXSTRING(ART_HELP_SETTINGS);
MAKE_CONST_WXSTRING(ART_HELP_BOOK);
MAKE_CONST_WXSTRING(ART_HELP_FOLDER);
MAKE_CONST_WXSTRING(ART_HELP_PAGE);
MAKE_CONST_WXSTRING(ART_GO_BACK);
MAKE_CONST_WXSTRING(ART_GO_FORWARD);
MAKE_CONST_WXSTRING(ART_GO_UP);
MAKE_CONST_WXSTRING(ART_GO_DOWN);
MAKE_CONST_WXSTRING(ART_GO_TO_PARENT);
MAKE_CONST_WXSTRING(ART_GO_HOME);
MAKE_CONST_WXSTRING(ART_FILE_OPEN);
MAKE_CONST_WXSTRING(ART_PRINT);
MAKE_CONST_WXSTRING(ART_HELP);
MAKE_CONST_WXSTRING(ART_TIP);
MAKE_CONST_WXSTRING(ART_REPORT_VIEW);
MAKE_CONST_WXSTRING(ART_LIST_VIEW);
MAKE_CONST_WXSTRING(ART_NEW_DIR);
MAKE_CONST_WXSTRING(ART_FOLDER);
MAKE_CONST_WXSTRING(ART_GO_DIR_UP);
MAKE_CONST_WXSTRING(ART_EXECUTABLE_FILE);
MAKE_CONST_WXSTRING(ART_NORMAL_FILE);
MAKE_CONST_WXSTRING(ART_TICK_MARK);
MAKE_CONST_WXSTRING(ART_CROSS_MARK);
MAKE_CONST_WXSTRING(ART_ERROR);
MAKE_CONST_WXSTRING(ART_QUESTION);
MAKE_CONST_WXSTRING(ART_WARNING);
MAKE_CONST_WXSTRING(ART_INFORMATION);
MAKE_CONST_WXSTRING(ART_MISSING_IMAGE);
//---------------------------------------------------------------------------
%{ // Python aware wxArtProvider
class wxPyArtProvider : public wxArtProvider {
public:
virtual wxBitmap CreateBitmap(const wxArtID& id,
const wxArtClient& client,
const wxSize& size) {
wxBitmap rval = wxNullBitmap;
wxPyBeginBlockThreads();
if ((wxPyCBH_findCallback(m_myInst, "CreateBitmap"))) {
PyObject* so = wxPyConstructObject((void*)&size, wxT("wxSize"), 0);
PyObject* ro;
wxBitmap* ptr;
PyObject* s1, *s2;
s1 = wx2PyString(id);
s2 = wx2PyString(client);
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOO)", s1, s2, so));
Py_DECREF(so);
Py_DECREF(s1);
Py_DECREF(s2);
if (ro) {
if (wxPyConvertSwigPtr(ro, (void**)&ptr, wxT("wxBitmap")))
rval = *ptr;
Py_DECREF(ro);
}
}
wxPyEndBlockThreads();
return rval;
}
PYPRIVATE;
};
%}
// The one for SWIG to see
%name(ArtProvider) class wxPyArtProvider /*: public wxObject*/
{
public:
%addtofunc wxPyArtProvider "self._setCallbackInfo(self, ArtProvider)"
wxPyArtProvider();
~wxPyArtProvider();
void _setCallbackInfo(PyObject* self, PyObject* _class);
// Add new provider to the top of providers stack.
static void PushProvider(wxPyArtProvider *provider);
// Remove latest added provider and delete it.
static bool PopProvider();
// Remove provider. The provider must have been added previously!
// The provider is _not_ deleted.
static bool RemoveProvider(wxPyArtProvider *provider);
// Query the providers for bitmap with given ID and return it. Return
// wxNullBitmap if no provider provides it.
static wxBitmap GetBitmap(const wxString& id,
const wxString& client = wxPyART_OTHER,
const wxSize& size = wxDefaultSize);
// Query the providers for icon with given ID and return it. Return
// wxNullIcon if no provider provides it.
static wxIcon GetIcon(const wxString& id,
const wxString& client = wxPyART_OTHER,
const wxSize& size = wxDefaultSize);
};
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxArtProvider", "wxPyArtProvider");
%}
//---------------------------------------------------------------------------

150
wxPython/src/_bitmap.i Normal file
View File

@@ -0,0 +1,150 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _bitmap.i
// Purpose: SWIG interface for wxBitmap and wxMask
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/image.h>
static char** ConvertListOfStrings(PyObject* listOfStrings) {
char** cArray = NULL;
int count;
if (!PyList_Check(listOfStrings)) {
PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
return NULL;
}
count = PyList_Size(listOfStrings);
cArray = new char*[count];
for(int x=0; x<count; x++) {
// TODO: Need some validation and error checking here
cArray[x] = PyString_AsString(PyList_GET_ITEM(listOfStrings, x));
}
return cArray;
}
%}
//---------------------------------------------------------------------------
// TODO: When the API stabalizes and is available on other platforms, add
// wrappers for the new wxBitmap, wxRawBitmap, wxDIB stuff...
class wxBitmap : public wxGDIObject
{
public:
wxBitmap(const wxString& name, wxBitmapType type=wxBITMAP_TYPE_ANY);
~wxBitmap();
// alternate constructors
%name(EmptyBitmap) wxBitmap(int width, int height, int depth=-1);
%name(BitmapFromIcon) wxBitmap(const wxIcon& icon);
%name(BitmapFromImage) wxBitmap(const wxImage& image, int depth=-1);
%extend {
%name(BitmapFromXPMData) wxBitmap(PyObject* listOfStrings) {
char** cArray = NULL;
wxBitmap* bmp;
cArray = ConvertListOfStrings(listOfStrings);
if (! cArray)
return NULL;
bmp = new wxBitmap(cArray);
delete [] cArray;
return bmp;
}
%name(BitmapFromBits) wxBitmap(PyObject* bits, int width, int height, int depth = 1 ) {
char* buf;
int length;
PyString_AsStringAndSize(bits, &buf, &length);
return new wxBitmap(buf, width, height, depth);
}
}
#ifdef __WXMSW__
void SetPalette(wxPalette& palette);
#endif
// wxGDIImage methods
#ifdef __WXMSW__
long GetHandle();
void SetHandle(long handle);
#endif
bool Ok();
int GetWidth();
int GetHeight();
int GetDepth();
virtual wxImage ConvertToImage() const;
virtual wxMask* GetMask() const;
virtual void SetMask(wxMask* mask);
%extend {
void SetMaskColour(const wxColour& colour) {
wxMask *mask = new wxMask(*self, colour);
self->SetMask(mask);
}
}
// def SetMaskColour(self, colour):
// mask = wxMaskColour(self, colour)
// self.SetMask(mask)
virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
virtual bool SaveFile(const wxString &name, wxBitmapType type,
wxPalette *palette = (wxPalette *)NULL);
virtual bool LoadFile(const wxString &name, wxBitmapType type);
#if wxUSE_PALETTE
virtual wxPalette *GetPalette() const;
virtual void SetPalette(const wxPalette& palette);
#endif
// copies the contents and mask of the given (colour) icon to the bitmap
virtual bool CopyFromIcon(const wxIcon& icon);
virtual void SetHeight(int height);
virtual void SetWidth(int width);
virtual void SetDepth(int depth);
#ifdef __WXMSW__
bool CopyFromCursor(const wxCursor& cursor);
int GetQuality();
void SetQuality(int q);
#endif
%pythoncode { def __nonzero__(self): return self.Ok() }
};
//---------------------------------------------------------------------------
class wxMask : public wxObject {
public:
wxMask(const wxBitmap& bitmap);
%name(MaskColour) wxMask(const wxBitmap& bitmap, const wxColour& colour);
//~wxMask();
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

42
wxPython/src/_brush.i Normal file
View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _brush.i
// Purpose: SWIG interface for wxPen
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
class wxBrush : public wxGDIObject {
public:
wxBrush(const wxColour& colour, int style=wxSOLID);
~wxBrush();
virtual void SetColour(const wxColour& col);
virtual void SetStyle(int style);
virtual void SetStipple(const wxBitmap& stipple);
wxColour GetColour() const;
int GetStyle() const;
wxBitmap *GetStipple() const;
bool Ok();
#ifdef __WXMAC__
short GetMacTheme();
void SetMacTheme(short macThemeBrush);
#endif
%pythoncode { def __nonzero__(self): return self.Ok() }
};
//---------------------------------------------------------------------------

151
wxPython/src/_button.i Normal file
View File

@@ -0,0 +1,151 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _button.i
// Purpose: SWIG interface defs for wxButton, wxBitmapButton
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup;
%{
DECLARE_DEF_STRING(ButtonNameStr);
%}
enum {
wxBU_LEFT,
wxBU_TOP,
wxBU_RIGHT,
wxBU_BOTTOM,
wxBU_EXACTFIT,
wxBU_AUTODRAW,
};
//---------------------------------------------------------------------------
// A button is a control that contains a text string, and is one of the most
// common elements of a GUI. It may be placed on a dialog box or panel, or
// indeed almost any other window.
//
// Styles
// wxBU_LEFT: Left-justifies the label. WIN32 only.
// wxBU_TOP: Aligns the label to the top of the button. WIN32 only.
// wxBU_RIGHT: Right-justifies the bitmap label. WIN32 only.
// wxBU_BOTTOM: Aligns the label to the bottom of the button. WIN32 only.
// wxBU_EXACTFIT: Creates the button as small as possible instead of making
// it of the standard size (which is the default behaviour.)
//
// Events
// EVT_BUTTON(win,id,func):
// Sent when the button is clicked.
//
class wxButton : public wxControl
{
public:
%addtofunc wxButton "self._setOORInfo(self)"
%addtofunc wxButton() ""
// Constructor, creating and showing a button.
//
// parent: Parent window. Must not be None.
// id: Button identifier. A value of -1 indicates a default value.
// label: The text to be displayed on the button.
// pos: The button position on it's parent.
// size: Button size. If the default size (-1, -1) is specified then the
// button is sized appropriately for the text.
// style: Window style. See wxButton.
// validator: Window validator.
// name: Window name.
wxButton(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr);
// Default constructor
%name(PreButton)wxButton();
// Button creation function for two-step creation.
bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr);
// This sets the button to be the default item for the panel or dialog box.
//
// Under Windows, only dialog box buttons respond to this function. As
// normal under Windows and Motif, pressing return causes the default
// button to be depressed when the return key is pressed. See also
// wxWindow.SetFocus which sets the keyboard focus for windows and text
// panel items, and wxPanel.SetDefaultItem.
void SetDefault();
#ifdef __WXMSW__
// show the image in the button in addition to the label
void SetImageLabel(const wxBitmap& bitmap);
// set the margins around the image
void SetImageMargins(wxCoord x, wxCoord y);
#endif
// returns the default button size for this platform
static wxSize GetDefaultSize();
};
//---------------------------------------------------------------------------
class wxBitmapButton : public wxButton
{
public:
%addtofunc wxBitmapButton "self._setOORInfo(self)"
%addtofunc wxBitmapButton() ""
wxBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr);
%name(PreBitmapButton)wxBitmapButton();
bool Create(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyButtonNameStr);
wxBitmap GetBitmapLabel();
wxBitmap GetBitmapDisabled();
wxBitmap GetBitmapFocus();
wxBitmap GetBitmapSelected();
void SetBitmapDisabled(const wxBitmap& bitmap);
void SetBitmapFocus(const wxBitmap& bitmap);
void SetBitmapSelected(const wxBitmap& bitmap);
void SetBitmapLabel(const wxBitmap& bitmap);
void SetMargins(int x, int y);
int GetMarginX() const;
int GetMarginY() const;
};
//---------------------------------------------------------------------------

View File

@@ -0,0 +1,26 @@
// A bunch of %rename directives generated by ./distrib/build_renamers.py
// in order to remove the wx prefix from all global scope names.
#ifndef SWIGXML
%rename(CAL_SUNDAY_FIRST) wxCAL_SUNDAY_FIRST;
%rename(CAL_MONDAY_FIRST) wxCAL_MONDAY_FIRST;
%rename(CAL_SHOW_HOLIDAYS) wxCAL_SHOW_HOLIDAYS;
%rename(CAL_NO_YEAR_CHANGE) wxCAL_NO_YEAR_CHANGE;
%rename(CAL_NO_MONTH_CHANGE) wxCAL_NO_MONTH_CHANGE;
%rename(CAL_SEQUENTIAL_MONTH_SELECTION) wxCAL_SEQUENTIAL_MONTH_SELECTION;
%rename(CAL_SHOW_SURROUNDING_WEEKS) wxCAL_SHOW_SURROUNDING_WEEKS;
%rename(CAL_HITTEST_NOWHERE) wxCAL_HITTEST_NOWHERE;
%rename(CAL_HITTEST_HEADER) wxCAL_HITTEST_HEADER;
%rename(CAL_HITTEST_DAY) wxCAL_HITTEST_DAY;
%rename(CAL_HITTEST_INCMONTH) wxCAL_HITTEST_INCMONTH;
%rename(CAL_HITTEST_DECMONTH) wxCAL_HITTEST_DECMONTH;
%rename(CAL_HITTEST_SURROUNDING_WEEK) wxCAL_HITTEST_SURROUNDING_WEEK;
%rename(CAL_BORDER_NONE) wxCAL_BORDER_NONE;
%rename(CAL_BORDER_SQUARE) wxCAL_BORDER_SQUARE;
%rename(CAL_BORDER_ROUND) wxCAL_BORDER_ROUND;
%rename(CalendarDateAttr) wxCalendarDateAttr;
%rename(CalendarEvent) wxCalendarEvent;
%rename(CalendarCtrl) wxCalendarCtrl;
#endif

View File

@@ -1,5 +0,0 @@
# Stuff these names into the wx namespace so wxPyConstructObject can find them
wx.wxCalendarEventPtr = wxCalendarEventPtr
wx.wxCalendarCtrlPtr = wxCalendarCtrlPtr

80
wxPython/src/_checkbox.i Normal file
View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _checkbox.i
// Purpose: SWIG interface defs for wxCheckBox
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup;
%{
DECLARE_DEF_STRING(CheckBoxNameStr);
%}
enum {
// Determine whether to use a 3-state or 2-state
// checkbox. 3-state enables to differentiate
// between 'unchecked', 'checked' and 'undetermined'.
wxCHK_2STATE,
wxCHK_3STATE,
// If this style is set the user can set the checkbox to the
// undetermined state. If not set the undetermined set can only
// be set programmatically.
// This style can only be used with 3 state checkboxes.
wxCHK_ALLOW_3RD_STATE_FOR_USER,
};
enum wxCheckBoxState
{
wxCHK_UNCHECKED,
wxCHK_CHECKED,
wxCHK_UNDETERMINED /* 3-state checkbox only */
};
//---------------------------------------------------------------------------
class wxCheckBox : public wxControl
{
public:
%addtofunc wxCheckBox "self._setOORInfo(self)"
%addtofunc wxCheckBox() ""
wxCheckBox(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyCheckBoxNameStr);
%name(PreCheckBox)wxCheckBox();
bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyCheckBoxNameStr);
bool GetValue();
bool IsChecked();
void SetValue(const bool state);
wxCheckBoxState Get3StateValue() const;
void Set3StateValue(wxCheckBoxState state);
bool Is3State() const;
bool Is3rdStateAllowedForUser() const;
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

59
wxPython/src/_choice.i Normal file
View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _choice.i
// Purpose: SWIG interface defs for wxChoice
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(ChoiceNameStr);
%}
//---------------------------------------------------------------------------
%newgroup;
class wxChoice : public wxControlWithItems
{
public:
%addtofunc wxChoice "self._setOORInfo(self)"
%addtofunc wxChoice() ""
wxChoice(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices=0, wxString* choices_array=NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyChoiceNameStr);
%name(PreChoice)wxChoice();
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices=0, wxString* choices_array=NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyChoiceNameStr);
int GetColumns();
void SetColumns(const int n = 1);
void SetSelection(const int n);
void SetStringSelection(const wxString& string);
void SetString(int n, const wxString& s);
%pragma(python) addtoclass = "
Select = SetSelection
"
};
//---------------------------------------------------------------------------

97
wxPython/src/_clipbrd.i Normal file
View File

@@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _clipbrd.i
// Purpose: SWIG definitions for the Clipboard
//
// Author: Robin Dunn
//
// Created: 31-October-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
%}
// wxClipboard represents the system clipboard. Normally, you should use
// wxTheClipboard which is a global pointer to the (unique) clipboard.
//
// Clipboard can be used to copy data to/paste data from. It works together
// with wxDataObject.
class wxClipboard : public wxObject {
public:
wxClipboard();
~wxClipboard();
// open the clipboard before Add/SetData() and GetData()
virtual bool Open();
// close the clipboard after Add/SetData() and GetData()
virtual void Close();
// query whether the clipboard is opened
virtual bool IsOpened() const;
// add to the clipboard data
//
// NB: the clipboard owns the pointer and will delete it, so data must be
// allocated on the heap
virtual bool AddData( wxDataObject *data );
// set the clipboard data, this is the same as Clear() followed by
// AddData()
virtual bool SetData( wxDataObject *data );
// ask if data in correct format is available
virtual bool IsSupported( const wxDataFormat& format );
// fill data with data on the clipboard (if available)
virtual bool GetData( wxDataObject& data );
// clears wxTheClipboard and the system's clipboard if possible
virtual void Clear();
// flushes the clipboard: this means that the data which is currently on
// clipboard will stay available even after the application exits (possibly
// eating memory), otherwise the clipboard will be emptied on exit
virtual bool Flush();
// X11 has two clipboards which get selected by this call. Empty on MSW.
virtual void UsePrimarySelection( bool primary = FALSE );
};
%immutable;
wxClipboard* const wxTheClipboard;
%mutable;
//---------------------------------------------------------------------------
// helpful class for opening the clipboard and automatically closing it when
// the locker is destroyed
class wxClipboardLocker
{
public:
wxClipboardLocker(wxClipboard *clipboard = NULL);
~wxClipboardLocker();
//bool operator!() const;
%extend {
bool __nonzero__() { return !!(*self); }
}
};
//---------------------------------------------------------------------------

View File

@@ -1,56 +1,34 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cmndlgs.i
// Purpose: SWIG definitions for the Common Dialog Classes
// Name: _cmndlgs.i
// Purpose: SWIG interface for the "Common Dialog" classes
//
// Author: Robin Dunn
//
// Created: 7/25/98
// Created: 25-July-1998
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module cmndlgs
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include "helpers.h"
#include <wx/colordlg.h>
#include <wx/dirdlg.h>
#include <wx/fontdlg.h>
#include <wx/progdlg.h>
#include <wx/fdrepdlg.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import gdi.i
%import windows.i
%import events.i
%import frames.i
%pragma(python) code = "import wx"
//----------------------------------------------------------------------
%{
// Put some wx default wxChar* values into wxStrings.
DECLARE_DEF_STRING(FileSelectorPromptStr);
DECLARE_DEF_STRING(DirSelectorPromptStr);
DECLARE_DEF_STRING(DirDialogNameStr);
DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
DECLARE_DEF_STRING(GetTextFromUserPromptStr);
DECLARE_DEF_STRING(MessageBoxCaptionStr);
static const wxString wxPyEmptyString(wxT(""));
%}
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxColourData : public wxObject {
public:
@@ -68,19 +46,21 @@ public:
class wxColourDialog : public wxDialog {
public:
wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
%addtofunc wxColourDialog "self._setOORInfo(self)"
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
wxColourData& GetColourData();
int ShowModal();
};
//----------------------------------------------------------------------
//--------------------------------------------------------------------------------
class wxDirDialog : public wxDialog {
public:
%addtofunc wxDirDialog "self._setOORInfo(self)"
wxDirDialog(wxWindow* parent,
const wxString& message = wxPyDirSelectorPromptStr,
const wxString& defaultPath = wxPyEmptyString,
@@ -89,7 +69,6 @@ public:
const wxSize& size = wxDefaultSize,
const wxString& name = wxPyDirDialogNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
wxString GetPath();
wxString GetMessage();
@@ -100,10 +79,12 @@ public:
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxFileDialog : public wxDialog {
public:
%addtofunc wxFileDialog "self._setOORInfo(self)"
wxFileDialog(wxWindow* parent,
const wxString& message = wxPyFileSelectorPromptStr,
const wxString& defaultDir = wxPyEmptyString,
@@ -112,7 +93,6 @@ public:
long style = 0,
const wxPoint& pos = wxDefaultPosition);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void SetMessage(const wxString& message);
void SetPath(const wxString& path);
@@ -130,7 +110,7 @@ public:
long GetStyle() const;
int GetFilterIndex() const;
%addmethods {
%extend {
PyObject* GetFilenames() {
wxArrayString arr;
self->GetFilenames(arr);
@@ -167,13 +147,15 @@ public:
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
enum { wxCHOICEDLG_STYLE };
class wxMultiChoiceDialog : public wxDialog
{
public:
%addtofunc wxMultiChoiceDialog "self._setOORInfo(self)"
wxMultiChoiceDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
@@ -181,12 +163,10 @@ public:
long style = wxCHOICEDLG_STYLE,
const wxPoint& pos = wxDefaultPosition);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void SetSelections(const wxArrayInt& selections);
// wxArrayInt GetSelections() const;
%addmethods {
%extend {
PyObject* GetSelections() {
return wxArrayInt2PyList_helper(self->GetSelections());
}
@@ -194,25 +174,25 @@ public:
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxSingleChoiceDialog : public wxDialog {
public:
%addmethods {
// TODO: ignoring clientData for now...
%addtofunc wxSingleChoiceDialog "self._setOORInfo(self)"
%extend {
// TODO: ignoring clientData for now... FIX THIS
// SWIG is messing up the &/*'s for some reason.
wxSingleChoiceDialog(wxWindow* parent,
wxString* message,
wxString* caption,
int LCOUNT, wxString* choices,
const wxString& message,
const wxString& caption,
int choices, wxString* choices_array,
//char** clientData = NULL,
long style = wxCHOICEDLG_STYLE,
wxPoint* pos = &wxDefaultPosition) {
return new wxSingleChoiceDialog(parent, *message, *caption,
LCOUNT, choices, NULL, style, *pos);
const wxPoint& pos = wxDefaultPosition) {
return new wxSingleChoiceDialog(parent, message, caption,
choices, choices_array, NULL, style, pos);
}
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
}
int GetSelection();
@@ -222,10 +202,12 @@ public:
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxTextEntryDialog : public wxDialog {
public:
%addtofunc wxTextEntryDialog "self._setOORInfo(self)"
wxTextEntryDialog(wxWindow* parent,
const wxString& message,
const wxString& caption = wxPyGetTextFromUserPromptStr,
@@ -233,14 +215,12 @@ public:
long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
wxString GetValue();
void SetValue(const wxString& value);
int ShowModal();
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxFontData : public wxObject {
public:
@@ -265,44 +245,47 @@ public:
class wxFontDialog : public wxDialog {
public:
%addtofunc wxFontDialog "self._setOORInfo(self)"
wxFontDialog(wxWindow* parent, const wxFontData& data);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
wxFontData& GetFontData();
int ShowModal();
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxMessageDialog : public wxDialog {
public:
%addtofunc wxMessageDialog "self._setOORInfo(self)"
wxMessageDialog(wxWindow* parent,
const wxString& message,
const wxString& caption = wxPyMessageBoxCaptionStr,
long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
int ShowModal();
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxProgressDialog : public wxFrame {
public:
%addtofunc wxProgressDialog "self._setOORInfo(self)"
wxProgressDialog(const wxString& title,
const wxString& message,
int maximum = 100,
wxWindow* parent = NULL,
int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
bool Update(int value, const wxString& newmsg = wxPyEmptyString);
void Resume();
}
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
enum wxFindReplaceFlags
{
@@ -332,32 +315,30 @@ enum wxFindReplaceDialogStyles
wxFR_NOWHOLEWORD = 8
};
enum {
wxEVT_COMMAND_FIND,
wxEVT_COMMAND_FIND_NEXT,
wxEVT_COMMAND_FIND_REPLACE,
wxEVT_COMMAND_FIND_REPLACE_ALL,
wxEVT_COMMAND_FIND_CLOSE,
};
%pragma(python) code = "
def EVT_COMMAND_FIND(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_FIND, func)
%constant wxEventType wxEVT_COMMAND_FIND;
%constant wxEventType wxEVT_COMMAND_FIND_NEXT;
%constant wxEventType wxEVT_COMMAND_FIND_REPLACE;
%constant wxEventType wxEVT_COMMAND_FIND_REPLACE_ALL;
%constant wxEventType wxEVT_COMMAND_FIND_CLOSE;
def EVT_COMMAND_FIND_NEXT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_FIND_NEXT, func)
def EVT_COMMAND_FIND_REPLACE(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE, func)
%pythoncode {
EVT_FIND = wx.PyEventBinder( wxEVT_COMMAND_FIND, 1 )
EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_COMMAND_FIND_NEXT, 1 )
EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE, 1 )
EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE_ALL, 1 )
EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_FIND_CLOSE, 1 )
def EVT_COMMAND_FIND_REPLACE_ALL(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE_ALL, func)
%# For backwards compatibility. Should they be removed?
EVT_COMMAND_FIND = EVT_FIND
EVT_COMMAND_FIND_NEXT = EVT_FIND_NEXT
EVT_COMMAND_FIND_REPLACE = EVT_FIND_REPLACE
EVT_COMMAND_FIND_REPLACE_ALL = EVT_FIND_REPLACE_ALL
EVT_COMMAND_FIND_CLOSE = EVT_FIND_CLOSE
}
def EVT_COMMAND_FIND_CLOSE(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_FIND_CLOSE, func)
"
class wxFindDialogEvent : public wxCommandEvent
{
@@ -391,22 +372,23 @@ public:
class wxFindReplaceDialog : public wxDialog {
public:
%addtofunc wxFindReplaceDialog "self._setOORInfo(self)"
%addtofunc wxFindReplaceDialog() ""
wxFindReplaceDialog(wxWindow *parent,
wxFindReplaceData *data,
const wxString &title,
int style = 0);
%name(wxPreFindReplaceDialog)wxFindReplaceDialog();
%name(PreFindReplaceDialog)wxFindReplaceDialog();
bool Create(wxWindow *parent,
wxFindReplaceData *data,
const wxString &title,
int style = 0);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
%pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)"
const wxFindReplaceData *GetData();
void SetData(wxFindReplaceData *data);
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

86
wxPython/src/_colour.i Normal file
View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _colour.i
// Purpose: SWIG interface for wxColour
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup;
%noautorepr wxColour;
class wxColour : public wxObject {
public:
wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
~wxColour();
%name(NamedColour) wxColour( const wxString& colorName);
%name(ColourRGB) wxColour( unsigned long colRGB );
unsigned char Red();
unsigned char Green();
unsigned char Blue();
bool Ok();
void Set(unsigned char red, unsigned char green, unsigned char blue);
%name(SetRBG) void Set(unsigned long colRGB);
bool operator==(const wxColour& colour) const;
bool operator != (const wxColour& colour) const;
%extend {
PyObject* Get() {
PyObject* rv = PyTuple_New(3);
int red = -1;
int green = -1;
int blue = -1;
if (self->Ok()) {
red = self->Red();
green = self->Green();
blue = self->Blue();
}
PyTuple_SetItem(rv, 0, PyInt_FromLong(red));
PyTuple_SetItem(rv, 1, PyInt_FromLong(green));
PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
return rv;
}
// bool __eq__(PyObject* obj) {
// wxColour tmp;
// wxColour* ptr = &tmp;
// if (obj == Py_None) return FALSE;
// wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
// if (! success) return FALSE;
// return *self == *ptr;
// }
// bool __ne__(PyObject* obj) {
// wxColour tmp;
// wxColour* ptr = &tmp;
// if (obj == Py_None) return TRUE;
// wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
// if (! success) return TRUE;
// return *self != *ptr;
// }
}
%pythoncode {
asTuple = Get
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxColour' + str(self.asTuple())
def __nonzero__(self): return self.Ok()
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
};
//---------------------------------------------------------------------------

74
wxPython/src/_combobox.i Normal file
View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _combobox.i
// Purpose: SWIG interface defs for wxComboBox
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(ComboBoxNameStr);
%}
//---------------------------------------------------------------------------
%newgroup;
#ifdef __WXMSW__
class wxComboBox : public wxChoice
#else
class wxComboBox : public wxControl, public wxItemContainer
#endif
{
public:
%addtofunc wxComboBox "self._setOORInfo(self)"
%addtofunc wxComboBox() ""
wxComboBox(wxWindow* parent, wxWindowID id,
const wxString& value = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices=0, wxString* choices_array=NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyComboBoxNameStr);
%name(PreComboBox)wxComboBox();
bool Create(wxWindow* parent, wxWindowID id,
const wxString& value = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices=0, wxString* choices_array=NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyComboBoxNameStr);
virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual void SetInsertionPoint(long pos);
virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value);
%name(SetMark) virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetInsertionPointEnd();
virtual void Remove(long from, long to);
};
//---------------------------------------------------------------------------

296
wxPython/src/_config.i Normal file
View File

@@ -0,0 +1,296 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _config.i
// Purpose: SWIG interface for wxConfig, wxFileConfig, etc.
//
// Author: Robin Dunn
//
// Created: 25-Nov-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
%}
//---------------------------------------------------------------------------
%{
static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) {
PyObject* ret = PyTuple_New(3);
if (ret) {
PyTuple_SET_ITEM(ret, 0, PyInt_FromLong(flag));
PyTuple_SET_ITEM(ret, 1, wx2PyString(str));
PyTuple_SET_ITEM(ret, 2, PyInt_FromLong(index));
}
return ret;
}
%}
enum
{
wxCONFIG_USE_LOCAL_FILE,
wxCONFIG_USE_GLOBAL_FILE,
wxCONFIG_USE_RELATIVE_PATH,
wxCONFIG_USE_NO_ESCAPE_CHARACTERS
};
// abstract base class wxConfigBase which defines the interface for derived
// classes
//
// wxConfig organizes the items in a tree-like structure (modeled after the
// Unix/Dos filesystem). There are groups (directories) and keys (files).
// There is always one current group given by the current path.
//
// Keys are pairs "key_name = value" where value may be of string or integer
// (long) type (TODO doubles and other types such as wxDate coming soon).
class wxConfigBase {
public:
// wxConfigBase(const wxString& appName = wxPyEmptyString, **** An ABC
// const wxString& vendorName = wxPyEmptyString,
// const wxString& localFilename = wxPyEmptyString,
// const wxString& globalFilename = wxPyEmptyString,
// long style = 0);
~wxConfigBase();
enum EntryType
{
Type_Unknown,
Type_String,
Type_Boolean,
Type_Integer, // use Read(long *)
Type_Float // use Read(double *)
};
// sets the config object, returns the previous pointer
static wxConfigBase *Set(wxConfigBase *pConfig);
// get the config object, creates it on demand unless DontCreateOnDemand
// was called
static wxConfigBase *Get(bool createOnDemand = TRUE);
// create a new config object: this function will create the "best"
// implementation of wxConfig available for the current platform, see
// comments near definition wxUSE_CONFIG_NATIVE for details. It returns
// the created object and also sets it as ms_pConfig.
static wxConfigBase *Create();
// should Get() try to create a new log object if the current one is NULL?
static void DontCreateOnDemand();
// set current path: if the first character is '/', it's the absolute path,
// otherwise it's a relative path. '..' is supported. If the strPath
// doesn't exist it is created.
virtual void SetPath(const wxString& strPath);
// retrieve the current path (always as absolute path)
virtual const wxString& GetPath() const;
// Each of these enumeration methods return a 3-tuple consisting of
// the continue flag, the value string, and the index for the next call.
%extend {
// enumerate subgroups
PyObject* GetFirstGroup() {
bool cont;
long index = 0;
wxString value;
cont = self->GetFirstGroup(value, index);
return __EnumerationHelper(cont, value, index);
}
PyObject* GetNextGroup(long index) {
bool cont;
wxString value;
cont = self->GetNextGroup(value, index);
return __EnumerationHelper(cont, value, index);
}
// enumerate entries
PyObject* GetFirstEntry() {
bool cont;
long index = 0;
wxString value;
cont = self->GetFirstEntry(value, index);
return __EnumerationHelper(cont, value, index);
}
PyObject* GetNextEntry(long index) {
bool cont;
wxString value;
cont = self->GetNextEntry(value, index);
return __EnumerationHelper(cont, value, index);
}
}
// get number of entries/subgroups in the current group, with or without
// it's subgroups
virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
// returns TRUE if the group by this name exists
virtual bool HasGroup(const wxString& strName) const;
// same as above, but for an entry
virtual bool HasEntry(const wxString& strName) const;
// returns TRUE if either a group or an entry with a given name exist
bool Exists(const wxString& strName) const;
// get the entry type
virtual EntryType GetEntryType(const wxString& name) const;
// Key access. Returns the value of key if it exists, defaultVal otherwise
wxString Read(const wxString& key, const wxString& defaultVal = wxPyEmptyString);
%extend {
long ReadInt(const wxString& key, long defaultVal = 0) {
long rv;
self->Read(key, &rv, defaultVal);
return rv;
}
double ReadFloat(const wxString& key, double defaultVal = 0.0) {
double rv;
self->Read(key, &rv, defaultVal);
return rv;
}
bool ReadBool(const wxString& key, bool defaultVal = FALSE) {
bool rv;
self->Read(key, &rv, defaultVal);
return rv;
}
}
// write the value (return true on success)
bool Write(const wxString& key, const wxString& value);
%name(WriteInt)bool Write(const wxString& key, long value);
%name(WriteFloat)bool Write(const wxString& key, double value);
%name(WriteBool)bool Write(const wxString& key, bool value);
// permanently writes all changes
virtual bool Flush(bool bCurrentOnly = FALSE);
// renaming, all functions return FALSE on failure (probably because the new
// name is already taken by an existing entry)
// rename an entry
virtual bool RenameEntry(const wxString& oldName,
const wxString& newName);
// rename a group
virtual bool RenameGroup(const wxString& oldName,
const wxString& newName);
// deletes the specified entry and the group it belongs to if
// it was the last key in it and the second parameter is true
virtual bool DeleteEntry(const wxString& key,
bool bDeleteGroupIfEmpty = TRUE);
// delete the group (with all subgroups)
virtual bool DeleteGroup(const wxString& key);
// delete the whole underlying object (disk file, registry key, ...)
// primarly for use by desinstallation routine.
virtual bool DeleteAll();
// we can automatically expand environment variables in the config entries
// (this option is on by default, you can turn it on/off at any time)
bool IsExpandingEnvVars() const;
void SetExpandEnvVars(bool bDoIt = TRUE);
// recording of default values
void SetRecordDefaults(bool bDoIt = TRUE);
bool IsRecordingDefaults() const;
// does expansion only if needed
wxString ExpandEnvVars(const wxString& str) const;
// misc accessors
wxString GetAppName() const;
wxString GetVendorName() const;
// Used wxIniConfig to set members in constructor
void SetAppName(const wxString& appName);
void SetVendorName(const wxString& vendorName);
void SetStyle(long style);
long GetStyle() const;
};
//---------------------------------------------------------------------------
// a handy little class which changes current path to the path of given entry
// and restores it in dtor: so if you declare a local variable of this type,
// you work in the entry directory and the path is automatically restored
// when the function returns
// Taken out of wxConfig since not all compilers can cope with nested classes.
class wxConfigPathChanger
{
public:
// ctor/dtor do path changing/restorin
wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry);
~wxConfigPathChanger();
// get the key name
const wxString& Name() const { return m_strName; }
};
//---------------------------------------------------------------------------
// This will be a wxRegConfig on Win32 and wxFileConfig otherwise.
class wxConfig : public wxConfigBase {
public:
wxConfig(const wxString& appName = wxPyEmptyString,
const wxString& vendorName = wxPyEmptyString,
const wxString& localFilename = wxPyEmptyString,
const wxString& globalFilename = wxPyEmptyString,
long style = 0);
~wxConfig();
};
// Sometimes it's nice to explicitly have a wxFileConfig too.
class wxFileConfig : public wxConfigBase {
public:
wxFileConfig(const wxString& appName = wxPyEmptyString,
const wxString& vendorName = wxPyEmptyString,
const wxString& localFilename = wxPyEmptyString,
const wxString& globalFilename = wxPyEmptyString,
long style = 0);
~wxFileConfig();
};
//---------------------------------------------------------------------------
// Replace environment variables ($SOMETHING) with their values. The format is
// $VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and
// '_' only. '$' must be escaped ('\$') in order to be taken literally.
wxString wxExpandEnvVars(const wxString &sz);
//---------------------------------------------------------------------------

139
wxPython/src/_constraints.i Normal file
View File

@@ -0,0 +1,139 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _constraints.i
// Purpose: SWIG interface defs for the layout constraints
//
// Author: Robin Dunn
//
// Created: 3-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%newgroup;
enum wxEdge
{
wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY
};
enum wxRelationship
{
wxUnconstrained = 0,
wxAsIs,
wxPercentOf,
wxAbove,
wxBelow,
wxLeftOf,
wxRightOf,
wxSameAs,
wxAbsolute
};
// wxIndividualLayoutConstraint: a constraint on window position
class wxIndividualLayoutConstraint : public wxObject
{
public:
// wxIndividualLayoutConstraint();
// ~wxIndividualLayoutConstraint();
void Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
//
// Sibling relationships
//
void LeftOf(wxWindow *sibling, int marg = 0);
void RightOf(wxWindow *sibling, int marg = 0);
void Above(wxWindow *sibling, int marg = 0);
void Below(wxWindow *sibling, int marg = 0);
//
// 'Same edge' alignment
//
void SameAs(wxWindow *otherW, wxEdge edge, int marg = 0);
// The edge is a percentage of the other window's edge
void PercentOf(wxWindow *otherW, wxEdge wh, int per);
//
// Edge has absolute value
//
void Absolute(int val);
//
// Dimension is unconstrained
//
void Unconstrained() { relationship = wxUnconstrained; }
//
// Dimension is 'as is' (use current size settings)
//
void AsIs() { relationship = wxAsIs; }
//
// Accessors
//
wxWindow *GetOtherWindow();
wxEdge GetMyEdge() const;
void SetEdge(wxEdge which);
void SetValue(int v);
int GetMargin();
void SetMargin(int m);
int GetValue() const;
int GetPercent() const;
int GetOtherEdge() const;
bool GetDone() const;
void SetDone(bool d);
wxRelationship GetRelationship();
void SetRelationship(wxRelationship r);
// Reset constraint if it mentions otherWin
bool ResetIfWin(wxWindow *otherW);
// Try to satisfy constraint
bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win);
// Get the value of this edge or dimension, or if this
// is not determinable, -1.
int GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const;
};
// wxLayoutConstraints: the complete set of constraints for a window
class wxLayoutConstraints : public wxObject
{
public:
%immutable;
// Edge constraints
wxIndividualLayoutConstraint left;
wxIndividualLayoutConstraint top;
wxIndividualLayoutConstraint right;
wxIndividualLayoutConstraint bottom;
// Size constraints
wxIndividualLayoutConstraint width;
wxIndividualLayoutConstraint height;
// Centre constraints
wxIndividualLayoutConstraint centreX;
wxIndividualLayoutConstraint centreY;
%mutable;
wxLayoutConstraints();
bool SatisfyConstraints(wxWindow *win, int *OUTPUT);
bool AreSatisfied() const;
};
//---------------------------------------------------------------------------

169
wxPython/src/_control.i Normal file
View File

@@ -0,0 +1,169 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _control.i
// Purpose: SWIG interface defs for wxControl and other base classes
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(ControlNameStr);
%}
//---------------------------------------------------------------------------
%newgroup;
// This is the base class for a control or 'widget'.
//
// A control is generally a small window which processes user input and/or
// displays one or more item of data.
class wxControl : public wxWindow
{
public:
%addtofunc wxControl "self._setOORInfo(self)"
%addtofunc wxControl() ""
wxControl(wxWindow *parent,
wxWindowID id,
const wxPoint& pos=wxDefaultPosition,
const wxSize& size=wxDefaultSize,
long style=0,
const wxValidator& validator=wxDefaultValidator,
const wxString& name=wxPyControlNameStr);
%name(PreControl)wxControl();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos=wxDefaultPosition,
const wxSize& size=wxDefaultSize,
long style=0,
const wxValidator& validator=wxDefaultValidator,
const wxString& name=wxPyControlNameStr);
// Simulates the effect of the user issuing a command to the item. See
// wxCommandEvent.
void Command(wxCommandEvent& event);
// Return a control's text.
wxString GetLabel();
// Sets the item's text.
void SetLabel(const wxString& label);
};
//---------------------------------------------------------------------------
%newgroup;
// wxItemContainer defines an interface which is implemented by all controls
// which have string subitems each of which may be selected.
//
// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which
// implements an extended interface deriving from this one)
class wxItemContainer
{
public:
// wxItemContainer() { m_clientDataItemsType = wxClientData_None; } ** It's an ABC
// int Append(const wxString& item)
// int Append(const wxString& item, void *clientData)
// int Append(const wxString& item, wxClientData *clientData)
%extend {
// Adds the item to the control, associating the given data with the
// item if not None.
int Append(const wxString& item, PyObject* clientData=NULL) {
if (clientData) {
wxPyClientData* data = new wxPyClientData(clientData);
return self->Append(item, data);
} else
return self->Append(item);
}
}
// append several items at once to the control
%name(AppendItems) void Append(const wxArrayString& strings);
// int Insert(const wxString& item, int pos)
// int Insert(const wxString& item, int pos, void *clientData);
// int Insert(const wxString& item, int pos, wxClientData *clientData);
%extend {
int Insert(const wxString& item, int pos, PyObject* clientData=NULL) {
if (clientData) {
wxPyClientData* data = new wxPyClientData(clientData);
return self->Insert(item, pos, data);
} else
return self->Insert(item, pos);
}
}
// deleting items
virtual void Clear();
virtual void Delete(int n);
// accessing strings
virtual int GetCount() const;
bool IsEmpty() const;
virtual wxString GetString(int n) const;
wxArrayString GetStrings() const;
virtual void SetString(int n, const wxString& s);
virtual int FindString(const wxString& s) const;
// selection
virtual void Select(int n);
virtual int GetSelection() const;
wxString GetStringSelection() const;
// client data stuff
%extend {
// Returns the client data associated with the given item, (if any.)
PyObject* GetClientData(int n) {
wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
if (data) {
Py_INCREF(data->m_obj);
return data->m_obj;
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
// Associate the given client data with the item at position n.
void SetClientData(int n, PyObject* clientData) {
wxPyClientData* data = new wxPyClientData(clientData);
self->SetClientObject(n, data);
}
}
};
//---------------------------------------------------------------------------
%newgroup;
class wxControlWithItems : public wxControl, public wxItemContainer
{
public:
};
//---------------------------------------------------------------------------

View File

@@ -0,0 +1,250 @@
// A bunch of %rename directives generated by ./distrib/build_renamers.py
// in order to remove the wx prefix from all global scope names.
#ifndef SWIGXML
%rename(BU_LEFT) wxBU_LEFT;
%rename(BU_TOP) wxBU_TOP;
%rename(BU_RIGHT) wxBU_RIGHT;
%rename(BU_BOTTOM) wxBU_BOTTOM;
%rename(BU_EXACTFIT) wxBU_EXACTFIT;
%rename(BU_AUTODRAW) wxBU_AUTODRAW;
%rename(Button) wxButton;
%rename(BitmapButton) wxBitmapButton;
%rename(CHK_2STATE) wxCHK_2STATE;
%rename(CHK_3STATE) wxCHK_3STATE;
%rename(CHK_ALLOW_3RD_STATE_FOR_USER) wxCHK_ALLOW_3RD_STATE_FOR_USER;
%rename(CHK_UNCHECKED) wxCHK_UNCHECKED;
%rename(CHK_CHECKED) wxCHK_CHECKED;
%rename(CHK_UNDETERMINED) wxCHK_UNDETERMINED;
%rename(CheckBox) wxCheckBox;
%rename(Choice) wxChoice;
%rename(ComboBox) wxComboBox;
%rename(GA_HORIZONTAL) wxGA_HORIZONTAL;
%rename(GA_VERTICAL) wxGA_VERTICAL;
%rename(GA_SMOOTH) wxGA_SMOOTH;
%rename(GA_PROGRESSBAR) wxGA_PROGRESSBAR;
%rename(Gauge) wxGauge;
%rename(StaticBox) wxStaticBox;
%rename(StaticLine) wxStaticLine;
%rename(StaticText) wxStaticText;
%rename(StaticBitmap) wxStaticBitmap;
%rename(ListBox) wxListBox;
%rename(CheckListBox) wxCheckListBox;
%rename(TE_NO_VSCROLL) wxTE_NO_VSCROLL;
%rename(TE_AUTO_SCROLL) wxTE_AUTO_SCROLL;
%rename(TE_READONLY) wxTE_READONLY;
%rename(TE_MULTILINE) wxTE_MULTILINE;
%rename(TE_PROCESS_TAB) wxTE_PROCESS_TAB;
%rename(TE_LEFT) wxTE_LEFT;
%rename(TE_CENTER) wxTE_CENTER;
%rename(TE_RIGHT) wxTE_RIGHT;
%rename(TE_CENTRE) wxTE_CENTRE;
%rename(TE_RICH) wxTE_RICH;
%rename(TE_PROCESS_ENTER) wxTE_PROCESS_ENTER;
%rename(TE_PASSWORD) wxTE_PASSWORD;
%rename(TE_AUTO_URL) wxTE_AUTO_URL;
%rename(TE_NOHIDESEL) wxTE_NOHIDESEL;
%rename(TE_DONTWRAP) wxTE_DONTWRAP;
%rename(TE_LINEWRAP) wxTE_LINEWRAP;
%rename(TE_WORDWRAP) wxTE_WORDWRAP;
%rename(TE_RICH2) wxTE_RICH2;
%rename(TEXT_ALIGNMENT_DEFAULT) wxTEXT_ALIGNMENT_DEFAULT;
%rename(TEXT_ALIGNMENT_LEFT) wxTEXT_ALIGNMENT_LEFT;
%rename(TEXT_ALIGNMENT_CENTRE) wxTEXT_ALIGNMENT_CENTRE;
%rename(TEXT_ALIGNMENT_CENTER) wxTEXT_ALIGNMENT_CENTER;
%rename(TEXT_ALIGNMENT_RIGHT) wxTEXT_ALIGNMENT_RIGHT;
%rename(TEXT_ALIGNMENT_JUSTIFIED) wxTEXT_ALIGNMENT_JUSTIFIED;
%rename(TEXT_ATTR_TEXT_COLOUR) wxTEXT_ATTR_TEXT_COLOUR;
%rename(TEXT_ATTR_BACKGROUND_COLOUR) wxTEXT_ATTR_BACKGROUND_COLOUR;
%rename(TEXT_ATTR_FONT_FACE) wxTEXT_ATTR_FONT_FACE;
%rename(TEXT_ATTR_FONT_SIZE) wxTEXT_ATTR_FONT_SIZE;
%rename(TEXT_ATTR_FONT_WEIGHT) wxTEXT_ATTR_FONT_WEIGHT;
%rename(TEXT_ATTR_FONT_ITALIC) wxTEXT_ATTR_FONT_ITALIC;
%rename(TEXT_ATTR_FONT_UNDERLINE) wxTEXT_ATTR_FONT_UNDERLINE;
%rename(TEXT_ATTR_FONT) wxTEXT_ATTR_FONT;
%rename(TEXT_ATTR_ALIGNMENT) wxTEXT_ATTR_ALIGNMENT;
%rename(TEXT_ATTR_LEFT_INDENT) wxTEXT_ATTR_LEFT_INDENT;
%rename(TEXT_ATTR_RIGHT_INDENT) wxTEXT_ATTR_RIGHT_INDENT;
%rename(TEXT_ATTR_TABS) wxTEXT_ATTR_TABS;
%rename(TextAttr) wxTextAttr;
%rename(TextCtrl) wxTextCtrl;
%rename(TextUrlEvent) wxTextUrlEvent;
%rename(ScrollBar) wxScrollBar;
%rename(SP_HORIZONTAL) wxSP_HORIZONTAL;
%rename(SP_VERTICAL) wxSP_VERTICAL;
%rename(SP_ARROW_KEYS) wxSP_ARROW_KEYS;
%rename(SP_WRAP) wxSP_WRAP;
%rename(SpinButton) wxSpinButton;
%rename(SpinCtrl) wxSpinCtrl;
%rename(RadioBox) wxRadioBox;
%rename(RadioButton) wxRadioButton;
%rename(Slider) wxSlider;
%rename(ToggleButton) wxToggleButton;
%rename(BookCtrl) wxBookCtrl;
%rename(BookCtrlEvent) wxBookCtrlEvent;
%rename(NB_FIXEDWIDTH) wxNB_FIXEDWIDTH;
%rename(NB_TOP) wxNB_TOP;
%rename(NB_LEFT) wxNB_LEFT;
%rename(NB_RIGHT) wxNB_RIGHT;
%rename(NB_BOTTOM) wxNB_BOTTOM;
%rename(NB_MULTILINE) wxNB_MULTILINE;
%rename(NB_HITTEST_NOWHERE) wxNB_HITTEST_NOWHERE;
%rename(NB_HITTEST_ONICON) wxNB_HITTEST_ONICON;
%rename(NB_HITTEST_ONLABEL) wxNB_HITTEST_ONLABEL;
%rename(NB_HITTEST_ONITEM) wxNB_HITTEST_ONITEM;
%rename(Notebook) wxNotebook;
%rename(NotebookEvent) wxNotebookEvent;
%rename(LB_DEFAULT) wxLB_DEFAULT;
%rename(LB_TOP) wxLB_TOP;
%rename(LB_BOTTOM) wxLB_BOTTOM;
%rename(LB_LEFT) wxLB_LEFT;
%rename(LB_RIGHT) wxLB_RIGHT;
%rename(LB_ALIGN_MASK) wxLB_ALIGN_MASK;
%rename(Listbook) wxListbook;
%rename(ListbookEvent) wxListbookEvent;
%rename(BookCtrlSizer) wxBookCtrlSizer;
%rename(NotebookSizer) wxNotebookSizer;
%rename(TOOL_STYLE_BUTTON) wxTOOL_STYLE_BUTTON;
%rename(TOOL_STYLE_SEPARATOR) wxTOOL_STYLE_SEPARATOR;
%rename(TOOL_STYLE_CONTROL) wxTOOL_STYLE_CONTROL;
%rename(TB_HORIZONTAL) wxTB_HORIZONTAL;
%rename(TB_VERTICAL) wxTB_VERTICAL;
%rename(TB_3DBUTTONS) wxTB_3DBUTTONS;
%rename(TB_FLAT) wxTB_FLAT;
%rename(TB_DOCKABLE) wxTB_DOCKABLE;
%rename(TB_NOICONS) wxTB_NOICONS;
%rename(TB_TEXT) wxTB_TEXT;
%rename(TB_NODIVIDER) wxTB_NODIVIDER;
%rename(TB_NOALIGN) wxTB_NOALIGN;
%rename(TB_HORZ_LAYOUT) wxTB_HORZ_LAYOUT;
%rename(TB_HORZ_TEXT) wxTB_HORZ_TEXT;
%rename(ToolBarToolBase) wxToolBarToolBase;
%rename(ToolBarBase) wxToolBarBase;
%rename(ToolBar) wxToolBar;
%rename(LC_VRULES) wxLC_VRULES;
%rename(LC_HRULES) wxLC_HRULES;
%rename(LC_ICON) wxLC_ICON;
%rename(LC_SMALL_ICON) wxLC_SMALL_ICON;
%rename(LC_LIST) wxLC_LIST;
%rename(LC_REPORT) wxLC_REPORT;
%rename(LC_ALIGN_TOP) wxLC_ALIGN_TOP;
%rename(LC_ALIGN_LEFT) wxLC_ALIGN_LEFT;
%rename(LC_AUTOARRANGE) wxLC_AUTOARRANGE;
%rename(LC_VIRTUAL) wxLC_VIRTUAL;
%rename(LC_EDIT_LABELS) wxLC_EDIT_LABELS;
%rename(LC_NO_HEADER) wxLC_NO_HEADER;
%rename(LC_NO_SORT_HEADER) wxLC_NO_SORT_HEADER;
%rename(LC_SINGLE_SEL) wxLC_SINGLE_SEL;
%rename(LC_SORT_ASCENDING) wxLC_SORT_ASCENDING;
%rename(LC_SORT_DESCENDING) wxLC_SORT_DESCENDING;
%rename(LC_MASK_TYPE) wxLC_MASK_TYPE;
%rename(LC_MASK_ALIGN) wxLC_MASK_ALIGN;
%rename(LC_MASK_SORT) wxLC_MASK_SORT;
%rename(LIST_MASK_STATE) wxLIST_MASK_STATE;
%rename(LIST_MASK_TEXT) wxLIST_MASK_TEXT;
%rename(LIST_MASK_IMAGE) wxLIST_MASK_IMAGE;
%rename(LIST_MASK_DATA) wxLIST_MASK_DATA;
%rename(LIST_SET_ITEM) wxLIST_SET_ITEM;
%rename(LIST_MASK_WIDTH) wxLIST_MASK_WIDTH;
%rename(LIST_MASK_FORMAT) wxLIST_MASK_FORMAT;
%rename(LIST_STATE_DONTCARE) wxLIST_STATE_DONTCARE;
%rename(LIST_STATE_DROPHILITED) wxLIST_STATE_DROPHILITED;
%rename(LIST_STATE_FOCUSED) wxLIST_STATE_FOCUSED;
%rename(LIST_STATE_SELECTED) wxLIST_STATE_SELECTED;
%rename(LIST_STATE_CUT) wxLIST_STATE_CUT;
%rename(LIST_STATE_DISABLED) wxLIST_STATE_DISABLED;
%rename(LIST_STATE_FILTERED) wxLIST_STATE_FILTERED;
%rename(LIST_STATE_INUSE) wxLIST_STATE_INUSE;
%rename(LIST_STATE_PICKED) wxLIST_STATE_PICKED;
%rename(LIST_STATE_SOURCE) wxLIST_STATE_SOURCE;
%rename(LIST_HITTEST_ABOVE) wxLIST_HITTEST_ABOVE;
%rename(LIST_HITTEST_BELOW) wxLIST_HITTEST_BELOW;
%rename(LIST_HITTEST_NOWHERE) wxLIST_HITTEST_NOWHERE;
%rename(LIST_HITTEST_ONITEMICON) wxLIST_HITTEST_ONITEMICON;
%rename(LIST_HITTEST_ONITEMLABEL) wxLIST_HITTEST_ONITEMLABEL;
%rename(LIST_HITTEST_ONITEMRIGHT) wxLIST_HITTEST_ONITEMRIGHT;
%rename(LIST_HITTEST_ONITEMSTATEICON) wxLIST_HITTEST_ONITEMSTATEICON;
%rename(LIST_HITTEST_TOLEFT) wxLIST_HITTEST_TOLEFT;
%rename(LIST_HITTEST_TORIGHT) wxLIST_HITTEST_TORIGHT;
%rename(LIST_HITTEST_ONITEM) wxLIST_HITTEST_ONITEM;
%rename(LIST_NEXT_ABOVE) wxLIST_NEXT_ABOVE;
%rename(LIST_NEXT_ALL) wxLIST_NEXT_ALL;
%rename(LIST_NEXT_BELOW) wxLIST_NEXT_BELOW;
%rename(LIST_NEXT_LEFT) wxLIST_NEXT_LEFT;
%rename(LIST_NEXT_RIGHT) wxLIST_NEXT_RIGHT;
%rename(LIST_ALIGN_DEFAULT) wxLIST_ALIGN_DEFAULT;
%rename(LIST_ALIGN_LEFT) wxLIST_ALIGN_LEFT;
%rename(LIST_ALIGN_TOP) wxLIST_ALIGN_TOP;
%rename(LIST_ALIGN_SNAP_TO_GRID) wxLIST_ALIGN_SNAP_TO_GRID;
%rename(LIST_FORMAT_LEFT) wxLIST_FORMAT_LEFT;
%rename(LIST_FORMAT_RIGHT) wxLIST_FORMAT_RIGHT;
%rename(LIST_FORMAT_CENTRE) wxLIST_FORMAT_CENTRE;
%rename(LIST_FORMAT_CENTER) wxLIST_FORMAT_CENTER;
%rename(LIST_AUTOSIZE) wxLIST_AUTOSIZE;
%rename(LIST_AUTOSIZE_USEHEADER) wxLIST_AUTOSIZE_USEHEADER;
%rename(LIST_RECT_BOUNDS) wxLIST_RECT_BOUNDS;
%rename(LIST_RECT_ICON) wxLIST_RECT_ICON;
%rename(LIST_RECT_LABEL) wxLIST_RECT_LABEL;
%rename(LIST_FIND_UP) wxLIST_FIND_UP;
%rename(LIST_FIND_DOWN) wxLIST_FIND_DOWN;
%rename(LIST_FIND_LEFT) wxLIST_FIND_LEFT;
%rename(LIST_FIND_RIGHT) wxLIST_FIND_RIGHT;
%rename(ListItemAttr) wxListItemAttr;
%rename(ListItem) wxListItem;
%rename(ListEvent) wxListEvent;
%rename(ListView) wxListView;
%rename(TR_NO_BUTTONS) wxTR_NO_BUTTONS;
%rename(TR_HAS_BUTTONS) wxTR_HAS_BUTTONS;
%rename(TR_NO_LINES) wxTR_NO_LINES;
%rename(TR_LINES_AT_ROOT) wxTR_LINES_AT_ROOT;
%rename(TR_SINGLE) wxTR_SINGLE;
%rename(TR_MULTIPLE) wxTR_MULTIPLE;
%rename(TR_EXTENDED) wxTR_EXTENDED;
%rename(TR_HAS_VARIABLE_ROW_HEIGHT) wxTR_HAS_VARIABLE_ROW_HEIGHT;
%rename(TR_EDIT_LABELS) wxTR_EDIT_LABELS;
%rename(TR_HIDE_ROOT) wxTR_HIDE_ROOT;
%rename(TR_ROW_LINES) wxTR_ROW_LINES;
%rename(TR_FULL_ROW_HIGHLIGHT) wxTR_FULL_ROW_HIGHLIGHT;
%rename(TR_DEFAULT_STYLE) wxTR_DEFAULT_STYLE;
%rename(TR_TWIST_BUTTONS) wxTR_TWIST_BUTTONS;
%rename(TR_MAC_BUTTONS) wxTR_MAC_BUTTONS;
%rename(TR_AQUA_BUTTONS) wxTR_AQUA_BUTTONS;
%rename(TreeItemIcon_Normal) wxTreeItemIcon_Normal;
%rename(TreeItemIcon_Selected) wxTreeItemIcon_Selected;
%rename(TreeItemIcon_Expanded) wxTreeItemIcon_Expanded;
%rename(TreeItemIcon_SelectedExpanded) wxTreeItemIcon_SelectedExpanded;
%rename(TreeItemIcon_Max) wxTreeItemIcon_Max;
%rename(TREE_HITTEST_ABOVE) wxTREE_HITTEST_ABOVE;
%rename(TREE_HITTEST_BELOW) wxTREE_HITTEST_BELOW;
%rename(TREE_HITTEST_NOWHERE) wxTREE_HITTEST_NOWHERE;
%rename(TREE_HITTEST_ONITEMBUTTON) wxTREE_HITTEST_ONITEMBUTTON;
%rename(TREE_HITTEST_ONITEMICON) wxTREE_HITTEST_ONITEMICON;
%rename(TREE_HITTEST_ONITEMINDENT) wxTREE_HITTEST_ONITEMINDENT;
%rename(TREE_HITTEST_ONITEMLABEL) wxTREE_HITTEST_ONITEMLABEL;
%rename(TREE_HITTEST_ONITEMRIGHT) wxTREE_HITTEST_ONITEMRIGHT;
%rename(TREE_HITTEST_ONITEMSTATEICON) wxTREE_HITTEST_ONITEMSTATEICON;
%rename(TREE_HITTEST_TOLEFT) wxTREE_HITTEST_TOLEFT;
%rename(TREE_HITTEST_TORIGHT) wxTREE_HITTEST_TORIGHT;
%rename(TREE_HITTEST_ONITEMUPPERPART) wxTREE_HITTEST_ONITEMUPPERPART;
%rename(TREE_HITTEST_ONITEMLOWERPART) wxTREE_HITTEST_ONITEMLOWERPART;
%rename(TREE_HITTEST_ONITEM) wxTREE_HITTEST_ONITEM;
%rename(TreeItemId) wxTreeItemId;
%rename(TreeEvent) wxTreeEvent;
%rename(DIRCTRL_DIR_ONLY) wxDIRCTRL_DIR_ONLY;
%rename(DIRCTRL_SELECT_FIRST) wxDIRCTRL_SELECT_FIRST;
%rename(DIRCTRL_SHOW_FILTERS) wxDIRCTRL_SHOW_FILTERS;
%rename(DIRCTRL_3D_INTERNAL) wxDIRCTRL_3D_INTERNAL;
%rename(DIRCTRL_EDIT_LABELS) wxDIRCTRL_EDIT_LABELS;
%rename(GenericDirCtrl) wxGenericDirCtrl;
%rename(DirFilterListCtrl) wxDirFilterListCtrl;
%rename(PyControl) wxPyControl;
%rename(FRAME_EX_CONTEXTHELP) wxFRAME_EX_CONTEXTHELP;
%rename(DIALOG_EX_CONTEXTHELP) wxDIALOG_EX_CONTEXTHELP;
%rename(HelpEvent) wxHelpEvent;
%rename(ContextHelp) wxContextHelp;
%rename(ContextHelpButton) wxContextHelpButton;
%rename(HelpProvider) wxHelpProvider;
%rename(SimpleHelpProvider) wxSimpleHelpProvider;
#endif

View File

@@ -0,0 +1,4 @@
# Other names that need to be reverse-renamed for the old namespace
EVT*

229
wxPython/src/_core_api.i Normal file
View File

@@ -0,0 +1,229 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _core_api.i
// Purpose:
//
// Author: Robin Dunn
//
// Created: 13-Sept-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#ifndef wxPyUSE_EXPORT
// Helper functions for dealing with SWIG objects and such. These are
// located here so they know about the SWIG types and functions declared
// in the wrapper code.
#include <wx/hashmap.h>
WX_DECLARE_STRING_HASH_MAP( swig_type_info*, wxPyTypeInfoHashMap );
// Maintains a hashmap of className to swig_type_info pointers. Given the
// name of a class either looks up the type info in the cache, or scans the
// SWIG tables for it.
extern PyObject* wxPyPtrTypeMap;
static
swig_type_info* wxPyFindSwigType(const wxChar* className) {
static wxPyTypeInfoHashMap* typeInfoCache = NULL;
if (typeInfoCache == NULL)
typeInfoCache = new wxPyTypeInfoHashMap;
wxString name(className);
swig_type_info* swigType = (*typeInfoCache)[name];
if (! swigType) {
// it wasn't in the cache, so look it up from SWIG
name.Append(wxT(" *"));
swigType = SWIG_Python_TypeQuery(name.mb_str());
// if it still wasn't found, try looking for a mapped name
if (!swigType) {
PyObject* item;
name = className;
if ((item = PyDict_GetItemString(wxPyPtrTypeMap,
(char*)(const char*)name.mbc_str())) != NULL) {
name = wxString(PyString_AsString(item), *wxConvCurrent);
name.Append(wxT(" *"));
swigType = SWIG_Python_TypeQuery(name.mb_str());
}
}
if (swigType) {
// and add it to the map if found
(*typeInfoCache)[className] = swigType;
}
}
return swigType;
}
// Check if a class name is a type known to SWIG
bool wxPyCheckSwigType(const wxChar* className) {
swig_type_info* swigType = wxPyFindSwigType(className);
return swigType != NULL;
}
// Given a pointer to a C++ object and a class name, construct a Python proxy
// object for it.
PyObject* wxPyConstructObject(void* ptr,
const wxChar* className,
int setThisOwn) {
swig_type_info* swigType = wxPyFindSwigType(className);
wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyConstructObject"));
return SWIG_Python_NewPointerObj(ptr, swigType, setThisOwn);
}
// Extract a pointer to the wrapped C++ object from a Python proxy object.
// Ensures that the proxy object is of the specified (or derived) type. If
// not able to perform the conversion then a Python exception is set and the
// error should be handled properly in the caller. Returns true on success.
bool wxPyConvertSwigPtr(PyObject* obj, void **ptr,
const wxChar* className) {
swig_type_info* swigType = wxPyFindSwigType(className);
wxCHECK_MSG(swigType != NULL, false, wxT("Unknown type in wxPyConvertSwigPtr"));
return SWIG_Python_ConvertPtr(obj, ptr, swigType, SWIG_POINTER_EXCEPTION) != -1;
}
// Make a SWIGified pointer object suitable for a .this attribute
PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) {
PyObject* robj = NULL;
swig_type_info* swigType = wxPyFindSwigType(className);
wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyConvertSwigPtr"));
#ifdef SWIG_COBJECT_TYPES
robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) swigType->name, NULL);
#else
{
char result[1024];
char *r = result;
*(r++) = '_';
r = SWIG_Python_PackData(r, &ptr, sizeof(void *));
strcpy(r, swigType->name);
robj = PyString_FromString(result);
}
#endif
return robj;
}
// Export a C API in a struct. Other modules will be able to load this from
// the wx.core module and will then have safe access to these functions, even if
// they are located in another shared library.
static wxPyCoreAPI API = {
(p_SWIG_Python_TypeRegister_t)SWIG_Python_TypeRegister,
(p_SWIG_Python_TypeCheck_t)SWIG_Python_TypeCheck,
(p_SWIG_Python_TypeCast_t)SWIG_Python_TypeCast,
(p_SWIG_Python_TypeDynamicCast_t)SWIG_Python_TypeDynamicCast,
(p_SWIG_Python_TypeName_t)SWIG_Python_TypeName,
(p_SWIG_Python_TypeQuery_t)SWIG_Python_TypeQuery,
(p_SWIG_Python_TypeClientData_t)SWIG_Python_TypeClientData,
(p_SWIG_Python_newvarlink_t)SWIG_Python_newvarlink,
(p_SWIG_Python_addvarlink_t)SWIG_Python_addvarlink,
(p_SWIG_Python_ConvertPtr_t)SWIG_Python_ConvertPtr,
(p_SWIG_Python_ConvertPacked_t)SWIG_Python_ConvertPacked,
(p_SWIG_Python_PackData_t)SWIG_Python_PackData,
(p_SWIG_Python_UnpackData_t)SWIG_Python_UnpackData,
(p_SWIG_Python_NewPointerObj_t)SWIG_Python_NewPointerObj,
(p_SWIG_Python_NewPackedObj_t)SWIG_Python_NewPackedObj,
(p_SWIG_Python_InstallConstants_t)SWIG_Python_InstallConstants,
(p_SWIG_Python_MustGetPtr_t)SWIG_Python_MustGetPtr,
wxPyCheckSwigType,
wxPyConstructObject,
wxPyConvertSwigPtr,
wxPyMakeSwigPtr,
wxPyBeginAllowThreads,
wxPyEndAllowThreads,
wxPyBeginBlockThreads,
wxPyEndBlockThreads,
wxPy_ConvertList,
wxString_in_helper,
Py2wxString,
wx2PyString,
byte_LIST_helper,
int_LIST_helper,
long_LIST_helper,
string_LIST_helper,
wxPoint_LIST_helper,
wxBitmap_LIST_helper,
wxString_LIST_helper,
wxAcceleratorEntry_LIST_helper,
wxSize_helper,
wxPoint_helper,
wxRealPoint_helper,
wxRect_helper,
wxColour_helper,
wxPoint2D_helper,
wxPySimple_typecheck,
wxColour_typecheck,
wxPyCBH_setCallbackInfo,
wxPyCBH_findCallback,
wxPyCBH_callCallback,
wxPyCBH_callCallbackObj,
wxPyCBH_delete,
wxPyMake_wxObject,
wxPyMake_wxSizer,
wxPyPtrTypeMap_Add,
wxPy2int_seq_helper,
wxPy4int_seq_helper,
wxArrayString2PyList_helper,
wxArrayInt2PyList_helper,
wxPyClientData_dtor,
wxPyUserData_dtor,
wxPyOORClientData_dtor,
wxPyCBInputStream_create,
wxPyInstance_Check,
wxPySwigInstance_Check
};
#endif
%}
%init %{
#ifndef wxPyUSE_EXPORT
// Make our API structure a CObject so other modules can import it
// from this module.
PyObject* cobj = PyCObject_FromVoidPtr(&API, NULL);
PyDict_SetItemString(d,"_wxPyCoreAPI", cobj);
Py_XDECREF(cobj);
#endif
%}
//---------------------------------------------------------------------------

193
wxPython/src/_core_ex.py Normal file
View File

@@ -0,0 +1,193 @@
#----------------------------------------------------------------------------
# Use Python's bool constants if available, make aliases if not
try:
True
except NameError:
True = 1==1
False = 1==0
# Backwards compaatibility
TRUE = true = True
FALSE = false = False
# workarounds for bad wxRTTI names
__wxPyPtrTypeMap['wxGauge95'] = 'wxGauge'
__wxPyPtrTypeMap['wxSlider95'] = 'wxSlider'
__wxPyPtrTypeMap['wxStatusBar95'] = 'wxStatusBar'
#----------------------------------------------------------------------------
# Load version numbers from __version__... Ensure that major and minor
# versions are the same for both wxPython and wxWindows.
from __version__ import *
__version__ = VERSION_STRING
assert MAJOR_VERSION == _core.MAJOR_VERSION, "wxPython/wxWindows version mismatch"
assert MINOR_VERSION == _core.MINOR_VERSION, "wxPython/wxWindows version mismatch"
if RELEASE_VERSION != _core.RELEASE_VERSION:
import warnings
warnings.warn("wxPython/wxWindows release number mismatch")
#----------------------------------------------------------------------------
class PyDeadObjectError(AttributeError):
pass
class _wxPyDeadObject(object):
"""
Instances of wx objects that are OOR capable will have their __class__
changed to this class when the C++ object is deleted. This should help
prevent crashes due to referencing a bogus C++ pointer.
"""
reprStr = "wxPython wrapper for DELETED %s object! (The C++ object no longer exists.)"
attrStr = "The C++ part of the %s object has been deleted, attribute access no longer allowed."
def __repr__( self ):
if not hasattr(self, "_name"):
self._name = "[unknown]"
return self.reprStr % self._name
def __getattr__( self, *args ):
if not hasattr(self, "_name"):
self._name = "[unknown]"
raise PyDeadObjectError( self.attrStr % self._name )
def __nonzero__(self):
return 0
#----------------------------------------------------------------------------
_wxPyCallAfterId = None
def CallAfter(callable, *args, **kw):
"""
Call the specified function after the current and pending event
handlers have been completed. This is also good for making GUI
method calls from non-GUI threads.
"""
app = wx.GetApp()
assert app, 'No wxApp created yet'
global _wxPyCallAfterId
if _wxPyCallAfterId is None:
_wxPyCallAfterId = wx.NewEventType()
app.Connect(-1, -1, _wxPyCallAfterId,
lambda event: event.callable(*event.args, **event.kw) )
evt = wx.PyEvent()
evt.SetEventType(_wxPyCallAfterId)
evt.callable = callable
evt.args = args
evt.kw = kw
wx.PostEvent(app, evt)
#----------------------------------------------------------------------------
class FutureCall:
"""
A convenience class for wxTimer, that calls the given callable
object once after the given amount of milliseconds, passing any
positional or keyword args. The return value of the callable is
availbale after it has been run with the GetResult method.
If you don't need to get the return value or restart the timer
then there is no need to hold a reference to this object. It will
hold a reference to itself while the timer is running (the timer
has a reference to self.Notify) but the cycle will be broken when
the timer completes, automatically cleaning up the wx.FutureCall
object.
"""
def __init__(self, millis, callable, *args, **kwargs):
self.millis = millis
self.callable = callable
self.SetArgs(*args, **kwargs)
self.runCount = 0
self.hasRun = False
self.result = None
self.timer = None
self.Start()
def __del__(self):
self.Stop()
def Start(self, millis=None, *args, **kwargs):
"""
(Re)start the timer
"""
self.hasRun = False
if millis is not None:
self.millis = millis
if args or kwargs:
self.SetArgs(*args, **kwargs)
self.Stop()
self.timer = wx.PyTimer(self.Notify)
self.timer.Start(self.millis, wx.TIMER_ONE_SHOT)
Restart = Start
def Stop(self):
"""
Stop and destroy the timer.
"""
if self.timer is not None:
self.timer.Stop()
self.timer = None
def GetInterval(self):
if self.timer is not None:
return self.timer.GetInterval()
else:
return 0
def IsRunning(self):
return self.timer is not None and self.timer.IsRunning()
def SetArgs(self, *args, **kwargs):
"""
(Re)set the args passed to the callable object. This is
useful in conjunction with Restart if you want to schedule a
new call to the same callable object but with different
parameters.
"""
self.args = args
self.kwargs = kwargs
def HasRun(self):
return self.hasRun
def GetResult(self):
return self.result
def Notify(self):
"""
The timer has expired so call the callable.
"""
if self.callable and getattr(self.callable, 'im_self', True):
self.runCount += 1
self.result = self.callable(*self.args, **self.kwargs)
self.hasRun = True
wx.CallAfter(self.Stop)
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Import other modules in this package that should show up in the
# "core" wx namespace
from gdi import *
from windows import *
from controls import *
from misc import *
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------

664
wxPython/src/_core_rename.i Normal file
View File

@@ -0,0 +1,664 @@
// A bunch of %rename directives generated by ./distrib/build_renamers.py
// in order to remove the wx prefix from all global scope names.
#ifndef SWIGXML
%rename(NOT_FOUND) wxNOT_FOUND;
%rename(VSCROLL) wxVSCROLL;
%rename(HSCROLL) wxHSCROLL;
%rename(CAPTION) wxCAPTION;
%rename(DOUBLE_BORDER) wxDOUBLE_BORDER;
%rename(SUNKEN_BORDER) wxSUNKEN_BORDER;
%rename(RAISED_BORDER) wxRAISED_BORDER;
%rename(BORDER) wxBORDER;
%rename(SIMPLE_BORDER) wxSIMPLE_BORDER;
%rename(STATIC_BORDER) wxSTATIC_BORDER;
%rename(TRANSPARENT_WINDOW) wxTRANSPARENT_WINDOW;
%rename(NO_BORDER) wxNO_BORDER;
%rename(USER_COLOURS) wxUSER_COLOURS;
%rename(NO_3D) wxNO_3D;
%rename(TAB_TRAVERSAL) wxTAB_TRAVERSAL;
%rename(WANTS_CHARS) wxWANTS_CHARS;
%rename(POPUP_WINDOW) wxPOPUP_WINDOW;
%rename(CENTER_FRAME) wxCENTER_FRAME;
%rename(CENTRE_ON_SCREEN) wxCENTRE_ON_SCREEN;
%rename(CENTER_ON_SCREEN) wxCENTER_ON_SCREEN;
%rename(STAY_ON_TOP) wxSTAY_ON_TOP;
%rename(ICONIZE) wxICONIZE;
%rename(MINIMIZE) wxMINIMIZE;
%rename(MAXIMIZE) wxMAXIMIZE;
%rename(CLOSE_BOX) wxCLOSE_BOX;
%rename(THICK_FRAME) wxTHICK_FRAME;
%rename(SYSTEM_MENU) wxSYSTEM_MENU;
%rename(MINIMIZE_BOX) wxMINIMIZE_BOX;
%rename(MAXIMIZE_BOX) wxMAXIMIZE_BOX;
%rename(TINY_CAPTION_HORIZ) wxTINY_CAPTION_HORIZ;
%rename(TINY_CAPTION_VERT) wxTINY_CAPTION_VERT;
%rename(RESIZE_BOX) wxRESIZE_BOX;
%rename(RESIZE_BORDER) wxRESIZE_BORDER;
%rename(DIALOG_MODAL) wxDIALOG_MODAL;
%rename(DIALOG_MODELESS) wxDIALOG_MODELESS;
%rename(DIALOG_NO_PARENT) wxDIALOG_NO_PARENT;
%rename(DEFAULT_FRAME_STYLE) wxDEFAULT_FRAME_STYLE;
%rename(DEFAULT_DIALOG_STYLE) wxDEFAULT_DIALOG_STYLE;
%rename(FRAME_TOOL_WINDOW) wxFRAME_TOOL_WINDOW;
%rename(FRAME_FLOAT_ON_PARENT) wxFRAME_FLOAT_ON_PARENT;
%rename(FRAME_NO_WINDOW_MENU) wxFRAME_NO_WINDOW_MENU;
%rename(FRAME_NO_TASKBAR) wxFRAME_NO_TASKBAR;
%rename(FRAME_SHAPED) wxFRAME_SHAPED;
%rename(ED_CLIENT_MARGIN) wxED_CLIENT_MARGIN;
%rename(ED_BUTTONS_BOTTOM) wxED_BUTTONS_BOTTOM;
%rename(ED_BUTTONS_RIGHT) wxED_BUTTONS_RIGHT;
%rename(ED_STATIC_LINE) wxED_STATIC_LINE;
%rename(EXT_DIALOG_STYLE) wxEXT_DIALOG_STYLE;
%rename(CLIP_CHILDREN) wxCLIP_CHILDREN;
%rename(CLIP_SIBLINGS) wxCLIP_SIBLINGS;
%rename(RETAINED) wxRETAINED;
%rename(BACKINGSTORE) wxBACKINGSTORE;
%rename(COLOURED) wxCOLOURED;
%rename(FIXED_LENGTH) wxFIXED_LENGTH;
%rename(LB_NEEDED_SB) wxLB_NEEDED_SB;
%rename(LB_ALWAYS_SB) wxLB_ALWAYS_SB;
%rename(LB_SORT) wxLB_SORT;
%rename(LB_SINGLE) wxLB_SINGLE;
%rename(LB_MULTIPLE) wxLB_MULTIPLE;
%rename(LB_EXTENDED) wxLB_EXTENDED;
%rename(LB_OWNERDRAW) wxLB_OWNERDRAW;
%rename(LB_HSCROLL) wxLB_HSCROLL;
%rename(PROCESS_ENTER) wxPROCESS_ENTER;
%rename(PASSWORD) wxPASSWORD;
%rename(CB_SIMPLE) wxCB_SIMPLE;
%rename(CB_DROPDOWN) wxCB_DROPDOWN;
%rename(CB_SORT) wxCB_SORT;
%rename(CB_READONLY) wxCB_READONLY;
%rename(RA_HORIZONTAL) wxRA_HORIZONTAL;
%rename(RA_VERTICAL) wxRA_VERTICAL;
%rename(RA_SPECIFY_ROWS) wxRA_SPECIFY_ROWS;
%rename(RA_SPECIFY_COLS) wxRA_SPECIFY_COLS;
%rename(RB_GROUP) wxRB_GROUP;
%rename(RB_SINGLE) wxRB_SINGLE;
%rename(SL_HORIZONTAL) wxSL_HORIZONTAL;
%rename(SL_VERTICAL) wxSL_VERTICAL;
%rename(SL_AUTOTICKS) wxSL_AUTOTICKS;
%rename(SL_LABELS) wxSL_LABELS;
%rename(SL_LEFT) wxSL_LEFT;
%rename(SL_TOP) wxSL_TOP;
%rename(SL_RIGHT) wxSL_RIGHT;
%rename(SL_BOTTOM) wxSL_BOTTOM;
%rename(SL_BOTH) wxSL_BOTH;
%rename(SL_SELRANGE) wxSL_SELRANGE;
%rename(SB_HORIZONTAL) wxSB_HORIZONTAL;
%rename(SB_VERTICAL) wxSB_VERTICAL;
%rename(ST_SIZEGRIP) wxST_SIZEGRIP;
%rename(ST_NO_AUTORESIZE) wxST_NO_AUTORESIZE;
%rename(FLOOD_SURFACE) wxFLOOD_SURFACE;
%rename(FLOOD_BORDER) wxFLOOD_BORDER;
%rename(ODDEVEN_RULE) wxODDEVEN_RULE;
%rename(WINDING_RULE) wxWINDING_RULE;
%rename(TOOL_TOP) wxTOOL_TOP;
%rename(TOOL_BOTTOM) wxTOOL_BOTTOM;
%rename(TOOL_LEFT) wxTOOL_LEFT;
%rename(TOOL_RIGHT) wxTOOL_RIGHT;
%rename(OK) wxOK;
%rename(YES_NO) wxYES_NO;
%rename(CANCEL) wxCANCEL;
%rename(YES) wxYES;
%rename(NO) wxNO;
%rename(NO_DEFAULT) wxNO_DEFAULT;
%rename(YES_DEFAULT) wxYES_DEFAULT;
%rename(ICON_EXCLAMATION) wxICON_EXCLAMATION;
%rename(ICON_HAND) wxICON_HAND;
%rename(ICON_QUESTION) wxICON_QUESTION;
%rename(ICON_INFORMATION) wxICON_INFORMATION;
%rename(ICON_STOP) wxICON_STOP;
%rename(ICON_ASTERISK) wxICON_ASTERISK;
%rename(ICON_MASK) wxICON_MASK;
%rename(ICON_WARNING) wxICON_WARNING;
%rename(ICON_ERROR) wxICON_ERROR;
%rename(FORWARD) wxFORWARD;
%rename(BACKWARD) wxBACKWARD;
%rename(RESET) wxRESET;
%rename(HELP) wxHELP;
%rename(MORE) wxMORE;
%rename(SETUP) wxSETUP;
%rename(SIZE_AUTO_WIDTH) wxSIZE_AUTO_WIDTH;
%rename(SIZE_AUTO_HEIGHT) wxSIZE_AUTO_HEIGHT;
%rename(SIZE_AUTO) wxSIZE_AUTO;
%rename(SIZE_USE_EXISTING) wxSIZE_USE_EXISTING;
%rename(SIZE_ALLOW_MINUS_ONE) wxSIZE_ALLOW_MINUS_ONE;
%rename(PORTRAIT) wxPORTRAIT;
%rename(LANDSCAPE) wxLANDSCAPE;
%rename(PRINT_QUALITY_HIGH) wxPRINT_QUALITY_HIGH;
%rename(PRINT_QUALITY_MEDIUM) wxPRINT_QUALITY_MEDIUM;
%rename(PRINT_QUALITY_LOW) wxPRINT_QUALITY_LOW;
%rename(PRINT_QUALITY_DRAFT) wxPRINT_QUALITY_DRAFT;
%rename(ID_ANY) wxID_ANY;
%rename(ID_SEPARATOR) wxID_SEPARATOR;
%rename(ID_LOWEST) wxID_LOWEST;
%rename(ID_OPEN) wxID_OPEN;
%rename(ID_CLOSE) wxID_CLOSE;
%rename(ID_NEW) wxID_NEW;
%rename(ID_SAVE) wxID_SAVE;
%rename(ID_SAVEAS) wxID_SAVEAS;
%rename(ID_REVERT) wxID_REVERT;
%rename(ID_EXIT) wxID_EXIT;
%rename(ID_UNDO) wxID_UNDO;
%rename(ID_REDO) wxID_REDO;
%rename(ID_HELP) wxID_HELP;
%rename(ID_PRINT) wxID_PRINT;
%rename(ID_PRINT_SETUP) wxID_PRINT_SETUP;
%rename(ID_PREVIEW) wxID_PREVIEW;
%rename(ID_ABOUT) wxID_ABOUT;
%rename(ID_HELP_CONTENTS) wxID_HELP_CONTENTS;
%rename(ID_HELP_COMMANDS) wxID_HELP_COMMANDS;
%rename(ID_HELP_PROCEDURES) wxID_HELP_PROCEDURES;
%rename(ID_HELP_CONTEXT) wxID_HELP_CONTEXT;
%rename(ID_CLOSE_ALL) wxID_CLOSE_ALL;
%rename(ID_PREFERENCES) wxID_PREFERENCES;
%rename(ID_CUT) wxID_CUT;
%rename(ID_COPY) wxID_COPY;
%rename(ID_PASTE) wxID_PASTE;
%rename(ID_CLEAR) wxID_CLEAR;
%rename(ID_FIND) wxID_FIND;
%rename(ID_DUPLICATE) wxID_DUPLICATE;
%rename(ID_SELECTALL) wxID_SELECTALL;
%rename(ID_DELETE) wxID_DELETE;
%rename(ID_REPLACE) wxID_REPLACE;
%rename(ID_REPLACE_ALL) wxID_REPLACE_ALL;
%rename(ID_PROPERTIES) wxID_PROPERTIES;
%rename(ID_VIEW_DETAILS) wxID_VIEW_DETAILS;
%rename(ID_VIEW_LARGEICONS) wxID_VIEW_LARGEICONS;
%rename(ID_VIEW_SMALLICONS) wxID_VIEW_SMALLICONS;
%rename(ID_VIEW_LIST) wxID_VIEW_LIST;
%rename(ID_VIEW_SORTDATE) wxID_VIEW_SORTDATE;
%rename(ID_VIEW_SORTNAME) wxID_VIEW_SORTNAME;
%rename(ID_VIEW_SORTSIZE) wxID_VIEW_SORTSIZE;
%rename(ID_VIEW_SORTTYPE) wxID_VIEW_SORTTYPE;
%rename(ID_FILE1) wxID_FILE1;
%rename(ID_FILE2) wxID_FILE2;
%rename(ID_FILE3) wxID_FILE3;
%rename(ID_FILE4) wxID_FILE4;
%rename(ID_FILE5) wxID_FILE5;
%rename(ID_FILE6) wxID_FILE6;
%rename(ID_FILE7) wxID_FILE7;
%rename(ID_FILE8) wxID_FILE8;
%rename(ID_FILE9) wxID_FILE9;
%rename(ID_OK) wxID_OK;
%rename(ID_CANCEL) wxID_CANCEL;
%rename(ID_APPLY) wxID_APPLY;
%rename(ID_YES) wxID_YES;
%rename(ID_NO) wxID_NO;
%rename(ID_STATIC) wxID_STATIC;
%rename(ID_FORWARD) wxID_FORWARD;
%rename(ID_BACKWARD) wxID_BACKWARD;
%rename(ID_DEFAULT) wxID_DEFAULT;
%rename(ID_MORE) wxID_MORE;
%rename(ID_SETUP) wxID_SETUP;
%rename(ID_RESET) wxID_RESET;
%rename(ID_CONTEXT_HELP) wxID_CONTEXT_HELP;
%rename(ID_YESTOALL) wxID_YESTOALL;
%rename(ID_NOTOALL) wxID_NOTOALL;
%rename(ID_ABORT) wxID_ABORT;
%rename(ID_RETRY) wxID_RETRY;
%rename(ID_IGNORE) wxID_IGNORE;
%rename(ID_HIGHEST) wxID_HIGHEST;
%rename(OPEN) wxOPEN;
%rename(SAVE) wxSAVE;
%rename(HIDE_READONLY) wxHIDE_READONLY;
%rename(OVERWRITE_PROMPT) wxOVERWRITE_PROMPT;
%rename(FILE_MUST_EXIST) wxFILE_MUST_EXIST;
%rename(MULTIPLE) wxMULTIPLE;
%rename(CHANGE_DIR) wxCHANGE_DIR;
%rename(ACCEL_ALT) wxACCEL_ALT;
%rename(ACCEL_CTRL) wxACCEL_CTRL;
%rename(ACCEL_SHIFT) wxACCEL_SHIFT;
%rename(ACCEL_NORMAL) wxACCEL_NORMAL;
%rename(PD_AUTO_HIDE) wxPD_AUTO_HIDE;
%rename(PD_APP_MODAL) wxPD_APP_MODAL;
%rename(PD_CAN_ABORT) wxPD_CAN_ABORT;
%rename(PD_ELAPSED_TIME) wxPD_ELAPSED_TIME;
%rename(PD_ESTIMATED_TIME) wxPD_ESTIMATED_TIME;
%rename(PD_REMAINING_TIME) wxPD_REMAINING_TIME;
%rename(DD_NEW_DIR_BUTTON) wxDD_NEW_DIR_BUTTON;
%rename(DD_DEFAULT_STYLE) wxDD_DEFAULT_STYLE;
%rename(MENU_TEAROFF) wxMENU_TEAROFF;
%rename(MB_DOCKABLE) wxMB_DOCKABLE;
%rename(NO_FULL_REPAINT_ON_RESIZE) wxNO_FULL_REPAINT_ON_RESIZE;
%rename(LI_HORIZONTAL) wxLI_HORIZONTAL;
%rename(LI_VERTICAL) wxLI_VERTICAL;
%rename(WS_EX_VALIDATE_RECURSIVELY) wxWS_EX_VALIDATE_RECURSIVELY;
%rename(WS_EX_BLOCK_EVENTS) wxWS_EX_BLOCK_EVENTS;
%rename(WS_EX_TRANSIENT) wxWS_EX_TRANSIENT;
%rename(WS_EX_THEMED_BACKGROUND) wxWS_EX_THEMED_BACKGROUND;
%rename(WS_EX_PROCESS_IDLE) wxWS_EX_PROCESS_IDLE;
%rename(WS_EX_PROCESS_UI_UPDATES) wxWS_EX_PROCESS_UI_UPDATES;
%rename(MM_TEXT) wxMM_TEXT;
%rename(MM_LOMETRIC) wxMM_LOMETRIC;
%rename(MM_HIMETRIC) wxMM_HIMETRIC;
%rename(MM_LOENGLISH) wxMM_LOENGLISH;
%rename(MM_HIENGLISH) wxMM_HIENGLISH;
%rename(MM_TWIPS) wxMM_TWIPS;
%rename(MM_ISOTROPIC) wxMM_ISOTROPIC;
%rename(MM_ANISOTROPIC) wxMM_ANISOTROPIC;
%rename(MM_POINTS) wxMM_POINTS;
%rename(MM_METRIC) wxMM_METRIC;
%rename(CENTRE) wxCENTRE;
%rename(CENTER) wxCENTER;
%rename(HORIZONTAL) wxHORIZONTAL;
%rename(VERTICAL) wxVERTICAL;
%rename(BOTH) wxBOTH;
%rename(LEFT) wxLEFT;
%rename(RIGHT) wxRIGHT;
%rename(UP) wxUP;
%rename(DOWN) wxDOWN;
%rename(TOP) wxTOP;
%rename(BOTTOM) wxBOTTOM;
%rename(NORTH) wxNORTH;
%rename(SOUTH) wxSOUTH;
%rename(WEST) wxWEST;
%rename(EAST) wxEAST;
%rename(ALL) wxALL;
%rename(ALIGN_NOT) wxALIGN_NOT;
%rename(ALIGN_CENTER_HORIZONTAL) wxALIGN_CENTER_HORIZONTAL;
%rename(ALIGN_CENTRE_HORIZONTAL) wxALIGN_CENTRE_HORIZONTAL;
%rename(ALIGN_LEFT) wxALIGN_LEFT;
%rename(ALIGN_TOP) wxALIGN_TOP;
%rename(ALIGN_RIGHT) wxALIGN_RIGHT;
%rename(ALIGN_BOTTOM) wxALIGN_BOTTOM;
%rename(ALIGN_CENTER_VERTICAL) wxALIGN_CENTER_VERTICAL;
%rename(ALIGN_CENTRE_VERTICAL) wxALIGN_CENTRE_VERTICAL;
%rename(ALIGN_CENTER) wxALIGN_CENTER;
%rename(ALIGN_CENTRE) wxALIGN_CENTRE;
%rename(ALIGN_MASK) wxALIGN_MASK;
%rename(STRETCH_NOT) wxSTRETCH_NOT;
%rename(SHRINK) wxSHRINK;
%rename(GROW) wxGROW;
%rename(EXPAND) wxEXPAND;
%rename(SHAPED) wxSHAPED;
%rename(ADJUST_MINSIZE) wxADJUST_MINSIZE;
%rename(TILE) wxTILE;
%rename(BORDER_DEFAULT) wxBORDER_DEFAULT;
%rename(BORDER_NONE) wxBORDER_NONE;
%rename(BORDER_STATIC) wxBORDER_STATIC;
%rename(BORDER_SIMPLE) wxBORDER_SIMPLE;
%rename(BORDER_RAISED) wxBORDER_RAISED;
%rename(BORDER_SUNKEN) wxBORDER_SUNKEN;
%rename(BORDER_DOUBLE) wxBORDER_DOUBLE;
%rename(BORDER_MASK) wxBORDER_MASK;
%rename(DEFAULT) wxDEFAULT;
%rename(DECORATIVE) wxDECORATIVE;
%rename(ROMAN) wxROMAN;
%rename(SCRIPT) wxSCRIPT;
%rename(SWISS) wxSWISS;
%rename(MODERN) wxMODERN;
%rename(TELETYPE) wxTELETYPE;
%rename(VARIABLE) wxVARIABLE;
%rename(FIXED) wxFIXED;
%rename(NORMAL) wxNORMAL;
%rename(LIGHT) wxLIGHT;
%rename(BOLD) wxBOLD;
%rename(ITALIC) wxITALIC;
%rename(SLANT) wxSLANT;
%rename(SOLID) wxSOLID;
%rename(DOT) wxDOT;
%rename(LONG_DASH) wxLONG_DASH;
%rename(SHORT_DASH) wxSHORT_DASH;
%rename(DOT_DASH) wxDOT_DASH;
%rename(USER_DASH) wxUSER_DASH;
%rename(TRANSPARENT) wxTRANSPARENT;
%rename(STIPPLE) wxSTIPPLE;
%rename(BDIAGONAL_HATCH) wxBDIAGONAL_HATCH;
%rename(CROSSDIAG_HATCH) wxCROSSDIAG_HATCH;
%rename(FDIAGONAL_HATCH) wxFDIAGONAL_HATCH;
%rename(CROSS_HATCH) wxCROSS_HATCH;
%rename(HORIZONTAL_HATCH) wxHORIZONTAL_HATCH;
%rename(VERTICAL_HATCH) wxVERTICAL_HATCH;
%rename(JOIN_BEVEL) wxJOIN_BEVEL;
%rename(JOIN_MITER) wxJOIN_MITER;
%rename(JOIN_ROUND) wxJOIN_ROUND;
%rename(CAP_ROUND) wxCAP_ROUND;
%rename(CAP_PROJECTING) wxCAP_PROJECTING;
%rename(CAP_BUTT) wxCAP_BUTT;
%rename(CLEAR) wxCLEAR;
%rename(XOR) wxXOR;
%rename(INVERT) wxINVERT;
%rename(OR_REVERSE) wxOR_REVERSE;
%rename(AND_REVERSE) wxAND_REVERSE;
%rename(COPY) wxCOPY;
%rename(AND) wxAND;
%rename(AND_INVERT) wxAND_INVERT;
%rename(NO_OP) wxNO_OP;
%rename(NOR) wxNOR;
%rename(EQUIV) wxEQUIV;
%rename(SRC_INVERT) wxSRC_INVERT;
%rename(OR_INVERT) wxOR_INVERT;
%rename(NAND) wxNAND;
%rename(OR) wxOR;
%rename(SET) wxSET;
%rename(PAPER_NONE) wxPAPER_NONE;
%rename(PAPER_LETTER) wxPAPER_LETTER;
%rename(PAPER_LEGAL) wxPAPER_LEGAL;
%rename(PAPER_A4) wxPAPER_A4;
%rename(PAPER_CSHEET) wxPAPER_CSHEET;
%rename(PAPER_DSHEET) wxPAPER_DSHEET;
%rename(PAPER_ESHEET) wxPAPER_ESHEET;
%rename(PAPER_LETTERSMALL) wxPAPER_LETTERSMALL;
%rename(PAPER_TABLOID) wxPAPER_TABLOID;
%rename(PAPER_LEDGER) wxPAPER_LEDGER;
%rename(PAPER_STATEMENT) wxPAPER_STATEMENT;
%rename(PAPER_EXECUTIVE) wxPAPER_EXECUTIVE;
%rename(PAPER_A3) wxPAPER_A3;
%rename(PAPER_A4SMALL) wxPAPER_A4SMALL;
%rename(PAPER_A5) wxPAPER_A5;
%rename(PAPER_B4) wxPAPER_B4;
%rename(PAPER_B5) wxPAPER_B5;
%rename(PAPER_FOLIO) wxPAPER_FOLIO;
%rename(PAPER_QUARTO) wxPAPER_QUARTO;
%rename(PAPER_10X14) wxPAPER_10X14;
%rename(PAPER_11X17) wxPAPER_11X17;
%rename(PAPER_NOTE) wxPAPER_NOTE;
%rename(PAPER_ENV_9) wxPAPER_ENV_9;
%rename(PAPER_ENV_10) wxPAPER_ENV_10;
%rename(PAPER_ENV_11) wxPAPER_ENV_11;
%rename(PAPER_ENV_12) wxPAPER_ENV_12;
%rename(PAPER_ENV_14) wxPAPER_ENV_14;
%rename(PAPER_ENV_DL) wxPAPER_ENV_DL;
%rename(PAPER_ENV_C5) wxPAPER_ENV_C5;
%rename(PAPER_ENV_C3) wxPAPER_ENV_C3;
%rename(PAPER_ENV_C4) wxPAPER_ENV_C4;
%rename(PAPER_ENV_C6) wxPAPER_ENV_C6;
%rename(PAPER_ENV_C65) wxPAPER_ENV_C65;
%rename(PAPER_ENV_B4) wxPAPER_ENV_B4;
%rename(PAPER_ENV_B5) wxPAPER_ENV_B5;
%rename(PAPER_ENV_B6) wxPAPER_ENV_B6;
%rename(PAPER_ENV_ITALY) wxPAPER_ENV_ITALY;
%rename(PAPER_ENV_MONARCH) wxPAPER_ENV_MONARCH;
%rename(PAPER_ENV_PERSONAL) wxPAPER_ENV_PERSONAL;
%rename(PAPER_FANFOLD_US) wxPAPER_FANFOLD_US;
%rename(PAPER_FANFOLD_STD_GERMAN) wxPAPER_FANFOLD_STD_GERMAN;
%rename(PAPER_FANFOLD_LGL_GERMAN) wxPAPER_FANFOLD_LGL_GERMAN;
%rename(PAPER_ISO_B4) wxPAPER_ISO_B4;
%rename(PAPER_JAPANESE_POSTCARD) wxPAPER_JAPANESE_POSTCARD;
%rename(PAPER_9X11) wxPAPER_9X11;
%rename(PAPER_10X11) wxPAPER_10X11;
%rename(PAPER_15X11) wxPAPER_15X11;
%rename(PAPER_ENV_INVITE) wxPAPER_ENV_INVITE;
%rename(PAPER_LETTER_EXTRA) wxPAPER_LETTER_EXTRA;
%rename(PAPER_LEGAL_EXTRA) wxPAPER_LEGAL_EXTRA;
%rename(PAPER_TABLOID_EXTRA) wxPAPER_TABLOID_EXTRA;
%rename(PAPER_A4_EXTRA) wxPAPER_A4_EXTRA;
%rename(PAPER_LETTER_TRANSVERSE) wxPAPER_LETTER_TRANSVERSE;
%rename(PAPER_A4_TRANSVERSE) wxPAPER_A4_TRANSVERSE;
%rename(PAPER_LETTER_EXTRA_TRANSVERSE) wxPAPER_LETTER_EXTRA_TRANSVERSE;
%rename(PAPER_A_PLUS) wxPAPER_A_PLUS;
%rename(PAPER_B_PLUS) wxPAPER_B_PLUS;
%rename(PAPER_LETTER_PLUS) wxPAPER_LETTER_PLUS;
%rename(PAPER_A4_PLUS) wxPAPER_A4_PLUS;
%rename(PAPER_A5_TRANSVERSE) wxPAPER_A5_TRANSVERSE;
%rename(PAPER_B5_TRANSVERSE) wxPAPER_B5_TRANSVERSE;
%rename(PAPER_A3_EXTRA) wxPAPER_A3_EXTRA;
%rename(PAPER_A5_EXTRA) wxPAPER_A5_EXTRA;
%rename(PAPER_B5_EXTRA) wxPAPER_B5_EXTRA;
%rename(PAPER_A2) wxPAPER_A2;
%rename(PAPER_A3_TRANSVERSE) wxPAPER_A3_TRANSVERSE;
%rename(PAPER_A3_EXTRA_TRANSVERSE) wxPAPER_A3_EXTRA_TRANSVERSE;
%rename(DUPLEX_SIMPLEX) wxDUPLEX_SIMPLEX;
%rename(DUPLEX_HORIZONTAL) wxDUPLEX_HORIZONTAL;
%rename(DUPLEX_VERTICAL) wxDUPLEX_VERTICAL;
%rename(ITEM_SEPARATOR) wxITEM_SEPARATOR;
%rename(ITEM_NORMAL) wxITEM_NORMAL;
%rename(ITEM_CHECK) wxITEM_CHECK;
%rename(ITEM_RADIO) wxITEM_RADIO;
%rename(ITEM_MAX) wxITEM_MAX;
%rename(HT_NOWHERE) wxHT_NOWHERE;
%rename(HT_SCROLLBAR_FIRST) wxHT_SCROLLBAR_FIRST;
%rename(HT_SCROLLBAR_ARROW_LINE_1) wxHT_SCROLLBAR_ARROW_LINE_1;
%rename(HT_SCROLLBAR_ARROW_LINE_2) wxHT_SCROLLBAR_ARROW_LINE_2;
%rename(HT_SCROLLBAR_ARROW_PAGE_1) wxHT_SCROLLBAR_ARROW_PAGE_1;
%rename(HT_SCROLLBAR_ARROW_PAGE_2) wxHT_SCROLLBAR_ARROW_PAGE_2;
%rename(HT_SCROLLBAR_THUMB) wxHT_SCROLLBAR_THUMB;
%rename(HT_SCROLLBAR_BAR_1) wxHT_SCROLLBAR_BAR_1;
%rename(HT_SCROLLBAR_BAR_2) wxHT_SCROLLBAR_BAR_2;
%rename(HT_SCROLLBAR_LAST) wxHT_SCROLLBAR_LAST;
%rename(HT_WINDOW_OUTSIDE) wxHT_WINDOW_OUTSIDE;
%rename(HT_WINDOW_INSIDE) wxHT_WINDOW_INSIDE;
%rename(HT_WINDOW_VERT_SCROLLBAR) wxHT_WINDOW_VERT_SCROLLBAR;
%rename(HT_WINDOW_HORZ_SCROLLBAR) wxHT_WINDOW_HORZ_SCROLLBAR;
%rename(HT_WINDOW_CORNER) wxHT_WINDOW_CORNER;
%rename(HT_MAX) wxHT_MAX;
%rename(MOD_NONE) wxMOD_NONE;
%rename(MOD_ALT) wxMOD_ALT;
%rename(MOD_CONTROL) wxMOD_CONTROL;
%rename(MOD_SHIFT) wxMOD_SHIFT;
%rename(MOD_WIN) wxMOD_WIN;
%rename(UPDATE_UI_NONE) wxUPDATE_UI_NONE;
%rename(UPDATE_UI_RECURSE) wxUPDATE_UI_RECURSE;
%rename(UPDATE_UI_FROMIDLE) wxUPDATE_UI_FROMIDLE;
%rename(Object) wxObject;
%rename(BITMAP_TYPE_INVALID) wxBITMAP_TYPE_INVALID;
%rename(BITMAP_TYPE_BMP) wxBITMAP_TYPE_BMP;
%rename(BITMAP_TYPE_BMP_RESOURCE) wxBITMAP_TYPE_BMP_RESOURCE;
%rename(BITMAP_TYPE_RESOURCE) wxBITMAP_TYPE_RESOURCE;
%rename(BITMAP_TYPE_ICO) wxBITMAP_TYPE_ICO;
%rename(BITMAP_TYPE_ICO_RESOURCE) wxBITMAP_TYPE_ICO_RESOURCE;
%rename(BITMAP_TYPE_CUR) wxBITMAP_TYPE_CUR;
%rename(BITMAP_TYPE_CUR_RESOURCE) wxBITMAP_TYPE_CUR_RESOURCE;
%rename(BITMAP_TYPE_XBM) wxBITMAP_TYPE_XBM;
%rename(BITMAP_TYPE_XBM_DATA) wxBITMAP_TYPE_XBM_DATA;
%rename(BITMAP_TYPE_XPM) wxBITMAP_TYPE_XPM;
%rename(BITMAP_TYPE_XPM_DATA) wxBITMAP_TYPE_XPM_DATA;
%rename(BITMAP_TYPE_TIF) wxBITMAP_TYPE_TIF;
%rename(BITMAP_TYPE_TIF_RESOURCE) wxBITMAP_TYPE_TIF_RESOURCE;
%rename(BITMAP_TYPE_GIF) wxBITMAP_TYPE_GIF;
%rename(BITMAP_TYPE_GIF_RESOURCE) wxBITMAP_TYPE_GIF_RESOURCE;
%rename(BITMAP_TYPE_PNG) wxBITMAP_TYPE_PNG;
%rename(BITMAP_TYPE_PNG_RESOURCE) wxBITMAP_TYPE_PNG_RESOURCE;
%rename(BITMAP_TYPE_JPEG) wxBITMAP_TYPE_JPEG;
%rename(BITMAP_TYPE_JPEG_RESOURCE) wxBITMAP_TYPE_JPEG_RESOURCE;
%rename(BITMAP_TYPE_PNM) wxBITMAP_TYPE_PNM;
%rename(BITMAP_TYPE_PNM_RESOURCE) wxBITMAP_TYPE_PNM_RESOURCE;
%rename(BITMAP_TYPE_PCX) wxBITMAP_TYPE_PCX;
%rename(BITMAP_TYPE_PCX_RESOURCE) wxBITMAP_TYPE_PCX_RESOURCE;
%rename(BITMAP_TYPE_PICT) wxBITMAP_TYPE_PICT;
%rename(BITMAP_TYPE_PICT_RESOURCE) wxBITMAP_TYPE_PICT_RESOURCE;
%rename(BITMAP_TYPE_ICON) wxBITMAP_TYPE_ICON;
%rename(BITMAP_TYPE_ICON_RESOURCE) wxBITMAP_TYPE_ICON_RESOURCE;
%rename(BITMAP_TYPE_ANI) wxBITMAP_TYPE_ANI;
%rename(BITMAP_TYPE_IFF) wxBITMAP_TYPE_IFF;
%rename(BITMAP_TYPE_MACCURSOR) wxBITMAP_TYPE_MACCURSOR;
%rename(BITMAP_TYPE_MACCURSOR_RESOURCE) wxBITMAP_TYPE_MACCURSOR_RESOURCE;
%rename(BITMAP_TYPE_ANY) wxBITMAP_TYPE_ANY;
%rename(CURSOR_NONE) wxCURSOR_NONE;
%rename(CURSOR_ARROW) wxCURSOR_ARROW;
%rename(CURSOR_RIGHT_ARROW) wxCURSOR_RIGHT_ARROW;
%rename(CURSOR_BULLSEYE) wxCURSOR_BULLSEYE;
%rename(CURSOR_CHAR) wxCURSOR_CHAR;
%rename(CURSOR_CROSS) wxCURSOR_CROSS;
%rename(CURSOR_HAND) wxCURSOR_HAND;
%rename(CURSOR_IBEAM) wxCURSOR_IBEAM;
%rename(CURSOR_LEFT_BUTTON) wxCURSOR_LEFT_BUTTON;
%rename(CURSOR_MAGNIFIER) wxCURSOR_MAGNIFIER;
%rename(CURSOR_MIDDLE_BUTTON) wxCURSOR_MIDDLE_BUTTON;
%rename(CURSOR_NO_ENTRY) wxCURSOR_NO_ENTRY;
%rename(CURSOR_PAINT_BRUSH) wxCURSOR_PAINT_BRUSH;
%rename(CURSOR_PENCIL) wxCURSOR_PENCIL;
%rename(CURSOR_POINT_LEFT) wxCURSOR_POINT_LEFT;
%rename(CURSOR_POINT_RIGHT) wxCURSOR_POINT_RIGHT;
%rename(CURSOR_QUESTION_ARROW) wxCURSOR_QUESTION_ARROW;
%rename(CURSOR_RIGHT_BUTTON) wxCURSOR_RIGHT_BUTTON;
%rename(CURSOR_SIZENESW) wxCURSOR_SIZENESW;
%rename(CURSOR_SIZENS) wxCURSOR_SIZENS;
%rename(CURSOR_SIZENWSE) wxCURSOR_SIZENWSE;
%rename(CURSOR_SIZEWE) wxCURSOR_SIZEWE;
%rename(CURSOR_SIZING) wxCURSOR_SIZING;
%rename(CURSOR_SPRAYCAN) wxCURSOR_SPRAYCAN;
%rename(CURSOR_WAIT) wxCURSOR_WAIT;
%rename(CURSOR_WATCH) wxCURSOR_WATCH;
%rename(CURSOR_BLANK) wxCURSOR_BLANK;
%rename(CURSOR_DEFAULT) wxCURSOR_DEFAULT;
%rename(CURSOR_COPY_ARROW) wxCURSOR_COPY_ARROW;
%rename(CURSOR_ARROWWAIT) wxCURSOR_ARROWWAIT;
%rename(CURSOR_MAX) wxCURSOR_MAX;
%rename(Size) wxSize;
%rename(RealPoint) wxRealPoint;
%rename(Point) wxPoint;
%rename(Rect) wxRect;
%rename(IntersectRect) wxIntersectRect;
%rename(Point2D) wxPoint2D;
%rename(DefaultPosition) wxDefaultPosition;
%rename(DefaultSize) wxDefaultSize;
%rename(FromStart) wxFromStart;
%rename(FromCurrent) wxFromCurrent;
%rename(FromEnd) wxFromEnd;
%rename(OutputStream) wxOutputStream;
%rename(FSFile) wxFSFile;
%rename(FileSystem) wxFileSystem;
%rename(FileSystem_URLToFileName) wxFileSystem_URLToFileName;
%rename(InternetFSHandler) wxInternetFSHandler;
%rename(ZipFSHandler) wxZipFSHandler;
%rename(MemoryFSHandler) wxMemoryFSHandler;
%rename(ImageHandler) wxImageHandler;
%rename(ImageHistogram) wxImageHistogram;
%rename(Image) wxImage;
%rename(InitAllImageHandlers) wxInitAllImageHandlers;
%rename(NullImage) wxNullImage;
%rename(IMAGE_RESOLUTION_INCHES) wxIMAGE_RESOLUTION_INCHES;
%rename(IMAGE_RESOLUTION_CM) wxIMAGE_RESOLUTION_CM;
%rename(BMP_24BPP) wxBMP_24BPP;
%rename(BMP_8BPP) wxBMP_8BPP;
%rename(BMP_8BPP_GREY) wxBMP_8BPP_GREY;
%rename(BMP_8BPP_GRAY) wxBMP_8BPP_GRAY;
%rename(BMP_8BPP_RED) wxBMP_8BPP_RED;
%rename(BMP_8BPP_PALETTE) wxBMP_8BPP_PALETTE;
%rename(BMP_4BPP) wxBMP_4BPP;
%rename(BMP_1BPP) wxBMP_1BPP;
%rename(BMP_1BPP_BW) wxBMP_1BPP_BW;
%rename(BMPHandler) wxBMPHandler;
%rename(ICOHandler) wxICOHandler;
%rename(CURHandler) wxCURHandler;
%rename(ANIHandler) wxANIHandler;
%rename(PNGHandler) wxPNGHandler;
%rename(GIFHandler) wxGIFHandler;
%rename(PCXHandler) wxPCXHandler;
%rename(JPEGHandler) wxJPEGHandler;
%rename(PNMHandler) wxPNMHandler;
%rename(XPMHandler) wxXPMHandler;
%rename(TIFFHandler) wxTIFFHandler;
%rename(EvtHandler) wxEvtHandler;
%rename(EVENT_PROPAGATE_NONE) wxEVENT_PROPAGATE_NONE;
%rename(EVENT_PROPAGATE_MAX) wxEVENT_PROPAGATE_MAX;
%rename(NewEventType) wxNewEventType;
%rename(Event) wxEvent;
%rename(PropagationDisabler) wxPropagationDisabler;
%rename(PropagateOnce) wxPropagateOnce;
%rename(CommandEvent) wxCommandEvent;
%rename(NotifyEvent) wxNotifyEvent;
%rename(ScrollEvent) wxScrollEvent;
%rename(ScrollWinEvent) wxScrollWinEvent;
%rename(MOUSE_BTN_ANY) wxMOUSE_BTN_ANY;
%rename(MOUSE_BTN_NONE) wxMOUSE_BTN_NONE;
%rename(MOUSE_BTN_LEFT) wxMOUSE_BTN_LEFT;
%rename(MOUSE_BTN_MIDDLE) wxMOUSE_BTN_MIDDLE;
%rename(MOUSE_BTN_RIGHT) wxMOUSE_BTN_RIGHT;
%rename(MouseEvent) wxMouseEvent;
%rename(SetCursorEvent) wxSetCursorEvent;
%rename(KeyEvent) wxKeyEvent;
%rename(SizeEvent) wxSizeEvent;
%rename(MoveEvent) wxMoveEvent;
%rename(PaintEvent) wxPaintEvent;
%rename(NcPaintEvent) wxNcPaintEvent;
%rename(EraseEvent) wxEraseEvent;
%rename(FocusEvent) wxFocusEvent;
%rename(ChildFocusEvent) wxChildFocusEvent;
%rename(ActivateEvent) wxActivateEvent;
%rename(InitDialogEvent) wxInitDialogEvent;
%rename(MenuEvent) wxMenuEvent;
%rename(CloseEvent) wxCloseEvent;
%rename(ShowEvent) wxShowEvent;
%rename(IconizeEvent) wxIconizeEvent;
%rename(MaximizeEvent) wxMaximizeEvent;
%rename(DropFilesEvent) wxDropFilesEvent;
%rename(UPDATE_UI_PROCESS_ALL) wxUPDATE_UI_PROCESS_ALL;
%rename(UPDATE_UI_PROCESS_SPECIFIED) wxUPDATE_UI_PROCESS_SPECIFIED;
%rename(UpdateUIEvent) wxUpdateUIEvent;
%rename(SysColourChangedEvent) wxSysColourChangedEvent;
%rename(MouseCaptureChangedEvent) wxMouseCaptureChangedEvent;
%rename(DisplayChangedEvent) wxDisplayChangedEvent;
%rename(PaletteChangedEvent) wxPaletteChangedEvent;
%rename(QueryNewPaletteEvent) wxQueryNewPaletteEvent;
%rename(NavigationKeyEvent) wxNavigationKeyEvent;
%rename(WindowCreateEvent) wxWindowCreateEvent;
%rename(WindowDestroyEvent) wxWindowDestroyEvent;
%rename(ContextMenuEvent) wxContextMenuEvent;
%rename(IDLE_PROCESS_ALL) wxIDLE_PROCESS_ALL;
%rename(IDLE_PROCESS_SPECIFIED) wxIDLE_PROCESS_SPECIFIED;
%rename(IdleEvent) wxIdleEvent;
%rename(PyEvent) wxPyEvent;
%rename(PyCommandEvent) wxPyCommandEvent;
%rename(PYAPP_ASSERT_SUPPRESS) wxPYAPP_ASSERT_SUPPRESS;
%rename(PYAPP_ASSERT_EXCEPTION) wxPYAPP_ASSERT_EXCEPTION;
%rename(PYAPP_ASSERT_DIALOG) wxPYAPP_ASSERT_DIALOG;
%rename(PYAPP_ASSERT_LOG) wxPYAPP_ASSERT_LOG;
%rename(PRINT_WINDOWS) wxPRINT_WINDOWS;
%rename(PRINT_POSTSCRIPT) wxPRINT_POSTSCRIPT;
%rename(PyApp) wxPyApp;
%rename(Exit) wxExit;
%rename(Yield) wxYield;
%rename(YieldIfNeeded) wxYieldIfNeeded;
%rename(SafeYield) wxSafeYield;
%rename(WakeUpIdle) wxWakeUpIdle;
%rename(PostEvent) wxPostEvent;
%rename(App_CleanUp) wxApp_CleanUp;
%rename(GetApp) wxGetApp;
%rename(Window) wxWindow;
%rename(FindWindowById) wxFindWindowById;
%rename(FindWindowByName) wxFindWindowByName;
%rename(FindWindowByLabel) wxFindWindowByLabel;
%rename(Window_FromHWND) wxWindow_FromHWND;
%rename(Validator) wxValidator;
%rename(PyValidator) wxPyValidator;
%rename(DefaultValidator) wxDefaultValidator;
%rename(Menu) wxMenu;
%rename(MenuBar) wxMenuBar;
%rename(MenuItem) wxMenuItem;
%rename(Control) wxControl;
%rename(ItemContainer) wxItemContainer;
%rename(ControlWithItems) wxControlWithItems;
%rename(SizerItem) wxSizerItem;
%rename(Sizer) wxSizer;
%rename(PySizer) wxPySizer;
%rename(BoxSizer) wxBoxSizer;
%rename(StaticBoxSizer) wxStaticBoxSizer;
%rename(GridSizer) wxGridSizer;
%rename(FLEX_GROWMODE_NONE) wxFLEX_GROWMODE_NONE;
%rename(FLEX_GROWMODE_SPECIFIED) wxFLEX_GROWMODE_SPECIFIED;
%rename(FLEX_GROWMODE_ALL) wxFLEX_GROWMODE_ALL;
%rename(FlexGridSizer) wxFlexGridSizer;
%rename(GBPosition) wxGBPosition;
%rename(GBSpan) wxGBSpan;
%rename(DefaultSpan) wxDefaultSpan;
%rename(GBSizerItem) wxGBSizerItem;
%rename(GridBagSizer) wxGridBagSizer;
%rename(Left) wxLeft;
%rename(Top) wxTop;
%rename(Right) wxRight;
%rename(Bottom) wxBottom;
%rename(Width) wxWidth;
%rename(Height) wxHeight;
%rename(Centre) wxCentre;
%rename(Center) wxCenter;
%rename(CentreX) wxCentreX;
%rename(CentreY) wxCentreY;
%rename(Unconstrained) wxUnconstrained;
%rename(AsIs) wxAsIs;
%rename(PercentOf) wxPercentOf;
%rename(Above) wxAbove;
%rename(Below) wxBelow;
%rename(LeftOf) wxLeftOf;
%rename(RightOf) wxRightOf;
%rename(SameAs) wxSameAs;
%rename(Absolute) wxAbsolute;
%rename(IndividualLayoutConstraint) wxIndividualLayoutConstraint;
%rename(LayoutConstraints) wxLayoutConstraints;
#endif

View File

@@ -0,0 +1,47 @@
# Other names that need to be reverse-renamed for the old namespace
PyOnDemandOutputWindow
App
PySimpleApp
PyWidgetTester
App_GetMacSupportPCMenuShortcuts
App_GetMacAboutMenuItemId
App_GetMacPreferencesMenuItemId
App_GetMacExitMenuItemId
App_GetMacHelpMenuTitleName
App_SetMacSupportPCMenuShortcuts
App_SetMacAboutMenuItemId
App_SetMacPreferencesMenuItemId
App_SetMacExitMenuItemId
App_SetMacHelpMenuTitleName
App_GetComCtl32Version
Platform
USE_UNICODE
VERSION_STRING
MAJOR_VERSION
MINOR_VERSION
RELEASE_VERSION
SUBREL_VERSION
VERSION
RELEASE_NUMBER
PyDeadObjectError
CallAfter
FutureCall
NotebookPage
PyEventBinder
DLG_PNT
DLG_SZE
PyAssertionError
MemoryFSHandler_AddFile
# With the * on the end these will cause code to be added that
# will scan for other names in the source module tha have the
# given prefix and will put a reference in the local module.
EVT*
WXK*

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: help.i
// Name: _cshelp.i
// Purpose: Context sensitive help classes, and etc.
//
// Author: Robin Dunn
@@ -10,64 +10,52 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module help
// not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include "wxPython.h"
#include <wx/cshelp.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import windows.i
%import misc.i
%import controls.i
//----------------------------------------------------------------------
enum {
wxFRAME_EX_CONTEXTHELP,
wxDIALOG_EX_CONTEXTHELP,
wxID_CONTEXT_HELP,
wxEVT_HELP,
wxEVT_DETAILED_HELP,
};
%constant wxEventType wxEVT_HELP;
%constant wxEventType wxEVT_DETAILED_HELP;
%pragma(python) code = "
# Help events
def EVT_HELP(win, id, func):
win.Connect(id, -1, wxEVT_HELP, func)
def EVT_HELP_RANGE(win, id, id2, func):
win.Connect(id, id2, wxEVT_HELP, func)
def EVT_DETAILED_HELP(win, id, func):
win.Connect(id, -1, wxEVT_DETAILED_HELP, func)
def EVT_DETAILED_HELP_RANGE(win, id, id2, func):
win.Connect(id, id2, wxEVT_DETAILED_HELP, func)
"
%pythoncode {
EVT_HELP = wx.PyEventBinder( wxEVT_HELP, 1)
EVT_HELP_RANGE = wx.PyEventBinder( wxEVT_HELP, 2)
EVT_DETAILED_HELP = wx.PyEventBinder( wxEVT_DETAILED_HELP, 1)
EVT_DETAILED_HELP_RANGE = wx.PyEventBinder( wxEVT_DETAILED_HELP, 2)
}
//----------------------------------------------------------------------
// A help event is sent when the user clicks on a window in context-help mode.
class wxHelpEvent : public wxCommandEvent
{
public:
wxHelpEvent(wxEventType type = wxEVT_NULL,
wxWindowID id = 0,
wxWindowID winid = 0,
const wxPoint& pt = wxDefaultPosition);
const wxPoint& GetPosition();
// Position of event (in screen coordinates)
const wxPoint& GetPosition() const;
void SetPosition(const wxPoint& pos);
const wxString& GetLink();
// Optional link to further help
const wxString& GetLink() const;
void SetLink(const wxString& link);
const wxString& GetTarget();
// Optional target to display help in. E.g. a window specification
const wxString& GetTarget() const;
void SetTarget(const wxString& target);
};
@@ -87,17 +75,18 @@ public:
class wxContextHelpButton : public wxBitmapButton {
public:
%addtofunc wxContextHelpButton "self._setOORInfo(self)"
wxContextHelpButton(wxWindow* parent, wxWindowID id = wxID_CONTEXT_HELP,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
};
//----------------------------------------------------------------------
class wxHelpProvider
class wxHelpProvider
{
public:
static wxHelpProvider *Set(wxHelpProvider *helpProvider);
@@ -109,11 +98,11 @@ public:
void AddHelp(wxWindow *window, const wxString& text);
%name(AddHelpById)void AddHelp(wxWindowID id, const wxString& text);
%addmethods { void Destroy() { delete self; } }
%extend { void Destroy() { delete self; } }
};
//----------------------------------------------------------------------
class wxSimpleHelpProvider : public wxHelpProvider
@@ -139,10 +128,4 @@ public:
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// This file gets appended to the shadow class file.
//----------------------------------------------------------------------
%pragma(python) include="_helpextras.py";
//---------------------------------------------------------------------------

74
wxPython/src/_cursor.i Normal file
View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _cursor.i
// Purpose: SWIG interface for wxCursor
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
class wxCursor : public wxGDIObject
{
public:
%extend {
wxCursor(const wxString* cursorName, long flags, int hotSpotX=0, int hotSpotY=0) {
#ifdef __WXGTK__
wxCHECK_MSG(FALSE, NULL,
wxT("wxCursor constructor not implemented for wxGTK, use wxStockCursor, wxCursorFromImage, or wxCursorFromBits instead."));
#else
return new wxCursor(*cursorName, flags, hotSpotX, hotSpotY);
#endif
}
}
~wxCursor();
// alternate constructors
%name(StockCursor) wxCursor(int id);
%name(CursorFromImage) wxCursor(const wxImage& image);
%extend {
%name(CursorFromBits) wxCursor(PyObject* bits, int width, int height,
int hotSpotX=-1, int hotSpotY=-1,
PyObject* maskBits=0) {
char* bitsbuf;
char* maskbuf = NULL;
int length;
PyString_AsStringAndSize(bits, &bitsbuf, &length);
if (maskBits)
PyString_AsStringAndSize(maskBits, &maskbuf, &length);
return new wxCursor(bitsbuf, width, height, hotSpotX, hotSpotY, maskbuf);
}
}
// wxGDIImage methods
#ifdef __WXMSW__
long GetHandle();
void SetHandle(long handle);
#endif
bool Ok();
#ifdef __WXMSW__
int GetWidth();
int GetHeight();
int GetDepth();
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
void SetSize(const wxSize& size);
#endif
%pythoncode { def __nonzero__(self): return self.Ok() }
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

462
wxPython/src/_dataobj.i Normal file
View File

@@ -0,0 +1,462 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _dataobj.i
// Purpose: SWIG definitions for the Data Object classes
//
// Author: Robin Dunn
//
// Created: 31-October-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/dataobj.h>
%}
//---------------------------------------------------------------------------
%newgroup
enum wxDataFormatId
{
wxDF_INVALID,
wxDF_TEXT,
wxDF_BITMAP,
wxDF_METAFILE,
wxDF_SYLK,
wxDF_DIF,
wxDF_TIFF,
wxDF_OEMTEXT,
wxDF_DIB,
wxDF_PALETTE,
wxDF_PENDATA,
wxDF_RIFF,
wxDF_WAVE,
wxDF_UNICODETEXT,
wxDF_ENHMETAFILE,
wxDF_FILENAME,
wxDF_LOCALE,
wxDF_PRIVATE,
wxDF_HTML,
wxDF_MAX,
};
class wxDataFormat {
public:
wxDataFormat( wxDataFormatId type );
%name(CustomDataFormat) wxDataFormat(const wxString& format);
~wxDataFormat();
%nokwargs operator==;
%nokwargs operator!=;
bool operator==(wxDataFormatId format) const;
bool operator!=(wxDataFormatId format) const;
bool operator==(const wxDataFormat& format) const;
bool operator!=(const wxDataFormat& format) const;
void SetType(wxDataFormatId format);
wxDataFormatId GetType() const;
wxString GetId() const;
void SetId(const wxString& format);
};
%immutable;
const wxDataFormat wxFormatInvalid;
%mutable;
//---------------------------------------------------------------------------
// wxDataObject represents a piece of data which knows which formats it
// supports and knows how to render itself in each of them - GetDataHere(),
// and how to restore data from the buffer (SetData()).
//
// Although this class may be used directly (i.e. custom classes may be
// derived from it), in many cases it might be simpler to use either
// wxDataObjectSimple or wxDataObjectComposite classes.
//
// A data object may be "read only", i.e. support only GetData() functions or
// "read-write", i.e. support both GetData() and SetData() (in principle, it
// might be "write only" too, but this is rare). Moreover, it doesn't have to
// support the same formats in Get() and Set() directions: for example, a data
// object containing JPEG image might accept BMPs in GetData() because JPEG
// image may be easily transformed into BMP but not in SetData(). Accordingly,
// all methods dealing with formats take an additional "direction" argument
// which is either SET or GET and which tells the function if the format needs
// to be supported by SetData() or GetDataHere().
class wxDataObject {
public:
enum Direction {
Get = 0x01, // format is supported by GetDataHere()
Set = 0x02, // format is supported by SetData()
Both = 0x03 // format is supported by both (unused currently)
};
// wxDataObject(); // *** It's an ABC.
~wxDataObject();
// get the best suited format for rendering our data
virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const;
// get the number of formats we support
virtual size_t GetFormatCount(Direction dir = Get) const;
// returns TRUE if this format is supported
bool IsSupported(const wxDataFormat& format, Direction dir = Get) const;
// get the (total) size of data for the given format
virtual size_t GetDataSize(const wxDataFormat& format) const;
//-------------------------------------------------------------------
// TODO: Fix these three methods to do the right Pythonic things...
//-------------------------------------------------------------------
// return all formats in the provided array (of size GetFormatCount())
virtual void GetAllFormats(wxDataFormat *formats,
Direction dir = Get) const;
// copy raw data (in the specified format) to the provided buffer, return
// TRUE if data copied successfully, FALSE otherwise
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const;
// get data from the buffer of specified length (in the given format),
// return TRUE if the data was read successfully, FALSE otherwise
virtual bool SetData(const wxDataFormat& format,
size_t len, const void * buf);
};
//---------------------------------------------------------------------------
// wxDataObjectSimple is a wxDataObject which only supports one format (in
// both Get and Set directions, but you may return FALSE from GetDataHere() or
// SetData() if one of them is not supported). This is the simplest possible
// wxDataObject implementation.
//
// This is still an "abstract base class" (although it doesn't have any pure
// virtual functions), to use it you should derive from it and implement
// GetDataSize(), GetDataHere() and SetData() functions because the base class
// versions don't do anything - they just return "not implemented".
//
// This class should be used when you provide data in only one format (no
// conversion to/from other formats), either a standard or a custom one.
// Otherwise, you should use wxDataObjectComposite or wxDataObject directly.
class wxDataObjectSimple : public wxDataObject {
public:
wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid);
// get/set the format we support
const wxDataFormat& GetFormat();
void SetFormat(const wxDataFormat& format);
};
%{ // Create a new class for wxPython to use
class wxPyDataObjectSimple : public wxDataObjectSimple {
public:
wxPyDataObjectSimple(const wxDataFormat& format = wxFormatInvalid)
: wxDataObjectSimple(format) {}
DEC_PYCALLBACK_SIZET__const(GetDataSize);
bool GetDataHere(void *buf) const;
bool SetData(size_t len, const void *buf) const;
PYPRIVATE;
};
IMP_PYCALLBACK_SIZET__const(wxPyDataObjectSimple, wxDataObjectSimple, GetDataSize);
bool wxPyDataObjectSimple::GetDataHere(void *buf) const {
// We need to get the data for this object and write it to buf. I think
// the best way to do this for wxPython is to have the Python method
// return either a string or None and then act appropriately with the
// C++ version.
bool rval = FALSE;
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "GetDataHere")) {
PyObject* ro;
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
if (ro) {
rval = (ro != Py_None && PyString_Check(ro));
if (rval)
memcpy(buf, PyString_AsString(ro), PyString_Size(ro));
Py_DECREF(ro);
}
}
wxPyEndBlockThreads();
return rval;
}
bool wxPyDataObjectSimple::SetData(size_t len, const void *buf) const{
// For this one we simply need to make a string from buf and len
// and send it to the Python method.
bool rval = FALSE;
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "SetData")) {
PyObject* data = PyString_FromStringAndSize((char*)buf, len);
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", data));
Py_DECREF(data);
}
wxPyEndBlockThreads();
return rval;
}
%}
// Now define it for SWIG
class wxPyDataObjectSimple : public wxDataObjectSimple {
public:
%addtofunc wxPyDataObjectSimple "self._setCallbackInfo(self, PyDataObjectSimple)"
wxPyDataObjectSimple(const wxDataFormat& format = wxFormatInvalid);
void _setCallbackInfo(PyObject* self, PyObject* _class);
};
//---------------------------------------------------------------------------
// wxDataObjectComposite is the simplest way to implement wxDataObject
// supporting multiple formats. It contains several wxDataObjectSimple and
// supports all formats supported by any of them.
//
class wxDataObjectComposite : public wxDataObject {
public:
wxDataObjectComposite();
%addtofunc Add "args[1].thisown = 0"
void Add(wxDataObjectSimple *dataObject, int preferred = FALSE);
};
//---------------------------------------------------------------------------
// wxTextDataObject contains text data
class wxTextDataObject : public wxDataObjectSimple {
public:
wxTextDataObject(const wxString& text = wxPyEmptyString);
size_t GetTextLength();
wxString GetText();
void SetText(const wxString& text);
};
%{ // Create a new class for wxPython to use
class wxPyTextDataObject : public wxTextDataObject {
public:
wxPyTextDataObject(const wxString& text = wxPyEmptyString)
: wxTextDataObject(text) {}
DEC_PYCALLBACK_SIZET__const(GetTextLength);
DEC_PYCALLBACK_STRING__const(GetText);
DEC_PYCALLBACK__STRING(SetText);
PYPRIVATE;
};
IMP_PYCALLBACK_SIZET__const(wxPyTextDataObject, wxTextDataObject, GetTextLength);
IMP_PYCALLBACK_STRING__const(wxPyTextDataObject, wxTextDataObject, GetText);
IMP_PYCALLBACK__STRING(wxPyTextDataObject, wxTextDataObject, SetText);
%}
// Now define it for SWIG
class wxPyTextDataObject : public wxTextDataObject {
public:
%addtofunc wxPyTextDataObject "self._setCallbackInfo(self, PyTextDataObject)"
wxPyTextDataObject(const wxString& text = wxPyEmptyString);
void _setCallbackInfo(PyObject* self, PyObject* _class);
};
//---------------------------------------------------------------------------
// wxBitmapDataObject contains a bitmap
class wxBitmapDataObject : public wxDataObjectSimple {
public:
wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap);
wxBitmap GetBitmap() const;
void SetBitmap(const wxBitmap& bitmap);
};
%{ // Create a new class for wxPython to use
class wxPyBitmapDataObject : public wxBitmapDataObject {
public:
wxPyBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap)
: wxBitmapDataObject(bitmap) {}
wxBitmap GetBitmap() const;
void SetBitmap(const wxBitmap& bitmap);
PYPRIVATE;
};
wxBitmap wxPyBitmapDataObject::GetBitmap() const {
wxBitmap* rval = &wxNullBitmap;
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "GetBitmap")) {
PyObject* ro;
wxBitmap* ptr;
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
if (ro) {
if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap")))
rval = ptr;
Py_DECREF(ro);
}
}
wxPyEndBlockThreads();
return *rval;
}
void wxPyBitmapDataObject::SetBitmap(const wxBitmap& bitmap) {
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "SetBitmap")) {
PyObject* bo = wxPyConstructObject((void*)&bitmap, wxT("wxBitmap"), false);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", bo));
Py_DECREF(bo);
}
wxPyEndBlockThreads();
}
%}
// Now define it for SWIG
class wxPyBitmapDataObject : public wxBitmapDataObject {
public:
%addtofunc wxPyBitmapDataObject "self._setCallbackInfo(self, PyBitmapDataObject)"
wxPyBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap);
void _setCallbackInfo(PyObject* self, PyObject* _class);
};
//---------------------------------------------------------------------------
// wxFileDataObject contains a list of filenames
class wxFileDataObject : public wxDataObjectSimple
{
public:
wxFileDataObject();
const wxArrayString& GetFilenames();
#ifdef __WXMSW__
void AddFile(const wxString &filename);
#endif
};
//---------------------------------------------------------------------------
// wxCustomDataObject contains arbitrary untyped user data.
// It is understood that this data can be copied bitwise.
class wxCustomDataObject : public wxDataObjectSimple {
public:
wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid);
//void TakeData(size_t size, void *data);
//bool SetData(size_t size, const void *buf);
%extend {
void TakeData(PyObject* data) {
if (PyString_Check(data)) {
// for Python we just call SetData here since we always need it to make a copy.
self->SetData(PyString_Size(data), PyString_AsString(data));
}
else {
// raise a TypeError if not a string
PyErr_SetString(PyExc_TypeError, "String expected.");
}
}
bool SetData(PyObject* data) {
if (PyString_Check(data)) {
return self->SetData(PyString_Size(data), PyString_AsString(data));
}
else {
// raise a TypeError if not a string
PyErr_SetString(PyExc_TypeError, "String expected.");
return FALSE;
}
}
}
size_t GetSize();
//void *GetData();
%extend {
PyObject* GetData() {
return PyString_FromStringAndSize((char*)self->GetData(), self->GetSize());
}
}
};
// TODO: Implement wxPyCustomDataObject allowing GetSize, GetData and SetData
// to be overloaded.
//---------------------------------------------------------------------------
class wxURLDataObject : public wxDataObjectComposite {
public:
wxURLDataObject();
wxString GetURL();
void SetURL(const wxString& url);
};
//---------------------------------------------------------------------------
#ifndef __WXGTK__
%{
#include <wx/metafile.h>
%}
class wxMetafileDataObject : public wxDataObjectSimple
{
public:
wxMetafileDataObject();
void SetMetafile(const wxMetafile& metafile);
wxMetafile GetMetafile() const;
};
#else
%{
class wxMetafileDataObject : public wxDataObjectSimple
{
public:
wxMetafileDataObject() { PyErr_SetNone(PyExc_NotImplementedError); }
};
%}
class wxMetafileDataObject : public wxDataObjectSimple
{
public:
wxMetafileDataObject();
};
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

View File

@@ -1,261 +1,54 @@
/////////////////////////////////////////////////////////////////////////////
// Name: utils.i
// Purpose: SWIG definitions of various utility classes
// Name: _datetime.i
// Purpose: SWIG interface for wxDateTime and etc.
//
// Author: Robin Dunn
//
// Created: 25-Nov-1998
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
%module utils
//---------------------------------------------------------------------------
%newgroup
%{
#include "helpers.h"
#include <wx/config.h>
#include <wx/fileconf.h>
#include <wx/datetime.h>
%}
//---------------------------------------------------------------------------
%{
// Put some wx default wxChar* values into wxStrings.
DECLARE_DEF_STRING2(DateFormatStr, wxT("%c"));
static const wxString wxPyEmptyString(wxT(""));
%}
//---------------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%pragma(python) code = "import wx"
DECLARE_DEF_STRING2(TimeSpanFormatStr, wxT("%H:%M:%S"));
%}
//---------------------------------------------------------------------------
%{
static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) {
PyObject* ret = PyTuple_New(3);
if (ret) {
PyTuple_SET_ITEM(ret, 0, PyInt_FromLong(flag));
#if wxUSE_UNICODE
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromWideChar(str.c_str(), str.Len()));
#else
PyTuple_SET_ITEM(ret, 1, PyString_FromStringAndSize(str.c_str(), str.Len()));
#endif
PyTuple_SET_ITEM(ret, 2, PyInt_FromLong(index));
}
return ret;
}
%}
//---------------------------------------------------------------------------
enum
{
wxCONFIG_USE_LOCAL_FILE,
wxCONFIG_USE_GLOBAL_FILE,
wxCONFIG_USE_RELATIVE_PATH,
wxCONFIG_USE_NO_ESCAPE_CHARACTERS
};
//---------------------------------------------------------------------------
class wxConfigBase {
public:
// wxConfigBase(const wxString& appName = wxPyEmptyString, **** An ABC
// const wxString& vendorName = wxPyEmptyString,
// const wxString& localFilename = wxPyEmptyString,
// const wxString& globalFilename = wxPyEmptyString,
// long style = 0);
~wxConfigBase();
enum EntryType
{
Type_Unknown,
Type_String,
Type_Boolean,
Type_Integer, // use Read(long *)
Type_Float // use Read(double *)
};
// static functions
// sets the config object, returns the previous pointer
static wxConfigBase *Set(wxConfigBase *pConfig);
// get the config object, creates it on demand unless DontCreateOnDemand
// was called
static wxConfigBase *Get(bool createOnDemand = TRUE);
// create a new config object: this function will create the "best"
// implementation of wxConfig available for the current platform, see
// comments near definition wxUSE_CONFIG_NATIVE for details. It returns
// the created object and also sets it as ms_pConfig.
static wxConfigBase *Create();
// should Get() try to create a new log object if the current one is NULL?
static void DontCreateOnDemand();
bool DeleteAll(); // This is supposed to have been fixed...
bool DeleteEntry(const wxString& key, bool bDeleteGroupIfEmpty = TRUE);
bool DeleteGroup(const wxString& key);
bool Exists(wxString& strName);
bool Flush(bool bCurrentOnly = FALSE);
wxString GetAppName();
// Each of these enumeration methods return a 3-tuple consisting of
// the continue flag, the value string, and the index for the next call.
%addmethods {
PyObject* GetFirstGroup() {
bool cont;
long index = 0;
wxString value;
cont = self->GetFirstGroup(value, index);
return __EnumerationHelper(cont, value, index);
}
PyObject* GetFirstEntry() {
bool cont;
long index = 0;
wxString value;
cont = self->GetFirstEntry(value, index);
return __EnumerationHelper(cont, value, index);
}
PyObject* GetNextGroup(long index) {
bool cont;
wxString value;
cont = self->GetNextGroup(value, index);
return __EnumerationHelper(cont, value, index);
}
PyObject* GetNextEntry(long index) {
bool cont;
wxString value;
cont = self->GetNextEntry(value, index);
return __EnumerationHelper(cont, value, index);
}
}
int GetNumberOfEntries(bool bRecursive = FALSE);
int GetNumberOfGroups(bool bRecursive = FALSE);
wxString GetPath();
wxString GetVendorName();
bool HasEntry(wxString& strName);
bool HasGroup(const wxString& strName);
bool IsExpandingEnvVars();
bool IsRecordingDefaults();
wxString Read(const wxString& key, const wxString& defaultVal = wxPyEmptyString);
%addmethods {
long ReadInt(const wxString& key, long defaultVal = 0) {
long rv;
self->Read(key, &rv, defaultVal);
return rv;
}
double ReadFloat(const wxString& key, double defaultVal = 0.0) {
double rv;
self->Read(key, &rv, defaultVal);
return rv;
}
bool ReadBool(const wxString& key, bool defaultVal = FALSE) {
bool rv;
self->Read(key, &rv, defaultVal);
return rv;
}
}
void SetExpandEnvVars (bool bDoIt = TRUE);
void SetPath(const wxString& strPath);
void SetRecordDefaults(bool bDoIt = TRUE);
void SetAppName(const wxString& appName);
void SetVendorName(const wxString& vendorName);
void SetStyle(long style);
long GetStyle();
bool Write(const wxString& key, const wxString& value);
%name(WriteInt)bool Write(const wxString& key, long value);
%name(WriteFloat)bool Write(const wxString& key, double value);
%name(WriteBool)bool Write(const wxString& key, bool value);
EntryType GetEntryType(const wxString& name);
bool RenameEntry(const wxString& oldName,
const wxString& newName);
bool RenameGroup(const wxString& oldName,
const wxString& newName);
wxString ExpandEnvVars(const wxString& str);
};
//---------------------------------------------------------------------------
// This will be a wxRegConfig on Win32 and wxFileConfig otherwise.
class wxConfig : public wxConfigBase {
public:
wxConfig(const wxString& appName = wxPyEmptyString,
const wxString& vendorName = wxPyEmptyString,
const wxString& localFilename = wxPyEmptyString,
const wxString& globalFilename = wxPyEmptyString,
long style = 0);
~wxConfig();
};
// Sometimes it's nice to explicitly have a wxFileConfig too.
class wxFileConfig : public wxConfigBase {
public:
wxFileConfig(const wxString& appName = wxPyEmptyString,
const wxString& vendorName = wxPyEmptyString,
const wxString& localFilename = wxPyEmptyString,
const wxString& globalFilename = wxPyEmptyString,
long style = 0);
~wxFileConfig();
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxDateTime;
class wxTimeSpan;
class wxDateSpan;
%typemap(python,in) wxDateTime::TimeZone& {
$target = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong($source));
%typemap(in) wxDateTime::TimeZone& {
$1 = new wxDateTime::TimeZone((wxDateTime::TZ)PyInt_AsLong($input));
}
%typemap(python,freearg) wxDateTime::TimeZone& {
if ($source) delete $source;
if ($1) delete $1;
}
%{
#define LOCAL *(new wxDateTime::TimeZone(wxDateTime::Local))
#define LOCAL_TZ wxDateTime::Local
%}
// Convert a wxLongLong to a Python Long by getting the hi/lo dwords, then
// shifting and oring them together
%typemap(python, out) wxLongLong {
PyObject *hi, *lo, *shifter, *shifted;
hi = PyLong_FromLong($source->GetHi());
lo = PyLong_FromLong($source->GetLo());
hi = PyLong_FromLong( $1.GetHi() );
lo = PyLong_FromLong( $1.GetLo() );
shifter = PyLong_FromLong(32);
shifted = PyNumber_Lshift(hi, shifter);
$target = PyNumber_Or(shifted, lo);
$result = PyNumber_Or(shifted, lo);
Py_DECREF(hi);
Py_DECREF(lo);
Py_DECREF(shifter);
@@ -263,16 +56,24 @@ class wxDateSpan;
}
//---------------------------------------------------------------------------
%noautorepr wxDateTime;
// wxDateTime represents an absolute moment in the time
class wxDateTime {
public:
typedef unsigned short wxDateTime_t;
enum TZ
{
// the time in the current time zone
Local,
// zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
// consequent numbers, so writing something like `GMT0 + offset' is
// safe if abs(offset) <= 12
// underscore stands for minus
GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
GMT0,
@@ -315,13 +116,141 @@ public:
// for GMT
UTC = GMT0
};
// the calendar systems we know about: notice that it's valid (for
// this classes purpose anyhow) to work with any of these calendars
// even with the dates before the historical appearance of the
// calendar
enum Calendar
{
Gregorian, // current calendar
Julian // calendar in use since -45 until the 1582 (or later)
};
// these values only are used to identify the different dates of
// adoption of the Gregorian calendar (see IsGregorian())
//
// All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
// by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html
// except for the comments "we take".
//
// Symbol "->" should be read as "was followed by" in the comments
// which follow.
enum GregorianAdoption
{
Gr_Unknown, // no data for this country or it's too uncertain to use
Gr_Standard, // on the day 0 of Gregorian calendar: 15 Oct 1582
Gr_Alaska, // Oct 1867 when Alaska became part of the USA
Gr_Albania, // Dec 1912
Gr_Austria = Gr_Unknown, // Different regions on different dates
Gr_Austria_Brixen, // 5 Oct 1583 -> 16 Oct 1583
Gr_Austria_Salzburg = Gr_Austria_Brixen,
Gr_Austria_Tyrol = Gr_Austria_Brixen,
Gr_Austria_Carinthia, // 14 Dec 1583 -> 25 Dec 1583
Gr_Austria_Styria = Gr_Austria_Carinthia,
Gr_Belgium, // Then part of the Netherlands
Gr_Bulgaria = Gr_Unknown, // Unknown precisely (from 1915 to 1920)
Gr_Bulgaria_1, // 18 Mar 1916 -> 1 Apr 1916
Gr_Bulgaria_2, // 31 Mar 1916 -> 14 Apr 1916
Gr_Bulgaria_3, // 3 Sep 1920 -> 17 Sep 1920
Gr_Canada = Gr_Unknown, // Different regions followed the changes in
// Great Britain or France
Gr_China = Gr_Unknown, // Different authorities say:
Gr_China_1, // 18 Dec 1911 -> 1 Jan 1912
Gr_China_2, // 18 Dec 1928 -> 1 Jan 1929
Gr_Czechoslovakia, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584
Gr_Denmark, // (including Norway) 18 Feb 1700 -> 1 Mar 1700
Gr_Egypt, // 1875
Gr_Estonia, // 1918
Gr_Finland, // Then part of Sweden
Gr_France, // 9 Dec 1582 -> 20 Dec 1582
Gr_France_Alsace, // 4 Feb 1682 -> 16 Feb 1682
Gr_France_Lorraine, // 16 Feb 1760 -> 28 Feb 1760
Gr_France_Strasbourg, // February 1682
Gr_Germany = Gr_Unknown, // Different states on different dates:
Gr_Germany_Catholic, // 1583-1585 (we take 1584)
Gr_Germany_Prussia, // 22 Aug 1610 -> 2 Sep 1610
Gr_Germany_Protestant, // 18 Feb 1700 -> 1 Mar 1700
Gr_GreatBritain, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)')
Gr_Greece, // 9 Mar 1924 -> 23 Mar 1924
Gr_Hungary, // 21 Oct 1587 -> 1 Nov 1587
Gr_Ireland = Gr_GreatBritain,
Gr_Italy = Gr_Standard,
Gr_Japan = Gr_Unknown, // Different authorities say:
Gr_Japan_1, // 19 Dec 1872 -> 1 Jan 1873
Gr_Japan_2, // 19 Dec 1892 -> 1 Jan 1893
Gr_Japan_3, // 18 Dec 1918 -> 1 Jan 1919
Gr_Latvia, // 1915-1918 (we take 1915)
Gr_Lithuania, // 1915
Gr_Luxemburg, // 14 Dec 1582 -> 25 Dec 1582
Gr_Netherlands = Gr_Belgium, // (including Belgium) 1 Jan 1583
// this is too weird to take into account: the Gregorian calendar was
// introduced twice in Groningen, first time 28 Feb 1583 was followed
// by 11 Mar 1583, then it has gone back to Julian in the summer of
// 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is
// the date we take here
Gr_Netherlands_Groningen, // 13 Dec 1700 -> 12 Jan 1701
Gr_Netherlands_Gelderland, // 30 Jun 1700 -> 12 Jul 1700
Gr_Netherlands_Utrecht, // (and Overijssel) 30 Nov 1700->12 Dec 1700
Gr_Netherlands_Friesland, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701
Gr_Norway = Gr_Denmark, // Then part of Denmark
Gr_Poland = Gr_Standard,
Gr_Portugal = Gr_Standard,
Gr_Romania, // 31 Mar 1919 -> 14 Apr 1919
Gr_Russia, // 31 Jan 1918 -> 14 Feb 1918
Gr_Scotland = Gr_GreatBritain,
Gr_Spain = Gr_Standard,
// Sweden has a curious history. Sweden decided to make a gradual
// change from the Julian to the Gregorian calendar. By dropping every
// leap year from 1700 through 1740 the eleven superfluous days would
// be omitted and from 1 Mar 1740 they would be in sync with the
// Gregorian calendar. (But in the meantime they would be in sync with
// nobody!)
//
// So 1700 (which should have been a leap year in the Julian calendar)
// was not a leap year in Sweden. However, by mistake 1704 and 1708
// became leap years. This left Sweden out of synchronisation with
// both the Julian and the Gregorian world, so they decided to go back
// to the Julian calendar. In order to do this, they inserted an extra
// day in 1712, making that year a double leap year! So in 1712,
// February had 30 days in Sweden.
//
// Later, in 1753, Sweden changed to the Gregorian calendar by
// dropping 11 days like everyone else.
Gr_Sweden = Gr_Finland, // 17 Feb 1753 -> 1 Mar 1753
Gr_Switzerland = Gr_Unknown,// Different cantons used different dates
Gr_Switzerland_Catholic, // 1583, 1584 or 1597 (we take 1584)
Gr_Switzerland_Protestant, // 31 Dec 1700 -> 12 Jan 1701
Gr_Turkey, // 1 Jan 1927
Gr_USA = Gr_GreatBritain,
Gr_Wales = Gr_GreatBritain,
Gr_Yugoslavia // 1919
};
// the country parameter is used so far for calculating the start and
// the end of DST period and for deciding whether the date is a work
// day or not
enum Country
{
Country_Unknown, // no special information for this country
@@ -376,11 +305,17 @@ public:
};
//** Nested class TimeZone is handled by a typemap instead
//** Is nested class Tm needed?
// static methods
// ------------------------------------------------------------------------
// set the current country
static void SetCountry(Country country);
// get the current country
static Country GetCountry();
@@ -414,9 +349,9 @@ public:
// get the number of the days in the given month (default value for
// the year means the current one)
%name(GetNumberOfDaysInMonth)
static wxDateTime_t GetNumberOfDays(Month month,
int year = Inv_Year,
Calendar cal = Gregorian);
static wxDateTime_t GetNumberOfDays(Month month,
int year = Inv_Year,
Calendar cal = Gregorian);
// get the full (default) or abbreviated month name in the current
// locale, returns empty string on error
@@ -463,20 +398,20 @@ public:
// constructors
wxDateTime();
%name(wxDateTimeFromTimeT)wxDateTime(time_t timet);
%name(wxDateTimeFromJDN)wxDateTime(double jdn);
%name(wxDateTimeFromHMS)wxDateTime(wxDateTime_t hour,
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
%name(wxDateTimeFromDMY)wxDateTime(wxDateTime_t day,
Month month = Inv_Month,
int year = Inv_Year,
wxDateTime_t hour = 0,
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
%name(DateTimeFromTimeT)wxDateTime(time_t timet);
%name(DateTimeFromJDN)wxDateTime(double jdn);
%name(DateTimeFromHMS)wxDateTime(wxDateTime_t hour,
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
%name(DateTimeFromDMY)wxDateTime(wxDateTime_t day,
Month month = Inv_Month,
int year = Inv_Year,
wxDateTime_t hour = 0,
wxDateTime_t minute = 0,
wxDateTime_t second = 0,
wxDateTime_t millisec = 0);
~wxDateTime();
// ------------------------------------------------------------------------
@@ -649,40 +584,40 @@ public:
inline time_t GetTicks() const;
// get the year (returns Inv_Year if date is invalid)
int GetYear(const wxDateTime::TimeZone& tz = LOCAL) const;
int GetYear(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the month (Inv_Month if date is invalid)
Month GetMonth(const wxDateTime::TimeZone& tz = LOCAL) const;
Month GetMonth(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the month day (in 1..31 range, 0 if date is invalid)
wxDateTime_t GetDay(const wxDateTime::TimeZone& tz = LOCAL) const;
wxDateTime_t GetDay(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the day of the week (Inv_WeekDay if date is invalid)
WeekDay GetWeekDay(const wxDateTime::TimeZone& tz = LOCAL) const;
WeekDay GetWeekDay(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the hour of the day
wxDateTime_t GetHour(const wxDateTime::TimeZone& tz = LOCAL) const;
wxDateTime_t GetHour(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the minute
wxDateTime_t GetMinute(const wxDateTime::TimeZone& tz = LOCAL) const;
wxDateTime_t GetMinute(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the second
wxDateTime_t GetSecond(const wxDateTime::TimeZone& tz = LOCAL) const;
wxDateTime_t GetSecond(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get milliseconds
wxDateTime_t GetMillisecond(const wxDateTime::TimeZone& tz = LOCAL) const;
wxDateTime_t GetMillisecond(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the day since the year start (1..366, 0 if date is invalid)
wxDateTime_t GetDayOfYear(const wxDateTime::TimeZone& tz = LOCAL) const;
wxDateTime_t GetDayOfYear(const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the week number since the year start (1..52 or 53, 0 if date is
// invalid)
wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First,
const wxDateTime::TimeZone& tz = LOCAL) const;
const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// get the week number since the month start (1..5, 0 if date is
// invalid)
wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First,
const wxDateTime::TimeZone& tz = LOCAL) const;
const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// is this date a work day? This depends on a country, of course,
// because the holidays are different in different countries
@@ -694,7 +629,7 @@ public:
// NB: this function shouldn't be considered as absolute authority in
// the matter. Besides, for some countries the exact date of
// adoption of the Gregorian calendar is simply unknown.
//bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const;
// bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const;
// ------------------------------------------------------------------------
@@ -744,45 +679,50 @@ public:
wxTimeSpan Subtract(const wxDateTime& dt) const;
%addmethods {
wxDateTime __add__TS(const wxTimeSpan& other) { return *self + other; }
wxDateTime __add__DS(const wxDateSpan& other) { return *self + other; }
%nokwargs operator+=;
// add a time span (positive or negative)
inline wxDateTime& operator+=(const wxTimeSpan& diff);
// add a date span (positive or negative)
inline wxDateTime& operator+=(const wxDateSpan& diff);
wxTimeSpan __sub__DT(const wxDateTime& other) { return *self - other; }
wxDateTime __sub__TS(const wxTimeSpan& other) { return *self - other; }
wxDateTime __sub__DS(const wxDateSpan& other) { return *self - other; }
%nokwargs operator-=;
// subtract a time span (positive or negative)
inline wxDateTime& operator-=(const wxTimeSpan& diff);
// subtract a date span (positive or negative)
inline wxDateTime& operator-=(const wxDateSpan& diff);
int __cmp__(const wxDateTime* other) {
if (! other) return -1;
if (*self < *other) return -1;
if (*self == *other) return 0;
return 1;
}
%nokwargs __add__;
%nokwargs __sub__;
%nokwargs __lt__;
%nokwargs __le__;
%nokwargs __gt__;
%nokwargs __ge__;
%nokwargs __eq__;
%nokwargs __ne__;
%extend {
wxDateTime __add__(const wxTimeSpan& other) { return *self + other; }
wxDateTime __add__(const wxDateSpan& other) { return *self + other; }
wxTimeSpan __sub__(const wxDateTime& other) { return *self - other; }
wxDateTime __sub__(const wxTimeSpan& other) { return *self - other; }
wxDateTime __sub__(const wxDateSpan& other) { return *self - other; }
bool __lt__(const wxDateTime& other) { return *self < other; }
bool __le__(const wxDateTime& other) { return *self <= other; }
bool __gt__(const wxDateTime& other) { return *self > other; }
bool __ge__(const wxDateTime& other) { return *self >= other; }
bool __eq__(const wxDateTime& other) { return *self == other; }
bool __ne__(const wxDateTime& other) { return *self != other; }
}
%pragma(python) addtoclass = "
def __add__(self, other):
if isinstance(other, wxTimeSpanPtr):
return self.__add__TS(other)
if isinstance(other, wxDateSpanPtr):
return self.__add__DS(other)
raise TypeError, 'Invalid r.h.s. type for __add__'
def __sub__(self, other):
if isinstance(other, wxDateTimePtr):
return self.__sub__DT(other)
if isinstance(other, wxTimeSpanPtr):
return self.__sub__TS(other)
if isinstance(other, wxDateSpanPtr):
return self.__sub__DS(other)
raise TypeError, 'Invalid r.h.s. type for __sub__'
"
// ------------------------------------------------------------------------
// conversion from text: all conversions from text return -1 on failure,
// or the index in the string where the next character following the date
// specification (i.e. the one where the scan had to stop) is located.
%addmethods {
%extend {
// parse a string in RFC 822 format (found e.g. in mail headers and
// having the form "Wed, 10 Feb 1999 19:07:07 +0100")
@@ -846,7 +786,7 @@ public:
// for the current locale) and returns the string containing the
// resulting text representation
wxString Format(const wxString& format = wxPyDateFormatStr,
const wxDateTime::TimeZone& tz = LOCAL) const;
const wxDateTime::TimeZone& tz = LOCAL_TZ) const;
// preferred date representation for the current locale
wxString FormatDate() const;
@@ -862,22 +802,26 @@ public:
// (HH:MM:SS)
wxString FormatISOTime() const;
%pragma(python) addtoclass = "
%pythoncode {
def __repr__(self):
return '<wxDateTime: \"%s\" at %s>' % ( self.Format(), self.this)
def __str__(self):
return self.Format()
"
}
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%noautorepr wxTimeSpan;
// This class contains a difference between 2 wxDateTime values, so it makes
// sense to add it to wxDateTime and it is the result of subtraction of 2
// objects of that class. See also wxDateSpan.
class wxTimeSpan
{
public:
// return the timespan for the given number of seconds
static wxTimeSpan Seconds(long sec);
static wxTimeSpan Second();
@@ -930,23 +874,29 @@ public:
// object
inline wxTimeSpan Abs() const;
%addmethods {
wxTimeSpan& operator+=(const wxTimeSpan& diff);
wxTimeSpan& operator-=(const wxTimeSpan& diff);
wxTimeSpan& operator*=(int n);
wxTimeSpan& operator-();
%extend {
wxTimeSpan __add__(const wxTimeSpan& other) { return *self + other; }
wxTimeSpan __sub__(const wxTimeSpan& other) { return *self - other; }
wxTimeSpan __mul__(int n) { return *self * n; }
wxTimeSpan __rmul__(int n) { return n * *self; }
wxTimeSpan __neg__() { return self->Negate(); }
int __cmp__(const wxTimeSpan* other) {
if (! other) return -1;
if (*self < *other) return -1;
if (*self == *other) return 0;
return 1;
}
bool __lt__(const wxTimeSpan& other) { return *self < other; }
bool __le__(const wxTimeSpan& other) { return *self <= other; }
bool __gt__(const wxTimeSpan& other) { return *self > other; }
bool __ge__(const wxTimeSpan& other) { return *self >= other; }
bool __eq__(const wxTimeSpan& other) { return *self == other; }
bool __ne__(const wxTimeSpan& other) { return *self != other; }
}
// comparaison (see also operator versions below)
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// is the timespan null?
bool IsNull() const;
@@ -996,26 +946,52 @@ public:
// resulting text representation. Notice that only some of format
// specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
// minutes and seconds make sense, but not "PM/AM" string for example.
wxString Format(const wxString& format = wxPyDateFormatStr) const;
wxString Format(const wxString& format = wxPyTimeSpanFormatStr) const;
// // preferred date representation for the current locale
// wxString FormatDate() const;
// // preferred time representation for the current locale
// wxString FormatTime() const;
// %pragma(python) addtoclass = "
// def __repr__(self):
// return '<wxTimeSpan: \"%s\" at %s>' % ( self.Format(), self.this)
// def __str__(self):
// return self.Format()
// "
%pythoncode {
def __repr__(self):
return '<wxTimeSpan: \"%s\" at %s>' % ( self.Format(), self.this)
def __str__(self):
return self.Format()
}
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// This class is a "logical time span" and is useful for implementing program
// logic for such things as "add one month to the date" which, in general,
// doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
// the next month (to understand that this is indeed different consider adding
// one month to Feb, 15 - we want to get Mar, 15, of course).
//
// When adding a month to the date, all lesser components (days, hours, ...)
// won't be changed unless the resulting date would be invalid: for example,
// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
//
// Because of this feature, adding and subtracting back again the same
// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
// month will be Jan 28, not Jan 31!
//
// wxDateSpan can be either positive or negative. They may be
// multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1
// month and 1 day) is 2 months and 2 days. They can be added together and
// with wxDateTime or wxTimeSpan, but the type of result is different for each
// case.
//
// Beware about weeks: if you specify both weeks and days, the total number of
// days added will be 7*weeks + days! See also GetTotalDays() function.
//
// Equality operators are defined for wxDateSpans. Two datespans are equal if
// they both give the same target date when added to *every* source date.
// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because
// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is
// equal to wxDateSpan::Weeks(2)
//
// Finally, notice that for adding hours, minutes &c you don't need this
// class: wxTimeSpan will do the job because there are no subtleties
// associated with those.
class wxDateSpan
{
public:
@@ -1084,16 +1060,30 @@ public:
// multiply all components by a (signed) number
inline wxDateSpan& Multiply(int factor);
%addmethods {
inline wxDateSpan& operator+=(const wxDateSpan& other);
inline wxDateSpan& operator-=(const wxDateSpan& other);
wxDateSpan& operator-() { return Neg(); }
inline wxDateSpan& operator*=(int factor) { return Multiply(factor); }
%extend {
wxDateSpan __add__(const wxDateSpan& other) { return *self + other; }
wxDateSpan __sub__(const wxDateSpan& other) { return *self - other; }
wxDateSpan __mul__(int n) { return *self * n; }
wxDateSpan __rmul__(int n) { return n * *self; }
wxDateSpan __neg__() { return self->Negate(); }
// bool __lt__(const wxDateSpan& other) { return *self < other; }
// bool __le__(const wxDateSpan& other) { return *self <= other; }
// bool __gt__(const wxDateSpan& other) { return *self > other; }
// bool __ge__(const wxDateSpan& other) { return *self >= other; }
bool __eq__(const wxDateSpan& other) { return *self == other; }
bool __ne__(const wxDateSpan& other) { return *self != other; }
}
};
//---------------------------------------------------------------------------
// TODO: wxDateTimeHolidayAuthority
//---------------------------------------------------------------------------
long wxGetLocalTime();
@@ -1103,9 +1093,3 @@ wxLongLong wxGetLocalTimeMillis();
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%init %{
%}
//---------------------------------------------------------------------------

727
wxPython/src/_dc.i Normal file
View File

@@ -0,0 +1,727 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _dc.i
// Purpose: SWIG interface defs for wxDC and releated classes
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include "wx/wxPython/pydrawxxx.h"
%}
// TODO: 1. wrappers for wxDrawObject and wxDC::DrawObject
//---------------------------------------------------------------------------
%typemap(in) (int points, wxPoint* points_array ) {
$2 = wxPoint_LIST_helper($input, &$1);
if ($2 == NULL) SWIG_fail;
}
%typemap(freearg) (int points, wxPoint* points_array ) {
if ($2) delete [] $2;
}
//---------------------------------------------------------------------------
%newgroup;
// wxDC is the device context - object on which any drawing is done
class wxDC : public wxObject {
public:
// wxDC(); **** abstract base class, can't instantiate.
~wxDC();
virtual void BeginDrawing();
virtual void EndDrawing();
// virtual void DrawObject(wxDrawObject* drawobject);
#if 0 // The old way
bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
//bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
%extend {
wxColour GetPixel(wxCoord x, wxCoord y) {
wxColour col;
self->GetPixel(x, y, &col);
return col;
}
}
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
void CrossHair(wxCoord x, wxCoord y);
void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
void DrawPoint(wxCoord x, wxCoord y);
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = FALSE);
void DrawText(const wxString& text, wxCoord x, wxCoord y);
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = FALSE,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
#else // The new way
%name(FloodFillXY) bool FloodFill(wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE);
bool FloodFill(const wxPoint& pt, const wxColour& col, int style = wxFLOOD_SURFACE);
//%name(GetPixelXY) bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const;
//bool GetPixel(const wxPoint& pt, wxColour *col) const;
%extend {
wxColour GetPixelXY(wxCoord x, wxCoord y) {
wxColour col;
self->GetPixel(x, y, &col);
return col;
}
wxColour GetPixel(const wxPoint& pt) {
wxColour col;
self->GetPixel(pt, &col);
return col;
}
}
%name(DrawLineXY) void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
%name(CrossHairXY) void CrossHair(wxCoord x, wxCoord y);
void CrossHair(const wxPoint& pt);
%name(DrawArcXY) void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc);
void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre);
%name(DrawCheckMarkXY) void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawCheckMark(const wxRect& rect);
%name(DrawEllipticArcXY) void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea);
void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, double sa, double ea);
%name(DrawPointXY) void DrawPoint(wxCoord x, wxCoord y);
void DrawPoint(const wxPoint& pt);
%name(DrawRectangleXY) void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawRectangle(const wxPoint& pt, const wxSize& sz);
%name(DrawRectangleRect) void DrawRectangle(const wxRect& rect);
%name(DrawRoundedRectangleXY) void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius);
void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius);
%name(DrawRoundedRectangleRect) void DrawRoundedRectangle(const wxRect& r, double radius);
%name(DrawCircleXY) void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
void DrawCircle(const wxPoint& pt, wxCoord radius);
%name(DrawEllipseXY) void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawEllipse(const wxPoint& pt, const wxSize& sz);
%name(DrawEllipseRect) void DrawEllipse(const wxRect& rect);
%name(DrawIconXY) void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
void DrawIcon(const wxIcon& icon, const wxPoint& pt);
%name(DrawBitmapXY) void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask = FALSE);
void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, bool useMask = FALSE);
%name(DrawTextXY) void DrawText(const wxString& text, wxCoord x, wxCoord y);
void DrawText(const wxString& text, const wxPoint& pt);
%name(DrawRotatedTextXY) void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle);
%name(BlitXY) bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = FALSE,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
bool Blit(const wxPoint& destPt, const wxSize& sz,
wxDC *source, const wxPoint& srcPt,
int rop = wxCOPY, bool useMask = FALSE,
const wxPoint& srcPtMask = wxDefaultPosition);
#endif
void DrawLines(int points, wxPoint* points_array, wxCoord xoffset = 0, wxCoord yoffset = 0);
void DrawPolygon(int points, wxPoint* points_array,
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE);
// this version puts both optional bitmap and the text into the given
// rectangle and aligns is as specified by alignment parameter; it also
// will emphasize the character with the given index if it is != -1 and
// return the bounding rectangle if required
void DrawLabel(const wxString& text, const wxRect& rect,
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
int indexAccel = -1);
%extend {
wxRect DrawImageLabel(const wxString& text,
const wxBitmap& image,
const wxRect& rect,
int alignment = wxALIGN_LEFT | wxALIGN_TOP,
int indexAccel = -1) {
wxRect rv;
self->DrawLabel(text, image, rect, alignment, indexAccel, &rv);
return rv;
}
}
void DrawSpline(int points, wxPoint* points_array);
// global DC operations
// --------------------
virtual void Clear();
virtual bool StartDoc(const wxString& message);
virtual void EndDoc();
virtual void StartPage();
virtual void EndPage();
// set objects to use for drawing
// ------------------------------
virtual void SetFont(const wxFont& font);
virtual void SetPen(const wxPen& pen);
virtual void SetBrush(const wxBrush& brush);
virtual void SetBackground(const wxBrush& brush);
virtual void SetBackgroundMode(int mode);
virtual void SetPalette(const wxPalette& palette);
// clipping region
// ---------------
void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
//void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
%name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
%name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
virtual void DestroyClippingRegion();
void GetClippingBox(wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT) const;
%extend {
wxRect GetClippingRect() {
wxRect rect;
self->GetClippingBox(rect);
return rect;
}
}
// text extent
// -----------
virtual wxCoord GetCharHeight() const;
virtual wxCoord GetCharWidth() const;
// only works for single line strings
void GetTextExtent(const wxString& string, wxCoord *OUTPUT, wxCoord *OUTPUT);
%name(GetFullTextExtent)void GetTextExtent(const wxString& string,
wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord* OUTPUT,
wxFont* font = NULL);
// works for single as well as multi-line strings
void GetMultiLineTextExtent(const wxString& text, wxCoord *OUTPUT, wxCoord *OUTPUT, wxCoord *OUTPUT,
wxFont *font = NULL);
// size and resolution
// -------------------
// in device units
%name(GetSizeTuple)void GetSize(int* OUTPUT, int* OUTPUT);
wxSize GetSize();
// in mm
%name(GetSizeMMWH)void GetSizeMM(int* OUTPUT, int* OUTPUT) const;
wxSize GetSizeMM() const;
// coordinates conversions
// -----------------------
// This group of functions does actual conversion of the input, as you'd
// expect.
wxCoord DeviceToLogicalX(wxCoord x) const;
wxCoord DeviceToLogicalY(wxCoord y) const;
wxCoord DeviceToLogicalXRel(wxCoord x) const;
wxCoord DeviceToLogicalYRel(wxCoord y) const;
wxCoord LogicalToDeviceX(wxCoord x) const;
wxCoord LogicalToDeviceY(wxCoord y) const;
wxCoord LogicalToDeviceXRel(wxCoord x) const;
wxCoord LogicalToDeviceYRel(wxCoord y) const;
// query DC capabilities
// ---------------------
virtual bool CanDrawBitmap() const;
virtual bool CanGetTextExtent() const;
// colour depth
virtual int GetDepth() const;
// Resolution in Pixels per inch
virtual wxSize GetPPI() const;
virtual bool Ok() const;
int GetBackgroundMode() const;
const wxBrush& GetBackground() const;
const wxBrush& GetBrush() const;
const wxFont& GetFont() const;
const wxPen& GetPen() const;
const wxColour& GetTextBackground() const;
const wxColour& GetTextForeground() const;
virtual void SetTextForeground(const wxColour& colour);
virtual void SetTextBackground(const wxColour& colour);
int GetMapMode() const;
virtual void SetMapMode(int mode);
virtual void GetUserScale(double *OUTPUT, double *OUTPUT) const;
virtual void SetUserScale(double x, double y);
virtual void GetLogicalScale(double *OUTPUT, double *OUTPUT);
virtual void SetLogicalScale(double x, double y);
%name(GetLogicalOriginTuple) void GetLogicalOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const;
wxPoint GetLogicalOrigin() const;
virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
%name(GetDeviceOriginTuple) void GetDeviceOrigin(wxCoord *OUTPUT, wxCoord *OUTPUT) const;
wxPoint GetDeviceOrigin() const;
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
int GetLogicalFunction() const;
virtual void SetLogicalFunction(int function);
virtual void SetOptimization(bool opt);
virtual bool GetOptimization();
// bounding box
// ------------
virtual void CalcBoundingBox(wxCoord x, wxCoord y);
void ResetBoundingBox();
// Get the final bounding box of the PostScript or Metafile picture.
wxCoord MinX() const;
wxCoord MaxX() const;
wxCoord MinY() const;
wxCoord MaxY() const;
%extend {
void GetBoundingBox(int* OUTPUT, int* OUTPUT, int* OUTPUT, int* OUTPUT);
// See below for implementation
}
%pythoncode { def __nonzero__(self): return self.Ok() };
%extend { // See drawlist.cpp for impplementaion of these...
PyObject* _DrawPointList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
{
return wxPyDrawXXXList(*self, wxPyDrawXXXPoint, pyCoords, pyPens, pyBrushes);
}
PyObject* _DrawLineList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
{
return wxPyDrawXXXList(*self, wxPyDrawXXXLine, pyCoords, pyPens, pyBrushes);
}
PyObject* _DrawRectangleList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
{
return wxPyDrawXXXList(*self, wxPyDrawXXXRectangle, pyCoords, pyPens, pyBrushes);
}
PyObject* _DrawEllipseList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
{
return wxPyDrawXXXList(*self, wxPyDrawXXXEllipse, pyCoords, pyPens, pyBrushes);
}
PyObject* _DrawPolygonList(PyObject* pyCoords, PyObject* pyPens, PyObject* pyBrushes)
{
return wxPyDrawXXXList(*self, wxPyDrawXXXPolygon, pyCoords, pyPens, pyBrushes);
}
PyObject* _DrawTextList(PyObject* textList, PyObject* pyPoints,
PyObject* foregroundList, PyObject* backgroundList) {
return wxPyDrawTextList(*self, textList, pyPoints, foregroundList, backgroundList);
}
}
%pythoncode {
def DrawPointList(self, points, pens=None):
if pens is None:
pens = []
elif isinstance(pens, wx.Pen):
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, wx.Pen):
pens = [pens]
elif len(pens) != len(lines):
raise ValueError('lines and pens must have same length')
return self._DrawLineList(lines, pens, [])
def DrawRectangleList(self, rectangles, pens=None, brushes=None):
if pens is None:
pens = []
elif isinstance(pens, wx.Pen):
pens = [pens]
elif len(pens) != len(rectangles):
raise ValueError('rectangles and pens must have same length')
if brushes is None:
brushes = []
elif isinstance(brushes, wx.Brush):
brushes = [brushes]
elif len(brushes) != len(rectangles):
raise ValueError('rectangles and brushes must have same length')
return self._DrawRectangleList(rectangles, pens, brushes)
def DrawEllipseList(self, ellipses, pens=None, brushes=None):
if pens is None:
pens = []
elif isinstance(pens, wx.Pen):
pens = [pens]
elif len(pens) != len(ellipses):
raise ValueError('ellipses and pens must have same length')
if brushes is None:
brushes = []
elif isinstance(brushes, wx.Brush):
brushes = [brushes]
elif len(brushes) != len(ellipses):
raise ValueError('ellipses and brushes must have same length')
return self._DrawEllipseList(ellipses, pens, brushes)
def DrawPolygonList(self, polygons, pens=None, brushes=None):
## Note: This does not currently support fill style or offset
## you can always use the non-List version if need be.
if pens is None:
pens = []
elif isinstance(pens, wx.Pen):
pens = [pens]
elif len(pens) != len(polygons):
raise ValueError('polygons and pens must have same length')
if brushes is None:
brushes = []
elif isinstance(brushes, wx.Brush):
brushes = [brushes]
elif len(brushes) != len(polygons):
raise ValueError('polygons and brushes must have same length')
return self._DrawPolygonList(polygons, pens, brushes)
def DrawTextList(self, textList, coords, foregrounds = None, backgrounds = None, fonts = None):
## NOTE: this does not currently support changing the font
## Make sure you set Background mode to wxSolid (DC.SetBackgroundMode)
## If you want backgounds to do anything.
if type(textList) == type(''):
textList = [textList]
elif len(textList) != len(coords):
raise ValueError('textlist and coords must have same length')
if foregrounds is None:
foregrounds = []
elif isinstance(foregrounds, wxColour):
foregrounds = [foregrounds]
elif len(foregrounds) != len(coords):
raise ValueError('foregrounds and coords must have same length')
if backgrounds is None:
backgrounds = []
elif isinstance(backgrounds, wxColour):
backgrounds = [backgrounds]
elif len(backgrounds) != len(coords):
raise ValueError('backgrounds and coords must have same length')
return self._DrawTextList(textList, coords, foregrounds, backgrounds)
}
};
%{
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();
}
%}
//---------------------------------------------------------------------------
%newgroup
class wxMemoryDC : public wxDC {
public:
wxMemoryDC();
%name(MemoryDCFromDC) wxMemoryDC(wxDC* oldDC);
void SelectObject(const wxBitmap& bitmap);
};
//---------------------------------------------------------------------------
%newgroup
class wxBufferedDC : public wxMemoryDC
{
public:
%addtofunc wxBufferedDC( wxDC *dc, const wxBitmap &buffer )
"self._dc = args[0] # save a ref so the other dc will not be deleted before self";
%addtofunc wxBufferedDC( wxDC *dc, const wxSize &area )
"val._dc = args[0] # save a ref so the other dc will not be deleted before self";
// Construct a wxBufferedDC using a user supplied buffer.
wxBufferedDC( wxDC *dc, const wxBitmap &buffer );
// Construct a wxBufferedDC with an internal buffer of 'area'
// (where area is usually something like the size of the window
// being buffered)
%name(BufferedDCInternalBuffer) wxBufferedDC( wxDC *dc, const wxSize &area );
// Blits the buffer to the dc, and detaches the dc from
// the buffer. Usually called in the dtor or by the dtor
// of derived classes if the BufferedDC must blit before
// the derived class (which may own the dc it's blitting
// to) is destroyed.
void UnMask();
};
class wxBufferedPaintDC : public wxBufferedDC
{
public:
wxBufferedPaintDC( wxWindow *window, const wxBitmap &buffer = wxNullBitmap );
};
//---------------------------------------------------------------------------
%newgroup
class wxScreenDC : public wxDC {
public:
wxScreenDC();
%name(StartDrawingOnTopWin) bool StartDrawingOnTop(wxWindow* window);
bool StartDrawingOnTop(wxRect* rect = NULL);
bool EndDrawingOnTop();
};
//---------------------------------------------------------------------------
%newgroup
class wxClientDC : public wxDC {
public:
wxClientDC(wxWindow* win);
};
//---------------------------------------------------------------------------
%newgroup
class wxPaintDC : public wxDC {
public:
wxPaintDC(wxWindow* win);
};
//---------------------------------------------------------------------------
%newgroup
class wxWindowDC : public wxDC {
public:
wxWindowDC(wxWindow* win);
};
//---------------------------------------------------------------------------
%newgroup
class wxMirrorDC : public wxDC
{
public:
// constructs a mirror DC associated with the given real DC
//
// if mirror parameter is true, all vertical and horizontal coordinates are
// exchanged, otherwise this class behaves in exactly the same way as a
// plain DC
//
wxMirrorDC(wxDC& dc, bool mirror);
};
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/dcps.h>
%}
class wxPostScriptDC : public wxDC {
public:
wxPostScriptDC(const wxPrintData& printData);
// %name(PostScriptDC2)wxPostScriptDC(const wxString& output,
// bool interactive = TRUE,
// wxWindow* parent = NULL);
wxPrintData& GetPrintData();
void SetPrintData(const wxPrintData& data);
static void SetResolution(int ppi);
static int GetResolution();
};
//---------------------------------------------------------------------------
%newgroup
#ifdef __WXMSW__
%{
#include <wx/metafile.h>
%}
class wxMetaFile : public wxObject {
public:
wxMetaFile(const wxString& filename = wxPyEmptyString);
~wxMetaFile();
bool Ok();
bool SetClipboard(int width = 0, int height = 0);
wxSize GetSize();
int GetWidth();
int GetHeight();
const wxString& GetFileName() const;
%pythoncode { def __nonzero__(self): return self.Ok() }
};
// bool wxMakeMetaFilePlaceable(const wxString& filename,
// int minX, int minY, int maxX, int maxY, float scale=1.0);
class wxMetaFileDC : public wxDC {
public:
wxMetaFileDC(const wxString& filename = wxPyEmptyString,
int width = 0, int height = 0,
const wxString& description = wxPyEmptyString);
wxMetaFile* Close();
};
#else // Make some dummies for the other platforms
%{
class wxMetaFile : public wxObject {
public:
wxMetaFile(const wxString&)
{ PyErr_SetNone(PyExc_NotImplementedError); }
};
class wxMetaFileDC : public wxClientDC {
public:
wxMetaFileDC(const wxString&, int, int, const wxString&)
{ PyErr_SetNone(PyExc_NotImplementedError); }
};
%}
class wxMetaFile : public wxObject {
public:
wxMetaFile(const wxString& filename = wxPyEmptyString);
};
class wxMetaFileDC : public wxDC {
public:
wxMetaFileDC(const wxString& filename = wxPyEmptyString,
int width = 0, int height = 0,
const wxString& description = wxPyEmptyString);
};
#endif
//---------------------------------------------------------------------------
#if defined(__WXMSW__) || defined(__WXMAC__)
class wxPrinterDC : public wxDC {
public:
wxPrinterDC(const wxPrintData& printData);
// %name(PrinterDC2) wxPrinterDC(const wxString& driver,
// const wxString& device,
// const wxString& output,
// bool interactive = TRUE,
// int orientation = wxPORTRAIT);
};
#else
%{
class wxPrinterDC : public wxClientDC {
public:
wxPrinterDC(const wxPrintData&)
{ PyErr_SetNone(PyExc_NotImplementedError); }
// wxPrinterDC(const wxString&, const wxString&, const wxString&, bool, int)
// { PyErr_SetNone(PyExc_NotImplementedError); }
};
%}
class wxPrinterDC : public wxDC {
public:
wxPrinterDC(const wxPrintData& printData);
// %name(PrinterDC2) wxPrinterDC(const wxString& driver,
// const wxString& device,
// const wxString& output,
// bool interactive = TRUE,
// int orientation = wxPORTRAIT);
};
#endif
//---------------------------------------------------------------------------

View File

@@ -13,165 +13,68 @@
//---------------------------------------------------------------------------
// Forward declares...
// some type definitions to simplify things for SWIG
class wxAcceleratorEntry;
class wxAcceleratorTable;
class wxActivateEvent;
class wxBitmapButton;
class wxBitmap;
class wxBrush;
class wxButton;
class wxCalculateLayoutEvent;
class wxCaret;
class wxCheckBox;
class wxCheckListBox;
class wxChoice;
class wxClientDC;
class wxCloseEvent;
class wxColourData;
class wxColourDialog;
class wxColour;
class wxComboBox;
class wxCommandEvent;
class wxConfig;
class wxControl;
class wxCursor;
class wxDC;
class wxDialog;
class wxDirDialog;
class wxDropFilesEvent;
class wxEraseEvent;
class wxEvent;
class wxEvtHandler;
class wxFileDialog;
class wxFocusEvent;
class wxFontData;
class wxFontDialog;
class wxFont;
class wxFrame;
class wxGauge;
class wxGridCell;
class wxGridEvent;
class wxGrid;
class wxIconizeEvent;
class wxIcon;
class wxIdleEvent;
class wxImageList;
class wxIndividualLayoutConstraint;
class wxInitDialogEvent;
class wxJoystickEvent;
class wxKeyEvent;
class wxLayoutAlgorithm;
class wxLayoutConstraints;
class wxListBox;
class wxListCtrl;
class wxListEvent;
class wxListItem;
class wxMDIChildFrame;
class wxMDIClientWindow;
class wxMDIParentFrame;
class wxMask;
class wxMaximizeEvent;
class wxMemoryDC;
class wxMenuBar;
class wxMenuEvent;
class wxMenuItem;
class wxMenu;
class wxMessageDialog;
class wxMetaFileDC;
class wxMiniFrame;
class wxMouseEvent;
class wxMoveEvent;
class wxNotebookEvent;
class wxNotebook;
class wxPageSetupData;
class wxPageSetupDialog;
class wxPaintDC;
class wxPaintEvent;
class wxPalette;
class wxPanel;
class wxPen;
class wxPoint;
class wxPostScriptDC;
class wxPrintData;
class wxPrintDialog;
class wxPrinterDC;
class wxQueryLayoutInfoEvent;
class wxRadioBox;
class wxRadioButton;
class wxRealPoint;
class wxRect;
class wxRegionIterator;
class wxRegion;
class wxSashEvent;
class wxSashLayoutWindow;
class wxSashWindow;
class wxScreenDC;
class wxScrollBar;
class wxScrollEvent;
class wxScrollWinEvent;
class wxScrolledWindow;
class wxShowEvent;
class wxSingleChoiceDialog;
class wxSizeEvent;
class wxSize;
class wxSlider;
class wxSpinButton;
class wxSpinEvent;
class wxSplitterWindow;
class wxStaticBitmap;
class wxStaticBox;
class wxStaticText;
class wxStatusBar;
class wxSysColourChangedEvent;
class wxTaskBarIcon;
class wxTextCtrl;
class wxTextEntryDialog;
class wxTimer;
class wxToolBarTool;
class wxToolBar;
class wxToolTip;
class wxTreeCtrl;
class wxTreeEvent;
class wxTreeItemData;
class wxTreeItemId;
class wxUpdateUIEvent;
class wxWindowDC;
class wxWindow;
class wxSizer;
class wxBoxSizer;
class wxStaticBoxSizer;
class wxPyApp;
class wxPyMenu;
class wxPyTimer;
//---------------------------------------------------------------------------
// some definitions for SWIG only
typedef unsigned char byte;
typedef short int WXTYPE;
typedef int wxWindowID;
typedef unsigned int uint;
typedef signed int EBool;
typedef unsigned int size_t
typedef unsigned int time_t
typedef int wxPrintQuality;
typedef int wxCoord;
typedef char wxChar;
typedef int wxInt32;
typedef unsigned int wxUint32;
typedef int wxEventType;
typedef unsigned int size_t;
typedef unsigned int time_t;
typedef unsigned char byte;
//----------------------------------------------------------------------
// Various SWIG macros and such
#define %addtofunc %feature("addtofunc")
#define %kwargs %feature("kwargs")
#define %nokwargs %feature("nokwargs")
#define %noautorepr %feature("noautorepr")
#ifndef %shadow
#define %shadow %insert("shadow")
#endif
#ifndef %pythoncode
#define %pythoncode %insert("python")
#endif
#define WXUNUSED(x) x
// Given the name of a wxChar (or wxString) constant in C++, make
// a static wxString for wxPython, and also let SWIG wrap it.
%define MAKE_CONST_WXSTRING(strname)
%{ static const wxString wxPy##strname(wx##strname); %}
%immutable;
%name(strname) const wxString wxPy##strname;
%mutable;
%enddef
// Generate code in the module init for the event types, since they may not be
// initialized yet when they are used in the static swig_const_table.
%typemap(consttab) wxEventType; // TODO: how to prevent code inserted into the consttab?
%typemap(constcode) wxEventType "PyDict_SetItemString(d, \"$symname\", PyInt_FromLong($value));";
%define %newgroup
%pythoncode {
%#---------------------------------------------------------------------------
}
%enddef
//---------------------------------------------------------------------------
// General numeric #define's and etc. Making them all enums makes SWIG use the
// real macro when making the Python Int
enum {
wxMAJOR_VERSION,
wxMINOR_VERSION,
wxRELEASE_NUMBER,
// wxMAJOR_VERSION,
// wxMINOR_VERSION,
// wxRELEASE_NUMBER,
wxNOT_FOUND,
@@ -192,9 +95,6 @@ enum {
wxTAB_TRAVERSAL,
wxWANTS_CHARS,
wxPOPUP_WINDOW,
wxHORIZONTAL,
wxVERTICAL,
wxBOTH,
wxCENTER_FRAME,
wxCENTRE_ON_SCREEN,
wxCENTER_ON_SCREEN,
@@ -238,18 +138,6 @@ enum {
wxCOLOURED,
wxFIXED_LENGTH,
wxALIGN_LEFT,
wxALIGN_CENTER_HORIZONTAL,
wxALIGN_CENTRE_HORIZONTAL,
wxALIGN_RIGHT,
wxALIGN_BOTTOM,
wxALIGN_CENTER_VERTICAL,
wxALIGN_CENTRE_VERTICAL,
wxALIGN_TOP,
wxALIGN_CENTER,
wxALIGN_CENTRE,
wxSHAPED,
wxADJUST_MINSIZE,
wxLB_NEEDED_SB,
wxLB_ALWAYS_SB,
@@ -272,10 +160,6 @@ enum {
wxRA_SPECIFY_COLS,
wxRB_GROUP,
wxRB_SINGLE,
wxGA_PROGRESSBAR,
wxGA_HORIZONTAL,
wxGA_VERTICAL,
wxGA_SMOOTH,
wxSL_HORIZONTAL,
wxSL_VERTICAL,
wxSL_AUTOTICKS,
@@ -291,14 +175,6 @@ enum {
wxST_SIZEGRIP,
wxST_NO_AUTORESIZE,
wxBU_NOAUTODRAW,
wxBU_AUTODRAW,
wxBU_LEFT,
wxBU_TOP,
wxBU_RIGHT,
wxBU_BOTTOM,
wxBU_EXACTFIT,
wxFLOOD_SURFACE,
wxFLOOD_BORDER,
wxODDEVEN_RULE,
@@ -332,8 +208,6 @@ enum {
wxSETUP,
wxCENTRE,
wxCENTER,
wxSIZE_AUTO_WIDTH,
wxSIZE_AUTO_HEIGHT,
wxSIZE_AUTO,
@@ -349,6 +223,7 @@ enum {
wxID_ANY,
wxID_SEPARATOR,
wxID_LOWEST,
wxID_OPEN,
wxID_CLOSE,
wxID_NEW,
@@ -421,6 +296,8 @@ enum {
wxID_RETRY,
wxID_IGNORE,
wxID_HIGHEST,
wxOPEN,
wxSAVE,
wxHIDE_READONLY,
@@ -447,37 +324,10 @@ enum {
wxMENU_TEAROFF,
wxMB_DOCKABLE,
wxNO_FULL_REPAINT_ON_RESIZE,
wxFULL_REPAINT_ON_RESIZE,
wxLEFT,
wxRIGHT,
wxUP,
wxDOWN,
wxALL,
wxTOP,
wxBOTTOM,
wxNORTH,
wxSOUTH,
wxEAST,
wxWEST,
wxSTRETCH_NOT,
wxSHRINK,
wxGROW,
wxEXPAND,
wxLI_HORIZONTAL,
wxLI_VERTICAL,
wxJOYSTICK1,
wxJOYSTICK2,
wxJOY_BUTTON1,
wxJOY_BUTTON2,
wxJOY_BUTTON3,
wxJOY_BUTTON4,
wxJOY_BUTTON_ANY,
wxWS_EX_VALIDATE_RECURSIVELY,
wxWS_EX_BLOCK_EVENTS,
wxWS_EX_TRANSIENT,
@@ -499,15 +349,6 @@ enum {
wxMM_POINTS,
wxMM_METRIC,
wxTIMER_CONTINUOUS,
wxTIMER_ONE_SHOT,
// the symbolic names for the mouse buttons
wxMOUSE_BTN_ANY,
wxMOUSE_BTN_NONE,
wxMOUSE_BTN_LEFT,
wxMOUSE_BTN_MIDDLE,
wxMOUSE_BTN_RIGHT,
// It looks like wxTabCtrl may rise from the dead. Uncomment these if
// it gets an implementation for all platforms...
@@ -523,6 +364,69 @@ enum {
};
enum wxGeometryCentre
{
wxCENTRE = 0x0001,
wxCENTER = wxCENTRE
};
enum wxOrientation
{
wxHORIZONTAL,
wxVERTICAL,
wxBOTH
};
enum wxDirection
{
wxLEFT,
wxRIGHT,
wxUP,
wxDOWN,
wxTOP,
wxBOTTOM,
wxNORTH,
wxSOUTH,
wxWEST,
wxEAST,
wxALL
};
enum wxAlignment
{
wxALIGN_NOT,
wxALIGN_CENTER_HORIZONTAL,
wxALIGN_CENTRE_HORIZONTAL,
wxALIGN_LEFT,
wxALIGN_TOP,
wxALIGN_RIGHT,
wxALIGN_BOTTOM,
wxALIGN_CENTER_VERTICAL,
wxALIGN_CENTRE_VERTICAL,
wxALIGN_CENTER,
wxALIGN_CENTRE,
wxALIGN_MASK,
};
enum wxStretch
{
wxSTRETCH_NOT,
wxSHRINK,
wxGROW,
wxEXPAND,
wxSHAPED,
wxADJUST_MINSIZE,
wxTILE,
};
enum wxBorder
{
wxBORDER_DEFAULT,
@@ -536,16 +440,6 @@ enum wxBorder
};
// // Standard error codes
// enum ErrCode
// {
// ERR_PARAM = (-4000),
// ERR_NODATA,
// ERR_CANCEL,
// ERR_SUCCESS = 0
// };
enum {
wxDEFAULT ,
wxDECORATIVE,
@@ -718,83 +612,6 @@ enum wxKeyCode {
};
// Bitmap flags
enum wxBitmapType
{
wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility!
wxBITMAP_TYPE_BMP,
wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_ICO,
wxBITMAP_TYPE_ICO_RESOURCE,
wxBITMAP_TYPE_CUR,
wxBITMAP_TYPE_CUR_RESOURCE,
wxBITMAP_TYPE_XBM,
wxBITMAP_TYPE_XBM_DATA,
wxBITMAP_TYPE_XPM,
wxBITMAP_TYPE_XPM_DATA,
wxBITMAP_TYPE_TIF,
wxBITMAP_TYPE_TIF_RESOURCE,
wxBITMAP_TYPE_GIF,
wxBITMAP_TYPE_GIF_RESOURCE,
wxBITMAP_TYPE_PNG,
wxBITMAP_TYPE_PNG_RESOURCE,
wxBITMAP_TYPE_JPEG,
wxBITMAP_TYPE_JPEG_RESOURCE,
wxBITMAP_TYPE_PNM,
wxBITMAP_TYPE_PNM_RESOURCE,
wxBITMAP_TYPE_PCX,
wxBITMAP_TYPE_PCX_RESOURCE,
wxBITMAP_TYPE_PICT,
wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_ANI,
wxBITMAP_TYPE_IFF,
wxBITMAP_TYPE_MACCURSOR,
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_ANY = 50
};
// Standard cursors
enum wxStockCursor
{
wxCURSOR_NONE,
wxCURSOR_ARROW,
wxCURSOR_RIGHT_ARROW,
wxCURSOR_BULLSEYE,
wxCURSOR_CHAR,
wxCURSOR_CROSS,
wxCURSOR_HAND,
wxCURSOR_IBEAM,
wxCURSOR_LEFT_BUTTON,
wxCURSOR_MAGNIFIER,
wxCURSOR_MIDDLE_BUTTON,
wxCURSOR_NO_ENTRY,
wxCURSOR_PAINT_BRUSH,
wxCURSOR_PENCIL,
wxCURSOR_POINT_LEFT,
wxCURSOR_POINT_RIGHT,
wxCURSOR_QUESTION_ARROW,
wxCURSOR_RIGHT_BUTTON,
wxCURSOR_SIZENESW,
wxCURSOR_SIZENS,
wxCURSOR_SIZENWSE,
wxCURSOR_SIZEWE,
wxCURSOR_SIZING,
wxCURSOR_SPRAYCAN,
wxCURSOR_WAIT,
wxCURSOR_WATCH,
wxCURSOR_BLANK,
wxCURSOR_DEFAULT,
wxCURSOR_ARROWWAIT,
wxCURSOR_MAX
};
typedef enum {
wxPAPER_NONE, // Use specific dimensions
@@ -945,168 +762,5 @@ enum wxUpdateUI
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/*
* Event types
*
*/
enum wxEventType {
wxEVT_NULL = 0,
wxEVT_FIRST = 10000,
// New names
wxEVT_COMMAND_BUTTON_CLICKED,
wxEVT_COMMAND_CHECKBOX_CLICKED,
wxEVT_COMMAND_CHOICE_SELECTED,
wxEVT_COMMAND_LISTBOX_SELECTED,
wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
wxEVT_COMMAND_CHECKLISTBOX_TOGGLED,
wxEVT_COMMAND_SPINCTRL_UPDATED,
wxEVT_COMMAND_TEXT_UPDATED,
wxEVT_COMMAND_TEXT_ENTER,
wxEVT_COMMAND_TEXT_URL,
wxEVT_COMMAND_TEXT_MAXLEN,
wxEVT_COMMAND_MENU_SELECTED,
wxEVT_COMMAND_SLIDER_UPDATED,
wxEVT_COMMAND_RADIOBOX_SELECTED,
wxEVT_COMMAND_RADIOBUTTON_SELECTED,
// wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use wxEVT_SCROLL... events
wxEVT_COMMAND_SCROLLBAR_UPDATED,
wxEVT_COMMAND_VLBOX_SELECTED,
wxEVT_COMMAND_COMBOBOX_SELECTED,
wxEVT_COMMAND_TOOL_CLICKED,
wxEVT_COMMAND_TOOL_RCLICKED,
wxEVT_COMMAND_TOOL_ENTER,
wxEVT_SET_FOCUS,
wxEVT_KILL_FOCUS,
wxEVT_CHILD_FOCUS,
wxEVT_MOUSEWHEEL,
/* Mouse event types */
wxEVT_LEFT_DOWN,
wxEVT_LEFT_UP,
wxEVT_MIDDLE_DOWN,
wxEVT_MIDDLE_UP,
wxEVT_RIGHT_DOWN,
wxEVT_RIGHT_UP,
wxEVT_MOTION,
wxEVT_ENTER_WINDOW,
wxEVT_LEAVE_WINDOW,
wxEVT_LEFT_DCLICK,
wxEVT_MIDDLE_DCLICK,
wxEVT_RIGHT_DCLICK,
wxEVT_MOUSE_CAPTURE_CHANGED,
// Non-client mouse events
wxEVT_NC_LEFT_DOWN,
wxEVT_NC_LEFT_UP,
wxEVT_NC_MIDDLE_DOWN,
wxEVT_NC_MIDDLE_UP,
wxEVT_NC_RIGHT_DOWN,
wxEVT_NC_RIGHT_UP,
wxEVT_NC_MOTION,
wxEVT_NC_ENTER_WINDOW,
wxEVT_NC_LEAVE_WINDOW,
wxEVT_NC_LEFT_DCLICK,
wxEVT_NC_MIDDLE_DCLICK,
wxEVT_NC_RIGHT_DCLICK,
wxEVT_SET_CURSOR,
/* Character input event type */
wxEVT_CHAR,
wxEVT_KEY_DOWN,
wxEVT_KEY_UP,
wxEVT_CHAR_HOOK,
wxEVT_HOTKEY,
/*
* Scrollbar event identifiers
*/
wxEVT_SCROLL_TOP,
wxEVT_SCROLL_BOTTOM,
wxEVT_SCROLL_LINEUP,
wxEVT_SCROLL_LINEDOWN,
wxEVT_SCROLL_PAGEUP,
wxEVT_SCROLL_PAGEDOWN,
wxEVT_SCROLL_THUMBTRACK,
wxEVT_SCROLL_THUMBRELEASE,
wxEVT_SCROLL_ENDSCROLL,
/*
* Scrolled Window
*/
wxEVT_SCROLLWIN_TOP,
wxEVT_SCROLLWIN_BOTTOM,
wxEVT_SCROLLWIN_LINEUP,
wxEVT_SCROLLWIN_LINEDOWN,
wxEVT_SCROLLWIN_PAGEUP,
wxEVT_SCROLLWIN_PAGEDOWN,
wxEVT_SCROLLWIN_THUMBTRACK,
wxEVT_SCROLLWIN_THUMBRELEASE,
wxEVT_SIZE = wxEVT_FIRST + 200,
wxEVT_MOVE,
wxEVT_SIZING,
wxEVT_MOVING,
wxEVT_CLOSE_WINDOW,
wxEVT_END_SESSION,
wxEVT_QUERY_END_SESSION,
wxEVT_ACTIVATE_APP,
wxEVT_POWER,
wxEVT_ACTIVATE,
wxEVT_CREATE,
wxEVT_DESTROY,
wxEVT_SHOW,
wxEVT_ICONIZE,
wxEVT_MAXIMIZE,
wxEVT_PAINT,
wxEVT_ERASE_BACKGROUND,
wxEVT_NC_PAINT,
wxEVT_PAINT_ICON,
wxEVT_MENU_OPEN,
wxEVT_MENU_CLOSE,
wxEVT_MENU_HIGHLIGHT,
wxEVT_CONTEXT_MENU,
wxEVT_SYS_COLOUR_CHANGED,
wxEVT_DISPLAY_CHANGED,
wxEVT_SETTING_CHANGED,
wxEVT_QUERY_NEW_PALETTE,
wxEVT_PALETTE_CHANGED,
wxEVT_JOY_BUTTON_DOWN,
wxEVT_JOY_BUTTON_UP,
wxEVT_JOY_MOVE,
wxEVT_JOY_ZMOVE,
wxEVT_DROP_FILES,
wxEVT_DRAW_ITEM,
wxEVT_MEASURE_ITEM,
wxEVT_COMPARE_ITEM,
wxEVT_INIT_DIALOG,
wxEVT_IDLE,
wxEVT_UPDATE_UI,
/* Generic command events */
// Note: a click is a higher-level event
// than button down/up
wxEVT_COMMAND_LEFT_CLICK,
wxEVT_COMMAND_LEFT_DCLICK,
wxEVT_COMMAND_RIGHT_CLICK,
wxEVT_COMMAND_RIGHT_DCLICK,
wxEVT_COMMAND_SET_FOCUS,
wxEVT_COMMAND_KILL_FOCUS,
wxEVT_COMMAND_ENTER,
wxEVT_NAVIGATION_KEY,
wxEVT_TIMER,
};
//----------------------------------------------------------------------

161
wxPython/src/_dirctrl.i Normal file
View File

@@ -0,0 +1,161 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _ditctrl.i
// Purpose: SWIG interface file for wxGenericDirCtrl
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2002 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(DirDialogDefaultFolderStr);
%}
//---------------------------------------------------------------------------
%newgroup
// Extra styles for wxGenericDirCtrl
enum
{
// Only allow directory viewing/selection, no files
wxDIRCTRL_DIR_ONLY = 0x0010,
// When setting the default path, select the first file in the directory
wxDIRCTRL_SELECT_FIRST = 0x0020,
// Show the filter list
wxDIRCTRL_SHOW_FILTERS = 0x0040,
// Use 3D borders on internal controls
wxDIRCTRL_3D_INTERNAL = 0x0080,
// Editable labels
wxDIRCTRL_EDIT_LABELS = 0x0100
};
#if 0
class wxDirItemData : public wxObject // wxTreeItemData
{
public:
wxDirItemData(const wxString& path, const wxString& name, bool isDir);
// ~wxDirItemDataEx();
void SetNewDirName( wxString path );
wxString m_path, m_name;
bool m_isHidden;
bool m_isExpanded;
bool m_isDir;
};
#endif
class wxGenericDirCtrl: public wxControl
{
public:
%addtofunc wxGenericDirCtrl "self._setOORInfo(self)"
%addtofunc wxGenericDirCtrl() ""
wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = -1,
const wxString& dir = wxPyDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER,
const wxString& filter = wxPyEmptyString,
int defaultFilter = 0,
const wxString& name = wxPy_TreeCtrlNameStr);
%name(PreGenericDirCtrl)wxGenericDirCtrl();
bool Create(wxWindow *parent, const wxWindowID id = -1,
const wxString& dir = wxPyDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER,
const wxString& filter = wxPyEmptyString,
int defaultFilter = 0,
const wxString& name = wxPy_TreeCtrlNameStr);
// Try to expand as much of the given path as possible.
virtual bool ExpandPath(const wxString& path);
virtual inline wxString GetDefaultPath() const;
virtual void SetDefaultPath(const wxString& path);
// Get dir or filename
virtual wxString GetPath() const;
// Get selected filename path only (else empty string).
// I.e. don't count a directory as a selection
virtual wxString GetFilePath() const;
virtual void SetPath(const wxString& path);
virtual void ShowHidden( bool show );
virtual bool GetShowHidden();
virtual wxString GetFilter() const;
virtual void SetFilter(const wxString& filter);
virtual int GetFilterIndex() const;
virtual void SetFilterIndex(int n);
virtual wxTreeItemId GetRootId();
virtual wxTreeCtrl* GetTreeCtrl() const;
virtual wxDirFilterListCtrl* GetFilterListCtrl() const;
// Parse the filter into an array of filters and an array of descriptions
// virtual int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions);
// Find the child that matches the first part of 'path'.
// E.g. if a child path is "/usr" and 'path' is "/usr/include"
// then the child for /usr is returned.
// If the path string has been used (we're at the leaf), done is set to TRUE
virtual wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& OUTPUT);
// Resize the components of the control
virtual void DoResize();
// Collapse & expand the tree, thus re-creating it from scratch:
virtual void ReCreateTree();
};
class wxDirFilterListCtrl: public wxChoice
{
public:
%addtofunc wxDirFilterListCtrl "self._setOORInfo(self)"
%addtofunc wxDirFilterListCtrl() ""
wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
%name(PreDirFilterListCtrl)wxDirFilterListCtrl();
bool Create(wxGenericDirCtrl* parent, const wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
//// Operations
void FillFilterList(const wxString& filter, int defaultFilter);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

320
wxPython/src/_dnd.i Normal file
View File

@@ -0,0 +1,320 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _dnd.i
// Purpose: SWIG definitions for the Drag-n-drop classes
//
// Author: Robin Dunn
//
// Created: 31-October-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/dnd.h>
%}
//---------------------------------------------------------------------------
%newgroup
// flags for wxDropSource::DoDragDrop()
//
// NB: wxDrag_CopyOnly must be 0 (== FALSE) and wxDrag_AllowMove must be 1
// (== TRUE) for compatibility with the old DoDragDrop(bool) method!
enum
{
wxDrag_CopyOnly = 0, // allow only copying
wxDrag_AllowMove = 1, // allow moving (copying is always allowed)
wxDrag_DefaultMove = 3 // the default operation is move, not copy
};
// result of wxDropSource::DoDragDrop() call
enum wxDragResult
{
wxDragError, // error prevented the d&d operation from completing
wxDragNone, // drag target didn't accept the data
wxDragCopy, // the data was successfully copied
wxDragMove, // the data was successfully moved (MSW only)
wxDragLink, // operation is a drag-link
wxDragCancel // the operation was cancelled by user (not an error)
};
bool wxIsDragResultOk(wxDragResult res);
//---------------------------------------------------------------------------
// wxDropSource is the object you need to create (and call DoDragDrop on it)
// to initiate a drag-and-drop operation
%{
class wxPyDropSource : public wxDropSource {
public:
#ifndef __WXGTK__
wxPyDropSource(wxWindow *win = NULL,
const wxCursor &copy = wxNullCursor,
const wxCursor &move = wxNullCursor,
const wxCursor &none = wxNullCursor)
: wxDropSource(win, copy, move, none) {}
#else
wxPyDropSource(wxWindow *win = NULL,
const wxIcon& copy = wxNullIcon,
const wxIcon& move = wxNullIcon,
const wxIcon& none = wxNullIcon)
: wxDropSource(win, copy, move, none) {}
#endif
~wxPyDropSource() { }
DEC_PYCALLBACK_BOOL_DR(GiveFeedback);
PYPRIVATE;
};
IMP_PYCALLBACK_BOOL_DR(wxPyDropSource, wxDropSource, GiveFeedback);
%}
%name(DropSource) class wxPyDropSource {
public:
#ifndef __WXGTK__
wxPyDropSource(wxWindow *win = NULL,
const wxCursor &copy = wxNullCursor,
const wxCursor &move = wxNullCursor,
const wxCursor &none = wxNullCursor);
#else
wxPyDropSource(wxWindow *win = NULL,
const wxIcon& copy = wxNullIcon,
const wxIcon& move = wxNullIcon,
const wxIcon& none = wxNullIcon);
#endif
void _setCallbackInfo(PyObject* self, PyObject* _class, int incref);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxDropSource, 0)"
~wxPyDropSource();
// set the data which is transfered by drag and drop
void SetData(wxDataObject& data);
wxDataObject *GetDataObject();
// set the icon corresponding to given drag result
void SetCursor(wxDragResult res, const wxCursor& cursor);
wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
bool base_GiveFeedback(wxDragResult effect);
};
//---------------------------------------------------------------------------
// wxDropTarget should be associated with a window if it wants to be able to
// receive data via drag and drop.
//
// To use this class, you should derive from wxDropTarget and implement
// OnData() pure virtual method. You may also wish to override OnDrop() if you
// want to accept the data only inside some region of the window (this may
// avoid having to copy the data to this application which happens only when
// OnData() is called)
// Just a place holder for the type system. The real base class for
// wxPython is wxPyDropTarget
// class wxDropTarget {
// public:
// };
%{
class wxPyDropTarget : public wxDropTarget {
public:
wxPyDropTarget(wxDataObject *dataObject = NULL)
: wxDropTarget(dataObject) {}
// called when mouse leaves the window: might be used to remove the
// feedback which was given in OnEnter()
DEC_PYCALLBACK__(OnLeave);
// called when the mouse enters the window (only once until OnLeave())
DEC_PYCALLBACK_DR_2WXCDR(OnEnter);
// called when the mouse moves in the window - shouldn't take long to
// execute or otherwise mouse movement would be too slow
DEC_PYCALLBACK_DR_2WXCDR(OnDragOver);
// called after OnDrop() returns TRUE: you will usually just call
// GetData() from here and, probably, also refresh something to update the
// new data and, finally, return the code indicating how did the operation
// complete (returning default value in case of success and wxDragError on
// failure is usually ok)
DEC_PYCALLBACK_DR_2WXCDR_pure(OnData);
// this function is called when data is dropped at position (x, y) - if it
// returns TRUE, OnData() will be called immediately afterwards which will
// allow to retrieve the data dropped.
DEC_PYCALLBACK_BOOL_INTINT(OnDrop);
PYPRIVATE;
};
IMP_PYCALLBACK__(wxPyDropTarget, wxDropTarget, OnLeave);
IMP_PYCALLBACK_DR_2WXCDR(wxPyDropTarget, wxDropTarget, OnEnter);
IMP_PYCALLBACK_DR_2WXCDR(wxPyDropTarget, wxDropTarget, OnDragOver);
IMP_PYCALLBACK_DR_2WXCDR_pure(wxPyDropTarget, wxDropTarget, OnData);
IMP_PYCALLBACK_BOOL_INTINT(wxPyDropTarget, wxDropTarget, OnDrop);
%}
%name(DropTarget) class wxPyDropTarget // : public wxDropTarget
{
public:
%addtofunc wxPyDropTarget "if args: args[1].thisown = 0; self._setCallbackInfo(self, DropTarget)"
wxPyDropTarget(wxDataObject *dataObject = NULL);
void _setCallbackInfo(PyObject* self, PyObject* _class);
~wxPyDropTarget();
// get/set the associated wxDataObject
wxDataObject *GetDataObject();
%addtofunc SetDataObject "args[1].thisown = 0"
void SetDataObject(wxDataObject *dataObject);
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave();
bool base_OnDrop(wxCoord x, wxCoord y);
// may be called *only* from inside OnData() and will fill m_dataObject
// with the data from the drop source if it returns TRUE
bool GetData();
};
%pythoncode { PyDropTarget = DropTarget }
//---------------------------------------------------------------------------
// A simple wxDropTarget derived class for text data: you only need to
// override OnDropText() to get something working
%{
class wxPyTextDropTarget : public wxTextDropTarget {
public:
wxPyTextDropTarget() {}
DEC_PYCALLBACK_BOOL_INTINTSTR_pure(OnDropText);
DEC_PYCALLBACK__(OnLeave);
DEC_PYCALLBACK_DR_2WXCDR(OnEnter);
DEC_PYCALLBACK_DR_2WXCDR(OnDragOver);
DEC_PYCALLBACK_DR_2WXCDR(OnData);
DEC_PYCALLBACK_BOOL_INTINT(OnDrop);
PYPRIVATE;
};
IMP_PYCALLBACK_BOOL_INTINTSTR_pure(wxPyTextDropTarget, wxTextDropTarget, OnDropText);
IMP_PYCALLBACK__(wxPyTextDropTarget, wxTextDropTarget, OnLeave);
IMP_PYCALLBACK_DR_2WXCDR(wxPyTextDropTarget, wxTextDropTarget, OnEnter);
IMP_PYCALLBACK_DR_2WXCDR(wxPyTextDropTarget, wxTextDropTarget, OnDragOver);
IMP_PYCALLBACK_DR_2WXCDR(wxPyTextDropTarget, wxTextDropTarget, OnData);
IMP_PYCALLBACK_BOOL_INTINT(wxPyTextDropTarget, wxTextDropTarget, OnDrop);
%}
%name(TextDropTarget) class wxPyTextDropTarget : public wxPyDropTarget {
public:
%addtofunc wxPyTextDropTarget "self._setCallbackInfo(self, TextDropTarget)"
wxPyTextDropTarget();
void _setCallbackInfo(PyObject* self, PyObject* _class);
//bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave();
bool base_OnDrop(wxCoord x, wxCoord y);
wxDragResult base_OnData(wxCoord x, wxCoord y, wxDragResult def);
};
//---------------------------------------------------------------------------
// A drop target which accepts files (dragged from File Manager or Explorer)
%{
class wxPyFileDropTarget : public wxFileDropTarget {
public:
wxPyFileDropTarget() {}
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
DEC_PYCALLBACK__(OnLeave);
DEC_PYCALLBACK_DR_2WXCDR(OnEnter);
DEC_PYCALLBACK_DR_2WXCDR(OnDragOver);
DEC_PYCALLBACK_DR_2WXCDR(OnData);
DEC_PYCALLBACK_BOOL_INTINT(OnDrop);
PYPRIVATE;
};
bool wxPyFileDropTarget::OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) {
bool rval = FALSE;
wxPyBeginBlockThreads();
if (wxPyCBH_findCallback(m_myInst, "OnDropFiles")) {
PyObject* list = wxArrayString2PyList_helper(filenames);
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",x,y,list));
Py_DECREF(list);
}
wxPyEndBlockThreads();
return rval;
}
IMP_PYCALLBACK__(wxPyFileDropTarget, wxFileDropTarget, OnLeave);
IMP_PYCALLBACK_DR_2WXCDR(wxPyFileDropTarget, wxFileDropTarget, OnEnter);
IMP_PYCALLBACK_DR_2WXCDR(wxPyFileDropTarget, wxFileDropTarget, OnDragOver);
IMP_PYCALLBACK_DR_2WXCDR(wxPyFileDropTarget, wxFileDropTarget, OnData);
IMP_PYCALLBACK_BOOL_INTINT(wxPyFileDropTarget, wxFileDropTarget, OnDrop);
%}
%name(FileDropTarget) class wxPyFileDropTarget : public wxPyDropTarget
{
public:
%addtofunc wxPyFileDropTarget "self._setCallbackInfo(self, FileDropTarget)"
wxPyFileDropTarget();
void _setCallbackInfo(PyObject* self, PyObject* _class);
// bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) = 0;
wxDragResult base_OnEnter(wxCoord x, wxCoord y, wxDragResult def);
wxDragResult base_OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
void base_OnLeave();
bool base_OnDrop(wxCoord x, wxCoord y);
wxDragResult base_OnData(wxCoord x, wxCoord y, wxDragResult def);
};
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxDropSource", "wxPyDropSource");
wxPyPtrTypeMap_Add("wxDropTarget", "wxPyDropTarget");
wxPyPtrTypeMap_Add("wxTextDropTarget", "wxPyTextDropTarget");
wxPyPtrTypeMap_Add("wxFileDropTarget", "wxPyFileDropTarget");
%}
//---------------------------------------------------------------------------

102
wxPython/src/_dragimg.i Normal file
View File

@@ -0,0 +1,102 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _dragimg.i
// Purpose: SWIG defs for wxDragImage
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/generic/dragimgg.h>
%}
//---------------------------------------------------------------------------
%name (DragImage) class wxGenericDragImage : public wxObject
{
public:
wxGenericDragImage(const wxBitmap& image,
const wxCursor& cursor = wxNullCursor);
%name(DragIcon)wxGenericDragImage(const wxIcon& image,
const wxCursor& cursor = wxNullCursor);
%name(DragString)wxGenericDragImage(const wxString& str,
const wxCursor& cursor = wxNullCursor);
%name(DragTreeItem)wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
%name(DragListItem)wxGenericDragImage(const wxListCtrl& listCtrl, long id);
~wxGenericDragImage();
// For efficiency, tell wxGenericDragImage to use a bitmap that's already
// created (e.g. from last drag)
void SetBackingBitmap(wxBitmap* bitmap);
// Begin drag. hotspot is the location of the drag position relative to the upper-left
// corner of the image.
bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
bool fullScreen = FALSE, wxRect* rect = NULL);
// Begin drag. hotspot is the location of the drag position relative to the upper-left
// corner of the image. This is full screen only. fullScreenRect gives the
// position of the window on the screen, to restrict the drag to.
%name(BeginDragBounded) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
wxWindow* boundingWindow);
// End drag
bool EndDrag();
// Move the image: call from OnMouseMove. Pt is in window client coordinates if window
// is non-NULL, or in screen coordinates if NULL.
bool Move(const wxPoint& pt);
// Show the image
bool Show();
// Hide the image
bool Hide();
// TODO, make the rest of these overridable
// Override this if you are using a virtual image (drawing your own image)
virtual wxRect GetImageRect(const wxPoint& pos) const;
// Override this if you are using a virtual image (drawing your own image)
virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const;
// Override this if you wish to draw the window contents to the backing bitmap
// yourself. This can be desirable if you wish to avoid flicker by not having to
// redraw the window itself before dragging in order to be graphic-minus-dragged-objects.
// Instead, paint the drag image's backing bitmap to be correct, and leave the window
// to be updated only when dragging the objects away (thus giving a smoother appearance).
virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
const wxRect& sourceRect, const wxRect& destRect) const;
// Erase and redraw simultaneously if possible
virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
};
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
%}
//---------------------------------------------------------------------------

56
wxPython/src/_effects.i Normal file
View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _effects.i
// Purpose: wxEffects
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/effects.h>
%}
//---------------------------------------------------------------------------
class wxEffects: public wxObject
{
public:
// Assume system colours
wxEffects();
wxColour GetHighlightColour() const;
wxColour GetLightShadow() const;
wxColour GetFaceColour() const;
wxColour GetMediumShadow() const;
wxColour GetDarkShadow() const;
void SetHighlightColour(const wxColour& c);
void SetLightShadow(const wxColour& c);
void SetFaceColour(const wxColour& c);
void SetMediumShadow(const wxColour& c);
void SetDarkShadow(const wxColour& c);
void Set(const wxColour& highlightColour, const wxColour& lightShadow,
const wxColour& faceColour, const wxColour& mediumShadow,
const wxColour& darkShadow);
// Draw a sunken edge
void DrawSunkenEdge(wxDC& dc, const wxRect& rect, int borderSize = 1);
// Tile a bitmap
bool TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap);
};
//---------------------------------------------------------------------------

1232
wxPython/src/_event.i Normal file

File diff suppressed because it is too large Load Diff

60
wxPython/src/_event_ex.py Normal file
View File

@@ -0,0 +1,60 @@
#---------------------------------------------------------------------------
class PyEventBinder(object):
"""
Instances of this class are used to bind specific events to event
handlers.
"""
def __init__(self, evtType, expectedIDs=0):
if expectedIDs not in [0, 1, 2]:
raise ValueError, "Invalid number of expectedIDs"
self.expectedIDs = expectedIDs
if type(evtType) == list or type(evtType) == tuple:
self.evtType = evtType
else:
self.evtType = [evtType]
def Bind(self, target, id1, id2, function):
"""Bind this set of event types to target."""
for et in self.evtType:
target.Connect(id1, id2, et, function)
def __call__(self, *args):
"""
For backwards compatibility with the old EVT_* functions.
Should be called with either (window, func), (window, ID,
func) or (window, ID1, ID2, func) parameters depending on the
type of the event.
"""
assert len(args) == 2 + self.expectedIDs
id1 = wx.ID_ANY
id2 = wx.ID_ANY
target = args[0]
if self.expectedIDs == 0:
func = args[1]
elif self.expectedIDs == 1:
id1 = args[1]
func = args[2]
elif self.expectedIDs == 2:
id1 = args[1]
id2 = args[2]
func = args[3]
else:
raise ValueError, "Unexpected number of IDs"
self.Bind(target, id1, id2, func)
# These two are square pegs that don't fit the PyEventBinder hole...
def EVT_COMMAND(win, id, cmd, func):
win.Connect(id, -1, cmd, func)
def EVT_COMMAND_RANGE(win, id1, id2, cmd, func):
win.Connect(id1, id2, cmd, func)
#---------------------------------------------------------------------------

113
wxPython/src/_evthandler.i Normal file
View File

@@ -0,0 +1,113 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _evthandler.i
// Purpose: SWIG interface for wxEventHandler
//
// Author: Robin Dunn
//
// Created: 9-Aug-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
// wxEvtHandler: the base class for all objects handling wxWindows events
class wxEvtHandler : public wxObject {
public:
wxEvtHandler();
wxEvtHandler* GetNextHandler();
wxEvtHandler* GetPreviousHandler();
void SetNextHandler(wxEvtHandler* handler);
void SetPreviousHandler(wxEvtHandler* handler);
bool GetEvtHandlerEnabled();
void SetEvtHandlerEnabled(bool enabled);
// process an event right now
bool ProcessEvent(wxEvent& event);
// add an event to be processed later
void AddPendingEvent(wxEvent& event);
// process all pending events
void ProcessPendingEvents();
%extend {
// Dynamic association of a member function handler with the event handler
void Connect( int id, int lastId, int eventType, PyObject* func) {
if (PyCallable_Check(func)) {
self->Connect(id, lastId, eventType,
(wxObjectEventFunction) &wxPyCallback::EventThunker,
new wxPyCallback(func));
}
else if (func == Py_None) {
self->Disconnect(id, lastId, eventType,
(wxObjectEventFunction)
&wxPyCallback::EventThunker);
}
else {
PyErr_SetString(PyExc_TypeError, "Expected callable object or None.");
}
}
bool Disconnect(int id, int lastId = -1,
wxEventType eventType = wxEVT_NULL) {
return self->Disconnect(id, lastId, eventType,
(wxObjectEventFunction)
&wxPyCallback::EventThunker);
}
}
%extend {
void _setOORInfo(PyObject* _self) {
if (_self && _self != Py_None) {
self->SetClientObject(new wxPyOORClientData(_self));
}
else {
wxPyOORClientData* data = (wxPyOORClientData*)self->GetClientObject();
if (data) {
self->SetClientObject(NULL); // This will delete it too
}
}
}
}
%pythoncode {
def Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
"""
Bind an event to an event handler.
event One of the EVT_* objects that specifies the
type of event to bind,
handler A callable object to be invoked when the event
is delivered to self. Pass None to disconnect an
event handler.
source Sometimes the event originates from a different window
than self, but you still want to catch it in self. (For
example, a button event delivered to a frame.) By
passing the source of the event, the event handling
system is able to differentiate between the same event
type from different controls.
id,id2 Used for menu IDs or for event types that require a
range of IDs
"""
if source is not None:
id = source.GetId()
event.Bind(self, id, id2, handler)
}
};
//---------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filesys.i
// Name: _filesys.i
// Purpose: SWIG definitions of the wxFileSystem family of classes
//
// Author: Joerg Baumann and Robin Dunn
// Author: Robin Dunn
//
// Created: 25-Sept-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Joerg Baumann
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module filesys
// Not a %module
%{
#include "helpers.h"
#include "pyistream.h"
#include <wx/filesys.h>
#include <wx/fs_inet.h>
#include <wx/fs_mem.h>
#include <wx/fs_zip.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import utils.i
%import image.i
%import streams.i
%pragma(python) code = "import wx"
//---------------------------------------------------------------------------
%{
#include "wx/wxPython/pyistream.h"
%}
class wxFSFile : public wxObject {
//---------------------------------------------------------------------------
%newgroup
class wxFSFile : public wxObject
{
public:
wxFSFile(wxInputStream *stream, const wxString& loc,
const wxString& mimetype, const wxString& anchor,
wxDateTime modif);
~wxFSFile();
wxInputStream *GetStream();
const wxString& GetMimeType();
@@ -51,17 +39,11 @@ public:
};
// clear typemaps
%typemap(python,in) wxInputStream *stream;
%typemap(python,out) wxInputStream *;
//---------------------------------------------------------------------------
%{
// wxPyFileSystemHandler will be the Python class wxFileSystemHandler and handling
// the callback functions
class wxPyFileSystemHandler : public wxFileSystemHandler {
class wxPyFileSystemHandler : public wxFileSystemHandler
{
public:
wxPyFileSystemHandler() : wxFileSystemHandler() {}
@@ -101,16 +83,23 @@ IMP_PYCALLBACK_STRING__pure(wxPyFileSystemHandler, wxFileSystemHandler, FindNext
%}
%name(wxCPPFileSystemHandler)class wxFileSystemHandler : public wxObject {
wxFileSystemHandler();
}
%name(wxFileSystemHandler)class wxPyFileSystemHandler : public wxFileSystemHandler {
%name(CPPFileSystemHandler) class wxFileSystemHandler //: public wxObject
{
public:
//wxFileSystemHandler();
};
%name(FileSystemHandler) class wxPyFileSystemHandler : public wxFileSystemHandler
{
public:
%addtofunc wxPyFileSystemHandler "self._setCallbackInfo(self, FileSystemHandler)";
wxPyFileSystemHandler();
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFileSystemHandler)"
bool CanOpen(const wxString& location);
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
@@ -120,15 +109,18 @@ public:
wxString GetProtocol(const wxString& location);
wxString GetLeftLocation(const wxString& location);
wxString GetAnchor(const wxString& location);
wxString GetRightLocation(const wxString& location) const;
wxString GetRightLocation(const wxString& location);
wxString GetMimeTypeFromExt(const wxString& location);
};
//---------------------------------------------------------------------------
// //---------------------------------------------------------------------------
class wxFileSystem : public wxObject {
public:
wxFileSystem();
~wxFileSystem();
void ChangePathTo(const wxString& location, bool is_dir = FALSE);
wxString GetPath();
@@ -158,6 +150,7 @@ wxString wxFileSystem_URLToFileName(const wxString& url);
}
%}
//---------------------------------------------------------------------------
class wxInternetFSHandler : public wxFileSystemHandler {
@@ -169,6 +162,7 @@ public:
//---------------------------------------------------------------------------
class wxZipFSHandler : public wxFileSystemHandler {
public:
wxZipFSHandler();
@@ -181,6 +175,45 @@ public:
//---------------------------------------------------------------------------
// TODO: Use SWIG's overloading feature to fix this mess?
// getting the overloaded static AddFile method right
%inline %{
void __wxMemoryFSHandler_AddFile_wxImage(const wxString& filename,
wxImage& image,
long type) {
wxMemoryFSHandler::AddFile(filename, image, type);
}
void __wxMemoryFSHandler_AddFile_wxBitmap(const wxString& filename,
const wxBitmap& bitmap,
long type) {
wxMemoryFSHandler::AddFile(filename, bitmap, type);
}
void __wxMemoryFSHandler_AddFile_Data(const wxString& filename,
PyObject* data) {
wxMemoryFSHandler::AddFile(filename,
// TODO: Verify data type
(void*)PyString_AsString(data),
(size_t)PyString_Size(data));
}
%}
// case switch for overloading
%pythoncode {
def MemoryFSHandler_AddFile(filename, a, b=''):
if isinstance(a, wx.Image):
__wxMemoryFSHandler_AddFile_wxImage(filename, a, b)
elif isinstance(a, wx.Bitmap):
__wxMemoryFSHandler_AddFile_wxBitmap(filename, a, b)
elif type(a) == str:
__wxMemoryFSHandler_AddFile_Data(filename, a)
else: raise TypeError, 'wx.Image, wx.Bitmap or string expected'
}
class wxMemoryFSHandler : public wxFileSystemHandler {
public:
wxMemoryFSHandler();
@@ -188,6 +221,9 @@ public:
// Remove file from memory FS and free occupied memory
static void RemoveFile(const wxString& filename);
// Add a file to the memory FS
%pythoncode { AddFile = staticmethod(MemoryFSHandler_AddFile) }
bool CanOpen(const wxString& location);
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
@@ -195,50 +231,8 @@ public:
};
// getting the overloaded static AddFile method right
%inline %{
void __wxMemoryFSHandler_AddFile_wxImage(const wxString& filename,
wxImage& image,
long type) {
wxMemoryFSHandler::AddFile(filename, image, type);
}
void __wxMemoryFSHandler_AddFile_wxBitmap(const wxString& filename,
const wxBitmap& bitmap,
long type) {
wxMemoryFSHandler::AddFile(filename, bitmap, type);
}
void __wxMemoryFSHandler_AddFile_Data(const wxString& filename,
PyObject* data) {
wxMemoryFSHandler::AddFile(filename,
// TODO: Verify data type
(void*)PyString_AsString(data),
(size_t)PyString_Size(data));
}
%}
// case switch for overloading
%pragma(python) code = "
import types
def wxMemoryFSHandler_AddFile(filename, a, b=''):
if wx.wxPy_isinstance(a, (wxImage, wxImagePtr)):
__wxMemoryFSHandler_AddFile_wxImage(filename, a, b)
elif wx.wxPy_isinstance(a, (wxBitmap, wxBitmapPtr)):
__wxMemoryFSHandler_AddFile_wxBitmap(filename, a, b)
elif type(a) == types.StringType:
#__wxMemoryFSHandler_AddFile_wxString(filename, a)
__wxMemoryFSHandler_AddFile_Data(filename, a)
else: raise TypeError, 'wxImage, wxBitmap or string expected'
"
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxFileSystemHandler", "wxPyFileSystemHandler");
%}
//---------------------------------------------------------------------------

515
wxPython/src/_font.i Normal file
View File

@@ -0,0 +1,515 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _font.i
// Purpose: SWIG interface file for wxFont and related classes
//
// Author: Robin Dunn
//
// Created: 1-Apr-2002
// RCS-ID: $Id$
// Copyright: (c) 2002 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/fontutil.h>
#include <wx/fontmap.h>
#include <wx/fontenum.h>
%}
//---------------------------------------------------------------------------
%newgroup
enum wxFontFamily
{
wxFONTFAMILY_DEFAULT = wxDEFAULT,
wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
wxFONTFAMILY_ROMAN = wxROMAN,
wxFONTFAMILY_SCRIPT = wxSCRIPT,
wxFONTFAMILY_SWISS = wxSWISS,
wxFONTFAMILY_MODERN = wxMODERN,
wxFONTFAMILY_TELETYPE = wxTELETYPE,
wxFONTFAMILY_MAX,
wxFONTFAMILY_UNKNOWN = wxFONTFAMILY_MAX
};
// font styles
enum wxFontStyle
{
wxFONTSTYLE_NORMAL = wxNORMAL,
wxFONTSTYLE_ITALIC = wxITALIC,
wxFONTSTYLE_SLANT = wxSLANT,
wxFONTSTYLE_MAX
};
// font weights
enum wxFontWeight
{
wxFONTWEIGHT_NORMAL = wxNORMAL,
wxFONTWEIGHT_LIGHT = wxLIGHT,
wxFONTWEIGHT_BOLD = wxBOLD,
wxFONTWEIGHT_MAX
};
// the font flag bits for the new font ctor accepting one combined flags word
enum
{
// no special flags: font with default weight/slant/anti-aliasing
wxFONTFLAG_DEFAULT = 0,
// slant flags (default: no slant)
wxFONTFLAG_ITALIC = 1 << 0,
wxFONTFLAG_SLANT = 1 << 1,
// weight flags (default: medium)
wxFONTFLAG_LIGHT = 1 << 2,
wxFONTFLAG_BOLD = 1 << 3,
// anti-aliasing flag: force on or off (default: the current system default)
wxFONTFLAG_ANTIALIASED = 1 << 4,
wxFONTFLAG_NOT_ANTIALIASED = 1 << 5,
// underlined/strikethrough flags (default: no lines)
wxFONTFLAG_UNDERLINED = 1 << 6,
wxFONTFLAG_STRIKETHROUGH = 1 << 7,
// the mask of all currently used flags
wxFONTFLAG_MASK = wxFONTFLAG_ITALIC |
wxFONTFLAG_SLANT |
wxFONTFLAG_LIGHT |
wxFONTFLAG_BOLD |
wxFONTFLAG_ANTIALIASED |
wxFONTFLAG_NOT_ANTIALIASED |
wxFONTFLAG_UNDERLINED |
wxFONTFLAG_STRIKETHROUGH
};
// font encodings
enum wxFontEncoding
{
wxFONTENCODING_SYSTEM = -1, // system default
wxFONTENCODING_DEFAULT, // current default encoding
// ISO8859 standard defines a number of single-byte charsets
wxFONTENCODING_ISO8859_1, // West European (Latin1)
wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
wxFONTENCODING_ISO8859_5, // Cyrillic
wxFONTENCODING_ISO8859_6, // Arabic
wxFONTENCODING_ISO8859_7, // Greek
wxFONTENCODING_ISO8859_8, // Hebrew
wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
wxFONTENCODING_ISO8859_11, // Thai
wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
// here anyhow to make all ISO8859
// consecutive numbers
wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
wxFONTENCODING_ISO8859_14, // Latin8
wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
wxFONTENCODING_ISO8859_MAX,
// Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
// what would we do without Microsoft? They have their own encodings
// for DOS
wxFONTENCODING_CP437, // original MS-DOS codepage
wxFONTENCODING_CP850, // CP437 merged with Latin1
wxFONTENCODING_CP852, // CP437 merged with Latin2
wxFONTENCODING_CP855, // another cyrillic encoding
wxFONTENCODING_CP866, // and another one
// and for Windows
wxFONTENCODING_CP874, // WinThai
wxFONTENCODING_CP932, // Japanese (shift-JIS)
wxFONTENCODING_CP936, // Chinese simplified (GB)
wxFONTENCODING_CP949, // Korean (Hangul charset)
wxFONTENCODING_CP950, // Chinese (traditional - Big5)
wxFONTENCODING_CP1250, // WinLatin2
wxFONTENCODING_CP1251, // WinCyrillic
wxFONTENCODING_CP1252, // WinLatin1
wxFONTENCODING_CP1253, // WinGreek (8859-7)
wxFONTENCODING_CP1254, // WinTurkish
wxFONTENCODING_CP1255, // WinHebrew
wxFONTENCODING_CP1256, // WinArabic
wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
wxFONTENCODING_CP12_MAX,
wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese
wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding
wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding
wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding
wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
wxFONTENCODING_MAX, // highest enumerated encoding value
// aliases for endian-dependent UTF encodings
wxFONTENCODING_UTF16, // native UTF-16
wxFONTENCODING_UTF32, // native UTF-32
// alias for the native Unicode encoding on this platform
// (this is used by wxEncodingConverter and wxUTFFile only for now)
wxFONTENCODING_UNICODE = wxFONTENCODING_UTF16,
// alternative names for Far Eastern encodings
// Chinese
wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese
wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese
// Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html)
wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932 // Shift JIS
};
//---------------------------------------------------------------------------
%newgroup
// wxNativeFontInfo is platform-specific font representation: this struct
// should be considered as opaque font description only used by the native
// functions, the user code can only get the objects of this type from
// somewhere and pass it somewhere else (possibly save them somewhere using
// ToString() and restore them using FromString())
struct wxNativeFontInfo
{
public:
wxNativeFontInfo();
~wxNativeFontInfo();
// reset to the default state
void Init();
// init with the parameters of the given font
void InitFromFont(const wxFont& font);
// accessors and modifiers for the font elements
int GetPointSize() const;
wxFontStyle GetStyle() const;
wxFontWeight GetWeight() const;
bool GetUnderlined() const;
wxString GetFaceName() const;
wxFontFamily GetFamily() const;
wxFontEncoding GetEncoding() const;
void SetPointSize(int pointsize);
void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
void SetFaceName(wxString facename);
void SetFamily(wxFontFamily family);
void SetEncoding(wxFontEncoding encoding);
// it is important to be able to serialize wxNativeFontInfo objects to be
// able to store them (in config file, for example)
bool FromString(const wxString& s);
wxString ToString() const;
%extend {
wxString __str__() {
return self->ToString();
}
}
// we also want to present the native font descriptions to the user in some
// human-readable form (it is not platform independent neither, but can
// hopefully be understood by the user)
bool FromUserString(const wxString& s);
wxString ToUserString() const;
};
struct wxNativeEncodingInfo
{
wxString facename; // may be empty meaning "any"
wxFontEncoding encoding; // so that we know what this struct represents
wxNativeEncodingInfo();
~wxNativeEncodingInfo();
// this struct is saved in config by wxFontMapper, so it should know to
// serialise itself (implemented in platform-specific code)
bool FromString(const wxString& s);
wxString ToString() const;
};
#ifndef __WXMSW__
// translate a wxFontEncoding into native encoding parameter (defined above),
// returning a wxNativeEncodingInfo if an (exact) match could be found, NULL
// otherwise.
%inline %{
wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding) {
static wxNativeEncodingInfo info;
if ( wxGetNativeFontEncoding(encoding, &info) )
return &info;
else
return NULL;
}
%}
// test for the existence of the font described by this facename/encoding,
// return TRUE if such font(s) exist, FALSE otherwise
bool wxTestFontEncoding(const wxNativeEncodingInfo& info);
#else
%inline %{
wxNativeEncodingInfo* wxGetNativeFontEncoding(wxFontEncoding encoding)
{ PyErr_SetNone(PyExc_NotImplementedError); return NULL; }
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
{ PyErr_SetNone(PyExc_NotImplementedError); return false; }
%}
#endif
//---------------------------------------------------------------------------
%newgroup
// wxFontMapper manages user-definable correspondence between logical font
// names and the fonts present on the machine.
//
// The default implementations of all functions will ask the user if they are
// not capable of finding the answer themselves and store the answer in a
// config file (configurable via SetConfigXXX functions). This behaviour may
// be disabled by giving the value of FALSE to "interactive" parameter.
// However, the functions will always consult the config file to allow the
// user-defined values override the default logic and there is no way to
// disable this - which shouldn't be ever needed because if "interactive" was
// never TRUE, the config file is never created anyhow.
//
// This is a singleton class, font mapper objects can only be accessed using
// wxFontMapper::Get().
class wxFontMapper
{
public:
wxFontMapper();
~wxFontMapper();
// return instance of the wxFontMapper singleton
static wxFontMapper *Get();
// set the sigleton to 'mapper' instance and return previous one
static wxFontMapper *Set(wxFontMapper *mapper);
// returns the encoding for the given charset (in the form of RFC 2046) or
// wxFONTENCODING_SYSTEM if couldn't decode it
//
// interactive parameter is ignored in the base class, we behave as if it
// were always false
virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
bool interactive = true);
// get the number of font encodings we know about
static size_t GetSupportedEncodingsCount();
// get the n-th supported encoding
static wxFontEncoding GetEncoding(size_t n);
// return internal string identifier for the encoding (see also
// GetEncodingDescription())
static wxString GetEncodingName(wxFontEncoding encoding);
// return user-readable string describing the given encoding
//
// NB: hard-coded now, but might change later (read it from config?)
static wxString GetEncodingDescription(wxFontEncoding encoding);
// set the config object to use (may be NULL to use default)
void SetConfig(wxConfigBase *config);
// set the root config path to use (should be an absolute path)
void SetConfigPath(const wxString& prefix);
// return default config path
static const wxString GetDefaultConfigPath();
// Find an alternative for the given encoding (which is supposed to not be
// available on this system). If successful, returns the encoding otherwise
// returns None.
%extend {
PyObject* GetAltForEncoding(wxFontEncoding encoding,
const wxString& facename = wxPyEmptyString,
bool interactive = TRUE) {
wxFontEncoding alt_enc;
if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
return PyInt_FromLong(alt_enc);
else {
Py_INCREF(Py_None);
return Py_None;
}
}
}
// checks whether given encoding is available in given face or not.
// If no facename is given,
bool IsEncodingAvailable(wxFontEncoding encoding,
const wxString& facename = wxPyEmptyString);
// the parent window for modal dialogs
void SetDialogParent(wxWindow *parent);
// the title for the dialogs (note that default is quite reasonable)
void SetDialogTitle(const wxString& title);
};
//---------------------------------------------------------------------------
%newgroup
class wxFont : public wxGDIObject {
public:
wxFont( int pointSize, int family, int style, int weight,
bool underline=FALSE, const wxString& face = wxPyEmptyString,
wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
~wxFont();
%name(FontFromNativeInfo) wxFont(const wxNativeFontInfo& info);
%extend {
%name(FontFromNativeInfoString) wxFont(const wxString& info) {
wxNativeFontInfo nfi;
nfi.FromString(info);
return new wxFont(nfi);
}
%name(Font2) wxFont(int pointSize,
wxFontFamily family,
int flags = wxFONTFLAG_DEFAULT,
const wxString& face = wxPyEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) {
return wxFont::New(pointSize, family, flags, face, encoding);
}
}
// was the font successfully created?
bool Ok() const;
%pythoncode { def __nonzero__(self): return self.Ok() }
// comparison
bool operator == (const wxFont& font) const;
bool operator != (const wxFont& font) const;
// accessors: get the font characteristics
virtual int GetPointSize() const;
virtual int GetFamily() const;
virtual int GetStyle() const;
virtual int GetWeight() const;
virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const;
virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual bool IsFixedWidth() const;
wxString GetNativeFontInfoDesc() const;
wxString GetNativeFontInfoUserDesc() const;
// change the font characteristics
virtual void SetPointSize( int pointSize );
virtual void SetFamily( int family );
virtual void SetStyle( int style );
virtual void SetWeight( int weight );
virtual void SetFaceName( const wxString& faceName );
virtual void SetUnderlined( bool underlined );
virtual void SetEncoding(wxFontEncoding encoding);
void SetNativeFontInfo(const wxNativeFontInfo& info);
%name(SetNativeFontInfoFromString) void SetNativeFontInfo(const wxString& info);
void SetNativeFontInfoUserDesc(const wxString& info);
// translate the fonts into human-readable string (i.e. GetStyleString()
// will return "wxITALIC" for an italic font, ...)
wxString GetFamilyString() const;
wxString GetStyleString() const;
wxString GetWeightString() const;
// Unofficial API, don't use
virtual void SetNoAntiAliasing( bool no = TRUE );
virtual bool GetNoAntiAliasing();
// the default encoding is used for creating all fonts with default
// encoding parameter
static wxFontEncoding GetDefaultEncoding() { return ms_encodingDefault; }
static void SetDefaultEncoding(wxFontEncoding encoding);
};
//---------------------------------------------------------------------------
%newgroup
// wxFontEnumerator
%{
class wxPyFontEnumerator : public wxFontEnumerator {
public:
wxPyFontEnumerator() {}
~wxPyFontEnumerator() {}
DEC_PYCALLBACK_BOOL_STRING(OnFacename);
DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
PYPRIVATE;
};
IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
%}
%name(FontEnumerator) class wxPyFontEnumerator {
public:
%addtofunc wxPyFontEnumerator "self._setCallbackInfo(self, FontEnumerator, 0)"
wxPyFontEnumerator();
~wxPyFontEnumerator();
void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref);
bool EnumerateFacenames(
wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
bool fixedWidthOnly = FALSE);
bool EnumerateEncodings(const wxString& facename = wxPyEmptyString);
//wxArrayString* GetEncodings();
//wxArrayString* GetFacenames();
%extend {
PyObject* GetEncodings() {
wxArrayString* arr = self->GetEncodings();
return wxArrayString2PyList_helper(*arr);
}
PyObject* GetFacenames() {
wxArrayString* arr = self->GetFacenames();
return wxArrayString2PyList_helper(*arr);
}
}
};
%init %{
wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator");
%}
//---------------------------------------------------------------------------

232
wxPython/src/_functions.i Normal file
View File

@@ -0,0 +1,232 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _functions.i
// Purpose: SWIG interface defs for various functions and such
//
// Author: Robin Dunn
//
// Created: 3-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(FileSelectorPromptStr);
DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
DECLARE_DEF_STRING(DirSelectorPromptStr);
%}
//---------------------------------------------------------------------------
%newgroup;
long wxNewId();
void wxRegisterId(long id);
long wxGetCurrentId();
void wxBell();
void wxEndBusyCursor();
long wxGetElapsedTime(bool resetTimer = TRUE);
void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
bool wxIsBusy();
wxString wxNow();
bool wxShell(const wxString& command = wxPyEmptyString);
void wxStartTimer();
int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
wxString wxGetOsDescription();
#if defined(__WXMSW__) || defined(__WXMAC__)
long wxGetFreeMemory();
#else
%inline %{
long wxGetFreeMemory()
{ PyErr_SetNone(PyExc_NotImplementedError); return 0; }
%}
#endif
enum wxShutdownFlags
{
wxSHUTDOWN_POWEROFF, // power off the computer
wxSHUTDOWN_REBOOT // shutdown and reboot
};
// Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags);
void wxSleep(int secs);
void wxUsleep(unsigned long milliseconds);
void wxEnableTopLevelWindows(bool enable);
wxString wxStripMenuCodes(const wxString& in);
wxString wxGetEmailAddress();
wxString wxGetHostName();
wxString wxGetFullHostName();
wxString wxGetUserId();
wxString wxGetUserName();
wxString wxGetHomeDir();
wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
unsigned long wxGetProcessId();
void wxTrap();
// Dialog Functions
wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
const wxString& default_path = wxPyEmptyString,
const wxString& default_filename = wxPyEmptyString,
const wxString& default_extension = wxPyEmptyString,
const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
int flags = 0,
wxWindow *parent = NULL,
int x = -1, int y = -1);
// TODO: wxFileSelectorEx
// Ask for filename to load
wxString wxLoadFileSelector(const wxString& what,
const wxString& extension,
const wxString& default_name = wxPyEmptyString,
wxWindow *parent = NULL);
// Ask for filename to save
wxString wxSaveFileSelector(const wxString& what,
const wxString& extension,
const wxString& default_name = wxPyEmptyString,
wxWindow *parent = NULL);
wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
const wxString& defaultPath = wxPyEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
wxWindow *parent = NULL);
wxString wxGetTextFromUser(const wxString& message,
const wxString& caption = wxPyEmptyString,
const wxString& default_value = wxPyEmptyString,
wxWindow *parent = NULL,
int x = -1, int y = -1,
bool centre = TRUE);
wxString wxGetPasswordFromUser(const wxString& message,
const wxString& caption = wxPyEmptyString,
const wxString& default_value = wxPyEmptyString,
wxWindow *parent = NULL);
// TODO: Need to custom wrap this one...
// int wxGetMultipleChoice(char* message, char* caption,
// int LCOUNT, char** choices,
// int nsel, int *selection,
// wxWindow *parent = NULL, int x = -1, int y = -1,
// bool centre = TRUE, int width=150, int height=200);
wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
int choices, wxString* choices_array,
wxWindow *parent = NULL,
int x = -1, int y = -1,
bool centre = TRUE,
int width=150, int height=200);
int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
int choices, wxString* choices_array,
wxWindow *parent = NULL,
int x = -1, int y = -1,
bool centre = TRUE,
int width=150, int height=200);
int wxMessageBox(const wxString& message,
const wxString& caption = wxPyEmptyString,
int style = wxOK | wxCENTRE,
wxWindow *parent = NULL,
int x = -1, int y = -1);
long wxGetNumberFromUser(const wxString& message,
const wxString& prompt,
const wxString& caption,
long value,
long min = 0, long max = 100,
wxWindow *parent = NULL,
const wxPoint& pos = wxDefaultPosition);
// GDI Functions
bool wxColourDisplay();
int wxDisplayDepth();
int wxGetDisplayDepth();
void wxDisplaySize(int* OUTPUT, int* OUTPUT);
wxSize wxGetDisplaySize();
void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT);
wxSize wxGetDisplaySizeMM();
void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT);
wxRect wxGetClientDisplayRect();
void wxSetCursor(wxCursor& cursor);
// Miscellaneous functions
void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
wxWindow * wxGetActiveWindow();
wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
wxWindow* wxGetTopLevelParent(wxWindow *win);
//bool wxSpawnBrowser(wxWindow *parent, wxString href);
//---------------------------------------------------------------------------
#if defined(__WXMSW__) || defined(__WXMAC__)
void wxWakeUpMainThread();
#else
%inline %{
void wxWakeUpMainThread() {}
%}
#endif
void wxMutexGuiEnter();
void wxMutexGuiLeave();
class wxMutexGuiLocker {
public:
wxMutexGuiLocker();
~wxMutexGuiLocker();
};
%inline %{
bool wxThread_IsMain() {
#ifdef WXP_WITH_THREAD
return wxThread::IsMain();
#else
return TRUE;
#endif
}
%}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

72
wxPython/src/_gauge.i Normal file
View File

@@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _gauge.i
// Purpose: SWIG interface defs for wxGauge
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(GaugeNameStr);
%}
%newgroup
enum {
wxGA_HORIZONTAL,
wxGA_VERTICAL,
wxGA_SMOOTH,
wxGA_PROGRESSBAR // obsolete
};
//---------------------------------------------------------------------------
class wxGauge : public wxControl {
public:
%addtofunc wxGauge "self._setOORInfo(self)"
%addtofunc wxGauge() ""
wxGauge(wxWindow* parent, wxWindowID id, int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyGaugeNameStr);
%name(PreGauge)wxGauge();
bool Create(wxWindow* parent, wxWindowID id, int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyGaugeNameStr);
// set/get the control range
virtual void SetRange(int range);
virtual int GetRange() const;
// position
virtual void SetValue(int pos);
virtual int GetValue() const;
// simple accessors
bool IsVertical() const;
// appearance params (not implemented for most ports)
virtual void SetShadowWidth(int w);
virtual int GetShadowWidth() const;
virtual void SetBezelFace(int w);
virtual int GetBezelFace() const;
};
//---------------------------------------------------------------------------

331
wxPython/src/_gbsizer.i Normal file
View File

@@ -0,0 +1,331 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _gbsizer.i
// Purpose: SWIG interface stuff for wxGBGridBagSizer and etc.
//
// Author: Robin Dunn
//
// Created: 05-Nov-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%typemap(in) wxGBPosition& (wxGBPosition temp) {
$1 = &temp;
if ( ! wxGBPosition_helper($input, &$1)) SWIG_fail;
}
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGBPosition& {
$1 = wxPySimple_typecheck($input, wxT("wxGBPosition"), 2);
}
%typemap(in) wxGBSpan& (wxGBSpan temp) {
$1 = &temp;
if ( ! wxGBSpan_helper($input, &$1)) SWIG_fail;
}
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGBSpan& {
$1 = wxPySimple_typecheck($input, wxT("wxGBSpan"), 2);
}
%{
bool wxGBPosition_helper(PyObject* source, wxGBPosition** obj)
{
return wxPyTwoIntItem_helper(source, obj, wxT("wxGBPosition"));
}
bool wxGBSpan_helper(PyObject* source, wxGBSpan** obj)
{
return wxPyTwoIntItem_helper(source, obj, wxT("wxGBSpan"));
}
%}
//---------------------------------------------------------------------------
%newgroup;
%noautorepr wxGBPosition;
class wxGBPosition
{
public:
wxGBPosition(int row=0, int col=0);
int GetRow() const;
int GetCol() const;
void SetRow(int row);
void SetCol(int col);
bool operator==(const wxGBPosition& p) const;
bool operator!=(const wxGBPosition& p) const;
%extend {
PyObject* asTuple() {
wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
wxPyEndBlockThreads();
return tup;
}
}
%pythoncode {
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxGBPosition'+str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.SetRow(val)
elif index == 1: self.SetCol(val)
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0,0)
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
%pythoncode {
row = property(GetRow, SetRow)
col = property(GetCol, SetCol)
}
};
%noautorepr wxGBSpan;
class wxGBSpan
{
public:
wxGBSpan(int rowspan=1, int colspan=1);
int GetRowspan() const;
int GetColspan() const;
void SetRowspan(int rowspan);
void SetColspan(int colspan);
bool operator==(const wxGBSpan& o) const;
bool operator!=(const wxGBSpan& o) const;
%extend {
PyObject* asTuple() {
wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRowspan()));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetColspan()));
wxPyEndBlockThreads();
return tup;
}
}
%pythoncode {
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxGBSpan'+str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.SetRowspan(val)
elif index == 1: self.SetColspan(val)
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0,0)
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
%pythoncode {
rowspan = property(GetRowspan, SetRowspan)
colspan = property(GetColspan, SetColspan)
}
};
%immutable;
const wxGBSpan wxDefaultSpan;
%mutable;
//---------------------------------------------------------------------------
class wxGBSizerItem : public wxSizerItem
{
public:
wxGBSizerItem();
%name(GBSizerItemWindow) wxGBSizerItem( wxWindow *window,
const wxGBPosition& pos,
const wxGBSpan& span,
int flag,
int border,
wxObject* userData );
%name(GBSizerItemSizer) wxGBSizerItem( wxSizer *sizer,
const wxGBPosition& pos,
const wxGBSpan& span,
int flag,
int border,
wxObject* userData );
%name(GBSizerItemSpacer) wxGBSizerItem( int width,
int height,
const wxGBPosition& pos,
const wxGBSpan& span,
int flag,
int border,
wxObject* userData);
// Get the grid position of the item
wxGBPosition GetPos() const;
%pythoncode { def GetPosTuple(self): return self.GetPos().asTuple() }
// Get the row and column spanning of the item
wxGBSpan GetSpan() const;
%pythoncode { def GetSpanTuple(self): return self.GetSpan().asTuple() }
// If the item is already a member of a sizer then first ensure that there
// is no other item that would intersect with this one at the new
// position, then set the new position. Returns true if the change is
// successful and after the next Layout the item will be moved.
bool SetPos( const wxGBPosition& pos );
// If the item is already a member of a sizer then first ensure that there
// is no other item that would intersect with this one with its new
// spanning size, then set the new spanning. Returns true if the change
// is successful and after the next Layout the item will be resized.
bool SetSpan( const wxGBSpan& span );
%nokwargs Intersects;
// Returns true if this item and the other item instersect
bool Intersects(const wxGBSizerItem& other);
// Returns true if the given pos/span would intersect with this item.
bool Intersects(const wxGBPosition& pos, const wxGBSpan& span);
// Get the row and column of the endpoint of this item
void GetEndPos(int& row, int& col);
wxGridBagSizer* GetGBSizer() const;
void SetGBSizer(wxGridBagSizer* sizer);
};
//---------------------------------------------------------------------------
class wxGridBagSizer : public wxFlexGridSizer
{
public:
wxGridBagSizer(int vgap = 0, int hgap = 0 );
// The Add method returns true if the item was successfully placed at the
// given cell position, false if something was already there.
%extend {
bool Add( PyObject* item,
const wxGBPosition& pos,
const wxGBSpan& span = wxDefaultSpan,
int flag = 0,
int border = 0,
PyObject* userData = NULL ) {
wxPyUserData* data = NULL;
wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
wxPyEndBlockThreads();
// Now call the real Add method if a valid item type was found
if ( info.window )
return self->Add(info.window, pos, span, flag, border, data);
else if ( info.sizer )
return self->Add(info.sizer, pos, span, flag, border, data);
else if (info.gotSize)
return self->Add(info.size.GetWidth(), info.size.GetHeight(),
pos, span, flag, border, data);
return false;
}
}
%name(AddItem) bool Add( wxGBSizerItem *item );
// Get/Set the size used for cells in the grid with no item.
wxSize GetEmptyCellSize() const;
void SetEmptyCellSize(const wxSize& sz);
// Get the grid position of the specified item
%nokwargs GetItemPosition;
wxGBPosition GetItemPosition(wxWindow *window);
wxGBPosition GetItemPosition(wxSizer *sizer);
wxGBPosition GetItemPosition(size_t index);
// Set the grid position of the specified item. Returns true on success.
// If the move is not allowed (because an item is already there) then
// false is returned.
%nokwargs SetItemPosition;
bool SetItemPosition(wxWindow *window, const wxGBPosition& pos);
bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos);
bool SetItemPosition(size_t index, const wxGBPosition& pos);
// Get the row/col spanning of the specified item
%nokwargs GetItemSpan;
wxGBSpan GetItemSpan(wxWindow *window);
wxGBSpan GetItemSpan(wxSizer *sizer);
wxGBSpan GetItemSpan(size_t index);
// Set the row/col spanning of the specified item. Returns true on
// success. If the move is not allowed (because an item is already there)
// then false is returned.
%nokwargs SetItemSpan;
bool SetItemSpan(wxWindow *window, const wxGBSpan& span);
bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span);
bool SetItemSpan(size_t index, const wxGBSpan& span);
// Find the sizer item for the given window or subsizer, returns NULL if
// not found. (non-recursive)
%nokwargs FindItem;
wxGBSizerItem* FindItem(wxWindow* window);
wxGBSizerItem* FindItem(wxSizer* sizer);
// Return the sizer item for the given grid cell, or NULL if there is no
// item at that position. (non-recursive)
wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos);
// Return the sizer item that has a matching user data (it only compares
// pointer values) or NULL if not found. (non-recursive)
wxGBSizerItem* FindItemWithData(const wxObject* userData);
// These are what make the sizer do size calculations and layout
virtual void RecalcSizes();
virtual wxSize CalcMin();
// Look at all items and see if any intersect (or would overlap) the given
// item. Returns true if so, false if there would be no overlap. If an
// excludeItem is given then it will not be checked for intersection, for
// example it may be the item we are checking the position of.
%nokwargs CheckForIntersection;
bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL);
bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL);
};
//---------------------------------------------------------------------------

435
wxPython/src/_gdi_rename.i Normal file
View File

@@ -0,0 +1,435 @@
// A bunch of %rename directives generated by ./distrib/build_renamers.py
// in order to remove the wx prefix from all global scope names.
#ifndef SWIGXML
%rename(GDIObject) wxGDIObject;
%rename(Colour) wxColour;
%rename(Palette) wxPalette;
%rename(Pen) wxPen;
%rename(PyPen) wxPyPen;
%rename(Brush) wxBrush;
%rename(Bitmap) wxBitmap;
%rename(Mask) wxMask;
%rename(Icon) wxIcon;
%rename(IconLocation) wxIconLocation;
%rename(IconBundle) wxIconBundle;
%rename(Cursor) wxCursor;
%rename(OutRegion) wxOutRegion;
%rename(PartRegion) wxPartRegion;
%rename(InRegion) wxInRegion;
%rename(Region) wxRegion;
%rename(RegionIterator) wxRegionIterator;
%rename(FONTFAMILY_DEFAULT) wxFONTFAMILY_DEFAULT;
%rename(FONTFAMILY_DECORATIVE) wxFONTFAMILY_DECORATIVE;
%rename(FONTFAMILY_ROMAN) wxFONTFAMILY_ROMAN;
%rename(FONTFAMILY_SCRIPT) wxFONTFAMILY_SCRIPT;
%rename(FONTFAMILY_SWISS) wxFONTFAMILY_SWISS;
%rename(FONTFAMILY_MODERN) wxFONTFAMILY_MODERN;
%rename(FONTFAMILY_TELETYPE) wxFONTFAMILY_TELETYPE;
%rename(FONTFAMILY_MAX) wxFONTFAMILY_MAX;
%rename(FONTFAMILY_UNKNOWN) wxFONTFAMILY_UNKNOWN;
%rename(FONTSTYLE_NORMAL) wxFONTSTYLE_NORMAL;
%rename(FONTSTYLE_ITALIC) wxFONTSTYLE_ITALIC;
%rename(FONTSTYLE_SLANT) wxFONTSTYLE_SLANT;
%rename(FONTSTYLE_MAX) wxFONTSTYLE_MAX;
%rename(FONTWEIGHT_NORMAL) wxFONTWEIGHT_NORMAL;
%rename(FONTWEIGHT_LIGHT) wxFONTWEIGHT_LIGHT;
%rename(FONTWEIGHT_BOLD) wxFONTWEIGHT_BOLD;
%rename(FONTWEIGHT_MAX) wxFONTWEIGHT_MAX;
%rename(FONTFLAG_DEFAULT) wxFONTFLAG_DEFAULT;
%rename(FONTFLAG_ITALIC) wxFONTFLAG_ITALIC;
%rename(FONTFLAG_SLANT) wxFONTFLAG_SLANT;
%rename(FONTFLAG_LIGHT) wxFONTFLAG_LIGHT;
%rename(FONTFLAG_BOLD) wxFONTFLAG_BOLD;
%rename(FONTFLAG_ANTIALIASED) wxFONTFLAG_ANTIALIASED;
%rename(FONTFLAG_NOT_ANTIALIASED) wxFONTFLAG_NOT_ANTIALIASED;
%rename(FONTFLAG_UNDERLINED) wxFONTFLAG_UNDERLINED;
%rename(FONTFLAG_STRIKETHROUGH) wxFONTFLAG_STRIKETHROUGH;
%rename(FONTFLAG_MASK) wxFONTFLAG_MASK;
%rename(FONTENCODING_SYSTEM) wxFONTENCODING_SYSTEM;
%rename(FONTENCODING_DEFAULT) wxFONTENCODING_DEFAULT;
%rename(FONTENCODING_ISO8859_1) wxFONTENCODING_ISO8859_1;
%rename(FONTENCODING_ISO8859_2) wxFONTENCODING_ISO8859_2;
%rename(FONTENCODING_ISO8859_3) wxFONTENCODING_ISO8859_3;
%rename(FONTENCODING_ISO8859_4) wxFONTENCODING_ISO8859_4;
%rename(FONTENCODING_ISO8859_5) wxFONTENCODING_ISO8859_5;
%rename(FONTENCODING_ISO8859_6) wxFONTENCODING_ISO8859_6;
%rename(FONTENCODING_ISO8859_7) wxFONTENCODING_ISO8859_7;
%rename(FONTENCODING_ISO8859_8) wxFONTENCODING_ISO8859_8;
%rename(FONTENCODING_ISO8859_9) wxFONTENCODING_ISO8859_9;
%rename(FONTENCODING_ISO8859_10) wxFONTENCODING_ISO8859_10;
%rename(FONTENCODING_ISO8859_11) wxFONTENCODING_ISO8859_11;
%rename(FONTENCODING_ISO8859_12) wxFONTENCODING_ISO8859_12;
%rename(FONTENCODING_ISO8859_13) wxFONTENCODING_ISO8859_13;
%rename(FONTENCODING_ISO8859_14) wxFONTENCODING_ISO8859_14;
%rename(FONTENCODING_ISO8859_15) wxFONTENCODING_ISO8859_15;
%rename(FONTENCODING_ISO8859_MAX) wxFONTENCODING_ISO8859_MAX;
%rename(FONTENCODING_KOI8) wxFONTENCODING_KOI8;
%rename(FONTENCODING_ALTERNATIVE) wxFONTENCODING_ALTERNATIVE;
%rename(FONTENCODING_BULGARIAN) wxFONTENCODING_BULGARIAN;
%rename(FONTENCODING_CP437) wxFONTENCODING_CP437;
%rename(FONTENCODING_CP850) wxFONTENCODING_CP850;
%rename(FONTENCODING_CP852) wxFONTENCODING_CP852;
%rename(FONTENCODING_CP855) wxFONTENCODING_CP855;
%rename(FONTENCODING_CP866) wxFONTENCODING_CP866;
%rename(FONTENCODING_CP874) wxFONTENCODING_CP874;
%rename(FONTENCODING_CP932) wxFONTENCODING_CP932;
%rename(FONTENCODING_CP936) wxFONTENCODING_CP936;
%rename(FONTENCODING_CP949) wxFONTENCODING_CP949;
%rename(FONTENCODING_CP950) wxFONTENCODING_CP950;
%rename(FONTENCODING_CP1250) wxFONTENCODING_CP1250;
%rename(FONTENCODING_CP1251) wxFONTENCODING_CP1251;
%rename(FONTENCODING_CP1252) wxFONTENCODING_CP1252;
%rename(FONTENCODING_CP1253) wxFONTENCODING_CP1253;
%rename(FONTENCODING_CP1254) wxFONTENCODING_CP1254;
%rename(FONTENCODING_CP1255) wxFONTENCODING_CP1255;
%rename(FONTENCODING_CP1256) wxFONTENCODING_CP1256;
%rename(FONTENCODING_CP1257) wxFONTENCODING_CP1257;
%rename(FONTENCODING_CP12_MAX) wxFONTENCODING_CP12_MAX;
%rename(FONTENCODING_UTF7) wxFONTENCODING_UTF7;
%rename(FONTENCODING_UTF8) wxFONTENCODING_UTF8;
%rename(FONTENCODING_EUC_JP) wxFONTENCODING_EUC_JP;
%rename(FONTENCODING_UTF16BE) wxFONTENCODING_UTF16BE;
%rename(FONTENCODING_UTF16LE) wxFONTENCODING_UTF16LE;
%rename(FONTENCODING_UTF32BE) wxFONTENCODING_UTF32BE;
%rename(FONTENCODING_UTF32LE) wxFONTENCODING_UTF32LE;
%rename(FONTENCODING_MAX) wxFONTENCODING_MAX;
%rename(FONTENCODING_UTF16) wxFONTENCODING_UTF16;
%rename(FONTENCODING_UTF32) wxFONTENCODING_UTF32;
%rename(FONTENCODING_UNICODE) wxFONTENCODING_UNICODE;
%rename(FONTENCODING_GB2312) wxFONTENCODING_GB2312;
%rename(FONTENCODING_BIG5) wxFONTENCODING_BIG5;
%rename(FONTENCODING_SHIFT_JIS) wxFONTENCODING_SHIFT_JIS;
%rename(NativeFontInfo) wxNativeFontInfo;
%rename(NativeEncodingInfo) wxNativeEncodingInfo;
%rename(GetNativeFontEncoding) wxGetNativeFontEncoding;
%rename(TestFontEncoding) wxTestFontEncoding;
%rename(FontMapper) wxFontMapper;
%rename(Font) wxFont;
%rename(LANGUAGE_DEFAULT) wxLANGUAGE_DEFAULT;
%rename(LANGUAGE_UNKNOWN) wxLANGUAGE_UNKNOWN;
%rename(LANGUAGE_ABKHAZIAN) wxLANGUAGE_ABKHAZIAN;
%rename(LANGUAGE_AFAR) wxLANGUAGE_AFAR;
%rename(LANGUAGE_AFRIKAANS) wxLANGUAGE_AFRIKAANS;
%rename(LANGUAGE_ALBANIAN) wxLANGUAGE_ALBANIAN;
%rename(LANGUAGE_AMHARIC) wxLANGUAGE_AMHARIC;
%rename(LANGUAGE_ARABIC) wxLANGUAGE_ARABIC;
%rename(LANGUAGE_ARABIC_ALGERIA) wxLANGUAGE_ARABIC_ALGERIA;
%rename(LANGUAGE_ARABIC_BAHRAIN) wxLANGUAGE_ARABIC_BAHRAIN;
%rename(LANGUAGE_ARABIC_EGYPT) wxLANGUAGE_ARABIC_EGYPT;
%rename(LANGUAGE_ARABIC_IRAQ) wxLANGUAGE_ARABIC_IRAQ;
%rename(LANGUAGE_ARABIC_JORDAN) wxLANGUAGE_ARABIC_JORDAN;
%rename(LANGUAGE_ARABIC_KUWAIT) wxLANGUAGE_ARABIC_KUWAIT;
%rename(LANGUAGE_ARABIC_LEBANON) wxLANGUAGE_ARABIC_LEBANON;
%rename(LANGUAGE_ARABIC_LIBYA) wxLANGUAGE_ARABIC_LIBYA;
%rename(LANGUAGE_ARABIC_MOROCCO) wxLANGUAGE_ARABIC_MOROCCO;
%rename(LANGUAGE_ARABIC_OMAN) wxLANGUAGE_ARABIC_OMAN;
%rename(LANGUAGE_ARABIC_QATAR) wxLANGUAGE_ARABIC_QATAR;
%rename(LANGUAGE_ARABIC_SAUDI_ARABIA) wxLANGUAGE_ARABIC_SAUDI_ARABIA;
%rename(LANGUAGE_ARABIC_SUDAN) wxLANGUAGE_ARABIC_SUDAN;
%rename(LANGUAGE_ARABIC_SYRIA) wxLANGUAGE_ARABIC_SYRIA;
%rename(LANGUAGE_ARABIC_TUNISIA) wxLANGUAGE_ARABIC_TUNISIA;
%rename(LANGUAGE_ARABIC_UAE) wxLANGUAGE_ARABIC_UAE;
%rename(LANGUAGE_ARABIC_YEMEN) wxLANGUAGE_ARABIC_YEMEN;
%rename(LANGUAGE_ARMENIAN) wxLANGUAGE_ARMENIAN;
%rename(LANGUAGE_ASSAMESE) wxLANGUAGE_ASSAMESE;
%rename(LANGUAGE_AYMARA) wxLANGUAGE_AYMARA;
%rename(LANGUAGE_AZERI) wxLANGUAGE_AZERI;
%rename(LANGUAGE_AZERI_CYRILLIC) wxLANGUAGE_AZERI_CYRILLIC;
%rename(LANGUAGE_AZERI_LATIN) wxLANGUAGE_AZERI_LATIN;
%rename(LANGUAGE_BASHKIR) wxLANGUAGE_BASHKIR;
%rename(LANGUAGE_BASQUE) wxLANGUAGE_BASQUE;
%rename(LANGUAGE_BELARUSIAN) wxLANGUAGE_BELARUSIAN;
%rename(LANGUAGE_BENGALI) wxLANGUAGE_BENGALI;
%rename(LANGUAGE_BHUTANI) wxLANGUAGE_BHUTANI;
%rename(LANGUAGE_BIHARI) wxLANGUAGE_BIHARI;
%rename(LANGUAGE_BISLAMA) wxLANGUAGE_BISLAMA;
%rename(LANGUAGE_BRETON) wxLANGUAGE_BRETON;
%rename(LANGUAGE_BULGARIAN) wxLANGUAGE_BULGARIAN;
%rename(LANGUAGE_BURMESE) wxLANGUAGE_BURMESE;
%rename(LANGUAGE_CAMBODIAN) wxLANGUAGE_CAMBODIAN;
%rename(LANGUAGE_CATALAN) wxLANGUAGE_CATALAN;
%rename(LANGUAGE_CHINESE) wxLANGUAGE_CHINESE;
%rename(LANGUAGE_CHINESE_SIMPLIFIED) wxLANGUAGE_CHINESE_SIMPLIFIED;
%rename(LANGUAGE_CHINESE_TRADITIONAL) wxLANGUAGE_CHINESE_TRADITIONAL;
%rename(LANGUAGE_CHINESE_HONGKONG) wxLANGUAGE_CHINESE_HONGKONG;
%rename(LANGUAGE_CHINESE_MACAU) wxLANGUAGE_CHINESE_MACAU;
%rename(LANGUAGE_CHINESE_SINGAPORE) wxLANGUAGE_CHINESE_SINGAPORE;
%rename(LANGUAGE_CHINESE_TAIWAN) wxLANGUAGE_CHINESE_TAIWAN;
%rename(LANGUAGE_CORSICAN) wxLANGUAGE_CORSICAN;
%rename(LANGUAGE_CROATIAN) wxLANGUAGE_CROATIAN;
%rename(LANGUAGE_CZECH) wxLANGUAGE_CZECH;
%rename(LANGUAGE_DANISH) wxLANGUAGE_DANISH;
%rename(LANGUAGE_DUTCH) wxLANGUAGE_DUTCH;
%rename(LANGUAGE_DUTCH_BELGIAN) wxLANGUAGE_DUTCH_BELGIAN;
%rename(LANGUAGE_ENGLISH) wxLANGUAGE_ENGLISH;
%rename(LANGUAGE_ENGLISH_UK) wxLANGUAGE_ENGLISH_UK;
%rename(LANGUAGE_ENGLISH_US) wxLANGUAGE_ENGLISH_US;
%rename(LANGUAGE_ENGLISH_AUSTRALIA) wxLANGUAGE_ENGLISH_AUSTRALIA;
%rename(LANGUAGE_ENGLISH_BELIZE) wxLANGUAGE_ENGLISH_BELIZE;
%rename(LANGUAGE_ENGLISH_BOTSWANA) wxLANGUAGE_ENGLISH_BOTSWANA;
%rename(LANGUAGE_ENGLISH_CANADA) wxLANGUAGE_ENGLISH_CANADA;
%rename(LANGUAGE_ENGLISH_CARIBBEAN) wxLANGUAGE_ENGLISH_CARIBBEAN;
%rename(LANGUAGE_ENGLISH_DENMARK) wxLANGUAGE_ENGLISH_DENMARK;
%rename(LANGUAGE_ENGLISH_EIRE) wxLANGUAGE_ENGLISH_EIRE;
%rename(LANGUAGE_ENGLISH_JAMAICA) wxLANGUAGE_ENGLISH_JAMAICA;
%rename(LANGUAGE_ENGLISH_NEW_ZEALAND) wxLANGUAGE_ENGLISH_NEW_ZEALAND;
%rename(LANGUAGE_ENGLISH_PHILIPPINES) wxLANGUAGE_ENGLISH_PHILIPPINES;
%rename(LANGUAGE_ENGLISH_SOUTH_AFRICA) wxLANGUAGE_ENGLISH_SOUTH_AFRICA;
%rename(LANGUAGE_ENGLISH_TRINIDAD) wxLANGUAGE_ENGLISH_TRINIDAD;
%rename(LANGUAGE_ENGLISH_ZIMBABWE) wxLANGUAGE_ENGLISH_ZIMBABWE;
%rename(LANGUAGE_ESPERANTO) wxLANGUAGE_ESPERANTO;
%rename(LANGUAGE_ESTONIAN) wxLANGUAGE_ESTONIAN;
%rename(LANGUAGE_FAEROESE) wxLANGUAGE_FAEROESE;
%rename(LANGUAGE_FARSI) wxLANGUAGE_FARSI;
%rename(LANGUAGE_FIJI) wxLANGUAGE_FIJI;
%rename(LANGUAGE_FINNISH) wxLANGUAGE_FINNISH;
%rename(LANGUAGE_FRENCH) wxLANGUAGE_FRENCH;
%rename(LANGUAGE_FRENCH_BELGIAN) wxLANGUAGE_FRENCH_BELGIAN;
%rename(LANGUAGE_FRENCH_CANADIAN) wxLANGUAGE_FRENCH_CANADIAN;
%rename(LANGUAGE_FRENCH_LUXEMBOURG) wxLANGUAGE_FRENCH_LUXEMBOURG;
%rename(LANGUAGE_FRENCH_MONACO) wxLANGUAGE_FRENCH_MONACO;
%rename(LANGUAGE_FRENCH_SWISS) wxLANGUAGE_FRENCH_SWISS;
%rename(LANGUAGE_FRISIAN) wxLANGUAGE_FRISIAN;
%rename(LANGUAGE_GALICIAN) wxLANGUAGE_GALICIAN;
%rename(LANGUAGE_GEORGIAN) wxLANGUAGE_GEORGIAN;
%rename(LANGUAGE_GERMAN) wxLANGUAGE_GERMAN;
%rename(LANGUAGE_GERMAN_AUSTRIAN) wxLANGUAGE_GERMAN_AUSTRIAN;
%rename(LANGUAGE_GERMAN_BELGIUM) wxLANGUAGE_GERMAN_BELGIUM;
%rename(LANGUAGE_GERMAN_LIECHTENSTEIN) wxLANGUAGE_GERMAN_LIECHTENSTEIN;
%rename(LANGUAGE_GERMAN_LUXEMBOURG) wxLANGUAGE_GERMAN_LUXEMBOURG;
%rename(LANGUAGE_GERMAN_SWISS) wxLANGUAGE_GERMAN_SWISS;
%rename(LANGUAGE_GREEK) wxLANGUAGE_GREEK;
%rename(LANGUAGE_GREENLANDIC) wxLANGUAGE_GREENLANDIC;
%rename(LANGUAGE_GUARANI) wxLANGUAGE_GUARANI;
%rename(LANGUAGE_GUJARATI) wxLANGUAGE_GUJARATI;
%rename(LANGUAGE_HAUSA) wxLANGUAGE_HAUSA;
%rename(LANGUAGE_HEBREW) wxLANGUAGE_HEBREW;
%rename(LANGUAGE_HINDI) wxLANGUAGE_HINDI;
%rename(LANGUAGE_HUNGARIAN) wxLANGUAGE_HUNGARIAN;
%rename(LANGUAGE_ICELANDIC) wxLANGUAGE_ICELANDIC;
%rename(LANGUAGE_INDONESIAN) wxLANGUAGE_INDONESIAN;
%rename(LANGUAGE_INTERLINGUA) wxLANGUAGE_INTERLINGUA;
%rename(LANGUAGE_INTERLINGUE) wxLANGUAGE_INTERLINGUE;
%rename(LANGUAGE_INUKTITUT) wxLANGUAGE_INUKTITUT;
%rename(LANGUAGE_INUPIAK) wxLANGUAGE_INUPIAK;
%rename(LANGUAGE_IRISH) wxLANGUAGE_IRISH;
%rename(LANGUAGE_ITALIAN) wxLANGUAGE_ITALIAN;
%rename(LANGUAGE_ITALIAN_SWISS) wxLANGUAGE_ITALIAN_SWISS;
%rename(LANGUAGE_JAPANESE) wxLANGUAGE_JAPANESE;
%rename(LANGUAGE_JAVANESE) wxLANGUAGE_JAVANESE;
%rename(LANGUAGE_KANNADA) wxLANGUAGE_KANNADA;
%rename(LANGUAGE_KASHMIRI) wxLANGUAGE_KASHMIRI;
%rename(LANGUAGE_KASHMIRI_INDIA) wxLANGUAGE_KASHMIRI_INDIA;
%rename(LANGUAGE_KAZAKH) wxLANGUAGE_KAZAKH;
%rename(LANGUAGE_KERNEWEK) wxLANGUAGE_KERNEWEK;
%rename(LANGUAGE_KINYARWANDA) wxLANGUAGE_KINYARWANDA;
%rename(LANGUAGE_KIRGHIZ) wxLANGUAGE_KIRGHIZ;
%rename(LANGUAGE_KIRUNDI) wxLANGUAGE_KIRUNDI;
%rename(LANGUAGE_KONKANI) wxLANGUAGE_KONKANI;
%rename(LANGUAGE_KOREAN) wxLANGUAGE_KOREAN;
%rename(LANGUAGE_KURDISH) wxLANGUAGE_KURDISH;
%rename(LANGUAGE_LAOTHIAN) wxLANGUAGE_LAOTHIAN;
%rename(LANGUAGE_LATIN) wxLANGUAGE_LATIN;
%rename(LANGUAGE_LATVIAN) wxLANGUAGE_LATVIAN;
%rename(LANGUAGE_LINGALA) wxLANGUAGE_LINGALA;
%rename(LANGUAGE_LITHUANIAN) wxLANGUAGE_LITHUANIAN;
%rename(LANGUAGE_MACEDONIAN) wxLANGUAGE_MACEDONIAN;
%rename(LANGUAGE_MALAGASY) wxLANGUAGE_MALAGASY;
%rename(LANGUAGE_MALAY) wxLANGUAGE_MALAY;
%rename(LANGUAGE_MALAYALAM) wxLANGUAGE_MALAYALAM;
%rename(LANGUAGE_MALAY_BRUNEI_DARUSSALAM) wxLANGUAGE_MALAY_BRUNEI_DARUSSALAM;
%rename(LANGUAGE_MALAY_MALAYSIA) wxLANGUAGE_MALAY_MALAYSIA;
%rename(LANGUAGE_MALTESE) wxLANGUAGE_MALTESE;
%rename(LANGUAGE_MANIPURI) wxLANGUAGE_MANIPURI;
%rename(LANGUAGE_MAORI) wxLANGUAGE_MAORI;
%rename(LANGUAGE_MARATHI) wxLANGUAGE_MARATHI;
%rename(LANGUAGE_MOLDAVIAN) wxLANGUAGE_MOLDAVIAN;
%rename(LANGUAGE_MONGOLIAN) wxLANGUAGE_MONGOLIAN;
%rename(LANGUAGE_NAURU) wxLANGUAGE_NAURU;
%rename(LANGUAGE_NEPALI) wxLANGUAGE_NEPALI;
%rename(LANGUAGE_NEPALI_INDIA) wxLANGUAGE_NEPALI_INDIA;
%rename(LANGUAGE_NORWEGIAN_BOKMAL) wxLANGUAGE_NORWEGIAN_BOKMAL;
%rename(LANGUAGE_NORWEGIAN_NYNORSK) wxLANGUAGE_NORWEGIAN_NYNORSK;
%rename(LANGUAGE_OCCITAN) wxLANGUAGE_OCCITAN;
%rename(LANGUAGE_ORIYA) wxLANGUAGE_ORIYA;
%rename(LANGUAGE_OROMO) wxLANGUAGE_OROMO;
%rename(LANGUAGE_PASHTO) wxLANGUAGE_PASHTO;
%rename(LANGUAGE_POLISH) wxLANGUAGE_POLISH;
%rename(LANGUAGE_PORTUGUESE) wxLANGUAGE_PORTUGUESE;
%rename(LANGUAGE_PORTUGUESE_BRAZILIAN) wxLANGUAGE_PORTUGUESE_BRAZILIAN;
%rename(LANGUAGE_PUNJABI) wxLANGUAGE_PUNJABI;
%rename(LANGUAGE_QUECHUA) wxLANGUAGE_QUECHUA;
%rename(LANGUAGE_RHAETO_ROMANCE) wxLANGUAGE_RHAETO_ROMANCE;
%rename(LANGUAGE_ROMANIAN) wxLANGUAGE_ROMANIAN;
%rename(LANGUAGE_RUSSIAN) wxLANGUAGE_RUSSIAN;
%rename(LANGUAGE_RUSSIAN_UKRAINE) wxLANGUAGE_RUSSIAN_UKRAINE;
%rename(LANGUAGE_SAMOAN) wxLANGUAGE_SAMOAN;
%rename(LANGUAGE_SANGHO) wxLANGUAGE_SANGHO;
%rename(LANGUAGE_SANSKRIT) wxLANGUAGE_SANSKRIT;
%rename(LANGUAGE_SCOTS_GAELIC) wxLANGUAGE_SCOTS_GAELIC;
%rename(LANGUAGE_SERBIAN) wxLANGUAGE_SERBIAN;
%rename(LANGUAGE_SERBIAN_CYRILLIC) wxLANGUAGE_SERBIAN_CYRILLIC;
%rename(LANGUAGE_SERBIAN_LATIN) wxLANGUAGE_SERBIAN_LATIN;
%rename(LANGUAGE_SERBO_CROATIAN) wxLANGUAGE_SERBO_CROATIAN;
%rename(LANGUAGE_SESOTHO) wxLANGUAGE_SESOTHO;
%rename(LANGUAGE_SETSWANA) wxLANGUAGE_SETSWANA;
%rename(LANGUAGE_SHONA) wxLANGUAGE_SHONA;
%rename(LANGUAGE_SINDHI) wxLANGUAGE_SINDHI;
%rename(LANGUAGE_SINHALESE) wxLANGUAGE_SINHALESE;
%rename(LANGUAGE_SISWATI) wxLANGUAGE_SISWATI;
%rename(LANGUAGE_SLOVAK) wxLANGUAGE_SLOVAK;
%rename(LANGUAGE_SLOVENIAN) wxLANGUAGE_SLOVENIAN;
%rename(LANGUAGE_SOMALI) wxLANGUAGE_SOMALI;
%rename(LANGUAGE_SPANISH) wxLANGUAGE_SPANISH;
%rename(LANGUAGE_SPANISH_ARGENTINA) wxLANGUAGE_SPANISH_ARGENTINA;
%rename(LANGUAGE_SPANISH_BOLIVIA) wxLANGUAGE_SPANISH_BOLIVIA;
%rename(LANGUAGE_SPANISH_CHILE) wxLANGUAGE_SPANISH_CHILE;
%rename(LANGUAGE_SPANISH_COLOMBIA) wxLANGUAGE_SPANISH_COLOMBIA;
%rename(LANGUAGE_SPANISH_COSTA_RICA) wxLANGUAGE_SPANISH_COSTA_RICA;
%rename(LANGUAGE_SPANISH_DOMINICAN_REPUBLIC) wxLANGUAGE_SPANISH_DOMINICAN_REPUBLIC;
%rename(LANGUAGE_SPANISH_ECUADOR) wxLANGUAGE_SPANISH_ECUADOR;
%rename(LANGUAGE_SPANISH_EL_SALVADOR) wxLANGUAGE_SPANISH_EL_SALVADOR;
%rename(LANGUAGE_SPANISH_GUATEMALA) wxLANGUAGE_SPANISH_GUATEMALA;
%rename(LANGUAGE_SPANISH_HONDURAS) wxLANGUAGE_SPANISH_HONDURAS;
%rename(LANGUAGE_SPANISH_MEXICAN) wxLANGUAGE_SPANISH_MEXICAN;
%rename(LANGUAGE_SPANISH_MODERN) wxLANGUAGE_SPANISH_MODERN;
%rename(LANGUAGE_SPANISH_NICARAGUA) wxLANGUAGE_SPANISH_NICARAGUA;
%rename(LANGUAGE_SPANISH_PANAMA) wxLANGUAGE_SPANISH_PANAMA;
%rename(LANGUAGE_SPANISH_PARAGUAY) wxLANGUAGE_SPANISH_PARAGUAY;
%rename(LANGUAGE_SPANISH_PERU) wxLANGUAGE_SPANISH_PERU;
%rename(LANGUAGE_SPANISH_PUERTO_RICO) wxLANGUAGE_SPANISH_PUERTO_RICO;
%rename(LANGUAGE_SPANISH_URUGUAY) wxLANGUAGE_SPANISH_URUGUAY;
%rename(LANGUAGE_SPANISH_US) wxLANGUAGE_SPANISH_US;
%rename(LANGUAGE_SPANISH_VENEZUELA) wxLANGUAGE_SPANISH_VENEZUELA;
%rename(LANGUAGE_SUNDANESE) wxLANGUAGE_SUNDANESE;
%rename(LANGUAGE_SWAHILI) wxLANGUAGE_SWAHILI;
%rename(LANGUAGE_SWEDISH) wxLANGUAGE_SWEDISH;
%rename(LANGUAGE_SWEDISH_FINLAND) wxLANGUAGE_SWEDISH_FINLAND;
%rename(LANGUAGE_TAGALOG) wxLANGUAGE_TAGALOG;
%rename(LANGUAGE_TAJIK) wxLANGUAGE_TAJIK;
%rename(LANGUAGE_TAMIL) wxLANGUAGE_TAMIL;
%rename(LANGUAGE_TATAR) wxLANGUAGE_TATAR;
%rename(LANGUAGE_TELUGU) wxLANGUAGE_TELUGU;
%rename(LANGUAGE_THAI) wxLANGUAGE_THAI;
%rename(LANGUAGE_TIBETAN) wxLANGUAGE_TIBETAN;
%rename(LANGUAGE_TIGRINYA) wxLANGUAGE_TIGRINYA;
%rename(LANGUAGE_TONGA) wxLANGUAGE_TONGA;
%rename(LANGUAGE_TSONGA) wxLANGUAGE_TSONGA;
%rename(LANGUAGE_TURKISH) wxLANGUAGE_TURKISH;
%rename(LANGUAGE_TURKMEN) wxLANGUAGE_TURKMEN;
%rename(LANGUAGE_TWI) wxLANGUAGE_TWI;
%rename(LANGUAGE_UIGHUR) wxLANGUAGE_UIGHUR;
%rename(LANGUAGE_UKRAINIAN) wxLANGUAGE_UKRAINIAN;
%rename(LANGUAGE_URDU) wxLANGUAGE_URDU;
%rename(LANGUAGE_URDU_INDIA) wxLANGUAGE_URDU_INDIA;
%rename(LANGUAGE_URDU_PAKISTAN) wxLANGUAGE_URDU_PAKISTAN;
%rename(LANGUAGE_UZBEK) wxLANGUAGE_UZBEK;
%rename(LANGUAGE_UZBEK_CYRILLIC) wxLANGUAGE_UZBEK_CYRILLIC;
%rename(LANGUAGE_UZBEK_LATIN) wxLANGUAGE_UZBEK_LATIN;
%rename(LANGUAGE_VIETNAMESE) wxLANGUAGE_VIETNAMESE;
%rename(LANGUAGE_VOLAPUK) wxLANGUAGE_VOLAPUK;
%rename(LANGUAGE_WELSH) wxLANGUAGE_WELSH;
%rename(LANGUAGE_WOLOF) wxLANGUAGE_WOLOF;
%rename(LANGUAGE_XHOSA) wxLANGUAGE_XHOSA;
%rename(LANGUAGE_YIDDISH) wxLANGUAGE_YIDDISH;
%rename(LANGUAGE_YORUBA) wxLANGUAGE_YORUBA;
%rename(LANGUAGE_ZHUANG) wxLANGUAGE_ZHUANG;
%rename(LANGUAGE_ZULU) wxLANGUAGE_ZULU;
%rename(LANGUAGE_USER_DEFINED) wxLANGUAGE_USER_DEFINED;
%rename(LanguageInfo) wxLanguageInfo;
%rename(LOCALE_CAT_NUMBER) wxLOCALE_CAT_NUMBER;
%rename(LOCALE_CAT_DATE) wxLOCALE_CAT_DATE;
%rename(LOCALE_CAT_MONEY) wxLOCALE_CAT_MONEY;
%rename(LOCALE_CAT_MAX) wxLOCALE_CAT_MAX;
%rename(LOCALE_THOUSANDS_SEP) wxLOCALE_THOUSANDS_SEP;
%rename(LOCALE_DECIMAL_POINT) wxLOCALE_DECIMAL_POINT;
%rename(LOCALE_LOAD_DEFAULT) wxLOCALE_LOAD_DEFAULT;
%rename(LOCALE_CONV_ENCODING) wxLOCALE_CONV_ENCODING;
%rename(Locale) wxLocale;
%rename(GetLocale) wxGetLocale;
%rename(GetTranslation) wxGetTranslation;
%rename(GetTranslation) wxGetTranslation;
%rename(CONVERT_STRICT) wxCONVERT_STRICT;
%rename(CONVERT_SUBSTITUTE) wxCONVERT_SUBSTITUTE;
%rename(PLATFORM_CURRENT) wxPLATFORM_CURRENT;
%rename(PLATFORM_UNIX) wxPLATFORM_UNIX;
%rename(PLATFORM_WINDOWS) wxPLATFORM_WINDOWS;
%rename(PLATFORM_OS2) wxPLATFORM_OS2;
%rename(PLATFORM_MAC) wxPLATFORM_MAC;
%rename(EncodingConverter) wxEncodingConverter;
%rename(DC) wxDC;
%rename(MemoryDC) wxMemoryDC;
%rename(BufferedDC) wxBufferedDC;
%rename(BufferedPaintDC) wxBufferedPaintDC;
%rename(ScreenDC) wxScreenDC;
%rename(ClientDC) wxClientDC;
%rename(PaintDC) wxPaintDC;
%rename(WindowDC) wxWindowDC;
%rename(MirrorDC) wxMirrorDC;
%rename(PostScriptDC) wxPostScriptDC;
%rename(MetaFile) wxMetaFile;
%rename(MetaFileDC) wxMetaFileDC;
%rename(PrinterDC) wxPrinterDC;
%rename(IMAGELIST_DRAW_NORMAL) wxIMAGELIST_DRAW_NORMAL;
%rename(IMAGELIST_DRAW_TRANSPARENT) wxIMAGELIST_DRAW_TRANSPARENT;
%rename(IMAGELIST_DRAW_SELECTED) wxIMAGELIST_DRAW_SELECTED;
%rename(IMAGELIST_DRAW_FOCUSED) wxIMAGELIST_DRAW_FOCUSED;
%rename(IMAGE_LIST_NORMAL) wxIMAGE_LIST_NORMAL;
%rename(IMAGE_LIST_SMALL) wxIMAGE_LIST_SMALL;
%rename(IMAGE_LIST_STATE) wxIMAGE_LIST_STATE;
%rename(ImageList) wxImageList;
%rename(PenList) wxPenList;
%rename(BrushList) wxBrushList;
%rename(ColourDatabase) wxColourDatabase;
%rename(FontList) wxFontList;
%rename(NORMAL_FONT) wxNORMAL_FONT;
%rename(SMALL_FONT) wxSMALL_FONT;
%rename(ITALIC_FONT) wxITALIC_FONT;
%rename(SWISS_FONT) wxSWISS_FONT;
%rename(RED_PEN) wxRED_PEN;
%rename(CYAN_PEN) wxCYAN_PEN;
%rename(GREEN_PEN) wxGREEN_PEN;
%rename(BLACK_PEN) wxBLACK_PEN;
%rename(WHITE_PEN) wxWHITE_PEN;
%rename(TRANSPARENT_PEN) wxTRANSPARENT_PEN;
%rename(BLACK_DASHED_PEN) wxBLACK_DASHED_PEN;
%rename(GREY_PEN) wxGREY_PEN;
%rename(MEDIUM_GREY_PEN) wxMEDIUM_GREY_PEN;
%rename(LIGHT_GREY_PEN) wxLIGHT_GREY_PEN;
%rename(BLUE_BRUSH) wxBLUE_BRUSH;
%rename(GREEN_BRUSH) wxGREEN_BRUSH;
%rename(WHITE_BRUSH) wxWHITE_BRUSH;
%rename(BLACK_BRUSH) wxBLACK_BRUSH;
%rename(TRANSPARENT_BRUSH) wxTRANSPARENT_BRUSH;
%rename(CYAN_BRUSH) wxCYAN_BRUSH;
%rename(RED_BRUSH) wxRED_BRUSH;
%rename(GREY_BRUSH) wxGREY_BRUSH;
%rename(MEDIUM_GREY_BRUSH) wxMEDIUM_GREY_BRUSH;
%rename(LIGHT_GREY_BRUSH) wxLIGHT_GREY_BRUSH;
%rename(BLACK) wxBLACK;
%rename(WHITE) wxWHITE;
%rename(RED) wxRED;
%rename(BLUE) wxBLUE;
%rename(GREEN) wxGREEN;
%rename(CYAN) wxCYAN;
%rename(LIGHT_GREY) wxLIGHT_GREY;
%rename(STANDARD_CURSOR) wxSTANDARD_CURSOR;
%rename(HOURGLASS_CURSOR) wxHOURGLASS_CURSOR;
%rename(CROSS_CURSOR) wxCROSS_CURSOR;
%rename(NullBitmap) wxNullBitmap;
%rename(NullIcon) wxNullIcon;
%rename(NullCursor) wxNullCursor;
%rename(NullPen) wxNullPen;
%rename(NullBrush) wxNullBrush;
%rename(NullPalette) wxNullPalette;
%rename(NullFont) wxNullFont;
%rename(NullColour) wxNullColour;
%rename(TheFontList) wxTheFontList;
%rename(ThePenList) wxThePenList;
%rename(TheBrushList) wxTheBrushList;
%rename(TheColourDatabase) wxTheColourDatabase;
%rename(Effects) wxEffects;
#endif

View File

@@ -0,0 +1,2 @@
# Other names that need to be reverse-renamed for the old namespace

489
wxPython/src/_gdicmn.i Normal file
View File

@@ -0,0 +1,489 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _gdicmn.i
// Purpose: SWIG interface for common GDI stuff and misc classes
//
// Author: Robin Dunn
//
// Created: 13-Sept-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
enum wxBitmapType
{
wxBITMAP_TYPE_INVALID, // should be == 0 for compatibility!
wxBITMAP_TYPE_BMP,
wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_ICO,
wxBITMAP_TYPE_ICO_RESOURCE,
wxBITMAP_TYPE_CUR,
wxBITMAP_TYPE_CUR_RESOURCE,
wxBITMAP_TYPE_XBM,
wxBITMAP_TYPE_XBM_DATA,
wxBITMAP_TYPE_XPM,
wxBITMAP_TYPE_XPM_DATA,
wxBITMAP_TYPE_TIF,
wxBITMAP_TYPE_TIF_RESOURCE,
wxBITMAP_TYPE_GIF,
wxBITMAP_TYPE_GIF_RESOURCE,
wxBITMAP_TYPE_PNG,
wxBITMAP_TYPE_PNG_RESOURCE,
wxBITMAP_TYPE_JPEG,
wxBITMAP_TYPE_JPEG_RESOURCE,
wxBITMAP_TYPE_PNM,
wxBITMAP_TYPE_PNM_RESOURCE,
wxBITMAP_TYPE_PCX,
wxBITMAP_TYPE_PCX_RESOURCE,
wxBITMAP_TYPE_PICT,
wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_ANI,
wxBITMAP_TYPE_IFF,
wxBITMAP_TYPE_MACCURSOR,
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_ANY = 50
};
// Standard cursors
enum wxStockCursor
{
wxCURSOR_NONE, // should be 0
wxCURSOR_ARROW,
wxCURSOR_RIGHT_ARROW,
wxCURSOR_BULLSEYE,
wxCURSOR_CHAR,
wxCURSOR_CROSS,
wxCURSOR_HAND,
wxCURSOR_IBEAM,
wxCURSOR_LEFT_BUTTON,
wxCURSOR_MAGNIFIER,
wxCURSOR_MIDDLE_BUTTON,
wxCURSOR_NO_ENTRY,
wxCURSOR_PAINT_BRUSH,
wxCURSOR_PENCIL,
wxCURSOR_POINT_LEFT,
wxCURSOR_POINT_RIGHT,
wxCURSOR_QUESTION_ARROW,
wxCURSOR_RIGHT_BUTTON,
wxCURSOR_SIZENESW,
wxCURSOR_SIZENS,
wxCURSOR_SIZENWSE,
wxCURSOR_SIZEWE,
wxCURSOR_SIZING,
wxCURSOR_SPRAYCAN,
wxCURSOR_WAIT,
wxCURSOR_WATCH,
wxCURSOR_BLANK,
wxCURSOR_DEFAULT, // standard X11 cursor
wxCURSOR_COPY_ARROW , // MacOS Theme Plus arrow
// #ifdef __X__
// // Not yet implemented for Windows
// wxCURSOR_CROSS_REVERSE,
// wxCURSOR_DOUBLE_ARROW,
// wxCURSOR_BASED_ARROW_UP,
// wxCURSOR_BASED_ARROW_DOWN,
// #endif // X11
wxCURSOR_ARROWWAIT,
wxCURSOR_MAX
};
%{
#ifndef __WXMAC__
#define wxCURSOR_COPY_ARROW wxCURSOR_ARROW
#endif
%}
//---------------------------------------------------------------------------
%newgroup
%noautorepr wxSize;
class wxSize
{
public:
//int x; // TODO: Can these be removed and just use width and height?
//int y;
%name(width) int x;
%name(height)int y;
wxSize(int w=0, int h=0);
~wxSize();
bool operator==(const wxSize& sz) const;
bool operator!=(const wxSize& sz) const;
wxSize operator+(const wxSize& sz);
wxSize operator-(const wxSize& sz);
void IncTo(const wxSize& sz);
void DecTo(const wxSize& sz);
void Set(int xx, int yy);
void SetWidth(int w);
void SetHeight(int h);
int GetWidth() const;
int GetHeight() const;
int GetX() const;
int GetY() const;
%extend {
PyObject* asTuple() {
wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
wxPyEndBlockThreads();
return tup;
}
}
%pythoncode {
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxSize'+str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.width = val
elif index == 1: self.height = val
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0,0)
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
};
//---------------------------------------------------------------------------
%newgroup
%noautorepr wxRealPoint;
class wxRealPoint
{
public:
double x;
double y;
wxRealPoint(double x=0.0, double y=0.0);
~wxRealPoint();
wxRealPoint operator+(const wxRealPoint& pt) const;
wxRealPoint operator-(const wxRealPoint& pt) const;
bool operator==(const wxRealPoint& pt) const;
bool operator!=(const wxRealPoint& pt) const;
%extend {
void Set(double x, double y) {
self->x = x;
self->y = y;
}
PyObject* asTuple() {
wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
wxPyEndBlockThreads();
return tup;
}
}
%pythoncode {
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxRealPoint'+str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.width = val
elif index == 1: self.height = val
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0.0, 0.0)
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
};
//---------------------------------------------------------------------------
%newgroup
%noautorepr wxPoint;
class wxPoint
{
public:
int x, y;
wxPoint(int x=0, int y=0);
~wxPoint();
bool operator==(const wxPoint& p) const;
bool operator!=(const wxPoint& p) const;
wxPoint operator+(const wxPoint& p) const;
wxPoint operator-(const wxPoint& p) const;
wxPoint& operator+=(const wxPoint& p);
wxPoint& operator-=(const wxPoint& p);
%extend {
void Set(long x, long y) {
self->x = x;
self->y = y;
}
PyObject* asTuple() {
wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
wxPyEndBlockThreads();
return tup;
}
}
%pythoncode {
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxPoint'+str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.x = val
elif index == 1: self.y = val
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0,0)
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
};
//---------------------------------------------------------------------------
%newgroup
%noautorepr wxRect;
class wxRect
{
public:
wxRect(int x=0, int y=0, int width=0, int height=0);
%name(RectPP) wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
%name(RectPS) wxRect(const wxPoint& pos, const wxSize& size);
~wxRect();
int GetX() const;
void SetX(int x);
int GetY();
void SetY(int y);
int GetWidth() const;
void SetWidth(int w);
int GetHeight() const;
void SetHeight(int h);
wxPoint GetPosition() const;
void SetPosition( const wxPoint &p );
wxSize GetSize() const;
void SetSize( const wxSize &s );
int GetLeft() const;
int GetTop() const;
int GetBottom() const;
int GetRight() const;
void SetLeft(int left);
void SetRight(int right);
void SetTop(int top);
void SetBottom(int bottom);
wxRect& Inflate(wxCoord dx, wxCoord dy);
wxRect& Deflate(wxCoord dx, wxCoord dy);
%name(OffsetXY)void Offset(wxCoord dx, wxCoord dy);
void Offset(const wxPoint& pt);
wxRect& Intersect(const wxRect& rect);
wxRect operator+(const wxRect& rect) const;
wxRect& operator+=(const wxRect& rect);
bool operator==(const wxRect& rect) const;
bool operator!=(const wxRect& rect) const { return !(*this == rect); }
// return TRUE if the point is (not strcitly) inside the rect
%name(InsideXY)bool Inside(int x, int y) const;
bool Inside(const wxPoint& pt) const;
// return TRUE if the rectangles have a non empty intersection
bool Intersects(const wxRect& rect) const;
int x, y, width, height;
%extend {
void Set(int x=0, int y=0, int width=0, int height=0) {
self->x = x;
self->y = y;
self->width = width;
self->height = height;
}
PyObject* asTuple() {
wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(4);
PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
wxPyEndBlockThreads();
return tup;
}
}
%pythoncode {
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxRect'+str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.x = val
elif index == 1: self.y = val
elif index == 2: self.width = val
elif index == 3: self.height = val
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0,0,0,0)
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
};
%inline %{
PyObject* wxIntersectRect(wxRect* r1, wxRect* r2) {
wxRegion reg1(*r1);
wxRegion reg2(*r2);
wxRect dest(0,0,0,0);
PyObject* obj;
reg1.Intersect(reg2);
dest = reg1.GetBox();
if (dest != wxRect(0,0,0,0)) {
wxPyBeginBlockThreads();
wxRect* newRect = new wxRect(dest);
obj = wxPyConstructObject((void*)newRect, wxT("wxRect"), true);
wxPyEndBlockThreads();
return obj;
}
Py_INCREF(Py_None);
return Py_None;
}
%}
//---------------------------------------------------------------------------
%newgroup
%noautorepr wxPoint2D;
// wxPoint2Ds represent a point or a vector in a 2d coordinate system
class wxPoint2D
{
public :
wxPoint2D( double x=0.0 , double y=0.0 );
%name(Point2DCopy) wxPoint2D( const wxPoint2D &pt );
%name(Point2DFromPoint) wxPoint2D( const wxPoint &pt );
// two different conversions to integers, floor and rounding
void GetFloor( int *OUTPUT , int *OUTPUT ) const;
void GetRounded( int *OUTPUT , int *OUTPUT ) const;
double GetVectorLength() const;
double GetVectorAngle() const ;
void SetVectorLength( double length );
void SetVectorAngle( double degrees );
// LinkError: void SetPolarCoordinates( double angle , double length );
// LinkError: void Normalize();
%pythoncode {
def SetPolarCoordinates(self, angle, length):
self.SetVectorLength(length)
self.SetVectorAngle(angle)
def Normalize(self):
self.SetVectorLength(1.0)
}
double GetDistance( const wxPoint2D &pt ) const;
double GetDistanceSquare( const wxPoint2D &pt ) const;
double GetDotProduct( const wxPoint2D &vec ) const;
double GetCrossProduct( const wxPoint2D &vec ) const;
// the reflection of this point
wxPoint2D operator-();
wxPoint2D& operator+=(const wxPoint2D& pt);
wxPoint2D& operator-=(const wxPoint2D& pt);
wxPoint2D& operator*=(const wxPoint2D& pt);
wxPoint2D& operator/=(const wxPoint2D& pt);
bool operator==(const wxPoint2D& pt) const;
bool operator!=(const wxPoint2D& pt) const;
double m_x;
double m_y;
%name(x)double m_x;
%name(y)double m_y;
%extend {
void Set( double x=0 , double y=0 ) {
self->m_x = x;
self->m_y = y;
}
PyObject* asTuple() {
wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->m_x));
PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->m_y));
wxPyEndBlockThreads();
return tup;
}
}
%pythoncode {
def __str__(self): return str(self.asTuple())
def __repr__(self): return 'wxPoint2D'+str(self.asTuple())
def __len__(self): return len(self.asTuple())
def __getitem__(self, index): return self.asTuple()[index]
def __setitem__(self, index, val):
if index == 0: self.m_x = val
elif index == 1: self.m_yt = val
else: raise IndexError
def __nonzero__(self): return self.asTuple() != (0.0, 0.0)
def __getinitargs__(self): return ()
def __getstate__(self): return self.asTuple()
def __setstate__(self, state): self.Set(*state)
}
};
//---------------------------------------------------------------------------
%immutable;
const wxPoint wxDefaultPosition;
const wxSize wxDefaultSize;
%mutable;
//---------------------------------------------------------------------------

30
wxPython/src/_gdiobj.i Normal file
View File

@@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _gdiobj.i
// Purpose: SWIG interface for wxGDIObject
//
// Author: Robin Dunn
//
// Created: 13-Sept-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
class wxGDIObject : public wxObject {
public:
wxGDIObject();
~wxGDIObject();
bool GetVisible();
void SetVisible( bool visible );
bool IsNull();
};
//---------------------------------------------------------------------------

View File

@@ -0,0 +1,57 @@
// A bunch of %rename directives generated by ./distrib/build_renamers.py
// in order to remove the wx prefix from all global scope names.
#ifndef SWIGXML
%rename(GRID_VALUE_STRING) wxGRID_VALUE_STRING;
%rename(GRID_VALUE_BOOL) wxGRID_VALUE_BOOL;
%rename(GRID_VALUE_NUMBER) wxGRID_VALUE_NUMBER;
%rename(GRID_VALUE_FLOAT) wxGRID_VALUE_FLOAT;
%rename(GRID_VALUE_CHOICE) wxGRID_VALUE_CHOICE;
%rename(GRID_VALUE_TEXT) wxGRID_VALUE_TEXT;
%rename(GRID_VALUE_LONG) wxGRID_VALUE_LONG;
%rename(GRID_VALUE_CHOICEINT) wxGRID_VALUE_CHOICEINT;
%rename(GRID_VALUE_DATETIME) wxGRID_VALUE_DATETIME;
%rename(GridNoCellCoords) wxGridNoCellCoords;
%rename(GridNoCellRect) wxGridNoCellRect;
%rename(GridCellRenderer) wxGridCellRenderer;
%rename(PyGridCellRenderer) wxPyGridCellRenderer;
%rename(GridCellStringRenderer) wxGridCellStringRenderer;
%rename(GridCellNumberRenderer) wxGridCellNumberRenderer;
%rename(GridCellFloatRenderer) wxGridCellFloatRenderer;
%rename(GridCellBoolRenderer) wxGridCellBoolRenderer;
%rename(GridCellDateTimeRenderer) wxGridCellDateTimeRenderer;
%rename(GridCellEnumRenderer) wxGridCellEnumRenderer;
%rename(GridCellAutoWrapStringRenderer) wxGridCellAutoWrapStringRenderer;
%rename(GridCellEditor) wxGridCellEditor;
%rename(PyGridCellEditor) wxPyGridCellEditor;
%rename(GridCellTextEditor) wxGridCellTextEditor;
%rename(GridCellNumberEditor) wxGridCellNumberEditor;
%rename(GridCellFloatEditor) wxGridCellFloatEditor;
%rename(GridCellBoolEditor) wxGridCellBoolEditor;
%rename(GridCellChoiceEditor) wxGridCellChoiceEditor;
%rename(GridCellEnumEditor) wxGridCellEnumEditor;
%rename(GridCellAutoWrapStringEditor) wxGridCellAutoWrapStringEditor;
%rename(GridCellAttr) wxGridCellAttr;
%rename(GridCellAttrProvider) wxGridCellAttrProvider;
%rename(PyGridCellAttrProvider) wxPyGridCellAttrProvider;
%rename(GridTableBase) wxGridTableBase;
%rename(PyGridTableBase) wxPyGridTableBase;
%rename(GridStringTable) wxGridStringTable;
%rename(GRIDTABLE_REQUEST_VIEW_GET_VALUES) wxGRIDTABLE_REQUEST_VIEW_GET_VALUES;
%rename(GRIDTABLE_REQUEST_VIEW_SEND_VALUES) wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES;
%rename(GRIDTABLE_NOTIFY_ROWS_INSERTED) wxGRIDTABLE_NOTIFY_ROWS_INSERTED;
%rename(GRIDTABLE_NOTIFY_ROWS_APPENDED) wxGRIDTABLE_NOTIFY_ROWS_APPENDED;
%rename(GRIDTABLE_NOTIFY_ROWS_DELETED) wxGRIDTABLE_NOTIFY_ROWS_DELETED;
%rename(GRIDTABLE_NOTIFY_COLS_INSERTED) wxGRIDTABLE_NOTIFY_COLS_INSERTED;
%rename(GRIDTABLE_NOTIFY_COLS_APPENDED) wxGRIDTABLE_NOTIFY_COLS_APPENDED;
%rename(GRIDTABLE_NOTIFY_COLS_DELETED) wxGRIDTABLE_NOTIFY_COLS_DELETED;
%rename(GridTableMessage) wxGridTableMessage;
%rename(GridCellCoords) wxGridCellCoords;
%rename(Grid) wxGrid;
%rename(GridEvent) wxGridEvent;
%rename(GridSizeEvent) wxGridSizeEvent;
%rename(GridRangeSelectEvent) wxGridRangeSelectEvent;
%rename(GridEditorCreatedEvent) wxGridEditorCreatedEvent;
#endif

View File

@@ -0,0 +1,4 @@
# Other names that need to be reverse-renamed for the old namespace
EVT*

View File

@@ -1,20 +0,0 @@
# Stuff these names into the wx namespace so wxPyConstructObject can find them
wx.wxGridEventPtr = wxGridEventPtr
wx.wxGridSizeEventPtr = wxGridSizeEventPtr
wx.wxGridRangeSelectEventPtr = wxGridRangeSelectEventPtr
wx.wxGridEditorCreatedEventPtr = wxGridEditorCreatedEventPtr
wx.wxGridCellRendererPtr = wxGridCellRendererPtr
wx.wxPyGridCellRendererPtr = wxPyGridCellRendererPtr
wx.wxGridCellEditorPtr = wxGridCellEditorPtr
wx.wxPyGridCellEditorPtr = wxPyGridCellEditorPtr
wx.wxGridCellAttrPtr = wxGridCellAttrPtr
wx.wxGridCellAttrProviderPtr = wxGridCellAttrProviderPtr
wx.wxPyGridCellAttrProviderPtr = wxPyGridCellAttrProviderPtr
wx.wxGridTableBasePtr = wxGridTableBasePtr
wx.wxPyGridTableBasePtr = wxPyGridTableBasePtr
wx.wxGridTableMessagePtr = wxGridTableMessagePtr
wx.wxGridCellCoordsPtr = wxGridCellCoordsPtr
wx.wxGridPtr = wxGridPtr

View File

@@ -1,4 +0,0 @@
# Stuff these names into the wx namespace so wxPyConstructObject can find them
import wx
wx.wxHelpEventPtr = wxHelpEventPtr
wx.wxContextHelpButtonPtr = wxContextHelpButtonPtr

View File

@@ -0,0 +1,79 @@
// A bunch of %rename directives generated by ./distrib/build_renamers.py
// in order to remove the wx prefix from all global scope names.
#ifndef SWIGXML
%rename(HTML_ALIGN_LEFT) wxHTML_ALIGN_LEFT;
%rename(HTML_ALIGN_CENTER) wxHTML_ALIGN_CENTER;
%rename(HTML_ALIGN_RIGHT) wxHTML_ALIGN_RIGHT;
%rename(HTML_ALIGN_BOTTOM) wxHTML_ALIGN_BOTTOM;
%rename(HTML_ALIGN_TOP) wxHTML_ALIGN_TOP;
%rename(HTML_CLR_FOREGROUND) wxHTML_CLR_FOREGROUND;
%rename(HTML_CLR_BACKGROUND) wxHTML_CLR_BACKGROUND;
%rename(HTML_UNITS_PIXELS) wxHTML_UNITS_PIXELS;
%rename(HTML_UNITS_PERCENT) wxHTML_UNITS_PERCENT;
%rename(HTML_INDENT_LEFT) wxHTML_INDENT_LEFT;
%rename(HTML_INDENT_RIGHT) wxHTML_INDENT_RIGHT;
%rename(HTML_INDENT_TOP) wxHTML_INDENT_TOP;
%rename(HTML_INDENT_BOTTOM) wxHTML_INDENT_BOTTOM;
%rename(HTML_INDENT_HORIZONTAL) wxHTML_INDENT_HORIZONTAL;
%rename(HTML_INDENT_VERTICAL) wxHTML_INDENT_VERTICAL;
%rename(HTML_INDENT_ALL) wxHTML_INDENT_ALL;
%rename(HTML_COND_ISANCHOR) wxHTML_COND_ISANCHOR;
%rename(HTML_COND_ISIMAGEMAP) wxHTML_COND_ISIMAGEMAP;
%rename(HTML_COND_USER) wxHTML_COND_USER;
%rename(HW_SCROLLBAR_NEVER) wxHW_SCROLLBAR_NEVER;
%rename(HW_SCROLLBAR_AUTO) wxHW_SCROLLBAR_AUTO;
%rename(HW_NO_SELECTION) wxHW_NO_SELECTION;
%rename(HW_DEFAULT_STYLE) wxHW_DEFAULT_STYLE;
%rename(HTML_OPEN) wxHTML_OPEN;
%rename(HTML_BLOCK) wxHTML_BLOCK;
%rename(HTML_REDIRECT) wxHTML_REDIRECT;
%rename(HTML_URL_PAGE) wxHTML_URL_PAGE;
%rename(HTML_URL_IMAGE) wxHTML_URL_IMAGE;
%rename(HTML_URL_OTHER) wxHTML_URL_OTHER;
%rename(HtmlLinkInfo) wxHtmlLinkInfo;
%rename(HtmlTag) wxHtmlTag;
%rename(HtmlParser) wxHtmlParser;
%rename(HtmlWinParser) wxHtmlWinParser;
%rename(HtmlWinParser_AddTagHandler) wxHtmlWinParser_AddTagHandler;
%rename(HtmlSelection) wxHtmlSelection;
%rename(HTML_SEL_OUT) wxHTML_SEL_OUT;
%rename(HTML_SEL_IN) wxHTML_SEL_IN;
%rename(HTML_SEL_CHANGING) wxHTML_SEL_CHANGING;
%rename(HtmlRenderingState) wxHtmlRenderingState;
%rename(HtmlRenderingStyle) wxHtmlRenderingStyle;
%rename(DefaultHtmlRenderingStyle) wxDefaultHtmlRenderingStyle;
%rename(HtmlRenderingInfo) wxHtmlRenderingInfo;
%rename(HTML_FIND_EXACT) wxHTML_FIND_EXACT;
%rename(HTML_FIND_NEAREST_BEFORE) wxHTML_FIND_NEAREST_BEFORE;
%rename(HTML_FIND_NEAREST_AFTER) wxHTML_FIND_NEAREST_AFTER;
%rename(HtmlCell) wxHtmlCell;
%rename(HtmlWordCell) wxHtmlWordCell;
%rename(HtmlContainerCell) wxHtmlContainerCell;
%rename(HtmlColourCell) wxHtmlColourCell;
%rename(HtmlFontCell) wxHtmlFontCell;
%rename(HtmlWidgetCell) wxHtmlWidgetCell;
%rename(HtmlDCRenderer) wxHtmlDCRenderer;
%rename(PAGE_ODD) wxPAGE_ODD;
%rename(PAGE_EVEN) wxPAGE_EVEN;
%rename(PAGE_ALL) wxPAGE_ALL;
%rename(HtmlPrintout) wxHtmlPrintout;
%rename(HtmlEasyPrinting) wxHtmlEasyPrinting;
%rename(HtmlBookRecord) wxHtmlBookRecord;
%rename(HtmlContentsItem) wxHtmlContentsItem;
%rename(HtmlSearchStatus) wxHtmlSearchStatus;
%rename(HtmlHelpData) wxHtmlHelpData;
%rename(HtmlHelpFrame) wxHtmlHelpFrame;
%rename(HF_TOOLBAR) wxHF_TOOLBAR;
%rename(HF_FLATTOOLBAR) wxHF_FLATTOOLBAR;
%rename(HF_CONTENTS) wxHF_CONTENTS;
%rename(HF_INDEX) wxHF_INDEX;
%rename(HF_SEARCH) wxHF_SEARCH;
%rename(HF_BOOKMARKS) wxHF_BOOKMARKS;
%rename(HF_OPENFILES) wxHF_OPENFILES;
%rename(HF_PRINT) wxHF_PRINT;
%rename(HF_DEFAULTSTYLE) wxHF_DEFAULTSTYLE;
%rename(HtmlHelpController) wxHtmlHelpController;
#endif

View File

@@ -1,15 +0,0 @@
# Stuff these names into the wx namespace so wxPyConstructObject can find them
import wx
wx.wxHtmlTagPtr = wxHtmlTagPtr
wx.wxHtmlParserPtr = wxHtmlParserPtr
wx.wxHtmlWinParserPtr = wxHtmlWinParserPtr
wx.wxHtmlTagHandlerPtr = wxHtmlTagHandlerPtr
wx.wxHtmlWinTagHandlerPtr = wxHtmlWinTagHandlerPtr
wx.wxHtmlCellPtr = wxHtmlCellPtr
wx.wxHtmlContainerCellPtr = wxHtmlContainerCellPtr
wx.wxHtmlWidgetCellPtr = wxHtmlWidgetCellPtr
wx.wxHtmlWindowPtr = wxHtmlWindowPtr
wx.wxHtmlLinkInfoPtr = wxHtmlLinkInfoPtr
wx.wxHtmlFilterPtr = wxHtmlFilterPtr

158
wxPython/src/_icon.i Normal file
View File

@@ -0,0 +1,158 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _icon.i
// Purpose: SWIG interface for wxIcon and related classes
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/iconbndl.h>
%}
//---------------------------------------------------------------------------
class wxIcon : public wxGDIObject
{
public:
wxIcon(const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
~wxIcon();
// alternate constructors
%name(EmptyIcon) wxIcon();
%name(IconFromLocation) wxIcon(const wxIconLocation& loc);
%extend {
%name(IconFromBitmap) wxIcon(const wxBitmap& bmp) {
wxIcon* icon = new wxIcon();
icon->CopyFromBitmap(bmp);
return icon;
}
%name(IconFromXPMData) wxIcon(PyObject* listOfStrings) {
char** cArray = NULL;
wxIcon* icon;
cArray = ConvertListOfStrings(listOfStrings);
if (! cArray)
return NULL;
icon = new wxIcon(cArray);
delete [] cArray;
return icon;
}
}
#ifndef __WXMAC__
bool LoadFile(const wxString& name, long flags);
#endif
// wxGDIImage methods
#ifdef __WXMSW__
long GetHandle();
void SetHandle(long handle);
#endif
bool Ok();
int GetWidth();
int GetHeight();
int GetDepth();
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
#ifdef __WXMSW__
void SetSize(const wxSize& size);
#endif
void CopyFromBitmap(const wxBitmap& bmp);
%pythoncode { def __nonzero__(self): return self.Ok() }
};
//---------------------------------------------------------------------------
class wxIconLocation
{
public:
// ctor takes the name of the file where the icon is
%extend {
wxIconLocation(const wxString* filename = &wxPyEmptyString, int num = 0) {
#ifdef __WXMSW__
return new wxIconLocation(*filename, num);
#else
return new wxIconLocation(*filename);
#endif
}
}
~wxIconLocation();
// returns true if this object is valid/initialized
bool IsOk() const;
%pythoncode { def __nonzero__(self): return self.Ok() }
// set/get the icon file name
void SetFileName(const wxString& filename);
const wxString& GetFileName() const;
%extend {
void SetIndex(int num) {
#ifdef __WXMSW__
self->SetIndex(num);
#else
// do nothing
#endif
}
int GetIndex() {
#ifdef __WXMSW__
return self->GetIndex();
#else
return -1;
#endif
}
}
};
//---------------------------------------------------------------------------
class wxIconBundle
{
public:
// default constructor
wxIconBundle();
// initializes the bundle with the icon(s) found in the file
%name(IconBundleFromFile) wxIconBundle( const wxString& file, long type );
// initializes the bundle with a single icon
%name(IconBundleFromIcon)wxIconBundle( const wxIcon& icon );
~wxIconBundle();
// adds the icon to the collection, if the collection already
// contains an icon with the same width and height, it is
// replaced
void AddIcon( const wxIcon& icon );
// adds all the icons contained in the file to the collection,
// if the collection already contains icons with the same
// width and height, they are replaced
%name(AddIconFromFile)void AddIcon( const wxString& file, long type );
// returns the icon with the given size; if no such icon exists,
// returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
// returns the first icon in the bundle
const wxIcon& GetIcon( const wxSize& size ) const;
};
//---------------------------------------------------------------------------

View File

@@ -1,34 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
// Name: image.i
// Purpose: SWIG interface file for wxImage, wxImageHandler, etc.
// Name: _image.i
// Purpose: SWIG definitions for wxImage and such
//
// Author: Robin Dunn
//
// Created: 28-Apr-1999
// Created: 25-Sept-2000
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
%module image
//---------------------------------------------------------------------------
%{
#include "helpers.h"
#include "pyistream.h"
#include <wx/image.h>
#include "wx/wxPython/pyistream.h"
%}
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
%newgroup
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import gdi.i
%import streams.i
class wxImageHandler : public wxObject {
public:
// wxImageHandler(); Abstract Base Class
wxString GetName();
wxString GetExtension();
long GetType();
wxString GetMimeType();
//bool LoadFile(wxImage* image, wxInputStream& stream);
//bool SaveFile(wxImage* image, wxOutputStream& stream);
//virtual int GetImageCount( wxInputStream& stream );
//bool CanRead( wxInputStream& stream );
bool CanRead( const wxString& name );
void SetName(const wxString& name);
void SetExtension(const wxString& extension);
void SetType(long type);
void SetMimeType(const wxString& mimetype);
};
//---------------------------------------------------------------------------
@@ -58,90 +73,40 @@ public:
//---------------------------------------------------------------------------
class wxImageHandler : public wxObject {
public:
// wxImageHandler(); Abstract Base Class
wxString GetName();
wxString GetExtension();
long GetType();
wxString GetMimeType();
//bool LoadFile(wxImage* image, wxInputStream& stream);
//bool SaveFile(wxImage* image, wxOutputStream& stream);
//virtual int GetImageCount( wxInputStream& stream );
//bool CanRead( wxInputStream& stream );
bool CanRead( const wxString& name );
void SetName(const wxString& name);
void SetExtension(const wxString& extension);
void SetType(long type);
void SetMimeType(const wxString& mimetype);
};
//---------------------------------------------------------------------------
class wxPNGHandler : public wxImageHandler {
public:
wxPNGHandler();
};
class wxJPEGHandler : public wxImageHandler {
public:
wxJPEGHandler();
};
class wxBMPHandler : public wxImageHandler {
public:
wxBMPHandler();
};
class wxICOHandler : public wxBMPHandler {
public:
wxICOHandler();
};
class wxCURHandler : public wxICOHandler {
public:
wxCURHandler();
};
class wxANIHandler : public wxCURHandler {
public:
wxANIHandler();
};
class wxGIFHandler : public wxImageHandler {
public:
wxGIFHandler();
};
class wxPNMHandler : public wxImageHandler {
public:
wxPNMHandler();
};
class wxPCXHandler : public wxImageHandler {
public:
wxPCXHandler();
};
class wxTIFFHandler : public wxImageHandler {
public:
wxTIFFHandler();
};
//---------------------------------------------------------------------------
class wxImage : public wxObject {
public:
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
~wxImage();
// Alternate constructors
%name(ImageFromMime) wxImage(const wxString& name, const wxString& mimetype, int index = -1);
%name(ImageFromStream) wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1);
%name(ImageFromStreamMime) wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1 );
%extend {
%name(EmptyImage) wxImage(int width=0, int height=0, bool clear = TRUE) {
if (width > 0 && height > 0)
return new wxImage(width, height, clear);
else
return new wxImage;
}
%name(ImageFromBitmap) wxImage(const wxBitmap &bitmap) {
return new wxImage(bitmap.ConvertToImage());
}
%name(ImageFromData) wxImage(int width, int height, unsigned char* data) {
// Copy the source data so the wxImage can clean it up later
unsigned char* copy = (unsigned char*)malloc(width*height*3);
if (copy == NULL) {
PyErr_NoMemory();
return NULL;
}
memcpy(copy, data, width*height*3);
return new wxImage(width, height, copy, FALSE);
}
}
void Create( int width, int height );
void Destroy();
@@ -197,11 +162,13 @@ public:
//unsigned char *GetData();
//void SetData( unsigned char *data );
%addmethods {
%extend {
PyObject* GetData() {
unsigned char* data = self->GetData();
int len = self->GetWidth() * self->GetHeight() * 3;
return PyString_FromStringAndSize((char*)data, len);
PyObject* rv;
wxPyBLOCK_THREADS( rv = PyString_FromStringAndSize((char*)data, len));
return rv;
}
void SetData(PyObject* data) {
unsigned char* dataPtr;
@@ -213,7 +180,7 @@ public:
size_t len = self->GetWidth() * self->GetHeight() * 3;
dataPtr = (unsigned char*) malloc(len);
memcpy(dataPtr, PyString_AsString(data), len);
wxPyBLOCK_THREADS( memcpy(dataPtr, PyString_AsString(data), len) );
self->SetData(dataPtr);
// wxImage takes ownership of dataPtr...
}
@@ -223,20 +190,25 @@ public:
PyObject* GetDataBuffer() {
unsigned char* data = self->GetData();
int len = self->GetWidth() * self->GetHeight() * 3;
return PyBuffer_FromReadWriteMemory(data, len);
PyObject* rv;
wxPyBLOCK_THREADS( rv = PyBuffer_FromReadWriteMemory(data, len) );
return rv;
}
void SetDataBuffer(PyObject* data) {
unsigned char* buffer;
int size;
if (!PyArg_Parse(data, "w#", &buffer, &size))
return;
wxPyBeginBlockThreads();
if (!PyArg_Parse(data, "t#", &buffer, &size))
goto done;
if (size != self->GetWidth() * self->GetHeight() * 3) {
PyErr_SetString(PyExc_TypeError, "Incorrect buffer size");
return;
goto done;
}
self->SetData(buffer);
done:
wxPyEndBlockThreads();
}
@@ -247,7 +219,9 @@ public:
RETURN_NONE();
} else {
int len = self->GetWidth() * self->GetHeight();
return PyString_FromStringAndSize((char*)data, len);
PyObject* rv;
wxPyBLOCK_THREADS( rv = PyString_FromStringAndSize((char*)data, len) );
return rv;
}
}
void SetAlphaData(PyObject* data) {
@@ -260,7 +234,7 @@ public:
size_t len = self->GetWidth() * self->GetHeight();
dataPtr = (unsigned char*) malloc(len);
memcpy(dataPtr, PyString_AsString(data), len);
wxPyBLOCK_THREADS( memcpy(dataPtr, PyString_AsString(data), len) );
self->SetAlpha(dataPtr);
// wxImage takes ownership of dataPtr...
}
@@ -270,20 +244,25 @@ public:
PyObject* GetAlphaBuffer() {
unsigned char* data = self->GetAlpha();
int len = self->GetWidth() * self->GetHeight();
return PyBuffer_FromReadWriteMemory(data, len);
PyObject* rv;
wxPyBLOCK_THREADS( rv = PyBuffer_FromReadWriteMemory(data, len) );
return rv;
}
void SetAlphaBuffer(PyObject* data) {
unsigned char* buffer;
int size;
if (!PyArg_Parse(data, "w#", &buffer, &size))
return;
wxPyBeginBlockThreads();
if (!PyArg_Parse(data, "t#", &buffer, &size))
goto done;
if (size != self->GetWidth() * self->GetHeight()) {
PyErr_SetString(PyExc_TypeError, "Incorrect buffer size");
return;
goto done;
}
self->SetAlpha(buffer);
done:
wxPyEndBlockThreads();
}
}
@@ -320,7 +299,7 @@ public:
static wxString GetImageExtWildcard();
%addmethods {
%extend {
wxBitmap ConvertToBitmap() {
wxBitmap bitmap(*self);
return bitmap;
@@ -335,92 +314,118 @@ public:
}
}
%pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
%pythoncode { def __nonzero__(self): return self.Ok() }
};
// Alternate constructors
%new wxImage* wxEmptyImage(int width=0, int height=0, bool clear = TRUE);
%new wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype, int index = -1);
%new wxImage* wxImageFromBitmap(const wxBitmap &bitmap);
%new wxImage* wxImageFromData(int width, int height, unsigned char* data);
%new wxImage* wxImageFromStream(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1);
%new wxImage* wxImageFromStreamMime(wxInputStream& stream, const wxString& mimetype, int index = -1 );
%{
wxImage* wxEmptyImage(int width=0, int height=0, bool clear = TRUE) {
if (width > 0 && height > 0)
return new wxImage(width, height, clear);
else
return new wxImage;
}
wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype, int index) {
return new wxImage(name, mimetype, index);
}
wxImage* wxImageFromBitmap(const wxBitmap &bitmap) {
return new wxImage(bitmap.ConvertToImage());
}
wxImage* wxImageFromData(int width, int height, unsigned char* data) {
// Copy the source data so the wxImage can clean it up later
unsigned char* copy = (unsigned char*)malloc(width*height*3);
if (copy == NULL) {
PyErr_NoMemory();
return NULL;
}
memcpy(copy, data, width*height*3);
return new wxImage(width, height, copy, FALSE);
}
wxImage* wxImageFromStream(wxInputStream& stream,
long type = wxBITMAP_TYPE_ANY, int index = -1) {
return new wxImage(stream, type, index);
}
wxImage* wxImageFromStreamMime(wxInputStream& stream,
const wxString& mimetype, int index = -1 ) {
return new wxImage(stream, mimetype, index);
}
%}
void wxInitAllImageHandlers();
%readonly
%{
#if 0
%}
// See also wxPy_ReinitStockObjects in helpers.cpp
extern wxImage wxNullImage;
%immutable;
const wxImage wxNullImage;
%mutable;
%readwrite
%{
//---------------------------------------------------------------------------
MAKE_CONST_WXSTRING(IMAGE_OPTION_BMP_FORMAT);
MAKE_CONST_WXSTRING(IMAGE_OPTION_CUR_HOTSPOT_X);
MAKE_CONST_WXSTRING(IMAGE_OPTION_CUR_HOTSPOT_Y);
MAKE_CONST_WXSTRING(IMAGE_OPTION_RESOLUTION);
MAKE_CONST_WXSTRING(IMAGE_OPTION_RESOLUTIONUNIT);
enum
{
wxIMAGE_RESOLUTION_INCHES = 1,
wxIMAGE_RESOLUTION_CM = 2
};
enum
{
wxBMP_24BPP = 24, // default, do not need to set
//wxBMP_16BPP = 16, // wxQuantize can only do 236 colors?
wxBMP_8BPP = 8, // 8bpp, quantized colors
wxBMP_8BPP_GREY = 9, // 8bpp, rgb averaged to greys
wxBMP_8BPP_GRAY = wxBMP_8BPP_GREY,
wxBMP_8BPP_RED = 10, // 8bpp, red used as greyscale
wxBMP_8BPP_PALETTE = 11, // 8bpp, use the wxImage's palette
wxBMP_4BPP = 4, // 4bpp, quantized colors
wxBMP_1BPP = 1, // 1bpp, quantized "colors"
wxBMP_1BPP_BW = 2 // 1bpp, black & white from red
};
class wxBMPHandler : public wxImageHandler {
public:
wxBMPHandler();
};
class wxICOHandler : public wxBMPHandler {
public:
wxICOHandler();
};
class wxCURHandler : public wxICOHandler {
public:
wxCURHandler();
};
class wxANIHandler : public wxCURHandler {
public:
wxANIHandler();
};
//---------------------------------------------------------------------------
class wxPNGHandler : public wxImageHandler {
public:
wxPNGHandler();
};
class wxGIFHandler : public wxImageHandler {
public:
wxGIFHandler();
};
class wxPCXHandler : public wxImageHandler {
public:
wxPCXHandler();
};
class wxJPEGHandler : public wxImageHandler {
public:
wxJPEGHandler();
};
class wxPNMHandler : public wxImageHandler {
public:
wxPNMHandler();
};
class wxXPMHandler : public wxImageHandler {
public:
wxXPMHandler();
};
class wxTIFFHandler : public wxImageHandler {
public:
wxTIFFHandler();
};
#if wxUSE_IFF
class wxIFFHandler : public wxImageHandler {
public:
wxIFFHandler();
};
#endif
%}
//---------------------------------------------------------------------------
// This one is here to avoid circular imports
%new wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1);
%{
wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1) {
return new wxBitmap(img, depth);
}
%}
//---------------------------------------------------------------------------

67
wxPython/src/_imaglist.i Normal file
View File

@@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _imaglist.i
// Purpose: SWIG interface defs for wxImageList and releated classes
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%newgroup
enum {
wxIMAGELIST_DRAW_NORMAL ,
wxIMAGELIST_DRAW_TRANSPARENT,
wxIMAGELIST_DRAW_SELECTED,
wxIMAGELIST_DRAW_FOCUSED,
wxIMAGE_LIST_NORMAL,
wxIMAGE_LIST_SMALL,
wxIMAGE_LIST_STATE
};
// wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to
// images for their items by an index into an image list.
// A wxImageList is capable of creating images with optional masks from
// a variety of sources - a single bitmap plus a colour to indicate the mask,
// two bitmaps, or an icon.
class wxImageList : public wxObject {
public:
wxImageList(int width, int height, int mask=TRUE, int initialCount=1);
~wxImageList();
int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
%name(AddWithColourMask)int Add(const wxBitmap& bitmap, const wxColour& maskColour);
%name(AddIcon)int Add(const wxIcon& icon);
#ifdef __WXMSW__
bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap);
#else
// %name(ReplaceIcon)bool Replace(int index, const wxIcon& icon);
// int Add(const wxBitmap& bitmap);
bool Replace(int index, const wxBitmap& bitmap);
#endif
bool Draw(int index, wxDC& dc, int x, int x, int flags = wxIMAGELIST_DRAW_NORMAL,
const bool solidBackground = FALSE);
int GetImageCount();
bool Remove(int index);
bool RemoveAll();
void GetSize(int index, int& OUTPUT, int& OUTPUT);
};
//---------------------------------------------------------------------------

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fonts.i
// Purpose: SWIG interface file wxFont, local, converters, etc.
// Name: _intl.i
// Purpose: SWIG interface file for wxLocale and related classes
//
// Author: Robin Dunn
//
@@ -10,443 +10,16 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module fonts
%{
#include "helpers.h"
#include <wx/fontmap.h>
#include <wx/fontenc.h>
#include <wx/fontutil.h>
#include <wx/fontenum.h>
#include <wx/intl.h>
#include <wx/encconv.h>
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
// Not a %module
//---------------------------------------------------------------------------
%{
// Put some wx default wxChar* values into wxStrings.
static const wxString wxPyEmptyString(wxT(""));
%}
//---------------------------------------------------------------------------
enum wxFontFamily
{
wxFONTFAMILY_DEFAULT = wxDEFAULT,
wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
wxFONTFAMILY_ROMAN = wxROMAN,
wxFONTFAMILY_SCRIPT = wxSCRIPT,
wxFONTFAMILY_SWISS = wxSWISS,
wxFONTFAMILY_MODERN = wxMODERN,
wxFONTFAMILY_TELETYPE = wxTELETYPE,
wxFONTFAMILY_MAX,
wxFONTFAMILY_UNKNOWN
};
// font styles
enum wxFontStyle
{
wxFONTSTYLE_NORMAL = wxNORMAL,
wxFONTSTYLE_ITALIC = wxITALIC,
wxFONTSTYLE_SLANT = wxSLANT,
wxFONTSTYLE_MAX
};
// font weights
enum wxFontWeight
{
wxFONTWEIGHT_NORMAL = wxNORMAL,
wxFONTWEIGHT_LIGHT = wxLIGHT,
wxFONTWEIGHT_BOLD = wxBOLD,
wxFONTWEIGHT_MAX
};
// font encodings
enum wxFontEncoding
{
wxFONTENCODING_SYSTEM = -1, // system default
wxFONTENCODING_DEFAULT, // current default encoding
// ISO8859 standard defines a number of single-byte charsets
wxFONTENCODING_ISO8859_1, // West European (Latin1)
wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
wxFONTENCODING_ISO8859_5, // Cyrillic
wxFONTENCODING_ISO8859_6, // Arabic
wxFONTENCODING_ISO8859_7, // Greek
wxFONTENCODING_ISO8859_8, // Hebrew
wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
wxFONTENCODING_ISO8859_11, // Thai
wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
// here anyhow to make all ISO8859
// consecutive numbers
wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
wxFONTENCODING_ISO8859_14, // Latin8
wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
wxFONTENCODING_ISO8859_MAX,
// Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
// what would we do without Microsoft? They have their own encodings
// for DOS
wxFONTENCODING_CP437, // original MS-DOS codepage
wxFONTENCODING_CP850, // CP437 merged with Latin1
wxFONTENCODING_CP852, // CP437 merged with Latin2
wxFONTENCODING_CP855, // another cyrillic encoding
wxFONTENCODING_CP866, // and another one
// and for Windows
wxFONTENCODING_CP874, // WinThai
wxFONTENCODING_CP932, // Japanese (shift-JIS)
wxFONTENCODING_CP936, // Chinese simplified (GB)
wxFONTENCODING_CP949, // Korean (Hangul charset)
wxFONTENCODING_CP950, // Chinese (traditional - Big5)
wxFONTENCODING_CP1250, // WinLatin2
wxFONTENCODING_CP1251, // WinCyrillic
wxFONTENCODING_CP1252, // WinLatin1
wxFONTENCODING_CP1253, // WinGreek (8859-7)
wxFONTENCODING_CP1254, // WinTurkish
wxFONTENCODING_CP1255, // WinHebrew
wxFONTENCODING_CP1256, // WinArabic
wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
wxFONTENCODING_CP12_MAX,
wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese
wxFONTENCODING_UTF16BE, // UTF-16 Big Endian Unicode encoding
wxFONTENCODING_UTF16LE, // UTF-16 Little Endian Unicode encoding
wxFONTENCODING_UTF32BE, // UTF-32 Big Endian Unicode encoding
wxFONTENCODING_UTF32LE, // UTF-32 Little Endian Unicode encoding
wxFONTENCODING_MAX,
// Far Eastern encodings
wxFONTENCODING_GB2312, // Simplified Chinese
wxFONTENCODING_BIG5, // Traditional Chinese
wxFONTENCODING_SHIFT_JIS, // Shift JIS
// Aliases
wxFONTENCODING_UTF16,
wxFONTENCODING_UTF32,
wxFONTENCODING_UNICODE,
};
//---------------------------------------------------------------------------
// wxNativeFontInfo is platform-specific font representation: this struct
// should be considered as opaque font description only used by the native
// functions, the user code can only get the objects of this type from
// somewhere and pass it somewhere else (possibly save them somewhere using
// ToString() and restore them using FromString())
struct wxNativeFontInfo
{
wxNativeFontInfo();
// reset to the default state
void Init();
// init with the parameters of the given font
void InitFromFont(const wxFont& font);
// accessors and modifiers for the font elements
int GetPointSize() const;
wxFontStyle GetStyle() const;
wxFontWeight GetWeight() const;
bool GetUnderlined() const;
wxString GetFaceName() const;
wxFontFamily GetFamily() const;
wxFontEncoding GetEncoding() const;
void SetPointSize(int pointsize);
void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
void SetFaceName(wxString facename);
void SetFamily(wxFontFamily family);
void SetEncoding(wxFontEncoding encoding);
// it is important to be able to serialize wxNativeFontInfo objects to be
// able to store them (in config file, for example)
bool FromString(const wxString& s);
wxString ToString() const;
%addmethods {
wxString __str__() {
return self->ToString();
}
}
// we also want to present the native font descriptions to the user in some
// human-readable form (it is not platform independent neither, but can
// hopefully be understood by the user)
bool FromUserString(const wxString& s);
wxString ToUserString() const;
};
%{
// Fix some link errors... Remove this when these methods get real implementations...
// #if defined(__WXGTK__) || defined(__WXX11__)
// #if wxUSE_PANGO
// void wxNativeFontInfo::SetPointSize(int pointsize)
// { wxFAIL_MSG( _T("not implemented") ); }
// void wxNativeFontInfo::SetStyle(wxFontStyle style)
// { wxFAIL_MSG( _T("not implemented") ); }
// void wxNativeFontInfo::SetWeight(wxFontWeight weight)
// { wxFAIL_MSG( _T("not implemented") ); }
// void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
// { wxFAIL_MSG( _T("not implemented") ); }
// void wxNativeFontInfo::SetFaceName(wxString facename)
// { wxFAIL_MSG( _T("not implemented") ); }
// void wxNativeFontInfo::SetFamily(wxFontFamily family)
// { wxFAIL_MSG( _T("not implemented") ); }
// void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding)
// { wxFAIL_MSG( _T("not implemented") ); }
// #endif
// #endif
%}
//---------------------------------------------------------------------------
// wxFontMapper manages user-definable correspondence between logical font
// names and the fonts present on the machine.
//
// The default implementations of all functions will ask the user if they are
// not capable of finding the answer themselves and store the answer in a
// config file (configurable via SetConfigXXX functions). This behaviour may
// be disabled by giving the value of FALSE to "interactive" parameter.
// However, the functions will always consult the config file to allow the
// user-defined values override the default logic and there is no way to
// disable this - which shouldn't be ever needed because if "interactive" was
// never TRUE, the config file is never created anyhow.
class wxFontMapper
{
public:
wxFontMapper();
~wxFontMapper();
// return instance of the wxFontMapper singleton
static wxFontMapper *Get();
// set the sigleton to 'mapper' instance and return previous one
static wxFontMapper *Set(wxFontMapper *mapper);
// returns the encoding for the given charset (in the form of RFC 2046) or
// wxFONTENCODING_SYSTEM if couldn't decode it
//
// interactive parameter is ignored in the base class, we behave as if it
// were always false
virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
bool interactive = true);
// get the number of font encodings we know about
static size_t GetSupportedEncodingsCount();
// get the n-th supported encoding
static wxFontEncoding GetEncoding(size_t n);
// return internal string identifier for the encoding (see also
// GetEncodingDescription())
static wxString GetEncodingName(wxFontEncoding encoding);
// return user-readable string describing the given encoding
//
// NB: hard-coded now, but might change later (read it from config?)
static wxString GetEncodingDescription(wxFontEncoding encoding);
// set the config object to use (may be NULL to use default)
void SetConfig(wxConfigBase *config);
// set the root config path to use (should be an absolute path)
void SetConfigPath(const wxString& prefix);
// return default config path
static const wxChar *GetDefaultConfigPath();
// Find an alternative for the given encoding (which is supposed to not be
// available on this system). If successful, returns the encoding otherwise
// returns None.
%addmethods {
PyObject* GetAltForEncoding(wxFontEncoding encoding,
const wxString& facename = wxPyEmptyString,
bool interactive = TRUE) {
wxFontEncoding alt_enc;
if (self->GetAltForEncoding(encoding, &alt_enc, facename, interactive))
return PyInt_FromLong(alt_enc);
else {
Py_INCREF(Py_None);
return Py_None;
}
}
}
// checks whether given encoding is available in given face or not.
// If no facename is given,
bool IsEncodingAvailable(wxFontEncoding encoding,
const wxString& facename = wxPyEmptyString);
// the parent window for modal dialogs
void SetDialogParent(wxWindow *parent) { m_windowParent = parent; }
// the title for the dialogs (note that default is quite reasonable)
void SetDialogTitle(const wxString& title) { m_titleDialog = title; }
};
//---------------------------------------------------------------------------
class wxFont : public wxObject {
public:
wxFont( int pointSize, int family, int style, int weight,
int underline=FALSE, const wxString& faceName = wxPyEmptyString,
wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
%name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info);
%addmethods {
%new wxFont* wxFontFromNativeInfoString(const wxString& info) {
wxNativeFontInfo nfi;
nfi.FromString(info);
return new wxFont(nfi);
}
}
~wxFont();
bool Ok() const;
int GetPointSize() const;
int GetFamily() const;
int GetStyle() const;
int GetWeight() const;
bool GetUnderlined() const;
wxString GetFaceName() const;
wxFontEncoding GetEncoding() const;
bool IsFixedWidth();
const wxNativeFontInfo* GetNativeFontInfo() const;
wxString GetNativeFontInfoDesc() const;
wxString GetNativeFontInfoUserDesc() const;
void SetPointSize(int pointSize);
void SetFamily(int family);
void SetStyle(int style);
void SetWeight(int weight);
void SetFaceName(const wxString& faceName);
void SetUnderlined(bool underlined);
void SetEncoding(wxFontEncoding encoding);
void SetNativeFontInfo(const wxNativeFontInfo& info);
// void SetNativeFontInfo(const wxString& info);
void SetNativeFontInfoUserDesc(const wxString& info);
wxString GetFamilyString() const;
wxString GetStyleString() const;
wxString GetWeightString() const;
void SetNoAntiAliasing( bool no = TRUE );
bool GetNoAntiAliasing();
static wxFontEncoding GetDefaultEncoding();
static void SetDefaultEncoding(wxFontEncoding encoding);
%pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
};
class wxFontList : public wxObject {
public:
void AddFont(wxFont* font);
wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
bool underline = FALSE, const wxString& facename = wxPyEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
void RemoveFont(wxFont *font);
int GetCount();
};
//----------------------------------------------------------------------
// wxFontEnumerator
%{
class wxPyFontEnumerator : public wxFontEnumerator {
public:
wxPyFontEnumerator() {}
~wxPyFontEnumerator() {}
DEC_PYCALLBACK_BOOL_STRING(OnFacename);
DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
PYPRIVATE;
};
IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
%}
%name(wxFontEnumerator) class wxPyFontEnumerator {
public:
wxPyFontEnumerator();
~wxPyFontEnumerator();
void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator, 0)"
bool EnumerateFacenames(
wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
bool fixedWidthOnly = FALSE);
bool EnumerateEncodings(const wxString& facename = wxPyEmptyString);
//wxArrayString* GetEncodings();
//wxArrayString* GetFacenames();
%addmethods {
PyObject* GetEncodings() {
wxArrayString* arr = self->GetEncodings();
return wxArrayString2PyList_helper(*arr);
}
PyObject* GetFacenames() {
wxArrayString* arr = self->GetFacenames();
return wxArrayString2PyList_helper(*arr);
}
}
};
//---------------------------------------------------------------------------
// wxLocale. Not really font related, but close enough
%newgroup
enum wxLanguage
@@ -689,11 +262,14 @@ enum wxLanguage
wxLANGUAGE_USER_DEFINED
};
//---------------------------------------------------------------------------
// wxLanguageInfo: encapsulates wxLanguage to OS native lang.desc.
// translation information
class wxLanguageInfo
struct wxLanguageInfo
{
public:
int Language; // wxLanguage id
wxString CanonicalName; // Canonical name, e.g. fr_FR
wxString Description; // human-readable name of the language
@@ -724,6 +300,9 @@ enum wxLocaleInitFlags
wxLOCALE_CONV_ENCODING = 0x0002 // convert encoding on the fly?
};
//---------------------------------------------------------------------------
class wxLocale
{
public:
@@ -744,15 +323,14 @@ public:
%name(Init2) bool Init(int language = wxLANGUAGE_DEFAULT,
int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING);
%pragma(python) addtoclass = "
%pythoncode {
def Init(self, *_args, **_kwargs):
if type(_args[0]) in [type(''), type(u'')]:
val = self.Init1(*_args, **_kwargs)
else:
val = self.Init2(*_args, **_kwargs)
return val
"
}
// Try to get user's (or OS's) prefered language setting.
// Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed
@@ -774,6 +352,7 @@ public:
// return TRUE if the locale was set successfully
bool IsOk() const;
%pythoncode { def __nonzero__(self): return self.IsOk() };
// returns locale name
wxString GetLocale() const;
@@ -853,20 +432,24 @@ public:
wxLocale* wxGetLocale();
// get the translation of the string in the current locale
%nokwargs wxGetTranslation;
wxString wxGetTranslation(const wxString& sz);
wxString wxGetTranslation(const wxString& sz1, const wxString& sz2, size_t n);
//---------------------------------------------------------------------------
%newgroup
//----------------------------------------------------------------------
// wxEncodingConverter
// This class is capable of converting strings between any two
// 8bit encodings/charsets. It can also convert from/to Unicode
%typemap(python, out) wxFontEncodingArray {
$target = PyList_New(0);
for (size_t i=0; i < $source->GetCount(); i++) {
PyObject* number = PyInt_FromLong($source->Item(i));
PyList_Append($target, number);
%typemap(out) wxFontEncodingArray {
$result = PyList_New(0);
for (size_t i=0; i < $1.GetCount(); i++) {
PyObject* number = PyInt_FromLong($1.Item(i));
PyList_Append($result, number);
Py_DECREF(number);
}
}
@@ -981,16 +564,22 @@ public:
// equivalent encodings, regardless the platform, including itself.
static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc);
%pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()"
// Return true if [any text in] one multibyte encoding can be
// converted to another one losslessly.
//
// Do not call this with wxFONTENCODING_UNICODE, it doesn't make
// sense (always works in one sense and always depends on the text
// to convert in the other)
static bool CanConvert(wxFontEncoding encIn, wxFontEncoding encOut);
%pythoncode { def __nonzero__(self): return self.IsOk() }
};
//----------------------------------------------------------------------
//----------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator");
%}
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
%pythoncode "_intl_ex.py"
//---------------------------------------------------------------------------

19
wxPython/src/_intl_ex.py Normal file
View File

@@ -0,0 +1,19 @@
#----------------------------------------------------------------------------
# wxGTK sets the locale when initialized. Doing this at the Python
# level should set it up to match what GTK is doing at the C level.
if wx.Platform == "__WXGTK__":
try:
import locale
locale.setlocale(locale.LC_ALL, "")
except:
pass
# On MSW add the directory where the wxWindows catalogs were installed
# to the default catalog path.
if wx.Platform == "__WXMSW__":
import os
localedir = os.path.join(os.path.split(__file__)[0], "locale")
Locale_AddCatalogLookupPathPrefix(localedir)
del os
#----------------------------------------------------------------------------

229
wxPython/src/_joystick.i Normal file
View File

@@ -0,0 +1,229 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _joystick.i
// Purpose: SWIG interface stuff for wxJoystick
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/joystick.h>
%}
//---------------------------------------------------------------------------
// Which joystick? Same as Windows ids so no conversion necessary.
enum
{
wxJOYSTICK1,
wxJOYSTICK2
};
// Which button is down?
enum
{
wxJOY_BUTTON_ANY,
wxJOY_BUTTON1,
wxJOY_BUTTON2,
wxJOY_BUTTON3,
wxJOY_BUTTON4,
};
%{
#if !wxUSE_JOYSTICK && !defined(__WXMSW__)
// A C++ stub class for wxJoystick for platforms that don't have it.
class wxJoystick : public wxObject {
public:
wxJoystick(int joystick = wxJOYSTICK1) {
wxPyBeginBlockThreads();
PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
wxPyEndBlockThreads();
}
wxPoint GetPosition() { return wxPoint(-1,-1); }
int GetZPosition() { return -1; }
int GetButtonState() { return -1; }
int GetPOVPosition() { return -1; }
int GetPOVCTSPosition() { return -1; }
int GetRudderPosition() { return -1; }
int GetUPosition() { return -1; }
int GetVPosition() { return -1; }
int GetMovementThreshold() { return -1; }
void SetMovementThreshold(int threshold) {}
bool IsOk(void) { return FALSE; }
int GetNumberJoysticks() { return -1; }
int GetManufacturerId() { return -1; }
int GetProductId() { return -1; }
wxString GetProductName() { return ""; }
int GetXMin() { return -1; }
int GetYMin() { return -1; }
int GetZMin() { return -1; }
int GetXMax() { return -1; }
int GetYMax() { return -1; }
int GetZMax() { return -1; }
int GetNumberButtons() { return -1; }
int GetNumberAxes() { return -1; }
int GetMaxButtons() { return -1; }
int GetMaxAxes() { return -1; }
int GetPollingMin() { return -1; }
int GetPollingMax() { return -1; }
int GetRudderMin() { return -1; }
int GetRudderMax() { return -1; }
int GetUMin() { return -1; }
int GetUMax() { return -1; }
int GetVMin() { return -1; }
int GetVMax() { return -1; }
bool HasRudder() { return FALSE; }
bool HasZ() { return FALSE; }
bool HasU() { return FALSE; }
bool HasV() { return FALSE; }
bool HasPOV() { return FALSE; }
bool HasPOV4Dir() { return FALSE; }
bool HasPOVCTS() { return FALSE; }
bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; }
bool ReleaseCapture() { return FALSE; }
};
#endif
%}
class wxJoystick /* : public wxObject */
{
public:
wxJoystick(int joystick = wxJOYSTICK1);
~wxJoystick();
wxPoint GetPosition();
int GetZPosition();
int GetButtonState();
int GetPOVPosition();
int GetPOVCTSPosition();
int GetRudderPosition();
int GetUPosition();
int GetVPosition();
int GetMovementThreshold();
void SetMovementThreshold(int threshold) ;
bool IsOk(void);
int GetNumberJoysticks();
int GetManufacturerId();
int GetProductId();
wxString GetProductName();
int GetXMin();
int GetYMin();
int GetZMin();
int GetXMax();
int GetYMax();
int GetZMax();
int GetNumberButtons();
int GetNumberAxes();
int GetMaxButtons();
int GetMaxAxes();
int GetPollingMin();
int GetPollingMax();
int GetRudderMin();
int GetRudderMax();
int GetUMin();
int GetUMax();
int GetVMin();
int GetVMax();
bool HasRudder();
bool HasZ();
bool HasU();
bool HasV();
bool HasPOV();
bool HasPOV4Dir();
bool HasPOVCTS();
bool SetCapture(wxWindow* win, int pollingFreq = 0);
bool ReleaseCapture();
%pythoncode { def __nonzero__(self): return self.IsOk() }
};
//---------------------------------------------------------------------------
%constant wxEventType wxEVT_JOY_BUTTON_DOWN;
%constant wxEventType wxEVT_JOY_BUTTON_UP;
%constant wxEventType wxEVT_JOY_MOVE;
%constant wxEventType wxEVT_JOY_ZMOVE;
class wxJoystickEvent : public wxEvent
{
public:
wxPoint m_pos;
int m_zPosition;
int m_buttonChange; // Which button changed?
int m_buttonState; // Which buttons are down?
int m_joyStick; // Which joystick?
wxJoystickEvent(wxEventType type = wxEVT_NULL,
int state = 0,
int joystick = wxJOYSTICK1,
int change = 0);
wxPoint GetPosition() const;
int GetZPosition() const;
int GetButtonState() const;
int GetButtonChange() const;
int GetJoystick() const;
void SetJoystick(int stick);
void SetButtonState(int state);
void SetButtonChange(int change);
void SetPosition(const wxPoint& pos);
void SetZPosition(int zPos);
// Was it a button event? (*doesn't* mean: is any button *down*?)
bool IsButton() const;
// Was it a move event?
bool IsMove() const;
// Was it a zmove event?
bool IsZMove() const;
// Was it a down event from button 1, 2, 3, 4 or any?
bool ButtonDown(int but = wxJOY_BUTTON_ANY) const;
// Was it a up event from button 1, 2, 3 or any?
bool ButtonUp(int but = wxJOY_BUTTON_ANY) const;
// Was the given button 1,2,3,4 or any in Down state?
bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const;
};
%pythoncode {
EVT_JOY_BUTTON_DOWN = wx.PyEventBinder( wxEVT_JOY_BUTTON_DOWN )
EVT_JOY_BUTTON_UP = wx.PyEventBinder( wxEVT_JOY_BUTTON_UP )
EVT_JOY_MOVE = wx.PyEventBinder( wxEVT_JOY_MOVE )
EVT_JOY_ZMOVE = wx.PyEventBinder( wxEVT_JOY_ZMOVE )
EVT_JOYSTICK_EVENTS = wx.PyEventBinder([ wxEVT_JOY_BUTTON_DOWN,
wxEVT_JOY_BUTTON_UP,
wxEVT_JOY_MOVE,
wxEVT_JOY_ZMOVE,
])
}
//---------------------------------------------------------------------------

147
wxPython/src/_listbox.i Normal file
View File

@@ -0,0 +1,147 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _listbox.i
// Purpose: SWIG interface defs for wxListBox and wxCheckListBox
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/checklst.h>
DECLARE_DEF_STRING(ListBoxNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
class wxListBox : public wxControlWithItems
{
public:
%addtofunc wxListBox "self._setOORInfo(self)"
%addtofunc wxListBox() ""
wxListBox(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices=0, wxString* choices_array = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListBoxNameStr);
%name(PreListBox)wxListBox();
bool Create(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices=0, wxString* choices_array = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListBoxNameStr);
// all generic methods are in wxControlWithItems...
%extend {
void Insert(const wxString& item, int pos, PyObject* clientData=NULL) {
if (clientData) {
wxPyClientData* data = new wxPyClientData(clientData);
self->Insert(item, pos, data);
} else
self->Insert(item, pos);
}
}
void InsertItems(const wxArrayString& items, int pos);
void Set(const wxArrayString& items/*, void **clientData = NULL */);
// multiple selection logic
virtual bool IsSelected(int n) const;
virtual void SetSelection(int n, bool select = TRUE);
virtual void Select(int n);
void Deselect(int n);
void DeselectAll(int itemToLeaveSelected = -1);
virtual bool SetStringSelection(const wxString& s, bool select = TRUE);
// works for single as well as multiple selection listboxes (unlike
// GetSelection which only works for listboxes with single selection)
//virtual int GetSelections(wxArrayInt& aSelections) const;
%extend {
PyObject* GetSelections() {
wxArrayInt lst;
self->GetSelections(lst);
PyObject *tup = PyTuple_New(lst.GetCount());
for(size_t i=0; i<lst.GetCount(); i++) {
PyTuple_SetItem(tup, i, PyInt_FromLong(lst[i]));
}
return tup;
}
}
// set the specified item at the first visible item or scroll to max
// range.
void SetFirstItem(int n);
%name(SetFirstItemStr) void SetFirstItem(const wxString& s);
// ensures that the given item is visible scrolling the listbox if
// necessary
virtual void EnsureVisible(int n);
// a combination of Append() and EnsureVisible(): appends the item to the
// listbox and ensures that it is visible i.e. not scrolled out of view
void AppendAndEnsureVisible(const wxString& s);
// return TRUE if this listbox is sorted
bool IsSorted() const;
};
//---------------------------------------------------------------------------
%newgroup
// wxCheckListBox: a listbox whose items may be checked
class wxCheckListBox : public wxListBox
{
public:
%addtofunc wxListBox "self._setOORInfo(self)"
%addtofunc wxListBox() ""
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices = 0, wxString* choices_array = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListBoxNameStr);
%name(PreCheckListBox)wxCheckListBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices = 0, wxString* choices_array = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListBoxNameStr);
bool IsChecked(int index);
void Check(int index, int check = TRUE);
#ifndef __WXMAC__
int GetItemHeight();
#endif
// return the index of the item at this position or wxNOT_FOUND
int HitTest(const wxPoint& pt) const;
%name(HitTestXY)int HitTest(wxCoord x, wxCoord y) const;
};
//---------------------------------------------------------------------------

824
wxPython/src/_listctrl.i Normal file
View File

@@ -0,0 +1,824 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _listctrl.i
// Purpose: SWIG interface file for wxListCtrl and related classes
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2002 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/listctrl.h>
const wxChar* wxListCtrlNameStr = _T("wxListCtrl");
DECLARE_DEF_STRING(ListCtrlNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
enum {
// style flags
wxLC_VRULES,
wxLC_HRULES,
wxLC_ICON,
wxLC_SMALL_ICON,
wxLC_LIST,
wxLC_REPORT,
wxLC_ALIGN_TOP,
wxLC_ALIGN_LEFT,
wxLC_AUTOARRANGE,
wxLC_VIRTUAL,
wxLC_EDIT_LABELS,
wxLC_NO_HEADER,
wxLC_NO_SORT_HEADER,
wxLC_SINGLE_SEL,
wxLC_SORT_ASCENDING,
wxLC_SORT_DESCENDING,
wxLC_MASK_TYPE,
wxLC_MASK_ALIGN,
wxLC_MASK_SORT
};
enum {
// Mask flags to tell app/GUI what fields of wxListItem are valid
wxLIST_MASK_STATE,
wxLIST_MASK_TEXT,
wxLIST_MASK_IMAGE,
wxLIST_MASK_DATA,
wxLIST_SET_ITEM,
wxLIST_MASK_WIDTH,
wxLIST_MASK_FORMAT,
// State flags for indicating the state of an item
wxLIST_STATE_DONTCARE,
wxLIST_STATE_DROPHILITED,
wxLIST_STATE_FOCUSED,
wxLIST_STATE_SELECTED,
wxLIST_STATE_CUT,
wxLIST_STATE_DISABLED,
wxLIST_STATE_FILTERED,
wxLIST_STATE_INUSE,
wxLIST_STATE_PICKED,
wxLIST_STATE_SOURCE,
// Hit test flags, used in HitTest
wxLIST_HITTEST_ABOVE,
wxLIST_HITTEST_BELOW,
wxLIST_HITTEST_NOWHERE,
wxLIST_HITTEST_ONITEMICON,
wxLIST_HITTEST_ONITEMLABEL,
wxLIST_HITTEST_ONITEMRIGHT,
wxLIST_HITTEST_ONITEMSTATEICON,
wxLIST_HITTEST_TOLEFT,
wxLIST_HITTEST_TORIGHT,
wxLIST_HITTEST_ONITEM,
};
// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL)
enum
{
wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
wxLIST_NEXT_ALL, // Searches for subsequent item by index
wxLIST_NEXT_BELOW, // Searches for an item below the specified item
wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
};
// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT)
enum
{
wxLIST_ALIGN_DEFAULT,
wxLIST_ALIGN_LEFT,
wxLIST_ALIGN_TOP,
wxLIST_ALIGN_SNAP_TO_GRID
};
// Column format (MSW only except wxLIST_FORMAT_LEFT)
enum wxListColumnFormat
{
wxLIST_FORMAT_LEFT,
wxLIST_FORMAT_RIGHT,
wxLIST_FORMAT_CENTRE,
wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
};
// Autosize values for SetColumnWidth
enum
{
wxLIST_AUTOSIZE = -1,
wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version
};
// Flag values for GetItemRect
enum
{
wxLIST_RECT_BOUNDS,
wxLIST_RECT_ICON,
wxLIST_RECT_LABEL
};
// Flag values for FindItem (MSW only)
enum
{
wxLIST_FIND_UP,
wxLIST_FIND_DOWN,
wxLIST_FIND_LEFT,
wxLIST_FIND_RIGHT
};
//---------------------------------------------------------------------------
%newgroup
// wxListItemAttr: a structure containing the visual attributes of an item
class wxListItemAttr
{
public:
// ctors
//wxListItemAttr();
wxListItemAttr(const wxColour& colText = wxNullColour,
const wxColour& colBack = wxNullColour,
const wxFont& font = wxNullFont);
// setters
void SetTextColour(const wxColour& colText);
void SetBackgroundColour(const wxColour& colBack);
void SetFont(const wxFont& font);
// accessors
bool HasTextColour();
bool HasBackgroundColour();
bool HasFont();
wxColour GetTextColour();
wxColour GetBackgroundColour();
wxFont GetFont();
%extend { void Destroy() { delete self; } }
};
//---------------------------------------------------------------------------
%newgroup
// wxListItem: the item or column info, used to exchange data with wxListCtrl
class wxListItem : public wxObject {
public:
wxListItem();
~wxListItem();
// resetting
void Clear();
void ClearAttributes();
// setters
void SetMask(long mask);
void SetId(long id);
void SetColumn(int col);
void SetState(long state);
void SetStateMask(long stateMask);
void SetText(const wxString& text);
void SetImage(int image);
void SetData(long data);
void SetWidth(int width);
void SetAlign(wxListColumnFormat align);
void SetTextColour(const wxColour& colText);
void SetBackgroundColour(const wxColour& colBack);
void SetFont(const wxFont& font);
// accessors
long GetMask();
long GetId();
int GetColumn();
long GetState();
const wxString& GetText();
int GetImage();
long GetData();
int GetWidth();
wxListColumnFormat GetAlign();
wxListItemAttr *GetAttributes();
bool HasAttributes();
wxColour GetTextColour() const;
wxColour GetBackgroundColour() const;
wxFont GetFont() const;
// these members are public for compatibility
long m_mask; // Indicates what fields are valid
long m_itemId; // The zero-based item position
int m_col; // Zero-based column, if in report mode
long m_state; // The state of the item
long m_stateMask;// Which flags of m_state are valid (uses same flags)
wxString m_text; // The label/header text
int m_image; // The zero-based index into an image list
long m_data; // App-defined data
// For columns only
int m_format; // left, right, centre
int m_width; // width of column
};
//---------------------------------------------------------------------------
%newgroup
// wxListEvent - the event class for the wxListCtrl notifications
class wxListEvent: public wxNotifyEvent {
public:
wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
int m_code;
long m_oldItemIndex;
long m_itemIndex;
int m_col;
wxPoint m_pointDrag;
%immutable;
wxListItem m_item;
%mutable;
int GetKeyCode();
%pythoncode { GetCode = GetKeyCode }
long GetIndex();
int GetColumn();
wxPoint GetPoint();
%pythoncode { GetPostiion = GetPoint }
const wxString& GetLabel();
const wxString& GetText();
int GetImage();
long GetData();
long GetMask();
const wxListItem& GetItem();
long GetCacheFrom();
long GetCacheTo();
// was label editing canceled? (for wxEVT_COMMAND_LIST_END_LABEL_EDIT only)
bool IsEditCancelled() const;
void SetEditCanceled(bool editCancelled);
};
/* List control event types */
%constant wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG;
%constant wxEventType wxEVT_COMMAND_LIST_BEGIN_RDRAG;
%constant wxEventType wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT;
%constant wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT;
%constant wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM;
%constant wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
%constant wxEventType wxEVT_COMMAND_LIST_GET_INFO;
%constant wxEventType wxEVT_COMMAND_LIST_SET_INFO;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED;
%constant wxEventType wxEVT_COMMAND_LIST_KEY_DOWN;
%constant wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM;
%constant wxEventType wxEVT_COMMAND_LIST_COL_CLICK;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
%constant wxEventType wxEVT_COMMAND_LIST_CACHE_HINT;
%constant wxEventType wxEVT_COMMAND_LIST_COL_RIGHT_CLICK;
%constant wxEventType wxEVT_COMMAND_LIST_COL_BEGIN_DRAG;
%constant wxEventType wxEVT_COMMAND_LIST_COL_DRAGGING;
%constant wxEventType wxEVT_COMMAND_LIST_COL_END_DRAG;
%constant wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED;
%pythoncode {
EVT_LIST_BEGIN_DRAG = wx.PyEventBinder(wxEVT_COMMAND_LIST_BEGIN_DRAG , 1)
EVT_LIST_BEGIN_RDRAG = wx.PyEventBinder(wxEVT_COMMAND_LIST_BEGIN_RDRAG , 1)
EVT_LIST_BEGIN_LABEL_EDIT = wx.PyEventBinder(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT , 1)
EVT_LIST_END_LABEL_EDIT = wx.PyEventBinder(wxEVT_COMMAND_LIST_END_LABEL_EDIT , 1)
EVT_LIST_DELETE_ITEM = wx.PyEventBinder(wxEVT_COMMAND_LIST_DELETE_ITEM , 1)
EVT_LIST_DELETE_ALL_ITEMS = wx.PyEventBinder(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS , 1)
EVT_LIST_GET_INFO = wx.PyEventBinder(wxEVT_COMMAND_LIST_GET_INFO , 1)
EVT_LIST_SET_INFO = wx.PyEventBinder(wxEVT_COMMAND_LIST_SET_INFO , 1)
EVT_LIST_ITEM_SELECTED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_SELECTED , 1)
EVT_LIST_ITEM_DESELECTED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_DESELECTED , 1)
EVT_LIST_KEY_DOWN = wx.PyEventBinder(wxEVT_COMMAND_LIST_KEY_DOWN , 1)
EVT_LIST_INSERT_ITEM = wx.PyEventBinder(wxEVT_COMMAND_LIST_INSERT_ITEM , 1)
EVT_LIST_COL_CLICK = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_CLICK , 1)
EVT_LIST_ITEM_RIGHT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK , 1)
EVT_LIST_ITEM_MIDDLE_CLICK = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 1)
EVT_LIST_ITEM_ACTIVATED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_ACTIVATED , 1)
EVT_LIST_CACHE_HINT = wx.PyEventBinder(wxEVT_COMMAND_LIST_CACHE_HINT , 1)
EVT_LIST_COL_RIGHT_CLICK = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK , 1)
EVT_LIST_COL_BEGIN_DRAG = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG , 1)
EVT_LIST_COL_DRAGGING = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_DRAGGING , 1)
EVT_LIST_COL_END_DRAG = wx.PyEventBinder(wxEVT_COMMAND_LIST_COL_END_DRAG , 1)
EVT_LIST_ITEM_FOCUSED = wx.PyEventBinder(wxEVT_COMMAND_LIST_ITEM_FOCUSED , 1)
}
//---------------------------------------------------------------------------
%newgroup
%{ // Python aware sorting function for wxPyListCtrl
static int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) {
int retval = 0;
PyObject* func = (PyObject*)funcPtr;
wxPyBeginBlockThreads();
PyObject* args = Py_BuildValue("(ii)", item1, item2);
PyObject* result = PyEval_CallObject(func, args);
Py_DECREF(args);
if (result) {
retval = PyInt_AsLong(result);
Py_DECREF(result);
}
wxPyEndBlockThreads();
return retval;
}
%}
%{ // C++ Version of a Python aware class
class wxPyListCtrl : public wxListCtrl {
DECLARE_ABSTRACT_CLASS(wxPyListCtrl);
public:
wxPyListCtrl() : wxListCtrl() {}
wxPyListCtrl(wxWindow* parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name) :
wxListCtrl(parent, id, pos, size, style, validator, name) {}
bool Create(wxWindow* parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name) {
return wxListCtrl::Create(parent, id, pos, size, style, validator, name);
}
DEC_PYCALLBACK_STRING_LONGLONG(OnGetItemText);
DEC_PYCALLBACK_INT_LONG(OnGetItemImage);
DEC_PYCALLBACK_LISTATTR_LONG(OnGetItemAttr);
PYPRIVATE;
};
IMPLEMENT_ABSTRACT_CLASS(wxPyListCtrl, wxListCtrl);
IMP_PYCALLBACK_STRING_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemText);
IMP_PYCALLBACK_INT_LONG(wxPyListCtrl, wxListCtrl, OnGetItemImage);
IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr);
%}
%name(ListCtrl)class wxPyListCtrl : public wxControl {
public:
%addtofunc wxPyListCtrl "self._setOORInfo(self);self._setCallbackInfo(self, ListCtrl)"
%addtofunc wxPyListCtrl() ""
wxPyListCtrl(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListCtrlNameStr);
%name(PreListCtrl)wxPyListCtrl();
bool Create(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListCtrlNameStr);
void _setCallbackInfo(PyObject* self, PyObject* _class);
// Set the control colours
bool SetForegroundColour(const wxColour& col);
bool SetBackgroundColour(const wxColour& col);
// Gets information about this column
%addtofunc GetColumn "if val is not None: val.thisown = 1"; // %newobject doesn't work with OOR typemap
%extend {
wxListItem* GetColumn(int col) {
wxListItem item;
item.SetMask( wxLIST_MASK_STATE |
wxLIST_MASK_TEXT |
wxLIST_MASK_IMAGE |
wxLIST_MASK_DATA |
wxLIST_SET_ITEM |
wxLIST_MASK_WIDTH |
wxLIST_MASK_FORMAT
);
if (self->GetColumn(col, item))
return new wxListItem(item);
else
return NULL;
}
}
// Sets information about this column
bool SetColumn(int col, wxListItem& item) ;
// Gets the column width
int GetColumnWidth(int col) const;
// Sets the column width
bool SetColumnWidth(int col, int width) ;
// Gets the number of items that can fit vertically in the
// visible area of the list control (list or report view)
// or the total number of items in the list control (icon
// or small icon view)
int GetCountPerPage() const;
// return the total area occupied by all the items (icon/small icon only)
wxRect GetViewRect() const;
#ifdef __WXMSW__
// Gets the edit control for editing labels.
wxTextCtrl* GetEditControl() const;
#endif
// Gets information about the item
%addtofunc GetItem "if val is not None: val.thisown = 1"; // %newobject doesn't work with OOR typemap
%extend {
wxListItem* GetItem(long itemId, int col=0) {
wxListItem* info = new wxListItem;
info->m_itemId = itemId;
info->m_col = col;
info->m_mask = 0xFFFF;
self->GetItem(*info);
return info;
}
}
// Sets information about the item
bool SetItem(wxListItem& info) ;
// Sets a string field at a particular column
%name(SetStringItem)long SetItem(long index, int col, const wxString& label, int imageId = -1);
// Gets the item state
int GetItemState(long item, long stateMask) const ;
// Sets the item state
bool SetItemState(long item, long state, long stateMask) ;
// Sets the item image
bool SetItemImage(long item, int image, int selImage) ;
// Gets the item text
wxString GetItemText(long item) const ;
// Sets the item text
void SetItemText(long item, const wxString& str) ;
// Gets the item data
long GetItemData(long item) const ;
// Sets the item data
bool SetItemData(long item, long data) ;
//bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ;
//bool GetItemPosition(long item, wxPoint& pos) const ;
// Gets the item position
%extend {
wxPoint GetItemPosition(long item) {
wxPoint pos;
self->GetItemPosition(item, pos);
return pos;
}
// Gets the item rectangle
wxRect GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) {
wxRect rect;
self->GetItemRect(item, rect, code);
return rect;
}
}
// Sets the item position
bool SetItemPosition(long item, const wxPoint& pos) ;
// Gets the number of items in the list control
int GetItemCount() const;
// Gets the number of columns in the list control
int GetColumnCount() const;
// get the horizontal and vertical components of the item spacing
wxSize GetItemSpacing() const;
#ifndef __WXMSW__
void SetItemSpacing( int spacing, bool isSmall = FALSE );
#endif
// Gets the number of selected items in the list control
int GetSelectedItemCount() const;
// Gets the text colour of the listview
wxColour GetTextColour() const;
// Sets the text colour of the listview
void SetTextColour(const wxColour& col);
// Gets the index of the topmost visible item when in
// list or report view
long GetTopItem() const ;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = TRUE) ;
// Set the whole window style
void SetWindowStyleFlag(long style) ;
// Searches for an item, starting from 'item'.
// item can be -1 to find the first item that matches the
// specified flags.
// Returns the item or -1 if unsuccessful.
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ;
// Gets one of the three image lists
wxImageList *GetImageList(int which) const ;
// Sets the image list
void SetImageList(wxImageList *imageList, int which);
// is there a way to tell SWIG to disown this???
%addtofunc AssignImageList "args[1].thisown = 0";
void AssignImageList(wxImageList *imageList, int which);
// returns true if it is a virtual list control
bool IsVirtual() const;
// refresh items selectively (only useful for virtual list controls)
void RefreshItem(long item);
void RefreshItems(long itemFrom, long itemTo);
// Arranges the items
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
// Deletes an item
bool DeleteItem(long item);
// Deletes all items
bool DeleteAllItems() ;
// Deletes a column
bool DeleteColumn(int col);
// Deletes all columns
bool DeleteAllColumns();
// Clears items, and columns if there are any.
void ClearAll();
#ifdef __WXMSW__
// Edit the label
wxTextCtrl* EditLabel(long item /*, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)*/);
// End label editing, optionally cancelling the edit
bool EndEditLabel(bool cancel);
#else
void EditLabel(long item);
#endif
// Ensures this item is visible
bool EnsureVisible(long item) ;
// Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = FALSE);
// Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1.
%name(FindItemData) long FindItem(long start, long data);
// Find an item nearest this position in the specified direction, starting from
// the item after 'start' or the beginning if 'start' is -1.
%name(FindItemAtPos) long FindItem(long start, const wxPoint& pt, int direction);
// Determines which item (if any) is at the specified point,
// giving details in the second return value (see wxLIST_HITTEST_... flags above)
long HitTest(const wxPoint& point, int& OUTPUT);
// Inserts an item, returning the index of the new item if successful,
// -1 otherwise.
long InsertItem(wxListItem& info);
// Insert a string item
%name(InsertStringItem) long InsertItem(long index, const wxString& label);
// Insert an image item
%name(InsertImageItem) long InsertItem(long index, int imageIndex);
// Insert an image/string item
%name(InsertImageStringItem) long InsertItem(long index, const wxString& label, int imageIndex);
// For list view mode (only), inserts a column.
%name(InsertColumnInfo) long InsertColumn(long col, wxListItem& info);
long InsertColumn(long col,
const wxString& heading,
int format = wxLIST_FORMAT_LEFT,
int width = -1);
// set the number of items in a virtual list control
void SetItemCount(long count);
// Scrolls the list control. If in icon, small icon or report view mode,
// x specifies the number of pixels to scroll. If in list view mode, x
// specifies the number of columns to scroll.
// If in icon, small icon or list view mode, y specifies the number of pixels
// to scroll. If in report view mode, y specifies the number of lines to scroll.
bool ScrollList(int dx, int dy);
void SetItemTextColour( long item, const wxColour& col);
wxColour GetItemTextColour( long item ) const;
void SetItemBackgroundColour( long item, const wxColour &col);
wxColour GetItemBackgroundColour( long item ) const;
%pythoncode {
%#
%# Some helpers...
def Select(self, idx, on=1):
'''[de]select an item'''
if on: state = wxLIST_STATE_SELECTED
else: state = 0
self.SetItemState(idx, state, wxLIST_STATE_SELECTED)
def Focus(self, idx):
'''Focus and show the given item'''
self.SetItemState(idx, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED)
self.EnsureVisible(idx)
def GetFocusedItem(self):
'''get the currently focused item or -1 if none'''
return self.GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED)
def GetFirstSelected(self, *args):
'''return first selected item, or -1 when none'''
return self.GetNextSelected(-1)
def GetNextSelected(self, item):
'''return subsequent selected items, or -1 when no more'''
return self.GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)
def IsSelected(self, idx):
'''return TRUE if the item is selected'''
return self.GetItemState(idx, wxLIST_STATE_SELECTED) != 0
def SetColumnImage(self, col, image):
item = self.GetColumn(col)
# preserve all other attributes too
item.SetMask( wxLIST_MASK_STATE |
wxLIST_MASK_TEXT |
wxLIST_MASK_IMAGE |
wxLIST_MASK_DATA |
wxLIST_SET_ITEM |
wxLIST_MASK_WIDTH |
wxLIST_MASK_FORMAT )
item.SetImage(image)
self.SetColumn(col, item)
def ClearColumnImage(self, col):
self.SetColumnImage(col, -1)
def Append(self, entry):
'''Append an item to the list control. The entry parameter should be a
sequence with an item for each column'''
if len(entry):
if wx.wxUSE_UNICODE:
cvtfunc = unicode
else:
cvtfunc = str
pos = self.GetItemCount()
self.InsertStringItem(pos, cvtfunc(entry[0]))
for i in range(1, len(entry)):
self.SetStringItem(pos, i, cvtfunc(entry[i]))
return pos
}
// bool SortItems(wxListCtrlCompare fn, long data);
%extend {
// Sort items.
// func is a function which takes 2 long arguments: item1, item2.
// item1 is the long data associated with a first item (NOT the index).
// item2 is the long data associated with a second item (NOT the index).
// The return value is a negative number if the first item should precede the second
// item, a positive number of the second item should precede the first,
// or zero if the two items are equivalent.
bool SortItems(PyObject* func) {
if (!PyCallable_Check(func))
return FALSE;
return self->SortItems((wxListCtrlCompare)wxPyListCtrl_SortItems, (long)func);
}
}
%extend {
wxWindow* GetMainWindow() {
#ifdef __WXMSW__
return self;
#else
return (wxWindow*)self->m_mainWin;
#endif
}
}
};
//---------------------------------------------------------------------------
%newgroup
// wxListView: a class which provides a little better API for list control
class wxListView : public wxPyListCtrl
{
public:
%addtofunc wxListView "self._setOORInfo(self)"
%addtofunc wxListView() ""
wxListView( wxWindow *parent,
wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_REPORT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListCtrlNameStr);
%name(PreListView)wxListView();
bool Create( wxWindow *parent,
wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_REPORT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyListCtrlNameStr);
// [de]select an item
void Select(long n, bool on = TRUE);
// focus and show the given item
void Focus(long index);
// get the currently focused item or -1 if none
long GetFocusedItem() const;
// get first and subsequent selected items, return -1 when no more
long GetNextSelected(long item) const;
long GetFirstSelected() const;
// return TRUE if the item is selected
bool IsSelected(long index);
void SetColumnImage(int col, int image);
void ClearColumnImage(int col);
};
//---------------------------------------------------------------------------
%init %{
// Map renamed classes back to their common name for OOR
wxPyPtrTypeMap_Add("wxListCtrl", "wxPyListCtrl");
%}
//---------------------------------------------------------------------------

290
wxPython/src/_log.i Normal file
View File

@@ -0,0 +1,290 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _log.i
// Purpose: SWIG interface stuff for wxLog
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
typedef unsigned long wxTraceMask;
typedef unsigned long wxLogLevel;
enum
{
wxLOG_FatalError, // program can't continue, abort immediately
wxLOG_Error, // a serious error, user must be informed about it
wxLOG_Warning, // user is normally informed about it but may be ignored
wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
wxLOG_Status, // informational: might go to the status line of GUI app
wxLOG_Info, // informational message (a.k.a. 'Verbose')
wxLOG_Debug, // never shown to the user, disabled in release mode
wxLOG_Trace, // trace messages are also only enabled in debug mode
wxLOG_Progress, // used for progress indicator (not yet)
wxLOG_User = 100, // user defined levels start here
wxLOG_Max = 10000
};
#define wxTRACE_MemAlloc "memalloc" // trace memory allocation (new/delete)
#define wxTRACE_Messages "messages" // trace window messages/X callbacks
#define wxTRACE_ResAlloc "resalloc" // trace GDI resource allocation
#define wxTRACE_RefCount "refcount" // trace various ref counting operations
#define wxTRACE_OleCalls "ole" // OLE interface calls
#define wxTraceMemAlloc 0x0001 // trace memory allocation (new/delete)
#define wxTraceMessages 0x0002 // trace window messages/X callbacks
#define wxTraceResAlloc 0x0004 // trace GDI resource allocation
#define wxTraceRefCount 0x0008 // trace various ref counting operations
#define wxTraceOleCalls 0x0100 // OLE interface calls
//---------------------------------------------------------------------------
class wxLog
{
public:
wxLog();
// these functions allow to completely disable all log messages
// is logging disabled now?
static bool IsEnabled();
// change the flag state, return the previous one
static bool EnableLogging(bool doIt = TRUE);
// static sink function
static void OnLog(wxLogLevel level, const wxChar *szString, time_t t);
// message buffering
// flush shows all messages if they're not logged immediately (FILE
// and iostream logs don't need it, but wxGuiLog does to avoid showing
// 17 modal dialogs one after another)
virtual void Flush();
// flush the active target if any
static void FlushActive();
// only one sink is active at each moment
// get current log target, will call wxApp::CreateLogTarget() to
// create one if none exists
static wxLog *GetActiveTarget();
// change log target, pLogger may be NULL
static wxLog *SetActiveTarget(wxLog *pLogger);
// suspend the message flushing of the main target until the next call
// to Resume() - this is mainly for internal use (to prevent wxYield()
// from flashing the messages)
static void Suspend();
// must be called for each Suspend()!
static void Resume();
// verbose mode is activated by standard command-line '-verbose'
// option
static void SetVerbose(bool bVerbose = TRUE);
// Set log level. Log messages with level > logLevel will not be logged.
static void SetLogLevel(wxLogLevel logLevel);
// should GetActiveTarget() try to create a new log object if the
// current is NULL?
static void DontCreateOnDemand();
// trace mask (see wxTraceXXX constants for details)
static void SetTraceMask(wxTraceMask ulMask);
// add string trace mask
static void AddTraceMask(const wxString& str);
// remove string trace mask
static void RemoveTraceMask(const wxString& str);
// remove all string trace masks
static void ClearTraceMasks();
// get string trace masks
static const wxArrayString &GetTraceMasks();
// sets the timestamp string: this is used as strftime() format string
// for the log targets which add time stamps to the messages - set it
// to NULL to disable time stamping completely.
static void SetTimestamp(const wxChar *ts);
// gets the verbose status
static bool GetVerbose();
// get trace mask
static wxTraceMask GetTraceMask();
// is this trace mask in the list?
static bool IsAllowedTraceMask(const wxChar *mask);
// return the current loglevel limit
static wxLogLevel GetLogLevel();
// get the current timestamp format string (may be NULL)
static const wxChar *GetTimestamp();
%extend {
static wxString TimeStamp() {
wxString msg;
wxLog::TimeStamp(&msg);
return msg;
}
}
%extend { void Destroy() { delete self; } }
};
//---------------------------------------------------------------------------
class wxLogStderr : public wxLog
{
public:
wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/);
};
class wxLogTextCtrl : public wxLog
{
public:
wxLogTextCtrl(wxTextCtrl *pTextCtrl);
};
class wxLogGui : public wxLog
{
public:
wxLogGui();
};
class wxLogWindow : public wxLog
{
public:
wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
const wxString& szTitle, // the title of the frame
bool bShow = TRUE, // show window immediately?
bool bPassToOld = TRUE); // pass log messages to the old target?
void Show(bool bShow = TRUE);
wxFrame *GetFrame() const;
wxLog *GetOldLog() const;
bool IsPassingMessages() const;
void PassMessages(bool bDoPass);
};
class wxLogChain : public wxLog
{
public:
wxLogChain(wxLog *logger);
void SetLog(wxLog *logger);
void PassMessages(bool bDoPass);
bool IsPassingMessages();
wxLog *GetOldLog();
};
//---------------------------------------------------------------------------
unsigned long wxSysErrorCode();
const wxString wxSysErrorMsg(unsigned long nErrCode = 0);
void wxLogFatalError(const wxString& msg);
void wxLogError(const wxString& msg);
void wxLogWarning(const wxString& msg);
void wxLogMessage(const wxString& msg);
void wxLogInfo(const wxString& msg);
void wxLogDebug(const wxString& msg);
void wxLogVerbose(const wxString& msg);
void wxLogStatus(const wxString& msg);
%name(LogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& msg);
void wxLogSysError(const wxString& msg);
void wxLogTrace(const wxString& msg);
%name(LogTraceMask)void wxLogTrace(const wxString& mask, const wxString& msg);
void wxLogGeneric(unsigned long level, const wxString& msg);
// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
// i.e. without using wxMessageBox() for example because it could crash
void wxSafeShowMessage(const wxString& title, const wxString& text);
// Suspress logging while an instance of this class exists
class wxLogNull
{
public:
wxLogNull();
~wxLogNull();
};
//---------------------------------------------------------------------------
%{
// A wxLog class that can be derived from in wxPython
class wxPyLog : public wxLog {
public:
wxPyLog() : wxLog() {}
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
bool found;
wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DoLog"))) {
PyObject* s = wx2PyString(szString);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iOi)", level, s, t));
Py_DECREF(s);
}
wxPyEndBlockThreads();
if (! found)
wxLog::DoLog(level, szString, t);
}
virtual void DoLogString(const wxChar *szString, time_t t) {
bool found;
wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString"))) {
PyObject* s = wx2PyString(szString);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", s, t));
Py_DECREF(s);
}
wxPyEndBlockThreads();
if (! found)
wxLog::DoLogString(szString, t);
}
PYPRIVATE;
};
%}
// Now tell SWIG about it
class wxPyLog : public wxLog {
public:
%addtofunc wxPyLog "self._setCallbackInfo(self, PyLog)"
wxPyLog();
void _setCallbackInfo(PyObject* self, PyObject* _class);
};
//---------------------------------------------------------------------------

View File

@@ -1,57 +1,43 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mdi.i
// Purpose: MDI related class definitions for wxPython
// Name: _mdi.i
// Purpose: SWIG interface for MDI related class definitions
//
// Author: Robin Dunn
//
// Created: 5/26/98
// Created: 26-May-1998
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
%module mdi
//---------------------------------------------------------------------------
%newgroup
%{
#include "helpers.h"
#include <wx/mdi.h>
%}
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import windows.i
%import frames.i
%pragma(python) code = "import wx"
//----------------------------------------------------------------------
%{
// Put some wx default wxChar* values into wxStrings.
DECLARE_DEF_STRING(FrameNameStr);
%}
//----------------------------------------------------------------------
const int IDM_WINDOWTILE = 4001;
const int IDM_WINDOWTILEHOR = 4001;
const int IDM_WINDOWCASCADE = 4002;
const int IDM_WINDOWICONS = 4003;
const int IDM_WINDOWNEXT = 4004;
const int IDM_WINDOWTILEVERT = 4005;
const int wxFIRST_MDI_CHILD = 4100;
const int wxLAST_MDI_CHILD = 4600;
#define IDM_WINDOWTILE 4001
#define IDM_WINDOWTILEHOR 4001
#define IDM_WINDOWCASCADE 4002
#define IDM_WINDOWICONS 4003
#define IDM_WINDOWNEXT 4004
#define IDM_WINDOWTILEVERT 4005
#define wxFIRST_MDI_CHILD 4100
#define wxLAST_MDI_CHILD 4600
class wxMDIParentFrame : public wxFrame {
public:
%addtofunc wxMDIParentFrame "self._setOORInfo(self)"
%addtofunc wxMDIParentFrame() ""
wxMDIParentFrame(wxWindow *parent,
const wxWindowID id,
const wxString& title,
@@ -59,7 +45,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxPyFrameNameStr);
%name(wxPreMDIParentFrame)wxMDIParentFrame();
%name(PreMDIParentFrame)wxMDIParentFrame();
bool Create(wxWindow *parent,
const wxWindowID id,
@@ -69,8 +55,6 @@ public:
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxPyFrameNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
%pragma(python) addtomethod = "wxPreMDIParentFrame:val._setOORInfo(val)"
void ActivateNext();
void ActivatePrevious();
@@ -96,6 +80,9 @@ public:
class wxMDIChildFrame : public wxFrame {
public:
%addtofunc wxMDIChildFrame "self._setOORInfo(self)"
%addtofunc wxMDIChildFrame() ""
wxMDIChildFrame(wxMDIParentFrame* parent,
const wxWindowID id,
const wxString& title,
@@ -103,7 +90,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxPyFrameNameStr);
%name(wxPreMDIChildFrame)wxMDIChildFrame();
%name(PreMDIChildFrame)wxMDIChildFrame();
bool Create(wxMDIParentFrame* parent,
const wxWindowID id,
@@ -113,9 +100,6 @@ public:
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxPyFrameNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
%pragma(python) addtomethod = "wxPreMDIChildFrame:val._setOORInfo(val)"
void Activate();
void Maximize(bool maximize);
void Restore();
@@ -127,13 +111,14 @@ public:
class wxMDIClientWindow : public wxWindow {
public:
%addtofunc wxMDIClientWindow "self._setOORInfo(self)"
%addtofunc wxMDIClientWindow() ""
wxMDIClientWindow(wxMDIParentFrame* parent, long style = 0);
%name(wxPreMDIClientWindow)wxMDIClientWindow();
%name(PreMDIClientWindow)wxMDIClientWindow();
bool Create(wxMDIParentFrame* parent, long style = 0);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
%pragma(python) addtomethod = "wxPreMDIClientWindow:val._setOORInfo(val)"
};
//---------------------------------------------------------------------------

387
wxPython/src/_menu.i Normal file
View File

@@ -0,0 +1,387 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _menu.i
// Purpose: SWIG interface defs for wxMenuBar, wxMenu and wxMenuItem
//
// Author: Robin Dunn
//
// Created: 24-June-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
class wxMenu : public wxEvtHandler
{
public:
%addtofunc wxMenu "self._setOORInfo(self)"
wxMenu(const wxString& title = wxPyEmptyString, long style = 0);
// append any kind of item (normal/check/radio/separator)
void Append(int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
// append a separator to the menu
void AppendSeparator();
// append a check item
void AppendCheckItem(int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString);
// append a radio item
void AppendRadioItem(int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString);
// append a submenu
%name(AppendMenu)void Append(int itemid,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxPyEmptyString);
// the most generic form of Append() - append anything
%name(AppendItem) void Append(wxMenuItem *item);
// insert a break in the menu (only works when appending the items, not
// inserting them)
virtual void Break();
// insert an item before given position
%name(InsertItem) bool Insert(size_t pos, wxMenuItem *item);
// insert an item before given position
void Insert(size_t pos,
int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
// insert a separator
void InsertSeparator(size_t pos);
// insert a check item
void InsertCheckItem(size_t pos,
int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString);
// insert a radio item
void InsertRadioItem(size_t pos,
int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString);
// insert a submenu
%name(InsertMenu) void Insert(size_t pos,
int itemid,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxPyEmptyString);
// prepend an item to the menu
%name(PrependItem)void Prepend(wxMenuItem *item);
// prepend any item to the menu
void Prepend(int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
// prepend a separator
void PrependSeparator();
// prepend a check item
void PrependCheckItem(int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString);
// prepend a radio item
void PrependRadioItem(int itemid,
const wxString& text,
const wxString& help = wxPyEmptyString);
// prepend a submenu
%name(PrependMenu)void Prepend(int itemid,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxPyEmptyString);
// detach an item from the menu, but don't delete it so that it can be
// added back later (but if it's not, the caller is responsible for
// deleting it!)
wxMenuItem *Remove(int itemid);
%name(RemoveItem) wxMenuItem *Remove(wxMenuItem *item);
// delete an item from the menu (submenus are not destroyed by this
// function, see Destroy)
bool Delete(int itemid);
%name(DeleteItem) bool Delete(wxMenuItem *item);
// delete the item from menu and destroy it (if it's a submenu)
%extend { void Destroy() { delete self; } }
%name(DestroyId) bool Destroy(int itemid);
%name(DestroyItem) bool Destroy(wxMenuItem *item);
// get the items
size_t GetMenuItemCount() const;
%extend {
PyObject* GetMenuItems() {
wxMenuItemList& list = self->GetMenuItems();
return wxPy_ConvertList(&list);
}
}
// search
int FindItem(const wxString& item) const;
%name(FindItemById) wxMenuItem* FindItem(int itemid /*, wxMenu **menu = NULL*/) const;
// find by position
wxMenuItem* FindItemByPosition(size_t position) const;
// get/set items attributes
void Enable(int itemid, bool enable);
bool IsEnabled(int itemid) const;
void Check(int itemid, bool check);
bool IsChecked(int itemid) const;
void SetLabel(int itemid, const wxString& label);
wxString GetLabel(int itemid) const;
virtual void SetHelpString(int itemid, const wxString& helpString);
virtual wxString GetHelpString(int itemid) const;
// the title
virtual void SetTitle(const wxString& title);
const wxString GetTitle() const;
// event handler
void SetEventHandler(wxEvtHandler *handler);
wxEvtHandler *GetEventHandler() const;
// invoking window
void SetInvokingWindow(wxWindow *win);
wxWindow *GetInvokingWindow() const;
// style
long GetStyle() const { return m_style; }
// Updates the UI for a menu and all submenus recursively. source is the
// object that has the update event handlers defined for it. If NULL, the
// menu or associated window will be used.
void UpdateUI(wxEvtHandler* source = NULL);
// get the menu bar this menu is attached to (may be NULL, always NULL for
// popup menus)
wxMenuBar *GetMenuBar() const;
// TODO: Should these be exposed?
// called when the menu is attached/detached to/from a menu bar
virtual void Attach(wxMenuBarBase *menubar);
virtual void Detach();
// is the menu attached to a menu bar (or is it a popup one)?
bool IsAttached() const;
// set/get the parent of this menu
void SetParent(wxMenu *parent);
wxMenu *GetParent() const;
};
//---------------------------------------------------------------------------
%newgroup
class wxMenuBar : public wxWindow
{
public:
%addtofunc wxMenuBar "self._setOORInfo(self)"
wxMenuBar(long style = 0);
// append a menu to the end of menubar, return TRUE if ok
virtual bool Append(wxMenu *menu, const wxString& title);
// insert a menu before the given position into the menubar, return TRUE
// if inserted ok
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title);
// get the number of menus in the menu bar
size_t GetMenuCount() const;
// get the menu at given position
wxMenu *GetMenu(size_t pos) const;
// replace the menu at given position with another one, returns the
// previous menu (which should be deleted by the caller)
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title);
// delete the menu at given position from the menu bar, return the pointer
// to the menu (which should be deleted by the caller)
virtual wxMenu *Remove(size_t pos);
// enable or disable a submenu
virtual void EnableTop(size_t pos, bool enable);
// is the menu enabled?
virtual bool IsEnabledTop(size_t WXUNUSED(pos)) const { return TRUE; }
// get or change the label of the menu at given position
virtual void SetLabelTop(size_t pos, const wxString& label);
virtual wxString GetLabelTop(size_t pos) const;
// by menu and item names, returns wxNOT_FOUND if not found or id of the
// found item
virtual int FindMenuItem(const wxString& menu, const wxString& item) const;
// find item by id (in any menu), returns NULL if not found
//
// if menu is !NULL, it will be filled with wxMenu this item belongs to
%name(FindItemById) virtual wxMenuItem* FindItem(int itemid /*, wxMenu **menu = NULL*/) const;
// find menu by its caption, return wxNOT_FOUND on failure
int FindMenu(const wxString& title) const;
// all these functions just use FindItem() and then call an appropriate
// method on it
//
// NB: under MSW, these methods can only be used after the menubar had
// been attached to the frame
void Enable(int itemid, bool enable);
void Check(int itemid, bool check);
bool IsChecked(int itemid) const;
bool IsEnabled(int itemid) const;
void SetLabel(int itemid, const wxString &label);
wxString GetLabel(int itemid) const;
void SetHelpString(int itemid, const wxString& helpString);
wxString GetHelpString(int itemid) const;
// get the frame we are attached to (may return NULL)
wxFrame *GetFrame() const;
// returns TRUE if we're attached to a frame
bool IsAttached() const;
// associate the menubar with the frame
virtual void Attach(wxFrame *frame);
// called before deleting the menubar normally
virtual void Detach();
};
//---------------------------------------------------------------------------
%newgroup
class wxMenuItem : public wxObject {
public:
wxMenuItem(wxMenu* parentMenu=NULL, int id=wxID_SEPARATOR,
const wxString& text = wxPyEmptyString,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL,
wxMenu* subMenu = NULL);
// the menu we're in
wxMenu *GetMenu() const;
void SetMenu(wxMenu* menu);
// get/set id
void SetId(int itemid);
int GetId() const;
bool IsSeparator() const;
// the item's text (or name)
//
// NB: the item's text includes the accelerators and mnemonics info (if
// any), i.e. it may contain '&' or '_' or "\t..." and thus is
// different from the item's label which only contains the text shown
// in the menu
virtual void SetText(const wxString& str);
wxString GetLabel() const;
const wxString& GetText() const;
// get the label from text
static wxString GetLabelFromText(const wxString& text);
// what kind of menu item we are
wxItemKind GetKind() const;
virtual void SetCheckable(bool checkable);
bool IsCheckable() const;
bool IsSubMenu() const;
void SetSubMenu(wxMenu *menu);
wxMenu *GetSubMenu() const;
// state
virtual void Enable(bool enable = TRUE);
virtual bool IsEnabled() const;
virtual void Check(bool check = TRUE);
virtual bool IsChecked() const;
void Toggle();
// help string (displayed in the status bar by default)
void SetHelp(const wxString& str);
const wxString& GetHelp() const;
// get our accelerator or NULL (caller must delete the pointer)
virtual wxAcceleratorEntry *GetAccel() const;
// set the accel for this item - this may also be done indirectly with
// SetText()
virtual void SetAccel(wxAcceleratorEntry *accel);
// wxOwnerDrawn methods
#ifdef __WXMSW__
void SetFont(const wxFont& font);
wxFont GetFont();
void SetTextColour(const wxColour& colText);
wxColour GetTextColour();
void SetBackgroundColour(const wxColour& colBack);
wxColour GetBackgroundColour();
void SetBitmaps(const wxBitmap& bmpChecked,
const wxBitmap& bmpUnchecked = wxNullBitmap);
void SetDisabledBitmap( const wxBitmap& bmpDisabled );
const wxBitmap& GetDisabledBitmap() const;
void SetMarginWidth(int nWidth);
int GetMarginWidth();
static int GetDefaultMarginWidth();
bool IsOwnerDrawn();
// switch on/off owner-drawing the item
void SetOwnerDrawn(bool ownerDrawn = TRUE);
void ResetOwnerDrawn();
#else
// just to keep the global renamers in sync
%extend {
static int GetDefaultMarginWidth() { return 0; }
}
#endif
void SetBitmap(const wxBitmap& bitmap);
const wxBitmap& GetBitmap();
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

395
wxPython/src/_mimetype.i Normal file
View File

@@ -0,0 +1,395 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _joystick.i
// Purpose: SWIG interface stuff for wxJoystick
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/mimetype.h>
%}
//---------------------------------------------------------------------------
enum wxMailcapStyle
{
wxMAILCAP_STANDARD = 1,
wxMAILCAP_NETSCAPE = 2,
wxMAILCAP_KDE = 4,
wxMAILCAP_GNOME = 8,
wxMAILCAP_ALL = 15
};
// wxFileTypeInfo: static container of information accessed via wxFileType.
class wxFileTypeInfo
{
public:
// a normal item
wxFileTypeInfo(const wxString& mimeType,
const wxString& openCmd,
const wxString& printCmd,
const wxString& desc);
// the array elements correspond to the parameters of the ctor above in
// the same order
%name(FileTypeInfoSequence)wxFileTypeInfo(const wxArrayString& sArray);
// invalid item - use this to terminate the array passed to
// wxMimeTypesManager::AddFallbacks
%name(NullFileTypeInfo)wxFileTypeInfo();
// test if this object can be used
bool IsValid() const;
// set the icon info
void SetIcon(const wxString& iconFile, int iconIndex = 0);
// set the short desc
void SetShortDesc(const wxString& shortDesc);
// 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;
int GetExtensionsCount() const;
// get the icon info
const wxString& GetIconFile() const;
int GetIconIndex() const;
};
//---------------------------------------------------------------------------
// wxFileType: gives access to all information about the files of given type.
//
// This class holds information about a given "file type". File type is the
// same as MIME type under Unix, but under Windows it corresponds more to an
// extension than to MIME type (in fact, several extensions may correspond to a
// file type). This object may be created in many different ways and depending
// on how it was created some fields may be unknown so the return value of all
// the accessors *must* be checked!
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=wxPyEmptyString,
// const wxString& mimetype=wxPyEmptyString);
// // 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);
~wxFileType();
// return the MIME type for this file type
%extend {
PyObject* GetMimeType() {
wxString str;
if (self->GetMimeType(&str))
return wx2PyString(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
%extend {
PyObject* GetExtensions() {
wxArrayString arr;
if (self->GetExtensions(arr))
return wxArrayString2PyList_helper(arr);
else
RETURN_NONE();
}
}
%extend {
// Get the icon corresponding to this file type
%newobject GetIcon;
wxIcon* GetIcon() {
wxIconLocation loc;
if (self->GetIcon(&loc))
return new wxIcon(loc);
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() {
wxIconLocation loc;
if (self->GetIcon(&loc)) {
wxString iconFile = loc.GetFileName();
int iconIndex = -1;
#ifdef __WXMSW__
iconIndex = loc.GetIndex();
#endif
// Make a tuple and put the values in it
wxPyBeginBlockThreads();
PyObject* tuple = PyTuple_New(3);
PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(loc),
wxT("wxIcon"), TRUE));
PyTuple_SetItem(tuple, 1, wx2PyString(iconFile));
PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
wxPyEndBlockThreads();
return tuple;
}
else
RETURN_NONE();
}
}
%extend {
// get a brief file type description ("*.txt" => "text document")
PyObject* GetDescription() {
wxString str;
if (self->GetDescription(&str))
return wx2PyString(str);
else
RETURN_NONE();
}
}
// get the command to open/execute the file of given type
%extend {
PyObject* GetOpenCommand(const wxString& filename,
const wxString& mimetype=wxPyEmptyString) {
wxString str;
if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype)))
return wx2PyString(str);
else
RETURN_NONE();
}
}
// get the command to print the file of given type
%extend {
PyObject* GetPrintCommand(const wxString& filename,
const wxString& mimetype=wxPyEmptyString) {
wxString str;
if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype)))
return wx2PyString(str);
else
RETURN_NONE();
}
}
// Get all commands defined for this file type
%extend {
PyObject* GetAllCommands(const wxString& filename,
const wxString& mimetype=wxPyEmptyString) {
wxArrayString verbs;
wxArrayString commands;
if (self->GetAllCommands(&verbs, &commands,
wxFileType::MessageParameters(filename, mimetype))) {
wxPyBeginBlockThreads();
PyObject* tuple = PyTuple_New(2);
PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
wxPyEndBlockThreads();
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 = wxPyEmptyString, 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).
%extend {
static wxString ExpandCommand(const wxString& command,
const wxString& filename,
const wxString& mimetype=wxPyEmptyString) {
return wxFileType::ExpandCommand(command,
wxFileType::MessageParameters(filename, mimetype));
}
}
};
//---------------------------------------------------------------------------
// See also wxPy_ReinitStockObjects in helpers.cpp
wxMimeTypesManager* const wxTheMimeTypesManager;
// wxMimeTypesManager: interface to system MIME database.
//
// This class accesses the information about all known MIME types and allows
// the application to retrieve information (including how to handle data of
// given type) about them.
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_ALL,
const wxString& extraDir = wxPyEmptyString);
// 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
%newobject GetFileTypeFromExtension;
wxFileType *GetFileTypeFromExtension(const wxString& ext);
// get file type from MIME type (in format <category>/<format>)
%newobject GetFileTypeFromMimeType;
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
%extend {
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
%newobject Associate;
wxFileType *Associate(const wxFileTypeInfo& ftInfo);
// undo Associate()
bool Unassociate(wxFileType *ft) ;
~wxMimeTypesManager();
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

275
wxPython/src/_misc.i Normal file
View File

@@ -0,0 +1,275 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _misc.i
// Purpose: SWIG interface definitions for lots of little stuff that
// don't deserve their own file. ;-)
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
class wxToolTip : public wxObject {
public:
wxToolTip(const wxString &tip);
void SetTip(const wxString& tip);
wxString GetTip();
// *** Not in the "public" interface void SetWindow(wxWindow *win);
wxWindow *GetWindow();
static void Enable(bool flag);
static void SetDelay(long milliseconds);
};
//---------------------------------------------------------------------------
class wxCaret {
public:
wxCaret(wxWindow* window, const wxSize& size);
~wxCaret();
bool IsOk();
bool IsVisible();
%name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT);
wxPoint GetPosition();
%name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT);
wxSize GetSize();
wxWindow *GetWindow();
%name(MoveXY)void Move(int x, int y);
void Move(const wxPoint& pt);
%name(SetSizeWH) void SetSize(int width, int height);
void SetSize(const wxSize& size);
void Show(int show = TRUE);
void Hide();
%pragma(python) addtoclass = "def __nonzero__(self): return self.IsOk()"
};
%inline %{
int wxCaret_GetBlinkTime() {
return wxCaret::GetBlinkTime();
}
void wxCaret_SetBlinkTime(int milliseconds) {
wxCaret::SetBlinkTime(milliseconds);
}
%}
//---------------------------------------------------------------------------
class wxBusyCursor {
public:
wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
~wxBusyCursor();
};
//---------------------------------------------------------------------------
class wxWindowDisabler {
public:
wxWindowDisabler(wxWindow *winToSkip = NULL);
~wxWindowDisabler();
};
//---------------------------------------------------------------------------
class wxBusyInfo : public wxObject {
public:
wxBusyInfo(const wxString& message);
~wxBusyInfo();
};
//---------------------------------------------------------------------------
// wxStopWatch: measure time intervals with up to 1ms resolution
class wxStopWatch
{
public:
// ctor starts the stop watch
wxStopWatch();
// start the stop watch at the moment t0
void Start(long t0 = 0);
// pause the stop watch
void Pause();
// resume it
void Resume();
// get elapsed time since the last Start() in milliseconds
long Time() const;
};
//---------------------------------------------------------------------------
class wxFileHistory : public wxObject
{
public:
wxFileHistory(int maxFiles = 9);
~wxFileHistory();
// Operations
void AddFileToHistory(const wxString& file);
void RemoveFileFromHistory(int i);
int GetMaxFiles() const;
void UseMenu(wxMenu *menu);
// Remove menu from the list (MDI child may be closing)
void RemoveMenu(wxMenu *menu);
void Load(wxConfigBase& config);
void Save(wxConfigBase& config);
void AddFilesToMenu();
%name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu);
// Accessors
wxString GetHistoryFile(int i) const;
int GetCount() const;
%pragma(python) addtoclass = "GetNoHistoryFiles = GetCount"
};
//---------------------------------------------------------------------------
%{
#include <wx/snglinst.h>
%}
class wxSingleInstanceChecker
{
public:
// like Create() but no error checking (dangerous!)
wxSingleInstanceChecker(const wxString& name,
const wxString& path = wxPyEmptyString);
// default ctor, use Create() after it
%name(PreSingleInstanceChecker) wxSingleInstanceChecker();
~wxSingleInstanceChecker();
// name must be given and be as unique as possible, it is used as the mutex
// name under Win32 and the lock file name under Unix -
// wxTheApp->GetAppName() may be a good value for this parameter
//
// path is optional and is ignored under Win32 and used as the directory to
// create the lock file in under Unix (default is wxGetHomeDir())
//
// returns FALSE if initialization failed, it doesn't mean that another
// instance is running - use IsAnotherRunning() to check it
bool Create(const wxString& name, const wxString& path = wxPyEmptyString);
// is another copy of this program already running?
bool IsAnotherRunning() const;
};
//---------------------------------------------------------------------------
// Experimental...
%{
#ifdef __WXMSW__
#include <wx/msw/private.h>
#include <wx/dynload.h>
#endif
%}
%inline %{
void wxDrawWindowOnDC(wxWindow* window, const wxDC& dc, int method)
{
#ifdef __WXMSW__
switch (method)
{
case 1:
// This one only partially works. Appears to be an undocumented
// "standard" convention that not all widgets adhear to. For
// example, for some widgets backgrounds or non-client areas may
// not be painted.
::SendMessage(GetHwndOf(window), WM_PAINT, (long)GetHdcOf(dc), 0);
break;
case 2:
// This one works much better, except for on XP. On Win2k nearly
// all widgets and their children are captured correctly[**]. On
// XP with Themes activated most native widgets draw only
// partially, if at all. Without themes it works just like on
// Win2k.
//
// ** For example the radio buttons in a wxRadioBox are not its
// children by default, but you can capture it via the panel
// instead, or change RADIOBTN_PARENT_IS_RADIOBOX in radiobox.cpp.
::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN |
PRF_ERASEBKGND | PRF_OWNED );
break;
case 3:
// This one is only defined in the latest SDK and is only
// available on XP. MSDN says it is similar to sending WM_PRINT
// so I expect that it will work similar to the above. Since it
// is avaialble only on XP, it can't be compiled like this and
// will have to be loaded dynamically.
// //::PrintWindow(GetHwndOf(window), GetHdcOf(dc), 0); //break;
// fall through
case 4:
// Use PrintWindow if available, or fallback to WM_PRINT
// otherwise. Unfortunately using PrintWindow is even worse than
// WM_PRINT. For most native widgets nothing is drawn to the dc
// at all, with or without Themes.
typedef BOOL (WINAPI *PrintWindow_t)(HWND, HDC, UINT);
static bool s_triedToLoad = false;
static PrintWindow_t pfnPrintWindow = NULL;
if ( !s_triedToLoad )
{
s_triedToLoad = true;
wxDynamicLibrary dllUser32(_T("user32.dll"));
if ( dllUser32.IsLoaded() )
{
wxLogNull nolog; // Don't report errors here
pfnPrintWindow = (PrintWindow_t)dllUser32.GetSymbol(_T("PrintWindow"));
}
}
if (pfnPrintWindow)
{
printf("Using PrintWindow\n");
pfnPrintWindow(GetHwndOf(window), GetHdcOf(dc), 0);
}
else
{
printf("Using WM_PRINT\n");
::SendMessage(GetHwndOf(window), WM_PRINT, (long)GetHdcOf(dc),
PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED );
}
}
#endif
}
%}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

334
wxPython/src/_misc_rename.i Normal file
View File

@@ -0,0 +1,334 @@
// A bunch of %rename directives generated by ./distrib/build_renamers.py
// in order to remove the wx prefix from all global scope names.
#ifndef SWIGXML
%rename(SYS_OEM_FIXED_FONT) wxSYS_OEM_FIXED_FONT;
%rename(SYS_ANSI_FIXED_FONT) wxSYS_ANSI_FIXED_FONT;
%rename(SYS_ANSI_VAR_FONT) wxSYS_ANSI_VAR_FONT;
%rename(SYS_SYSTEM_FONT) wxSYS_SYSTEM_FONT;
%rename(SYS_DEVICE_DEFAULT_FONT) wxSYS_DEVICE_DEFAULT_FONT;
%rename(SYS_DEFAULT_PALETTE) wxSYS_DEFAULT_PALETTE;
%rename(SYS_SYSTEM_FIXED_FONT) wxSYS_SYSTEM_FIXED_FONT;
%rename(SYS_DEFAULT_GUI_FONT) wxSYS_DEFAULT_GUI_FONT;
%rename(SYS_ICONTITLE_FONT) wxSYS_ICONTITLE_FONT;
%rename(SYS_COLOUR_SCROLLBAR) wxSYS_COLOUR_SCROLLBAR;
%rename(SYS_COLOUR_BACKGROUND) wxSYS_COLOUR_BACKGROUND;
%rename(SYS_COLOUR_DESKTOP) wxSYS_COLOUR_DESKTOP;
%rename(SYS_COLOUR_ACTIVECAPTION) wxSYS_COLOUR_ACTIVECAPTION;
%rename(SYS_COLOUR_INACTIVECAPTION) wxSYS_COLOUR_INACTIVECAPTION;
%rename(SYS_COLOUR_MENU) wxSYS_COLOUR_MENU;
%rename(SYS_COLOUR_WINDOW) wxSYS_COLOUR_WINDOW;
%rename(SYS_COLOUR_WINDOWFRAME) wxSYS_COLOUR_WINDOWFRAME;
%rename(SYS_COLOUR_MENUTEXT) wxSYS_COLOUR_MENUTEXT;
%rename(SYS_COLOUR_WINDOWTEXT) wxSYS_COLOUR_WINDOWTEXT;
%rename(SYS_COLOUR_CAPTIONTEXT) wxSYS_COLOUR_CAPTIONTEXT;
%rename(SYS_COLOUR_ACTIVEBORDER) wxSYS_COLOUR_ACTIVEBORDER;
%rename(SYS_COLOUR_INACTIVEBORDER) wxSYS_COLOUR_INACTIVEBORDER;
%rename(SYS_COLOUR_APPWORKSPACE) wxSYS_COLOUR_APPWORKSPACE;
%rename(SYS_COLOUR_HIGHLIGHT) wxSYS_COLOUR_HIGHLIGHT;
%rename(SYS_COLOUR_HIGHLIGHTTEXT) wxSYS_COLOUR_HIGHLIGHTTEXT;
%rename(SYS_COLOUR_BTNFACE) wxSYS_COLOUR_BTNFACE;
%rename(SYS_COLOUR_3DFACE) wxSYS_COLOUR_3DFACE;
%rename(SYS_COLOUR_BTNSHADOW) wxSYS_COLOUR_BTNSHADOW;
%rename(SYS_COLOUR_3DSHADOW) wxSYS_COLOUR_3DSHADOW;
%rename(SYS_COLOUR_GRAYTEXT) wxSYS_COLOUR_GRAYTEXT;
%rename(SYS_COLOUR_BTNTEXT) wxSYS_COLOUR_BTNTEXT;
%rename(SYS_COLOUR_INACTIVECAPTIONTEXT) wxSYS_COLOUR_INACTIVECAPTIONTEXT;
%rename(SYS_COLOUR_BTNHIGHLIGHT) wxSYS_COLOUR_BTNHIGHLIGHT;
%rename(SYS_COLOUR_BTNHILIGHT) wxSYS_COLOUR_BTNHILIGHT;
%rename(SYS_COLOUR_3DHIGHLIGHT) wxSYS_COLOUR_3DHIGHLIGHT;
%rename(SYS_COLOUR_3DHILIGHT) wxSYS_COLOUR_3DHILIGHT;
%rename(SYS_COLOUR_3DDKSHADOW) wxSYS_COLOUR_3DDKSHADOW;
%rename(SYS_COLOUR_3DLIGHT) wxSYS_COLOUR_3DLIGHT;
%rename(SYS_COLOUR_INFOTEXT) wxSYS_COLOUR_INFOTEXT;
%rename(SYS_COLOUR_INFOBK) wxSYS_COLOUR_INFOBK;
%rename(SYS_COLOUR_LISTBOX) wxSYS_COLOUR_LISTBOX;
%rename(SYS_COLOUR_HOTLIGHT) wxSYS_COLOUR_HOTLIGHT;
%rename(SYS_COLOUR_GRADIENTACTIVECAPTION) wxSYS_COLOUR_GRADIENTACTIVECAPTION;
%rename(SYS_COLOUR_GRADIENTINACTIVECAPTION) wxSYS_COLOUR_GRADIENTINACTIVECAPTION;
%rename(SYS_COLOUR_MENUHILIGHT) wxSYS_COLOUR_MENUHILIGHT;
%rename(SYS_COLOUR_MENUBAR) wxSYS_COLOUR_MENUBAR;
%rename(SYS_COLOUR_MAX) wxSYS_COLOUR_MAX;
%rename(SYS_MOUSE_BUTTONS) wxSYS_MOUSE_BUTTONS;
%rename(SYS_BORDER_X) wxSYS_BORDER_X;
%rename(SYS_BORDER_Y) wxSYS_BORDER_Y;
%rename(SYS_CURSOR_X) wxSYS_CURSOR_X;
%rename(SYS_CURSOR_Y) wxSYS_CURSOR_Y;
%rename(SYS_DCLICK_X) wxSYS_DCLICK_X;
%rename(SYS_DCLICK_Y) wxSYS_DCLICK_Y;
%rename(SYS_DRAG_X) wxSYS_DRAG_X;
%rename(SYS_DRAG_Y) wxSYS_DRAG_Y;
%rename(SYS_EDGE_X) wxSYS_EDGE_X;
%rename(SYS_EDGE_Y) wxSYS_EDGE_Y;
%rename(SYS_HSCROLL_ARROW_X) wxSYS_HSCROLL_ARROW_X;
%rename(SYS_HSCROLL_ARROW_Y) wxSYS_HSCROLL_ARROW_Y;
%rename(SYS_HTHUMB_X) wxSYS_HTHUMB_X;
%rename(SYS_ICON_X) wxSYS_ICON_X;
%rename(SYS_ICON_Y) wxSYS_ICON_Y;
%rename(SYS_ICONSPACING_X) wxSYS_ICONSPACING_X;
%rename(SYS_ICONSPACING_Y) wxSYS_ICONSPACING_Y;
%rename(SYS_WINDOWMIN_X) wxSYS_WINDOWMIN_X;
%rename(SYS_WINDOWMIN_Y) wxSYS_WINDOWMIN_Y;
%rename(SYS_SCREEN_X) wxSYS_SCREEN_X;
%rename(SYS_SCREEN_Y) wxSYS_SCREEN_Y;
%rename(SYS_FRAMESIZE_X) wxSYS_FRAMESIZE_X;
%rename(SYS_FRAMESIZE_Y) wxSYS_FRAMESIZE_Y;
%rename(SYS_SMALLICON_X) wxSYS_SMALLICON_X;
%rename(SYS_SMALLICON_Y) wxSYS_SMALLICON_Y;
%rename(SYS_HSCROLL_Y) wxSYS_HSCROLL_Y;
%rename(SYS_VSCROLL_X) wxSYS_VSCROLL_X;
%rename(SYS_VSCROLL_ARROW_X) wxSYS_VSCROLL_ARROW_X;
%rename(SYS_VSCROLL_ARROW_Y) wxSYS_VSCROLL_ARROW_Y;
%rename(SYS_VTHUMB_Y) wxSYS_VTHUMB_Y;
%rename(SYS_CAPTION_Y) wxSYS_CAPTION_Y;
%rename(SYS_MENU_Y) wxSYS_MENU_Y;
%rename(SYS_NETWORK_PRESENT) wxSYS_NETWORK_PRESENT;
%rename(SYS_PENWINDOWS_PRESENT) wxSYS_PENWINDOWS_PRESENT;
%rename(SYS_SHOW_SOUNDS) wxSYS_SHOW_SOUNDS;
%rename(SYS_SWAP_BUTTONS) wxSYS_SWAP_BUTTONS;
%rename(SYS_CAN_DRAW_FRAME_DECORATIONS) wxSYS_CAN_DRAW_FRAME_DECORATIONS;
%rename(SYS_CAN_ICONIZE_FRAME) wxSYS_CAN_ICONIZE_FRAME;
%rename(SYS_SCREEN_NONE) wxSYS_SCREEN_NONE;
%rename(SYS_SCREEN_TINY) wxSYS_SCREEN_TINY;
%rename(SYS_SCREEN_PDA) wxSYS_SCREEN_PDA;
%rename(SYS_SCREEN_SMALL) wxSYS_SCREEN_SMALL;
%rename(SYS_SCREEN_DESKTOP) wxSYS_SCREEN_DESKTOP;
%rename(SystemSettings) wxSystemSettings;
%rename(SystemOptions) wxSystemOptions;
%rename(NewId) wxNewId;
%rename(RegisterId) wxRegisterId;
%rename(GetCurrentId) wxGetCurrentId;
%rename(Bell) wxBell;
%rename(EndBusyCursor) wxEndBusyCursor;
%rename(GetElapsedTime) wxGetElapsedTime;
%rename(GetMousePosition) wxGetMousePosition;
%rename(IsBusy) wxIsBusy;
%rename(Now) wxNow;
%rename(Shell) wxShell;
%rename(StartTimer) wxStartTimer;
%rename(GetOsVersion) wxGetOsVersion;
%rename(GetOsDescription) wxGetOsDescription;
%rename(GetFreeMemory) wxGetFreeMemory;
%rename(SHUTDOWN_POWEROFF) wxSHUTDOWN_POWEROFF;
%rename(SHUTDOWN_REBOOT) wxSHUTDOWN_REBOOT;
%rename(Shutdown) wxShutdown;
%rename(Sleep) wxSleep;
%rename(Usleep) wxUsleep;
%rename(EnableTopLevelWindows) wxEnableTopLevelWindows;
%rename(StripMenuCodes) wxStripMenuCodes;
%rename(GetEmailAddress) wxGetEmailAddress;
%rename(GetHostName) wxGetHostName;
%rename(GetFullHostName) wxGetFullHostName;
%rename(GetUserId) wxGetUserId;
%rename(GetUserName) wxGetUserName;
%rename(GetHomeDir) wxGetHomeDir;
%rename(GetUserHome) wxGetUserHome;
%rename(GetProcessId) wxGetProcessId;
%rename(Trap) wxTrap;
%rename(FileSelector) wxFileSelector;
%rename(LoadFileSelector) wxLoadFileSelector;
%rename(SaveFileSelector) wxSaveFileSelector;
%rename(DirSelector) wxDirSelector;
%rename(GetTextFromUser) wxGetTextFromUser;
%rename(GetPasswordFromUser) wxGetPasswordFromUser;
%rename(GetSingleChoice) wxGetSingleChoice;
%rename(GetSingleChoiceIndex) wxGetSingleChoiceIndex;
%rename(MessageBox) wxMessageBox;
%rename(GetNumberFromUser) wxGetNumberFromUser;
%rename(ColourDisplay) wxColourDisplay;
%rename(DisplayDepth) wxDisplayDepth;
%rename(GetDisplayDepth) wxGetDisplayDepth;
%rename(DisplaySize) wxDisplaySize;
%rename(GetDisplaySize) wxGetDisplaySize;
%rename(DisplaySizeMM) wxDisplaySizeMM;
%rename(GetDisplaySizeMM) wxGetDisplaySizeMM;
%rename(ClientDisplayRect) wxClientDisplayRect;
%rename(GetClientDisplayRect) wxGetClientDisplayRect;
%rename(SetCursor) wxSetCursor;
%rename(BeginBusyCursor) wxBeginBusyCursor;
%rename(GetActiveWindow) wxGetActiveWindow;
%rename(GenericFindWindowAtPoint) wxGenericFindWindowAtPoint;
%rename(FindWindowAtPoint) wxFindWindowAtPoint;
%rename(GetTopLevelParent) wxGetTopLevelParent;
%rename(WakeUpMainThread) wxWakeUpMainThread;
%rename(MutexGuiEnter) wxMutexGuiEnter;
%rename(MutexGuiLeave) wxMutexGuiLeave;
%rename(MutexGuiLocker) wxMutexGuiLocker;
%rename(Thread_IsMain) wxThread_IsMain;
%rename(ToolTip) wxToolTip;
%rename(Caret) wxCaret;
%rename(Caret_GetBlinkTime) wxCaret_GetBlinkTime;
%rename(Caret_SetBlinkTime) wxCaret_SetBlinkTime;
%rename(BusyCursor) wxBusyCursor;
%rename(WindowDisabler) wxWindowDisabler;
%rename(BusyInfo) wxBusyInfo;
%rename(StopWatch) wxStopWatch;
%rename(FileHistory) wxFileHistory;
%rename(SingleInstanceChecker) wxSingleInstanceChecker;
%rename(DrawWindowOnDC) wxDrawWindowOnDC;
%rename(TipProvider) wxTipProvider;
%rename(PyTipProvider) wxPyTipProvider;
%rename(ShowTip) wxShowTip;
%rename(CreateFileTipProvider) wxCreateFileTipProvider;
%rename(TIMER_CONTINUOUS) wxTIMER_CONTINUOUS;
%rename(TIMER_ONE_SHOT) wxTIMER_ONE_SHOT;
%rename(TimerEvent) wxTimerEvent;
%rename(TimerRunner) wxTimerRunner;
%rename(LOG_FatalError) wxLOG_FatalError;
%rename(LOG_Error) wxLOG_Error;
%rename(LOG_Warning) wxLOG_Warning;
%rename(LOG_Message) wxLOG_Message;
%rename(LOG_Status) wxLOG_Status;
%rename(LOG_Info) wxLOG_Info;
%rename(LOG_Debug) wxLOG_Debug;
%rename(LOG_Trace) wxLOG_Trace;
%rename(LOG_Progress) wxLOG_Progress;
%rename(LOG_User) wxLOG_User;
%rename(LOG_Max) wxLOG_Max;
%rename(TRACE_MemAlloc) wxTRACE_MemAlloc;
%rename(TRACE_Messages) wxTRACE_Messages;
%rename(TRACE_ResAlloc) wxTRACE_ResAlloc;
%rename(TRACE_RefCount) wxTRACE_RefCount;
%rename(TRACE_OleCalls) wxTRACE_OleCalls;
%rename(TraceMemAlloc) wxTraceMemAlloc;
%rename(TraceMessages) wxTraceMessages;
%rename(TraceResAlloc) wxTraceResAlloc;
%rename(TraceRefCount) wxTraceRefCount;
%rename(TraceOleCalls) wxTraceOleCalls;
%rename(Log) wxLog;
%rename(LogStderr) wxLogStderr;
%rename(LogTextCtrl) wxLogTextCtrl;
%rename(LogGui) wxLogGui;
%rename(LogWindow) wxLogWindow;
%rename(LogChain) wxLogChain;
%rename(SysErrorCode) wxSysErrorCode;
%rename(SysErrorMsg) wxSysErrorMsg;
%rename(LogFatalError) wxLogFatalError;
%rename(LogError) wxLogError;
%rename(LogWarning) wxLogWarning;
%rename(LogMessage) wxLogMessage;
%rename(LogInfo) wxLogInfo;
%rename(LogDebug) wxLogDebug;
%rename(LogVerbose) wxLogVerbose;
%rename(LogStatus) wxLogStatus;
%rename(LogSysError) wxLogSysError;
%rename(LogTrace) wxLogTrace;
%rename(LogGeneric) wxLogGeneric;
%rename(SafeShowMessage) wxSafeShowMessage;
%rename(LogNull) wxLogNull;
%rename(PyLog) wxPyLog;
%rename(PROCESS_DEFAULT) wxPROCESS_DEFAULT;
%rename(PROCESS_REDIRECT) wxPROCESS_REDIRECT;
%rename(KILL_OK) wxKILL_OK;
%rename(KILL_BAD_SIGNAL) wxKILL_BAD_SIGNAL;
%rename(KILL_ACCESS_DENIED) wxKILL_ACCESS_DENIED;
%rename(KILL_NO_PROCESS) wxKILL_NO_PROCESS;
%rename(KILL_ERROR) wxKILL_ERROR;
%rename(SIGNONE) wxSIGNONE;
%rename(SIGHUP) wxSIGHUP;
%rename(SIGINT) wxSIGINT;
%rename(SIGQUIT) wxSIGQUIT;
%rename(SIGILL) wxSIGILL;
%rename(SIGTRAP) wxSIGTRAP;
%rename(SIGABRT) wxSIGABRT;
%rename(SIGIOT) wxSIGIOT;
%rename(SIGEMT) wxSIGEMT;
%rename(SIGFPE) wxSIGFPE;
%rename(SIGKILL) wxSIGKILL;
%rename(SIGBUS) wxSIGBUS;
%rename(SIGSEGV) wxSIGSEGV;
%rename(SIGSYS) wxSIGSYS;
%rename(SIGPIPE) wxSIGPIPE;
%rename(SIGALRM) wxSIGALRM;
%rename(SIGTERM) wxSIGTERM;
%rename(ProcessEvent) wxProcessEvent;
%rename(EXEC_ASYNC) wxEXEC_ASYNC;
%rename(EXEC_SYNC) wxEXEC_SYNC;
%rename(EXEC_NOHIDE) wxEXEC_NOHIDE;
%rename(EXEC_MAKE_GROUP_LEADER) wxEXEC_MAKE_GROUP_LEADER;
%rename(Execute) wxExecute;
%rename(JOYSTICK1) wxJOYSTICK1;
%rename(JOYSTICK2) wxJOYSTICK2;
%rename(JOY_BUTTON_ANY) wxJOY_BUTTON_ANY;
%rename(JOY_BUTTON1) wxJOY_BUTTON1;
%rename(JOY_BUTTON2) wxJOY_BUTTON2;
%rename(JOY_BUTTON3) wxJOY_BUTTON3;
%rename(JOY_BUTTON4) wxJOY_BUTTON4;
%rename(Joystick) wxJoystick;
%rename(JoystickEvent) wxJoystickEvent;
%rename(Wave) wxWave;
%rename(MAILCAP_STANDARD) wxMAILCAP_STANDARD;
%rename(MAILCAP_NETSCAPE) wxMAILCAP_NETSCAPE;
%rename(MAILCAP_KDE) wxMAILCAP_KDE;
%rename(MAILCAP_GNOME) wxMAILCAP_GNOME;
%rename(MAILCAP_ALL) wxMAILCAP_ALL;
%rename(FileTypeInfo) wxFileTypeInfo;
%rename(FileType) wxFileType;
%rename(TheMimeTypesManager) wxTheMimeTypesManager;
%rename(MimeTypesManager) wxMimeTypesManager;
%rename(CONFIG_USE_LOCAL_FILE) wxCONFIG_USE_LOCAL_FILE;
%rename(CONFIG_USE_GLOBAL_FILE) wxCONFIG_USE_GLOBAL_FILE;
%rename(CONFIG_USE_RELATIVE_PATH) wxCONFIG_USE_RELATIVE_PATH;
%rename(CONFIG_USE_NO_ESCAPE_CHARACTERS) wxCONFIG_USE_NO_ESCAPE_CHARACTERS;
%rename(ConfigBase) wxConfigBase;
%rename(ConfigPathChanger) wxConfigPathChanger;
%rename(Config) wxConfig;
%rename(FileConfig) wxFileConfig;
%rename(ExpandEnvVars) wxExpandEnvVars;
%rename(DateTime) wxDateTime;
%rename(TimeSpan) wxTimeSpan;
%rename(DateSpan) wxDateSpan;
%rename(GetLocalTime) wxGetLocalTime;
%rename(GetUTCTime) wxGetUTCTime;
%rename(GetCurrentTime) wxGetCurrentTime;
%rename(GetLocalTimeMillis) wxGetLocalTimeMillis;
%rename(DF_INVALID) wxDF_INVALID;
%rename(DF_TEXT) wxDF_TEXT;
%rename(DF_BITMAP) wxDF_BITMAP;
%rename(DF_METAFILE) wxDF_METAFILE;
%rename(DF_SYLK) wxDF_SYLK;
%rename(DF_DIF) wxDF_DIF;
%rename(DF_TIFF) wxDF_TIFF;
%rename(DF_OEMTEXT) wxDF_OEMTEXT;
%rename(DF_DIB) wxDF_DIB;
%rename(DF_PALETTE) wxDF_PALETTE;
%rename(DF_PENDATA) wxDF_PENDATA;
%rename(DF_RIFF) wxDF_RIFF;
%rename(DF_WAVE) wxDF_WAVE;
%rename(DF_UNICODETEXT) wxDF_UNICODETEXT;
%rename(DF_ENHMETAFILE) wxDF_ENHMETAFILE;
%rename(DF_FILENAME) wxDF_FILENAME;
%rename(DF_LOCALE) wxDF_LOCALE;
%rename(DF_PRIVATE) wxDF_PRIVATE;
%rename(DF_HTML) wxDF_HTML;
%rename(DF_MAX) wxDF_MAX;
%rename(DataFormat) wxDataFormat;
%rename(FormatInvalid) wxFormatInvalid;
%rename(DataObject) wxDataObject;
%rename(DataObjectSimple) wxDataObjectSimple;
%rename(PyDataObjectSimple) wxPyDataObjectSimple;
%rename(DataObjectComposite) wxDataObjectComposite;
%rename(TextDataObject) wxTextDataObject;
%rename(PyTextDataObject) wxPyTextDataObject;
%rename(BitmapDataObject) wxBitmapDataObject;
%rename(PyBitmapDataObject) wxPyBitmapDataObject;
%rename(FileDataObject) wxFileDataObject;
%rename(CustomDataObject) wxCustomDataObject;
%rename(URLDataObject) wxURLDataObject;
%rename(MetafileDataObject) wxMetafileDataObject;
%rename(Drag_CopyOnly) wxDrag_CopyOnly;
%rename(Drag_AllowMove) wxDrag_AllowMove;
%rename(Drag_DefaultMove) wxDrag_DefaultMove;
%rename(DragError) wxDragError;
%rename(DragNone) wxDragNone;
%rename(DragCopy) wxDragCopy;
%rename(DragMove) wxDragMove;
%rename(DragLink) wxDragLink;
%rename(DragCancel) wxDragCancel;
%rename(IsDragResultOk) wxIsDragResultOk;
%rename(Clipboard) wxClipboard;
%rename(TheClipboard) wxTheClipboard;
%rename(ClipboardLocker) wxClipboardLocker;
#endif

View File

@@ -0,0 +1,13 @@
# Other names that need to be reverse-renamed for the old namespace
PyTimer
PyDropTarget
# With the * on the end these will cause code to be added that
# will scan for other names in the source module tha have the
# given prefix and will put a reference in the local module.

354
wxPython/src/_notebook.i Normal file
View File

@@ -0,0 +1,354 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _notebook.i
// Purpose: SWIG interface defs for wxNotebook and such
//
// Author: Robin Dunn
//
// Created: 2-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(NOTEBOOK_NAME);
%}
//---------------------------------------------------------------------------
%newgroup
// TODO: Virtualize this class so other book controls can be derived in Python
// Common base class for wxList/Tree/Notebook
class wxBookCtrl : public wxControl
{
public:
// This is an ABC, it can't be constructed...
// wxBookCtrl(wxWindow *parent,
// wxWindowID id,
// const wxPoint& pos = wxDefaultPosition,
// const wxSize& size = wxDefaultSize,
// long style = 0,
// const wxString& name = wxPyEmptyString);
// %name(PreBookCtrl)wxBookCtrl();
// bool Create(wxWindow *parent,
// wxWindowID id,
// const wxPoint& pos = wxDefaultPosition,
// const wxSize& size = wxDefaultSize,
// long style = 0,
// const wxString& name = wxPyEmptyString);
// get number of pages in the dialog
virtual size_t GetPageCount() const;
// get the panel which represents the given page
virtual wxWindow *GetPage(size_t n);
// get the currently selected page or wxNOT_FOUND if none
virtual int GetSelection() const/* = 0*/;
// set/get the title of a page
virtual bool SetPageText(size_t n, const wxString& strText)/* = 0*/;
virtual wxString GetPageText(size_t n) const/* = 0*/;
// image list stuff: each page may have an image associated with it (all
// images belong to the same image list)
// sets the image list to use, it is *not* deleted by the control
virtual void SetImageList(wxImageList *imageList);
// as SetImageList() but we will delete the image list ourselves
%addtofunc AssignImageList "args[1].thisown = 0"
void AssignImageList(wxImageList *imageList);
// get pointer (may be NULL) to the associated image list
wxImageList* GetImageList() const;
// sets/returns item's image index in the current image list
virtual int GetPageImage(size_t n) const/* = 0*/;
virtual bool SetPageImage(size_t n, int imageId)/* = 0*/;
// resize the notebook so that all pages will have the specified size
virtual void SetPageSize(const wxSize& size);
// calculate the size of the control from the size of its page
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const/* = 0*/;
// remove one page from the control and delete it
virtual bool DeletePage(size_t n);
// remove one page from the notebook, without deleting it
virtual bool RemovePage(size_t n);
// remove all pages and delete them
virtual bool DeleteAllPages();
// adds a new page to the control
virtual bool AddPage(wxWindow *page,
const wxString& text,
bool select = false,
int imageId = -1);
// the same as AddPage(), but adds the page at the specified position
virtual bool InsertPage(size_t n,
wxWindow *page,
const wxString& text,
bool select = false,
int imageId = -1)/* = 0*/;
// set the currently selected page, return the index of the previously
// selected one (or -1 on error)
//
// NB: this function will _not_ generate PAGE_CHANGING/ED events
virtual int SetSelection(size_t n)/* = 0*/;
// cycle thru the pages
void AdvanceSelection(bool forward = true);
};
class wxBookCtrlEvent : public wxNotifyEvent
{
public:
wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1);
// the currently selected page (-1 if none)
int GetSelection() const;
void SetSelection(int nSel);
// the page that was selected before the change (-1 if none)
int GetOldSelection() const;
void SetOldSelection(int nOldSel);
};
//---------------------------------------------------------------------------
%newgroup
enum {
// styles
wxNB_FIXEDWIDTH,
wxNB_TOP,
wxNB_LEFT,
wxNB_RIGHT,
wxNB_BOTTOM,
wxNB_MULTILINE,
// hittest flags
wxNB_HITTEST_NOWHERE = 1, // not on tab
wxNB_HITTEST_ONICON = 2, // on icon
wxNB_HITTEST_ONLABEL = 4, // on label
wxNB_HITTEST_ONITEM = wxNB_HITTEST_ONICON | wxNB_HITTEST_ONLABEL,
};
class wxNotebook : public wxBookCtrl {
public:
%addtofunc wxNotebook "self._setOORInfo(self)"
%addtofunc wxNotebook() ""
wxNotebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyNOTEBOOK_NAME);
%name(PreNotebook)wxNotebook();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyNOTEBOOK_NAME);
// get the number of rows for a control with wxNB_MULTILINE style (not all
// versions support it - they will always return 1 then)
virtual int GetRowCount() const;
// set the padding between tabs (in pixels)
virtual void SetPadding(const wxSize& padding);
// set the size of the tabs for wxNB_FIXEDWIDTH controls
virtual void SetTabSize(const wxSize& sz);
// hit test, returns which tab is hit and, optionally, where (icon, label)
// (not implemented on all platforms)
virtual int HitTest(const wxPoint& pt, long* OUTPUT) const;
// implement some base class functions
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
#ifdef __WXMSW__
// Windows only: attempts to apply the UX theme page background to this page
void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
#endif
};
class wxNotebookEvent : public wxBookCtrlEvent
{
public:
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1);
};
// notebook control event types
%constant wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED;
%constant wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING;
%pythoncode {
%# wxNotebook events
EVT_NOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 1 )
EVT_NOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 1 )
}
%pythoncode {
%#----------------------------------------------------------------------------
class NotebookPage(wx.Panel):
"""
There is an old (and apparently unsolvable) bug when placing a
window with a nonstandard background colour in a wxNotebook on
wxGTK, as the notbooks's background colour would always be used
when the window is refreshed. The solution is to place a panel in
the notbook and the coloured window on the panel, sized to cover
the panel. This simple class does that for you, just put an
instance of this in the notebook and make your regular window a
child of this one and it will handle the resize for you.
"""
def __init__(self, parent, id=-1,
pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.TAB_TRAVERSAL, name="panel"):
wx.Panel.__init__(self, parent, id, pos, size, style, name)
self.child = None
EVT_SIZE(self, self.OnSize)
def OnSize(self, evt):
if self.child is None:
children = self.GetChildren()
if len(children):
self.child = children[0]
if self.child:
self.child.SetPosition((0,0))
self.child.SetSize(self.GetSize())
}
//---------------------------------------------------------------------------
%newgroup
enum
{
// default alignment: left everywhere except Mac where it is top
wxLB_DEFAULT = 0,
// put the list control to the left/right/top/bottom of the page area
wxLB_TOP = 0x1,
wxLB_BOTTOM = 0x2,
wxLB_LEFT = 0x4,
wxLB_RIGHT = 0x8,
// the mask which can be used to extract the alignment from the style
wxLB_ALIGN_MASK = 0xf,
};
// wxListCtrl and wxNotebook combination
class wxListbook : public wxBookCtrl
{
public:
%addtofunc wxListbook "self._setOORInfo(self)"
%addtofunc wxListbook() ""
wxListbook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyEmptyString);
%name(PreListbook)wxListbook();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyEmptyString);
// returns true if we have wxLB_TOP or wxLB_BOTTOM style
bool IsVertical() const;
};
class wxListbookEvent : public wxBookCtrlEvent
{
public:
wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1);
};
%constant wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED;
%constant wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING;
%pythoncode {
EVT_LISTBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, 1 )
EVT_LISTBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, 1 )
}
//---------------------------------------------------------------------------
%newgroup;
class wxBookCtrlSizer: public wxSizer
{
public:
%addtofunc wxBookCtrlSizer "self._setOORInfo(self)"
wxBookCtrlSizer( wxBookCtrl *nb );
void RecalcSizes();
wxSize CalcMin();
wxBookCtrl *GetControl();
};
class wxNotebookSizer: public wxSizer {
public:
%addtofunc wxNotebookSizer "self._setOORInfo(self)"
wxNotebookSizer( wxNotebook *nb );
void RecalcSizes();
wxSize CalcMin();
wxNotebook *GetNotebook();
};
//---------------------------------------------------------------------------

34
wxPython/src/_obj.i Normal file
View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _wxobj.i
// Purpose: SWIG interface for wxObject
//
// Author: Robin Dunn
//
// Created: 9-Aug-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
class wxObject {
public:
%extend {
wxString GetClassName() {
return self->GetClassInfo()->GetClassName();
}
void Destroy() {
delete self;
}
}
};
//---------------------------------------------------------------------------

36
wxPython/src/_palette.i Normal file
View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _wxPalette.i
// Purpose: SWIG interface defs for wxPalette
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
// TODO: Create a typemap for the ctor!
//---------------------------------------------------------------------------
class wxPalette : public wxGDIObject {
public:
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
~wxPalette();
int GetPixel(byte red, byte green, byte blue);
bool GetRGB(int pixel, byte* OUTPUT, byte* OUTPUT, byte* OUTPUT);
bool Ok();
%pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
};
//---------------------------------------------------------------------------

150
wxPython/src/_panel.i Normal file
View File

@@ -0,0 +1,150 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _window.i
// Purpose: SWIG interface for wxPanel and wxScrolledWindow
//
// Author: Robin Dunn
//
// Created: 24-June-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%newgroup
class wxPanel : public wxWindow
{
public:
%addtofunc wxPanel "self._setOORInfo(self)"
%addtofunc wxPanel() ""
wxPanel(wxWindow* parent,
const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
const wxString& name = wxPyPanelNameStr);
%name(PrePanel)wxPanel();
bool Create(wxWindow* parent,
const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
const wxString& name = wxPyPanelNameStr);
void InitDialog();
};
//---------------------------------------------------------------------------
%newgroup
// TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow
// derive from it and wxPanel. But what to do about wxGTK where this
// is not true?
class wxScrolledWindow : public wxPanel
{
public:
%addtofunc wxScrolledWindow "self._setOORInfo(self)"
%addtofunc wxScrolledWindow() ""
wxScrolledWindow(wxWindow* parent,
const wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHSCROLL | wxVSCROLL,
const wxString& name = wxPyPanelNameStr);
%name(PreScrolledWindow)wxScrolledWindow();
bool Create(wxWindow* parent,
const wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHSCROLL | wxVSCROLL,
const wxString& name = wxPyPanelNameStr);
// configure the scrolling
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY,
int xPos = 0, int yPos = 0,
bool noRefresh = FALSE );
// scroll to the given (in logical coords) position
virtual void Scroll(int x, int y);
// get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
int GetScrollPageSize(int orient) const;
void SetScrollPageSize(int orient, int pageSize);
// Set the x, y scrolling increments.
void SetScrollRate( int xstep, int ystep );
// get the size of one logical unit in physical ones
virtual void GetScrollPixelsPerUnit(int *OUTPUT,
int *OUTPUT) const;
// Enable/disable Windows scrolling in either direction. If TRUE, wxWindows
// scrolls the canvas and only a bit of the canvas is invalidated; no
// Clear() is necessary. If FALSE, the whole canvas is invalidated and a
// Clear() is necessary. Disable for when the scroll increment is used to
// actually scroll a non-constant distance
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
// Get the view start
virtual void GetViewStart(int *OUTPUT, int *OUTPUT) const;
// Set the scale factor, used in PrepareDC
void SetScale(double xs, double ys);
double GetScaleX() const;
double GetScaleY() const;
%nokwargs CalcScrolledPosition;
%nokwargs CalcUnscrolledPosition;
// translate between scrolled and unscrolled coordinates
void CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const;
wxPoint CalcScrolledPosition(const wxPoint& pt) const;
void CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const;
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const;
// TODO: use directors?
// virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
// virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
// Adjust the scrollbars
virtual void AdjustScrollbars();
// Calculate scroll increment
virtual int CalcScrollInc(wxScrollWinEvent& event);
// Normally the wxScrolledWindow will scroll itself, but in some rare
// occasions you might want it to scroll [part of] another window (e.g. a
// child of it in order to scroll only a portion the area between the
// scrollbars (spreadsheet: only cell area will move).
virtual void SetTargetWindow(wxWindow *target);
virtual wxWindow *GetTargetWindow() const;
#ifndef __WXGTK__
void SetTargetRect(const wxRect& rect);
wxRect GetTargetRect() const;
#endif
};
//---------------------------------------------------------------------------

109
wxPython/src/_pen.i Normal file
View File

@@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _pen.i
// Purpose: SWIG interface for wxPen
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
// wxDash is a signed char, byte is unsigned char...
%typemap(in) (int dashes, wxDash* dashes_array ) {
$1 = PyList_Size($input);
$2 = (wxDash*)byte_LIST_helper($input);
if ($2 == NULL) SWIG_fail;
}
%typemap(freearg) (int dashes, wxDash* dashes_array ) {
if ($2) delete [] $2;
}
//---------------------------------------------------------------------------
%newgroup
class wxPen : public wxGDIObject {
public:
wxPen(wxColour& colour, int width=1, int style=wxSOLID);
~wxPen();
int GetCap();
wxColour GetColour();
int GetJoin();
int GetStyle();
int GetWidth();
bool Ok();
void SetCap(int cap_style);
void SetColour(wxColour& colour);
void SetJoin(int join_style);
void SetStyle(int style);
void SetWidth(int width);
void SetDashes(int dashes, wxDash* dashes_array);
//int GetDashes(wxDash **dashes);
%extend {
PyObject* GetDashes() {
wxDash* dashes;
int count = self->GetDashes(&dashes);
wxPyBeginBlockThreads();
PyObject* retval = PyList_New(0);
for (int x=0; x<count; x++)
PyList_Append(retval, PyInt_FromLong(dashes[x]));
wxPyEndBlockThreads();
return retval;
}
}
#ifdef __WXMSW__
wxBitmap* GetStipple();
void SetStipple(wxBitmap& stipple);
#endif
%pythoncode { def __nonzero__(self): return self.Ok() }
};
// The list of ints for the dashes needs to exist for the life of the pen
// so we make it part of the class to save it. See pyclasses.h
%{
wxPyPen::~wxPyPen()
{
if (m_dash)
delete [] m_dash;
}
void wxPyPen::SetDashes(int nb_dashes, const wxDash *dash)
{
if (m_dash)
delete [] m_dash;
m_dash = new wxDash[nb_dashes];
for (int i=0; i<nb_dashes; i++) {
m_dash[i] = dash[i];
}
wxPen::SetDashes(nb_dashes, m_dash);
}
%}
class wxPyPen : public wxPen {
public:
wxPyPen(wxColour& colour, int width=1, int style=wxSOLID);
~wxPyPen();
void SetDashes(int dashes, wxDash* dashes_array);
};
// wxPyPen is aliased to wxPen
%pythoncode { Pen = PyPen };
//---------------------------------------------------------------------------

134
wxPython/src/_popupwin.i Normal file
View File

@@ -0,0 +1,134 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _popupwin.i
// Purpose: SWIG interface defs for wxPopupWindow and derived classes
//
// Author: Robin Dunn
//
// Created: 22-Dec-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/popupwin.h>
%}
//---------------------------------------------------------------------------
#ifndef __WXMAC__
%newgroup;
// wxPopupWindow: a special kind of top level window used for popup menus,
// combobox popups and such.
class wxPopupWindow : public wxWindow {
public:
%addtofunc wxPopupWindow "self._setOORInfo(self)"
%addtofunc wxPopupWindow() ""
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
%name(PrePopupWindow)wxPopupWindow();
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
// move the popup window to the right position, i.e. such that it is
// entirely visible
//
// the popup is positioned at ptOrigin + size if it opens below and to the
// right (default), at ptOrigin - sizePopup if it opens above and to the
// left &c
//
// the point must be given in screen coordinates!
void Position(const wxPoint& ptOrigin,
const wxSize& size);
};
//---------------------------------------------------------------------------
%newgroup;
%{
class wxPyPopupTransientWindow : public wxPopupTransientWindow
{
public:
wxPyPopupTransientWindow() : wxPopupTransientWindow() {}
wxPyPopupTransientWindow(wxWindow* parent, int style = wxBORDER_NONE)
: wxPopupTransientWindow(parent, style) {}
DEC_PYCALLBACK_BOOL_ME(ProcessLeftDown);
DEC_PYCALLBACK__(OnDismiss);
DEC_PYCALLBACK_BOOL_(CanDismiss);
PYPRIVATE;
};
IMP_PYCALLBACK_BOOL_ME(wxPyPopupTransientWindow, wxPopupTransientWindow, ProcessLeftDown);
IMP_PYCALLBACK__(wxPyPopupTransientWindow, wxPopupTransientWindow, OnDismiss);
IMP_PYCALLBACK_BOOL_(wxPyPopupTransientWindow, wxPopupTransientWindow, CanDismiss);
%}
// wxPopupTransientWindow: a wxPopupWindow which disappears automatically
// when the user clicks mouse outside it or if it loses focus in any other way
%name(PopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow
{
public:
%addtofunc wxPyPopupTransientWindow "self._setOORInfo(self);self._setCallbackInfo(self, PopupTransientWindow)"
%addtofunc wxPyPopupTransientWindow() ""
wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
%name(PrePopupTransientWindow)wxPyPopupTransientWindow();
void _setCallbackInfo(PyObject* self, PyObject* _class);
// popup the window (this will show it too) and keep focus at winFocus
// (or itself if it's NULL), dismiss the popup if we lose focus
virtual void Popup(wxWindow *focus = NULL);
// hide the window
virtual void Dismiss();
};
//---------------------------------------------------------------------------
#else // On Mac we need to provide dummy classes to keep the renamers in sync
%{
class wxPopupWindow : public wxWindow {
public:
wxPopupWindow(wxWindow *, int) { PyErr_SetNone(PyExc_NotImplementedError); }
wxPopupWindow() { PyErr_SetNone(PyExc_NotImplementedError); }
};
class wxPyPopupTransientWindow : public wxPopupWindow
{
public:
wxPyPopupTransientWindow(wxWindow *, int) { PyErr_SetNone(PyExc_NotImplementedError); }
wxPyPopupTransientWindow() { PyErr_SetNone(PyExc_NotImplementedError); }
};
%}
class wxPopupWindow : public wxWindow {
public:
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
%name(PrePopupWindow)wxPopupWindow();
};
%name(PopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow
{
public:
wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
%name(PrePopupTransientWindow)wxPyPopupTransientWindow();
};
#endif
//---------------------------------------------------------------------------

View File

@@ -1,59 +1,33 @@
/////////////////////////////////////////////////////////////////////////////
// Name: printfw.i
// Purpose: Printing Framework classes
// Name: _????.i
// Purpose: SWIG interface for wx????
//
// Author: Robin Dunn
//
// Created: 7-May-1999
// Created: 9-Aug-2003
// RCS-ID: $Id$
// Copyright: (c) 1998 by Total Control Software
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module printfw
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include "helpers.h"
#include <wx/print.h>
#include <wx/printdlg.h>
#include <wx/dcps.h>
#include "wx/wxPython/printfw.h"
#include "printfw.h"
%}
//----------------------------------------------------------------------
%{
// Put some wx default wxChar* values into wxStrings.
static const wxChar* wxPrintoutTitleStr = wxT("Printout");
DECLARE_DEF_STRING(PrintoutTitleStr);
static const wxChar* wxPreviewCanvasNameStr = wxT("previewcanvas");
DECLARE_DEF_STRING(PreviewCanvasNameStr);
DECLARE_DEF_STRING(FrameNameStr);
DECLARE_DEF_STRING(PanelNameStr);
DECLARE_DEF_STRING(DialogNameStr);
%}
//----------------------------------------------------------------------
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%import misc.i
%import windows.i
%import gdi.i
%import cmndlgs.i
%import frames.i
%pragma(python) code = "import wx"
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
enum wxPrintMode
{
@@ -120,37 +94,7 @@ public:
void SetPrinterTranslation(long x, long y);
void SetPrintMode(wxPrintMode printMode);
%pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
};
//----------------------------------------------------------------------
#ifdef __WXMSW__
class wxPrinterDC : public wxDC {
public:
wxPrinterDC(const wxPrintData& printData);
%name(wxPrinterDC2) wxPrinterDC(const wxString& driver,
const wxString& device,
const wxString& output,
bool interactive = TRUE,
int orientation = wxPORTRAIT);
};
#endif
//---------------------------------------------------------------------------
class wxPostScriptDC : public wxDC {
public:
wxPostScriptDC(const wxPrintData& printData);
// %name(wxPostScriptDC2)wxPostScriptDC(const wxString& output,
// bool interactive = TRUE,
// wxWindow* parent = NULL);
wxPrintData& GetPrintData();
void SetPrintData(const wxPrintData& data);
static void SetResolution(int ppi);
static int GetResolution();
%pythoncode { def __nonzero__(self): return self.Ok() }
};
//---------------------------------------------------------------------------
@@ -178,11 +122,13 @@ public:
wxPoint GetMinMarginBottomRight();
wxPaperSize GetPaperId();
wxSize GetPaperSize();
%addmethods {
%new wxPrintData* GetPrintData() {
return new wxPrintData(self->GetPrintData()); // force a copy
}
}
wxPrintData& GetPrintData();
// %addmethods {
// %new wxPrintData* GetPrintData() {
// return new wxPrintData(self->GetPrintData()); // force a copy
// }
// }
bool Ok();
@@ -196,21 +142,22 @@ public:
void SetPaperSize(const wxSize& size);
void SetPrintData(const wxPrintData& printData);
%pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
%pythoncode { def __nonzero__(self): return self.Ok() }
};
class wxPageSetupDialog : public wxDialog {
public:
wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL);
%addtofunc wxPageSetupDialog "self._setOORInfo(self)"
%pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
wxPageSetupDialog(wxWindow* parent, wxPageSetupDialogData* data = NULL);
wxPageSetupDialogData& GetPageSetupData();
int ShowModal();
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
class wxPrintDialogData : public wxObject {
@@ -253,28 +200,63 @@ public:
// Is this data OK for showing the print dialog?
bool Ok() const;
%addmethods {
%new wxPrintData* GetPrintData() {
return new wxPrintData(self->GetPrintData()); // force a copy
}
}
wxPrintData& GetPrintData();
// %addmethods {
// %new wxPrintData* GetPrintData() {
// return new wxPrintData(self->GetPrintData()); // force a copy
// }
// }
void SetPrintData(const wxPrintData& printData);
%pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
%pythoncode { def __nonzero__(self): return self.Ok() }
};
class wxPrintDialog : public wxDialog {
public:
%addtofunc wxPrintDialog "self._setOORInfo(self)"
wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL);
wxPrintDialogData& GetPrintDialogData();
%new wxDC* GetPrintDC();
%newobject GetPrintDC;
wxDC* GetPrintDC();
int ShowModal();
};
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
enum wxPrinterError
{
wxPRINTER_NO_ERROR = 0,
wxPRINTER_CANCELLED,
wxPRINTER_ERROR
};
class wxPrinter : public wxObject {
public:
wxPrinter(wxPrintDialogData* data = NULL);
~wxPrinter();
void CreateAbortWindow(wxWindow* parent, wxPyPrintout* printout);
wxPrintDialogData& GetPrintDialogData();
bool Print(wxWindow *parent, wxPyPrintout *printout, int prompt=TRUE);
wxDC* PrintDialog(wxWindow *parent);
void ReportError(wxWindow *parent, wxPyPrintout *printout, const wxString& message);
bool Setup(wxWindow *parent);
bool GetAbort();
static wxPrinterError GetLastError();
};
//---------------------------------------------------------------------------
// Custom wxPrintout class that knows how to call python
%{
@@ -285,8 +267,8 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p
bool found;
wxPyBeginBlockThreads();
if ((found = m_myInst.findCallback("GetPageInfo"))) {
PyObject* result = m_myInst.callCallbackObj(Py_BuildValue("()"));
if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) {
PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) {
PyObject* val;
@@ -338,24 +320,36 @@ IMP_PYCALLBACK_BOOL_INT(wxPyPrintout, wxPrintout, HasPage);
// Now define the custom class for SWIGging
%name(wxPrintout) class wxPyPrintout : public wxObject {
%name(Printout) class wxPyPrintout : public wxObject {
public:
%addtofunc wxPyPrintout "self._setCallbackInfo(self, Printout)"
wxPyPrintout(const wxString& title = wxPyPrintoutTitleStr);
//~wxPyPrintout(); wxPrintPreview object takes ownership...
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPrintout)"
%addmethods {
void Destroy() { delete self; }
}
wxString GetTitle() const;
wxDC* GetDC();
void GetPageSizeMM(int *OUTPUT, int *OUTPUT);
void GetPageSizePixels(int *OUTPUT, int *OUTPUT);
void GetPPIPrinter(int *OUTPUT, int *OUTPUT);
void GetPPIScreen(int *OUTPUT, int *OUTPUT);
bool IsPreview();
void SetDC(wxDC *dc);
void GetPageSizePixels(int *OUTPUT, int *OUTPUT);
void SetPageSizePixels(int w, int h);
void SetPageSizeMM(int w, int h);
void GetPageSizeMM(int *OUTPUT, int *OUTPUT);
void SetPPIScreen(int x, int y);
void GetPPIScreen(int *OUTPUT, int *OUTPUT);
void SetPPIPrinter(int x, int y);
void GetPPIPrinter(int *OUTPUT, int *OUTPUT);
bool IsPreview();
void SetIsPreview(bool p);
bool base_OnBeginDocument(int startPage, int endPage);
void base_OnEndDocument();
void base_OnBeginPrinting();
@@ -365,47 +359,90 @@ public:
bool base_HasPage(int page);
};
//----------------------------------------------------------------------
enum wxPrinterError
{
wxPRINTER_NO_ERROR = 0,
wxPRINTER_CANCELLED,
wxPRINTER_ERROR
};
//---------------------------------------------------------------------------
class wxPrinter : public wxObject {
public:
wxPrinter(wxPrintDialogData* data = NULL);
~wxPrinter();
void CreateAbortWindow(wxWindow* parent, wxPyPrintout* printout);
wxPrintDialogData& GetPrintDialogData();
bool Print(wxWindow *parent, wxPyPrintout *printout, int prompt=TRUE);
wxDC* PrintDialog(wxWindow *parent);
void ReportError(wxWindow *parent, wxPyPrintout *printout, const wxString& message);
bool Setup(wxWindow *parent);
bool GetAbort();
static wxPrinterError GetLastError();
};
//----------------------------------------------------------------------
class wxPrintAbortDialog: public wxDialog
class wxPreviewCanvas: public wxScrolledWindow
{
public:
wxPrintAbortDialog(wxWindow *parent,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyDialogNameStr);
%addtofunc wxPreviewCanvas "self._self._setOORInfo(self)"
wxPreviewCanvas(wxPrintPreview *preview,
wxWindow *parent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyPreviewCanvasNameStr);
};
//----------------------------------------------------------------------
class wxPreviewFrame : public wxFrame {
public:
%addtofunc wxPreviewFrame "self._self._setOORInfo(self)"
wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxPyFrameNameStr);
void Initialize();
void CreateControlBar();
void CreateCanvas();
wxPreviewControlBar* GetControlBar() const;
};
enum {
wxPREVIEW_PRINT,
wxPREVIEW_PREVIOUS,
wxPREVIEW_NEXT,
wxPREVIEW_ZOOM,
wxPREVIEW_FIRST,
wxPREVIEW_LAST,
wxPREVIEW_GOTO,
wxPREVIEW_DEFAULT,
wxID_PREVIEW_CLOSE,
wxID_PREVIEW_NEXT,
wxID_PREVIEW_PREVIOUS,
wxID_PREVIEW_PRINT,
wxID_PREVIEW_ZOOM,
wxID_PREVIEW_FIRST,
wxID_PREVIEW_LAST,
wxID_PREVIEW_GOTO
};
class wxPreviewControlBar: public wxPanel
{
public:
%addtofunc wxPreviewControlBar "self._self._setOORInfo(self)"
wxPreviewControlBar(wxPrintPreview *preview,
long buttons,
wxWindow *parent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name = wxPyPanelNameStr);
int GetZoomControl();
void SetZoomControl(int zoom);
wxPrintPreview* GetPrintPreview();
void OnNext();
void OnPrevious();
void OnFirst();
void OnLast();
void OnGoto();
};
//---------------------------------------------------------------------------
class wxPrintPreview : public wxObject {
public:
@@ -452,87 +489,13 @@ public:
virtual bool Print(bool interactive);
virtual void DetermineScaling();
%pragma(python) addtoclass = "def __nonzero__(self): return self.Ok()"
};
class wxPreviewFrame : public wxFrame {
public:
wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxPyFrameNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void Initialize();
void CreateControlBar();
void CreateCanvas();
wxPreviewControlBar* GetControlBar() const;
};
class wxPreviewCanvas: public wxScrolledWindow
{
public:
wxPreviewCanvas(wxPrintPreview *preview,
wxWindow *parent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyPreviewCanvasNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
%pythoncode { def __nonzero__(self): return self.Ok() }
};
enum {
wxPREVIEW_PRINT,
wxPREVIEW_PREVIOUS,
wxPREVIEW_NEXT,
wxPREVIEW_ZOOM,
wxPREVIEW_FIRST,
wxPREVIEW_LAST,
wxPREVIEW_GOTO,
wxPREVIEW_DEFAULT,
//---------------------------------------------------------------------------
wxID_PREVIEW_CLOSE,
wxID_PREVIEW_NEXT,
wxID_PREVIEW_PREVIOUS,
wxID_PREVIEW_PRINT,
wxID_PREVIEW_ZOOM,
wxID_PREVIEW_FIRST,
wxID_PREVIEW_LAST,
wxID_PREVIEW_GOTO
};
class wxPreviewControlBar: public wxPanel
{
public:
wxPreviewControlBar(wxPrintPreview *preview,
long buttons,
wxWindow *parent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name = wxPyPanelNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
int GetZoomControl();
void SetZoomControl(int zoom);
wxPrintPreview* GetPrintPreview();
void OnNext();
void OnPrevious();
void OnFirst();
void OnLast();
void OnGoto();
};
//----------------------------------------------------------------------
// Python-derivable versions of the above preview classes
%{
@@ -609,13 +572,14 @@ IMP_PYCALLBACK_VOID_ (wxPyPrintPreview, wxPrintPreview, DetermineScaling)
class wxPyPrintPreview : public wxPrintPreview
{
public:
%addtofunc wxPyPrintPreview "self._setCallbackInfo(self, PyPrintPreview)"
wxPyPrintPreview(wxPyPrintout* printout,
wxPyPrintout* printoutForPrinting,
wxPrintData* data=NULL);
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPrintPreview)"
bool base_SetCurrentPage(int pageNum);
bool base_PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
bool base_DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
@@ -659,9 +623,12 @@ IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateCanvas);
IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateControlBar);
%}
class wxPyPreviewFrame : public wxPreviewFrame
{
public:
%addtofunc wxPyPreviewFrame "self._setCallbackInfo(self, PyPreviewFrame); self._setOORInfo(self)"
wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
@@ -670,8 +637,6 @@ public:
const wxString& name = wxPyFrameNameStr);
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPreviewFrame)"
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void SetPreviewCanvas(wxPreviewCanvas* canvas);
void SetControlBar(wxPreviewControlBar* bar);
@@ -712,9 +677,12 @@ IMP_PYCALLBACK_VOID_(wxPyPreviewControlBar, wxPreviewControlBar, CreateButtons);
IMP_PYCALLBACK_VOID_INT(wxPyPreviewControlBar, wxPreviewControlBar, SetZoomControl);
%}
class wxPyPreviewControlBar : public wxPreviewControlBar
{
public:
%addtofunc wxPyPreviewControlBar "self._setCallbackInfo(self, PyPreviewControlBar); self._setOORInfo(self)"
wxPyPreviewControlBar(wxPrintPreview *preview,
long buttons,
wxWindow *parent,
@@ -724,8 +692,6 @@ public:
const wxString& name = wxPyPanelNameStr);
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPreviewControlBar)"
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void SetPrintPreview(wxPrintPreview* preview);
@@ -734,15 +700,9 @@ public:
};
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxPrintout", "wxPyPrintout");
%}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//---------------------------------------------------------------------------

171
wxPython/src/_process.i Normal file
View File

@@ -0,0 +1,171 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _process.i
// Purpose: SWIG interface stuff for wxProcess and wxExecute
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
%}
//---------------------------------------------------------------------------
enum
{
// no redirection
wxPROCESS_DEFAULT = 0,
// redirect the IO of the child process
wxPROCESS_REDIRECT = 1
};
enum wxKillError
{
wxKILL_OK, // no error
wxKILL_BAD_SIGNAL, // no such signal
wxKILL_ACCESS_DENIED, // permission denied
wxKILL_NO_PROCESS, // no such process
wxKILL_ERROR // another, unspecified error
};
enum wxSignal
{
wxSIGNONE = 0, // verify if the process exists under Unix
wxSIGHUP,
wxSIGINT,
wxSIGQUIT,
wxSIGILL,
wxSIGTRAP,
wxSIGABRT,
wxSIGIOT = wxSIGABRT, // another name
wxSIGEMT,
wxSIGFPE,
wxSIGKILL,
wxSIGBUS,
wxSIGSEGV,
wxSIGSYS,
wxSIGPIPE,
wxSIGALRM,
wxSIGTERM
// further signals are different in meaning between different Unix systems
};
//---------------------------------------------------------------------------
%{
IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
%}
%name(Process)class wxPyProcess : public wxEvtHandler {
public:
// kill the process with the given PID
static wxKillError Kill(int pid, wxSignal sig = wxSIGTERM);
// test if the given process exists
static bool Exists(int pid);
// this function replaces the standard popen() one: it launches a process
// asynchronously and allows the caller to get the streams connected to its
// std{in|out|err}
//
// on error NULL is returned, in any case the process object will be
// deleted automatically when the process terminates and should *not* be
// deleted by the caller
static wxPyProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC);
%addtofunc wxPyProcess "self._setCallbackInfo(self, Process)"
wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
void _setCallbackInfo(PyObject* self, PyObject* _class);
void base_OnTerminate(int pid, int status);
// call Redirect before passing the object to wxExecute() to redirect the
// launched process stdin/stdout, then use GetInputStream() and
// GetOutputStream() to get access to them
void Redirect();
bool IsRedirected();
// detach from the parent - should be called by the parent if it's deleted
// before the process it started terminates
void Detach();
wxInputStream *GetInputStream();
wxInputStream *GetErrorStream();
wxOutputStream *GetOutputStream();
void CloseOutput();
// return TRUE if the child process stdout is not closed
bool IsInputOpened() const;
// return TRUE if any input is available on the child process stdout/err
bool IsInputAvailable() const;
bool IsErrorAvailable() const;
};
//---------------------------------------------------------------------------
class wxProcessEvent : public wxEvent {
public:
wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
int GetPid();
int GetExitCode();
int m_pid, m_exitcode;
};
%constant wxEventType wxEVT_END_PROCESS;
%pythoncode {
EVT_END_PROCESS = wx.PyEventBinder( wxEVT_END_PROCESS, 1 )
}
//---------------------------------------------------------------------------
enum
{
// execute the process asynchronously
wxEXEC_ASYNC = 0,
// execute it synchronously, i.e. wait until it finishes
wxEXEC_SYNC = 1,
// under Windows, don't hide the child even if it's IO is redirected (this
// is done by default)
wxEXEC_NOHIDE = 2,
// under Unix, if the process is the group leader then killing -pid kills
// all children as well as pid
wxEXEC_MAKE_GROUP_LEADER = 4
};
long wxExecute(const wxString& command,
int flags = wxEXEC_ASYNC,
wxPyProcess *process = NULL);
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess");
%}
//---------------------------------------------------------------------------

140
wxPython/src/_pycontrol.i Normal file
View File

@@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _pywindows.i
// Purpose: SWIG interface for wxPyControl, See also _pywindows.i
//
// Author: Robin Dunn
//
// Created: 2-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
// TODO: Virtualize ShouldInheritColours
//---------------------------------------------------------------------------
%{ // C++ version of Python aware wxControl
class wxPyControl : public wxControl
{
DECLARE_DYNAMIC_CLASS(wxPyControl)
public:
wxPyControl() : wxControl() {}
wxPyControl(wxWindow* parent, const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator=wxDefaultValidator,
const wxString& name = wxPyControlNameStr)
: wxControl(parent, id, pos, size, style, validator, name) {}
DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
DEC_PYCALLBACK_VOID_INT5(DoSetSize);
DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
DEC_PYCALLBACK__(InitDialog);
DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
DEC_PYCALLBACK_BOOL_(Validate);
DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
DEC_PYCALLBACK_SIZE_const(GetMaxSize);
DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
PYPRIVATE;
};
IMPLEMENT_DYNAMIC_CLASS(wxPyControl, wxControl);
IMP_PYCALLBACK_VOID_INT4(wxPyControl, wxControl, DoMoveWindow);
IMP_PYCALLBACK_VOID_INT5(wxPyControl, wxControl, DoSetSize);
IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetClientSize);
IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetVirtualSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetClientSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetPosition);
IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetVirtualSize);
IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetBestSize);
IMP_PYCALLBACK__(wxPyControl, wxControl, InitDialog);
IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataFromWindow);
IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataToWindow);
IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, Validate);
IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocus);
IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocusFromKeyboard);
IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, GetMaxSize);
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, AddChild);
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, RemoveChild);
%}
// And now the one for SWIG to see
class wxPyControl : public wxControl
{
public:
%addtofunc wxPyControl "self._setOORInfo(self); self._setCallbackInfo(self, PyControl)"
wxPyControl(wxWindow* parent, const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator=wxDefaultValidator,
const wxString& name = wxPyControlNameStr);
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyControl)"
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

288
wxPython/src/_pywindows.i Normal file
View File

@@ -0,0 +1,288 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _pywindows.i
// Purpose: SWIG interface for wxPyWindow, and etc. These classes support
// overriding many of wxWindow's virtual methods in Python derived
// classes.
//
// Author: Robin Dunn
//
// Created: 2-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
// TODO: Redo these with SWIG directors?
// TODO: Which (if any?) of these should be done also???
// Destroy
// DoCaptureMouse
// DoClientToScreen
// DoHitTest
// DoMoveWindow
// DoPopupMenu
// DoReleaseMouse
// DoScreenToClient
// DoSetToolTip
// Enable
// Fit
// GetCharHeight
// GetCharWidth
// GetClientAreaOrigin
// GetDefaultItem
// IsTopLevel
// SetBackgroundColour
// SetDefaultItem
// SetFocus
// SetFocusFromKbd
// SetForegroundColour
// SetSizeHints
// SetVirtualSizeHints
// Show
// TODO: Virtualize ShouldInheritColours
//---------------------------------------------------------------------------
%{ // C++ version of Python aware wxWindow
class wxPyWindow : public wxWindow
{
DECLARE_DYNAMIC_CLASS(wxPyWindow)
public:
wxPyWindow() : wxWindow() {}
wxPyWindow(wxWindow* parent, const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyPanelNameStr)
: wxWindow(parent, id, pos, size, style, name) {}
DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
DEC_PYCALLBACK_VOID_INT5(DoSetSize);
DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
DEC_PYCALLBACK__(InitDialog);
DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
DEC_PYCALLBACK_BOOL_(Validate);
DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
DEC_PYCALLBACK_SIZE_const(GetMaxSize);
DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
PYPRIVATE;
};
IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
%}
// And now the one for SWIG to see
class wxPyWindow : public wxWindow
{
public:
%addtofunc wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
wxPyWindow(wxWindow* parent, const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyPanelNameStr);
void _setCallbackInfo(PyObject* self, PyObject* _class);
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
};
//---------------------------------------------------------------------------
// Do the same thing for wxControl
// ** See _pycontrol.i, it was moved there because of dependency on wxControl
//---------------------------------------------------------------------------
// and for wxPanel
%{ // C++ version of Python aware wxPanel
class wxPyPanel : public wxPanel
{
DECLARE_DYNAMIC_CLASS(wxPyPanel)
public:
wxPyPanel() : wxPanel() {}
wxPyPanel(wxWindow* parent, const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyPanelNameStr)
: wxPanel(parent, id, pos, size, style, name) {}
DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
DEC_PYCALLBACK_VOID_INT5(DoSetSize);
DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
DEC_PYCALLBACK__(InitDialog);
DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
DEC_PYCALLBACK_BOOL_(Validate);
DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
DEC_PYCALLBACK_SIZE_const(GetMaxSize);
DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
PYPRIVATE;
};
IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
%}
// And now the one for SWIG to see
class wxPyPanel : public wxPanel
{
public:
%addtofunc wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
wxPyPanel(wxWindow* parent, const wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyPanelNameStr);
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPanel)"
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
void base_DoMoveWindow(int x, int y, int width, int height);
void base_DoSetSize(int x, int y, int width, int height,
int sizeFlags = wxSIZE_AUTO);
void base_DoSetClientSize(int width, int height);
void base_DoSetVirtualSize( int x, int y );
void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const;
void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const;
void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const;
wxSize base_DoGetVirtualSize() const;
wxSize base_DoGetBestSize() const;
void base_InitDialog();
bool base_TransferDataToWindow();
bool base_TransferDataFromWindow();
bool base_Validate();
bool base_AcceptsFocus() const;
bool base_AcceptsFocusFromKeyboard() const;
wxSize base_GetMaxSize() const;
void base_AddChild(wxWindow* child);
void base_RemoveChild(wxWindow* child);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

121
wxPython/src/_radio.i Normal file
View File

@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _radio.i
// Purpose: SWIG interface defs for wxRadioButton and wxRadioBox
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(RadioBoxNameStr);
DECLARE_DEF_STRING(RadioButtonNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
class wxRadioBox : public wxControl
{
public:
%addtofunc wxRadioBox "self._setOORInfo(self)"
%addtofunc wxRadioBox() ""
wxRadioBox(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& point = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices = 0, wxString* choices_array = NULL,
int majorDimension = 0,
long style = wxRA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyRadioBoxNameStr);
%name(PreRadioBox)wxRadioBox();
bool Create(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& point = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int choices = 0, wxString* choices_array = NULL,
int majorDimension = 0,
long style = wxRA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyRadioBoxNameStr);
virtual void SetSelection(int n);
virtual int GetSelection() const;
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection(const wxString& s);
// string access
virtual int GetCount() const;
virtual int FindString(const wxString& s) const;
virtual wxString GetString(int n) const;
virtual void SetString(int n, const wxString& label);
%pythoncode { GetItemLabel = GetString };
%pythoncode { SetItemLabel = SetString };
// change the individual radio button state
%name(EnableItem) virtual void Enable(int n, bool enable = TRUE);
%name(ShowItem) virtual void Show(int n, bool show = TRUE);
#ifndef __WXGTK__
// layout parameters
virtual int GetColumnCount() const;
virtual int GetRowCount() const;
// return the item above/below/to the left/right of the given one
int GetNextItem(int item, wxDirection dir, long style) const;
#else
%extend {
int GetColumnCount() const { return -1; }
int GetRowCount() const { return -1; }
int GetNextItem(int item, wxDirection dir, long style) const { return -1; }
}
#endif
};
//---------------------------------------------------------------------------
%newgroup
class wxRadioButton : public wxControl
{
public:
%addtofunc wxRadioButton "self._setOORInfo(self)"
%addtofunc wxRadioButton() ""
wxRadioButton(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyRadioButtonNameStr);
%name(PreRadioButton)wxRadioButton();
bool Create(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyRadioButtonNameStr);
bool GetValue();
void SetValue(bool value);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

140
wxPython/src/_region.i Normal file
View File

@@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _imaglist.i
// Purpose: SWIG interface defs for wxImageList and releated classes
//
// Author: Robin Dunn
//
// Created: 7-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%typemap(in) (int points, wxPoint* points_array ) {
$2 = wxPoint_LIST_helper($input, &$1);
if ($2 == NULL) SWIG_fail;
}
%typemap(freearg) (int points, wxPoint* points_array ) {
if ($2) delete [] $2;
}
//---------------------------------------------------------------------------
%newgroup
enum wxRegionContain
{
wxOutRegion = 0,
wxPartRegion = 1,
wxInRegion = 2
};
class wxRegion : public wxGDIObject {
public:
wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
%name(RegionFromBitmap)wxRegion(const wxBitmap& bmp,
const wxColour& transColour = wxNullColour,
int tolerance = 0);
#ifndef __WXMAC__
%name(RegionFromPoints)wxRegion(int points, wxPoint* points_array,
int fillStyle = wxWINDING_RULE);
#else
%extend {
%name(RegionFromPoints)wxRegion(int points, wxPoint* points_array,
int fillStyle = wxWINDING_RULE) {
PyErr_SetNone(PyExc_NotImplementedError);
return NULL;
}
}
#endif
~wxRegion();
void Clear();
#ifndef __WXMAC__
bool Offset(wxCoord x, wxCoord y);
#endif
wxRegionContain Contains(wxCoord x, wxCoord y);
%name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
%name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
%name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
wxRect GetBox();
bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(IntersectRect)bool Intersect(const wxRect& rect);
%name(IntersectRegion)bool Intersect(const wxRegion& region);
bool IsEmpty();
bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(UnionRect)bool Union(const wxRect& rect);
%name(UnionRegion)bool Union(const wxRegion& region);
bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(SubtractRect)bool Subtract(const wxRect& rect);
%name(SubtractRegion)bool Subtract(const wxRegion& region);
bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
%name(XorRect)bool Xor(const wxRect& rect);
%name(XorRegion)bool Xor(const wxRegion& region);
// Convert the region to a B&W bitmap with the white pixels being inside
// the region.
wxBitmap ConvertToBitmap();
// Use the non-transparent pixels of a wxBitmap for the region to combine
// with this region. If the bitmap has a mask then it will be used,
// otherwise the colour to be treated as transparent may be specified,
// along with an optional tolerance value.
%name(UnionBitmap)bool Union(const wxBitmap& bmp,
const wxColour& transColour = wxNullColour,
int tolerance = 0);
};
class wxRegionIterator : public wxObject {
public:
wxRegionIterator(const wxRegion& region);
~wxRegionIterator();
wxCoord GetX();
wxCoord GetY();
wxCoord GetW();
wxCoord GetWidth();
wxCoord GetH();
wxCoord GetHeight();
wxRect GetRect();
bool HaveRects();
void Reset();
%extend {
void Next() {
(*self) ++;
}
bool __nonzero__() {
return self->operator bool();
}
};
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

280
wxPython/src/_sashwin.i Normal file
View File

@@ -0,0 +1,280 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _sashwin.i
// Purpose: SWIG interface defs for wxSashWindow and wxSashLayoutWindow
//
// Author: Robin Dunn
//
// Created: 22-Dec-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
static const wxChar* wxSashNameStr = wxT("sashWindow");
DECLARE_DEF_STRING(SashNameStr);
static const wxChar* wxSashLayoutNameStr = wxT("layoutWindow");
DECLARE_DEF_STRING(SashLayoutNameStr);
%}
//---------------------------------------------------------------------------
%newgroup;
enum {
wxSASH_DRAG_NONE,
wxSASH_DRAG_DRAGGING,
wxSASH_DRAG_LEFT_DOWN,
wxSW_NOBORDER,
wxSW_BORDER,
wxSW_3DSASH,
wxSW_3DBORDER,
wxSW_3D,
};
enum wxSashEdgePosition {
wxSASH_TOP = 0,
wxSASH_RIGHT,
wxSASH_BOTTOM,
wxSASH_LEFT,
wxSASH_NONE = 100
};
// wxSashWindow allows any of its edges to have a sash which can be dragged
// to resize the window. The actual content window will be created as a child
// of wxSashWindow.
class wxSashWindow: public wxWindow
{
public:
%addtofunc wxSashWindow "self._setOORInfo(self)"
%addtofunc wxSashWindow() ""
wxSashWindow(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLIP_CHILDREN | wxSW_3D,
const wxString& name = wxPySashNameStr);
%name(PreSashWindow)wxSashWindow();
bool Create(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLIP_CHILDREN | wxSW_3D,
const wxString& name = wxPySashNameStr);
// Set whether there's a sash in this position
void SetSashVisible(wxSashEdgePosition edge, bool sash);
// Get whether there's a sash in this position
bool GetSashVisible(wxSashEdgePosition edge) const;
// Set whether there's a border in this position
void SetSashBorder(wxSashEdgePosition edge, bool border);
// Get whether there's a border in this position
bool HasBorder(wxSashEdgePosition edge) const;
// Get border size
int GetEdgeMargin(wxSashEdgePosition edge) const;
// Sets the default sash border size
void SetDefaultBorderSize(int width);
// Gets the default sash border size
int GetDefaultBorderSize() const;
// Sets the addition border size between child and sash window
void SetExtraBorderSize(int width);
// Gets the addition border size between child and sash window
int GetExtraBorderSize() const;
virtual void SetMinimumSizeX(int min);
virtual void SetMinimumSizeY(int min);
virtual int GetMinimumSizeX() const;
virtual int GetMinimumSizeY() const;
virtual void SetMaximumSizeX(int max);
virtual void SetMaximumSizeY(int max);
virtual int GetMaximumSizeX() const;
virtual int GetMaximumSizeY() const;
// Tests for x, y over sash
wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2);
// Resizes subwindows
void SizeWindows();
};
enum wxSashDragStatus
{
wxSASH_STATUS_OK,
wxSASH_STATUS_OUT_OF_RANGE
};
class wxSashEvent: public wxCommandEvent
{
public:
wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
void SetEdge(wxSashEdgePosition edge);
wxSashEdgePosition GetEdge() const;
//// The rectangle formed by the drag operation
void SetDragRect(const wxRect& rect);
wxRect GetDragRect() const;
//// Whether the drag caused the rectangle to be reversed (e.g.
//// dragging the top below the bottom)
void SetDragStatus(wxSashDragStatus status);
wxSashDragStatus GetDragStatus() const;
};
%constant wxEventType wxEVT_SASH_DRAGGED;
%pythoncode {
EVT_SASH_DRAGGED = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 1 )
EVT_SASH_DRAGGED_RANGE = wx.PyEventBinder( wxEVT_SASH_DRAGGED, 2 )
};
//---------------------------------------------------------------------------
%newgroup;
enum wxLayoutOrientation
{
wxLAYOUT_HORIZONTAL,
wxLAYOUT_VERTICAL
};
enum wxLayoutAlignment
{
wxLAYOUT_NONE,
wxLAYOUT_TOP,
wxLAYOUT_LEFT,
wxLAYOUT_RIGHT,
wxLAYOUT_BOTTOM
};
enum {
wxLAYOUT_LENGTH_Y,
wxLAYOUT_LENGTH_X,
wxLAYOUT_MRU_LENGTH,
wxLAYOUT_QUERY,
};
%constant wxEventType wxEVT_QUERY_LAYOUT_INFO;
%constant wxEventType wxEVT_CALCULATE_LAYOUT;
// This event is used to get information about window alignment,
// orientation and size.
class wxQueryLayoutInfoEvent: public wxEvent
{
public:
wxQueryLayoutInfoEvent(wxWindowID id = 0);
// Read by the app
void SetRequestedLength(int length);
int GetRequestedLength() const;
void SetFlags(int flags);
int GetFlags() const;
// Set by the app
void SetSize(const wxSize& size);
wxSize GetSize() const;
void SetOrientation(wxLayoutOrientation orient);
wxLayoutOrientation GetOrientation() const;
void SetAlignment(wxLayoutAlignment align);
wxLayoutAlignment GetAlignment() const;
};
// This event is used to take a bite out of the available client area.
class wxCalculateLayoutEvent: public wxEvent
{
public:
wxCalculateLayoutEvent(wxWindowID id = 0);
// Read by the app
void SetFlags(int flags);
int GetFlags() const;
// Set by the app
void SetRect(const wxRect& rect);
wxRect GetRect() const;
};
%pythoncode {
EVT_QUERY_LAYOUT_INFO = wx.PyEventBinder( wxEVT_QUERY_LAYOUT_INFO )
EVT_CALCULATE_LAYOUT = wx.PyEventBinder( wxEVT_CALCULATE_LAYOUT )
};
// This is window that can remember alignment/orientation, does its own layout,
// and can provide sashes too. Useful for implementing docked windows with sashes in
// an IDE-style interface.
class wxSashLayoutWindow: public wxSashWindow
{
public:
%addtofunc wxSashLayoutWindow "self._setOORInfo(self)"
%addtofunc wxSashLayoutWindow() ""
wxSashLayoutWindow(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLIP_CHILDREN | wxSW_3D,
const wxString& name = wxPySashLayoutNameStr);
%name(PreSashLayoutWindow)wxSashLayoutWindow();
bool Create(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLIP_CHILDREN | wxSW_3D,
const wxString& name = wxPySashLayoutNameStr);
wxLayoutAlignment GetAlignment();
wxLayoutOrientation GetOrientation();
void SetAlignment(wxLayoutAlignment alignment);
void SetDefaultSize(const wxSize& size);
void SetOrientation(wxLayoutOrientation orientation);
};
class wxLayoutAlgorithm : public wxObject {
public:
wxLayoutAlgorithm();
~wxLayoutAlgorithm();
bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL);
bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL);
bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL);
};
//---------------------------------------------------------------------------

59
wxPython/src/_scrolbar.i Normal file
View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _scrolbar.i
// Purpose: SWIG interface defs for wxScrollBar
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(ScrollBarNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
class wxScrollBar : public wxControl {
public:
%addtofunc wxScrollBar "self._setOORInfo(self)"
%addtofunc wxScrollBar() ""
wxScrollBar(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyScrollBarNameStr);
%name(PreScrollBar)wxScrollBar();
bool Create(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyScrollBarNameStr);
virtual int GetThumbPosition() const;
virtual int GetThumbSize() const;
%pythoncode { GetThumbLength = GetThumbSize };
virtual int GetPageSize() const;
virtual int GetRange() const;
bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; }
virtual void SetThumbPosition(int viewStart);
virtual void SetScrollbar(int position, int thumbSize,
int range, int pageSize,
bool refresh = TRUE);
};
//---------------------------------------------------------------------------

197
wxPython/src/_settings.i Normal file
View File

@@ -0,0 +1,197 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _settings.i
// Purpose: SWIG interface defs for wxSystemSettings and wxSystemOptions
//
// Author: Robin Dunn
//
// Created: 3-July-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%newgroup;
enum wxSystemFont
{
wxSYS_OEM_FIXED_FONT = 10,
wxSYS_ANSI_FIXED_FONT,
wxSYS_ANSI_VAR_FONT,
wxSYS_SYSTEM_FONT,
wxSYS_DEVICE_DEFAULT_FONT,
wxSYS_DEFAULT_PALETTE,
wxSYS_SYSTEM_FIXED_FONT,
wxSYS_DEFAULT_GUI_FONT,
wxSYS_ICONTITLE_FONT
};
enum wxSystemColour
{
wxSYS_COLOUR_SCROLLBAR,
wxSYS_COLOUR_BACKGROUND,
wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND,
wxSYS_COLOUR_ACTIVECAPTION,
wxSYS_COLOUR_INACTIVECAPTION,
wxSYS_COLOUR_MENU,
wxSYS_COLOUR_WINDOW,
wxSYS_COLOUR_WINDOWFRAME,
wxSYS_COLOUR_MENUTEXT,
wxSYS_COLOUR_WINDOWTEXT,
wxSYS_COLOUR_CAPTIONTEXT,
wxSYS_COLOUR_ACTIVEBORDER,
wxSYS_COLOUR_INACTIVEBORDER,
wxSYS_COLOUR_APPWORKSPACE,
wxSYS_COLOUR_HIGHLIGHT,
wxSYS_COLOUR_HIGHLIGHTTEXT,
wxSYS_COLOUR_BTNFACE,
wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
wxSYS_COLOUR_BTNSHADOW,
wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
wxSYS_COLOUR_GRAYTEXT,
wxSYS_COLOUR_BTNTEXT,
wxSYS_COLOUR_INACTIVECAPTIONTEXT,
wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
wxSYS_COLOUR_3DDKSHADOW,
wxSYS_COLOUR_3DLIGHT,
wxSYS_COLOUR_INFOTEXT,
wxSYS_COLOUR_INFOBK,
wxSYS_COLOUR_LISTBOX,
wxSYS_COLOUR_HOTLIGHT,
wxSYS_COLOUR_GRADIENTACTIVECAPTION,
wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
wxSYS_COLOUR_MENUHILIGHT,
wxSYS_COLOUR_MENUBAR,
wxSYS_COLOUR_MAX
};
enum wxSystemMetric
{
wxSYS_MOUSE_BUTTONS = 1,
wxSYS_BORDER_X,
wxSYS_BORDER_Y,
wxSYS_CURSOR_X,
wxSYS_CURSOR_Y,
wxSYS_DCLICK_X,
wxSYS_DCLICK_Y,
wxSYS_DRAG_X,
wxSYS_DRAG_Y,
wxSYS_EDGE_X,
wxSYS_EDGE_Y,
wxSYS_HSCROLL_ARROW_X,
wxSYS_HSCROLL_ARROW_Y,
wxSYS_HTHUMB_X,
wxSYS_ICON_X,
wxSYS_ICON_Y,
wxSYS_ICONSPACING_X,
wxSYS_ICONSPACING_Y,
wxSYS_WINDOWMIN_X,
wxSYS_WINDOWMIN_Y,
wxSYS_SCREEN_X,
wxSYS_SCREEN_Y,
wxSYS_FRAMESIZE_X,
wxSYS_FRAMESIZE_Y,
wxSYS_SMALLICON_X,
wxSYS_SMALLICON_Y,
wxSYS_HSCROLL_Y,
wxSYS_VSCROLL_X,
wxSYS_VSCROLL_ARROW_X,
wxSYS_VSCROLL_ARROW_Y,
wxSYS_VTHUMB_Y,
wxSYS_CAPTION_Y,
wxSYS_MENU_Y,
wxSYS_NETWORK_PRESENT,
wxSYS_PENWINDOWS_PRESENT,
wxSYS_SHOW_SOUNDS,
wxSYS_SWAP_BUTTONS
};
enum wxSystemFeature
{
wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
wxSYS_CAN_ICONIZE_FRAME
};
enum wxSystemScreenType
{
wxSYS_SCREEN_NONE = 0, // not yet defined
wxSYS_SCREEN_TINY, // <
wxSYS_SCREEN_PDA, // >= 320x240
wxSYS_SCREEN_SMALL, // >= 640x480
wxSYS_SCREEN_DESKTOP // >= 800x600
};
//---------------------------------------------------------------------------
class wxSystemSettings
{
public:
// get a standard system colour
static wxColour GetColour(wxSystemColour index);
// get a standard system font
static wxFont GetFont(wxSystemFont index);
// get a system-dependent metric
static int GetMetric(wxSystemMetric index);
// return true if the port has certain feature
static bool HasFeature(wxSystemFeature index);
// Get system screen design (desktop, pda, ..) used for
// laying out various dialogs.
static wxSystemScreenType GetScreenType();
// Override default.
static void SetScreenType( wxSystemScreenType screen );
};
//---------------------------------------------------------------------------
class wxSystemOptions : public wxObject
{
public:
wxSystemOptions() { }
// User-customizable hints to wxWindows or associated libraries
// These could also be used to influence GetSystem... calls, indeed
// to implement SetSystemColour/Font/Metric
static void SetOption(const wxString& name, const wxString& value);
%name(SetOptionInt) static void SetOption(const wxString& name, int value);
static wxString GetOption(const wxString& name) ;
static int GetOptionInt(const wxString& name) ;
static bool HasOption(const wxString& name) ;
};
//---------------------------------------------------------------------------

488
wxPython/src/_sizers.i Normal file
View File

@@ -0,0 +1,488 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _sizers.i
// Purpose: SWIG interface defs for the Sizers
//
// Author: Robin Dunn
//
// Created: 18-Sept-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%newgroup;
class wxSizerItem : public wxObject {
public:
wxSizerItem();
%name(SizerItemSpacer) wxSizerItem( int width, int height, int proportion, int flag, int border, wxObject* userData);
%name(SizerItemWindow) wxSizerItem( wxWindow *window, int proportion, int flag, int border, wxObject* userData );
%name(SizerItemSizer) wxSizerItem( wxSizer *sizer, int proportion, int flag, int border, wxObject* userData );
void DeleteWindows();
void DetachSizer();
wxSize GetSize();
wxSize CalcMin();
void SetDimension( wxPoint pos, wxSize size );
wxSize GetMinSize();
void SetInitSize( int x, int y );
%name(SetRatioWH) void SetRatio( int width, int height );
%name(SetRatioSize) void SetRatio( wxSize size );
void SetRatio( float ratio );
float GetRatio();
bool IsWindow();
bool IsSizer();
bool IsSpacer();
void SetProportion( int proportion );
int GetProportion();
void SetFlag( int flag );
int GetFlag();
void SetBorder( int border );
int GetBorder();
wxWindow *GetWindow();
void SetWindow( wxWindow *window );
wxSizer *GetSizer();
void SetSizer( wxSizer *sizer );
const wxSize& GetSpacer();
void SetSpacer( const wxSize &size );
void Show( bool show );
bool IsShown();
wxPoint GetPosition();
// wxObject* GetUserData();
%extend {
// Assume that the user data is a wxPyUserData object and return the contents
PyObject* GetUserData() {
wxPyUserData* data = (wxPyUserData*)self->GetUserData();
if (data) {
Py_INCREF(data->m_obj);
return data->m_obj;
} else {
Py_INCREF(Py_None);
return Py_None;
}
}
}
};
//---------------------------------------------------------------------------
%{
// Figure out the type of the sizer item
struct wxPySizerItemInfo {
wxPySizerItemInfo()
: window(NULL), sizer(NULL), gotSize(false),
size(wxDefaultSize), gotPos(false), pos(-1)
{}
wxWindow* window;
wxSizer* sizer;
bool gotSize;
wxSize size;
bool gotPos;
int pos;
};
static wxPySizerItemInfo wxPySizerItemTypeHelper(PyObject* item, bool checkSize, bool checkIdx ) {
wxPySizerItemInfo info;
wxSize size;
wxSize* sizePtr = &size;
// Find out what the type of the item is
// try wxWindow
if ( ! wxPyConvertSwigPtr(item, (void**)&info.window, wxT("wxWindow")) ) {
PyErr_Clear();
info.window = NULL;
// try wxSizer
if ( ! wxPyConvertSwigPtr(item, (void**)&info.sizer, wxT("wxSizer")) ) {
PyErr_Clear();
info.sizer = NULL;
// try wxSize or (w,h)
if ( checkSize && wxSize_helper(item, &sizePtr)) {
info.size = *sizePtr;
info.gotSize = true;
}
// or a single int
if (checkIdx && PyInt_Check(item)) {
info.pos = PyInt_AsLong(item);
info.gotPos = true;
}
}
}
if ( !(info.window || info.sizer || (checkSize && info.gotSize) || (checkIdx && info.gotPos)) ) {
// no expected type, figure out what kind of error message to generate
if ( !checkSize && !checkIdx )
PyErr_SetString(PyExc_TypeError, "wxWindow or wxSizer expected for item");
else if ( checkSize && !checkIdx )
PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) expected for item");
else if ( !checkSize && checkIdx)
PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer or int (position) expected for item");
else
// can this one happen?
PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) or int (position) expected for item");
}
return info;
}
%}
class wxSizer : public wxObject {
public:
// wxSizer(); **** abstract, can't instantiate
// ~wxSizer();
%extend {
void _setOORInfo(PyObject* _self) {
self->SetClientObject(new wxPyOORClientData(_self));
}
void Add(PyObject* item, int proportion=0, int flag=0, int border=0,
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
wxPyEndBlockThreads();
// Now call the real Add method if a valid item type was found
if ( info.window )
self->Add(info.window, proportion, flag, border, data);
else if ( info.sizer )
self->Add(info.sizer, proportion, flag, border, data);
else if (info.gotSize)
self->Add(info.size.GetWidth(), info.size.GetHeight(),
proportion, flag, border, data);
}
void Insert(int before, PyObject* item, int proportion=0, int flag=0,
int border=0, PyObject* userData=NULL) {
wxPyUserData* data = NULL;
wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
wxPyEndBlockThreads();
// Now call the real Insert method if a valid item type was found
if ( info.window )
self->Insert(before, info.window, proportion, flag, border, data);
else if ( info.sizer )
self->Insert(before, info.sizer, proportion, flag, border, data);
else if (info.gotSize)
self->Insert(before, info.size.GetWidth(), info.size.GetHeight(),
proportion, flag, border, data);
}
void Prepend(PyObject* item, int proportion=0, int flag=0, int border=0,
PyObject* userData=NULL) {
wxPyUserData* data = NULL;
wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
if ( userData && (info.window || info.sizer || info.gotSize) )
data = new wxPyUserData(userData);
wxPyEndBlockThreads();
// Now call the real Prepend method if a valid item type was found
if ( info.window )
self->Prepend(info.window, proportion, flag, border, data);
else if ( info.sizer )
self->Prepend(info.sizer, proportion, flag, border, data);
else if (info.gotSize)
self->Prepend(info.size.GetWidth(), info.size.GetHeight(),
proportion, flag, border, data);
}
bool Remove(PyObject* item) {
wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
wxPyEndBlockThreads();
if ( info.window )
return self->Remove(info.window);
else if ( info.sizer )
return self->Remove(info.sizer);
else if ( info.gotPos )
return self->Remove(info.pos);
else
return FALSE;
}
void _SetItemMinSize(PyObject* item, wxSize size) {
wxPyBeginBlockThreads();
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
wxPyEndBlockThreads();
if ( info.window )
self->SetItemMinSize(info.window, size);
else if ( info.sizer )
self->SetItemMinSize(info.sizer, size);
else if ( info.gotPos )
self->SetItemMinSize(info.pos, size);
}
}
%name(AddItem) void Add( wxSizerItem *item );
%name(InsertItem) void Insert( size_t index, wxSizerItem *item );
%name(PrependItem) void Prepend( wxSizerItem *item );
%pythoncode {
def AddMany(self, widgets):
for childinfo in widgets:
if type(childinfo) != type(()):
childinfo = (childinfo, )
self.Add(*childinfo)
# for backwards compatibility only, do not use in new code
AddWindow = AddSizer = AddSpacer = Add
PrependWindow = PrependSizer = PrependSpacer = Prepend
InsertWindow = InsertSizer = InsertSpacer = Insert
RemoveWindow = RemoveSizer = RemovePos = Remove
def SetItemMinSize(self, item, *args):
if len(args) == 2:
return self._SetItemMinSize(item, args)
else:
return self._SetItemMinSize(item, args[0])
}
void SetDimension( int x, int y, int width, int height );
void SetMinSize(wxSize size);
wxSize GetSize();
wxPoint GetPosition();
wxSize GetMinSize();
%pythoncode {
def GetSizeTuple(self):
return self.GetSize().asTuple()
def GetPositionTuple(self):
return self.GetPosition().asTuple()
def GetMinSizeTuple(self):
return self.GetMinSize().asTuple()
}
virtual void RecalcSizes();
virtual wxSize CalcMin();
void Layout();
wxSize Fit( wxWindow *window );
void FitInside( wxWindow *window );
void SetSizeHints( wxWindow *window );
void SetVirtualSizeHints( wxWindow *window );
void Clear( bool delete_windows=FALSE );
void DeleteWindows();
// wxList& GetChildren();
%extend {
PyObject* GetChildren() {
wxSizerItemList& list = self->GetChildren();
return wxPy_ConvertList(&list);
}
}
// Manage whether individual windows or sub-sizers are considered
// in the layout calculations or not.
%extend {
void Show(PyObject* item, bool show = TRUE) {
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, false);
if ( info.window )
self->Show(info.window, show);
else if ( info.sizer )
self->Show(info.sizer, show);
}
void Hide(PyObject* item) {
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, false);
if ( info.window )
self->Hide(info.window);
else if ( info.sizer )
self->Hide(info.sizer);
}
bool IsShown(PyObject* item) {
wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, false);
if ( info.window )
return self->IsShown(info.window);
else if ( info.sizer )
return self->IsShown(info.sizer);
else
return false;
}
}
// Recursively call wxWindow::Show() on all sizer items.
void ShowItems(bool show);
};
//---------------------------------------------------------------------------
// Use this one for deriving Python classes from
%{
// See pyclasses.h
IMP_PYCALLBACK___pure(wxPySizer, wxSizer, RecalcSizes);
IMP_PYCALLBACK_wxSize__pure(wxPySizer, wxSizer, CalcMin);
IMPLEMENT_DYNAMIC_CLASS(wxPySizer, wxSizer);
%}
class wxPySizer : public wxSizer {
public:
%addtofunc wxPySizer "self._setCallbackInfo(self, PySizer);self._setOORInfo(self)"
wxPySizer();
void _setCallbackInfo(PyObject* self, PyObject* _class);
};
//---------------------------------------------------------------------------
%newgroup;
class wxBoxSizer : public wxSizer {
public:
%addtofunc wxBoxSizer "self._setOORInfo(self)"
wxBoxSizer(int orient = wxHORIZONTAL);
int GetOrientation();
void SetOrientation(int orient);
void RecalcSizes();
wxSize CalcMin();
};
//---------------------------------------------------------------------------
%newgroup;
class wxStaticBoxSizer : public wxBoxSizer {
public:
%addtofunc wxStaticBoxSizer "self._setOORInfo(self)"
wxStaticBoxSizer(wxStaticBox *box, int orient = wxHORIZONTAL);
wxStaticBox *GetStaticBox();
void RecalcSizes();
wxSize CalcMin();
};
//---------------------------------------------------------------------------
%newgroup;
class wxGridSizer: public wxSizer
{
public:
%addtofunc wxGridSizer "self._setOORInfo(self)"
wxGridSizer( int rows=1, int cols=0, int vgap=0, int hgap=0 );
void RecalcSizes();
wxSize CalcMin();
void SetCols( int cols );
void SetRows( int rows );
void SetVGap( int gap );
void SetHGap( int gap );
int GetCols();
int GetRows();
int GetVGap();
int GetHGap();
};
//---------------------------------------------------------------------------
%newgroup;
enum wxFlexSizerGrowMode
{
// don't resize the cells in non-flexible direction at all
wxFLEX_GROWMODE_NONE,
// uniformly resize only the specified ones (default)
wxFLEX_GROWMODE_SPECIFIED,
// uniformly resize all cells
wxFLEX_GROWMODE_ALL
};
class wxFlexGridSizer: public wxGridSizer
{
public:
%addtofunc wxFlexGridSizer "self._setOORInfo(self)"
wxFlexGridSizer( int rows=1, int cols=0, int vgap=0, int hgap=0 );
void RecalcSizes();
wxSize CalcMin();
void AddGrowableRow( size_t idx, int proportion = 0 );
void RemoveGrowableRow( size_t idx );
void AddGrowableCol( size_t idx, int proportion = 0 );
void RemoveGrowableCol( size_t idx );
// the sizer cells may grow in both directions, not grow at all or only
// grow in one direction but not the other
// the direction may be wxVERTICAL, wxHORIZONTAL or wxBOTH (default)
void SetFlexibleDirection(int direction);
int GetFlexibleDirection();
// note that the grow mode only applies to the direction which is not
// flexible
void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode);
wxFlexSizerGrowMode GetNonFlexibleGrowMode();
};
//---------------------------------------------------------------------------

85
wxPython/src/_slider.i Normal file
View File

@@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _slider.i
// Purpose: SWIG interface defs for wxSlider
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/slider.h>
DECLARE_DEF_STRING(SliderNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
class wxSlider : public wxControl {
public:
%addtofunc wxSlider "self._setOORInfo(self)"
%addtofunc wxSlider() ""
wxSlider(wxWindow* parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& point = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPySliderNameStr);
%name(PreSlider)wxSlider();
bool Create(wxWindow* parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& point = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPySliderNameStr);
// get/set the current slider value (should be in range)
virtual int GetValue() const;
virtual void SetValue(int value);
// retrieve/change the range
virtual void SetRange(int minValue, int maxValue);
virtual int GetMin() const;
virtual int GetMax() const;
void SetMin( int minValue );
void SetMax( int maxValue );
// the line/page size is the increment by which the slider moves when
// cursor arrow key/page up or down are pressed (clicking the mouse is like
// pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
virtual void SetLineSize(int lineSize);
virtual void SetPageSize(int pageSize);
virtual int GetLineSize() const;
virtual int GetPageSize() const;
// these methods get/set the length of the slider pointer in pixels
virtual void SetThumbLength(int lenPixels);
virtual int GetThumbLength() const;
virtual void SetTickFreq(int n, int pos);
virtual int GetTickFreq() const;
virtual void ClearTicks();
virtual void SetTick(int tickPos);
virtual void ClearSel();
virtual int GetSelEnd() const;
virtual int GetSelStart() const;
virtual void SetSelection(int min, int max);
};
//---------------------------------------------------------------------------

134
wxPython/src/_spin.i Normal file
View File

@@ -0,0 +1,134 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _spin.i
// Purpose: SWIG interface defs for wxSpinButton and wxSpinCtrl
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(SPIN_BUTTON_NAME);
wxChar* wxSpinCtrlNameStr = _T("wxSpinCtrl");
DECLARE_DEF_STRING(SpinCtrlNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
enum {
wxSP_HORIZONTAL,
wxSP_VERTICAL,
wxSP_ARROW_KEYS,
wxSP_WRAP
};
// The wxSpinButton is like a small scrollbar than is often placed next
// to a text control.
//
// Styles:
// wxSP_HORIZONTAL: horizontal spin button
// wxSP_VERTICAL: vertical spin button (the default)
// wxSP_ARROW_KEYS: arrow keys increment/decrement value
// wxSP_WRAP: value wraps at either end
class wxSpinButton : public wxControl
{
public:
%addtofunc wxSpinButton "self._setOORInfo(self)"
%addtofunc wxSpinButton() ""
wxSpinButton(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_HORIZONTAL,
const wxString& name = wxPySPIN_BUTTON_NAME);
%name(PreSpinButton)wxSpinButton();
bool Create(wxWindow* parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_HORIZONTAL,
const wxString& name = wxPySPIN_BUTTON_NAME);
virtual int GetValue() const;
virtual int GetMin() const;
virtual int GetMax() const;
virtual void SetValue(int val);
virtual void SetMin(int minVal);
virtual void SetMax(int maxVal);
virtual void SetRange(int minVal, int maxVal);
// is this spin button vertically oriented?
bool IsVertical() const;
};
//---------------------------------------------------------------------------
// a spin ctrl is a text control with a spin button which is usually used to
// prompt the user for a numeric input
class wxSpinCtrl : public wxControl
{
public:
%addtofunc wxSpinCtrl "self._setOORInfo(self)"
%addtofunc wxSpinCtrl() ""
wxSpinCtrl(wxWindow *parent,
wxWindowID id = -1,
const wxString& value = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int initial = 0,
const wxString& name = wxPySpinCtrlNameStr);
%name(PreSpinCtrl)wxSpinCtrl();
bool Create(wxWindow *parent,
wxWindowID id = -1,
const wxString& value = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int initial = 0,
const wxString& name = wxPySpinCtrlNameStr);
virtual int GetValue() const;
virtual void SetValue( int value );
%name(SetValueString) void SetValue(const wxString& text);
virtual void SetRange( int minVal, int maxVal );
virtual int GetMin() const;
virtual int GetMax() const;
#ifdef __WXGTK__
%extend {
void SetSelection(long from, long to) {
}
}
#else
void SetSelection(long from, long to);
#endif
};
%constant wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED;
%pythoncode {
EVT_SPINCTRL = wx.PyEventBinder( wxEVT_COMMAND_SPINCTRL_UPDATED, 1)
}
//---------------------------------------------------------------------------

194
wxPython/src/_splitter.i Normal file
View File

@@ -0,0 +1,194 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _splitter.i
// Purpose: SWIG interface defs for wxSplitterWindow
//
// Author: Robin Dunn
//
// Created: 2-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
static const wxChar* wxSplitterNameStr = wxT("splitter");
DECLARE_DEF_STRING(SplitterNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
enum {
wxSP_NOBORDER,
wxSP_NOSASH,
wxSP_PERMIT_UNSPLIT,
wxSP_LIVE_UPDATE,
wxSP_3DSASH,
wxSP_3DBORDER,
wxSP_BORDER,
wxSP_3D,
};
enum wxSplitMode
{
wxSPLIT_HORIZONTAL = 1,
wxSPLIT_VERTICAL
};
enum
{
wxSPLIT_DRAG_NONE,
wxSPLIT_DRAG_DRAGGING,
wxSPLIT_DRAG_LEFT_DOWN
};
//---------------------------------------------------------------------------
// wxSplitterWindow maintains one or two panes, with an optional vertical or
// horizontal split which can be used with the mouse or programmatically.
class wxSplitterWindow: public wxWindow
{
public:
%addtofunc wxSplitterWindow "self._setOORInfo(self)"
%addtofunc wxSplitterWindow() ""
wxSplitterWindow(wxWindow* parent, wxWindowID id,
const wxPoint& point = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style=wxSP_3D,
const wxString& name = wxPySplitterNameStr);
%name(PreSplitterWindow)wxSplitterWindow();
bool Create(wxWindow* parent, wxWindowID id,
const wxPoint& point = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style=wxSP_3D,
const wxString& name = wxPySplitterNameStr);
// Gets the only or left/top pane
wxWindow *GetWindow1() const;
// Gets the right/bottom pane
wxWindow *GetWindow2() const;
// Sets the split mode
void SetSplitMode(int mode);
// Gets the split mode
wxSplitMode GetSplitMode() const;
// Initialize with one window
void Initialize(wxWindow *window);
// Associates the given window with window 2, drawing the appropriate sash
// and changing the split mode.
// Does nothing and returns FALSE if the window is already split.
// A sashPosition of 0 means choose a default sash position,
// negative sashPosition specifies the size of right/lower pane as it's
// absolute value rather than the size of left/upper pane.
virtual bool SplitVertically(wxWindow *window1,
wxWindow *window2,
int sashPosition = 0);
virtual bool SplitHorizontally(wxWindow *window1,
wxWindow *window2,
int sashPosition = 0);
// Removes the specified (or second) window from the view
// Doesn't actually delete the window.
bool Unsplit(wxWindow *toRemove = NULL);
// Replaces one of the windows with another one (neither old nor new
// parameter should be NULL)
bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
// Is the window split?
bool IsSplit() const;
// Sets the sash size
void SetSashSize(int width);
// Sets the border size
void SetBorderSize(int width);
// Gets the sash size
int GetSashSize() const;
// Gets the border size
int GetBorderSize() const;
// Set the sash position
void SetSashPosition(int position, bool redraw = TRUE);
// Gets the sash position
int GetSashPosition() const;
// If this is zero, we can remove panes by dragging the sash.
void SetMinimumPaneSize(int min);
int GetMinimumPaneSize() const;
// Tests for x, y over sash
virtual bool SashHitTest(int x, int y, int tolerance = 5);
// Resizes subwindows
virtual void SizeWindows();
void SetNeedUpdating(bool needUpdating);
bool GetNeedUpdating() const;
};
// we reuse the same class for all splitter event types because this is the
// usual wxWin convention, but the three event types have different kind of
// data associated with them, so the accessors can be only used if the real
// event type matches with the one for which the accessors make sense
class wxSplitterEvent : public wxNotifyEvent
{
public:
wxSplitterEvent(wxEventType type = wxEVT_NULL,
wxSplitterWindow *splitter = (wxSplitterWindow *)NULL);
// SASH_POS_CHANGED methods
// setting the sash position to -1 prevents the change from taking place at
// all
void SetSashPosition(int pos);
int GetSashPosition() const;
// UNSPLIT event methods
wxWindow *GetWindowBeingRemoved() const;
// DCLICK event methods
int GetX() const;
int GetY() const;
};
%constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED;
%constant wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING;
%constant wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED;
%constant wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT;
%pythoncode {
EVT_SPLITTER_SASH_POS_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 1 )
EVT_SPLITTER_SASH_POS_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 1 )
EVT_SPLITTER_DOUBLECLICKED = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 1 )
EVT_SPLITTER_UNSPLIT = wx.PyEventBinder( wxEVT_COMMAND_SPLITTER_UNSPLIT, 1 )
}
//---------------------------------------------------------------------------

130
wxPython/src/_statctrls.i Normal file
View File

@@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _statctrls.i
// Purpose: SWIG interface defs for wxStaticBox, wxStaticLine,
// wxStaticText, wxStaticBitmap
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(StaticBitmapNameStr);
DECLARE_DEF_STRING(StaticBoxNameStr);
DECLARE_DEF_STRING(StaticTextNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
class wxStaticBox : public wxControl {
public:
%addtofunc wxStaticBox "self._setOORInfo(self)"
%addtofunc wxStaticBox() ""
wxStaticBox(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyStaticBoxNameStr);
%name(PreStaticBox)wxStaticBox();
bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyStaticBoxNameStr);
};
//---------------------------------------------------------------------------
%newgroup
class wxStaticLine : public wxControl {
public:
%addtofunc wxStaticLine "self._setOORInfo(self)"
%addtofunc wxStaticLine() ""
wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL,
const wxString& name = wxPyStaticTextNameStr);
%name(PreStaticLine)wxStaticLine();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxLI_HORIZONTAL,
const wxString& name = wxPyStaticTextNameStr);
// is the line vertical?
bool IsVertical() const;
// get the default size for the "lesser" dimension of the static line
static int GetDefaultSize() { return 2; }
};
//---------------------------------------------------------------------------
%newgroup
class wxStaticText : public wxControl {
public:
%addtofunc wxStaticText "self._setOORInfo(self)"
%addtofunc wxStaticText() ""
wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyStaticTextNameStr);
%name(PreStaticText)wxStaticText();
bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyStaticTextNameStr);
};
//---------------------------------------------------------------------------
%newgroup
class wxStaticBitmap : public wxControl {
public:
%addtofunc wxStaticText "self._setOORInfo(self)"
%addtofunc wxStaticText() ""
wxStaticBitmap(wxWindow* parent, wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyStaticBitmapNameStr);
%name(PreStaticBitmap)wxStaticBitmap();
bool Create(wxWindow* parent, wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPyStaticBitmapNameStr);
wxBitmap GetBitmap();
void SetBitmap(const wxBitmap& bitmap);
void SetIcon(const wxIcon& icon);
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

73
wxPython/src/_statusbar.i Normal file
View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _statusbar.i
// Purpose: SWIG interface defs for wxStatusBar
//
// Author: Robin Dunn
//
// Created: 24-Aug-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%newgroup;
// wxStatusBar: a window near the bottom of the frame used for status info
class wxStatusBar : public wxWindow
{
public:
%addtofunc wxStatusBar "self._setOORInfo(self)"
%addtofunc wxStatusBar() ""
wxStatusBar(wxWindow* parent, wxWindowID id = -1,
long style = wxST_SIZEGRIP,
const wxString& name = wxPyStatusLineNameStr);
%name(PreStatusBar)wxStatusBar();
bool Create(wxWindow* parent, wxWindowID id,
long style = wxST_SIZEGRIP,
const wxString& name = wxPyStatusLineNameStr);
// set the number of fields and call SetStatusWidths(widths) if widths are
// given
virtual void SetFieldsCount(int number = 1 /*, const int *widths = NULL*/);
int GetFieldsCount() const;
virtual void SetStatusText(const wxString& text, int number = 0);
virtual wxString GetStatusText(int number = 0) const;
void PushStatusText(const wxString& text, int number = 0);
void PopStatusText(int number = 0);
// set status field widths as absolute numbers: positive widths mean that
// the field has the specified absolute width, negative widths are
// interpreted as the sizer options, i.e. the extra space (total space
// minus the sum of fixed width fields) is divided between the fields with
// negative width according to the abs value of the width (field with width
// -2 grows twice as much as one with width -1 &c)
virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap in _toplvl.i
// Get the position and size of the field's internal bounding rectangle
virtual bool GetFieldRect(int i, wxRect& rect) const;
// sets the minimal vertical size of the status bar
virtual void SetMinHeight(int height);
// get the dimensions of the horizontal and vertical borders
virtual int GetBorderX() const;
virtual int GetBorderY() const;
};
//---------------------------------------------------------------------------

146
wxPython/src/_stockobjs.i Normal file
View File

@@ -0,0 +1,146 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _stockobjs.i
// Purpose: SWIG interface defining "stock" GDI objects
//
// Author: Robin Dunn
//
// Created: 13-Sept-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
class wxPenList : public wxObject {
public:
void AddPen(wxPen* pen);
wxPen* FindOrCreatePen(const wxColour& colour, int width, int style);
void RemovePen(wxPen* pen);
int GetCount();
};
//---------------------------------------------------------------------------
class wxBrushList : public wxObject {
public:
void AddBrush(wxBrush *brush);
wxBrush * FindOrCreateBrush(const wxColour& colour, int style);
void RemoveBrush(wxBrush *brush);
int GetCount();
};
//---------------------------------------------------------------------------
class wxColourDatabase : public wxObject {
public:
wxColourDatabase();
~wxColourDatabase();
// find colour by name or name for the given colour
wxColour Find(const wxString& name) const;
wxString FindName(const wxColour& colour) const;
%pythoncode { FindColour = Find }
// add a new colour to the database
void AddColour(const wxString& name, const wxColour& colour);
%extend {
void Append(const wxString& name, int red, int green, int blue) {
self->AddColour(name, wxColour(red, green, blue));
}
}
};
//---------------------------------------------------------------------------
class wxFontList : public wxObject {
public:
void AddFont(wxFont* font);
wxFont * FindOrCreateFont(int point_size, int family, int style, int weight,
bool underline = FALSE, const wxString& facename = wxPyEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
void RemoveFont(wxFont *font);
int GetCount();
};
//---------------------------------------------------------------------------
%newgroup
// See also wxPy_ReinitStockObjects in helpers.cpp
%immutable;
wxFont* const wxNORMAL_FONT;
wxFont* const wxSMALL_FONT;
wxFont* const wxITALIC_FONT;
wxFont* const wxSWISS_FONT;
wxPen* const wxRED_PEN;
wxPen* const wxCYAN_PEN;
wxPen* const wxGREEN_PEN;
wxPen* const wxBLACK_PEN;
wxPen* const wxWHITE_PEN;
wxPen* const wxTRANSPARENT_PEN;
wxPen* const wxBLACK_DASHED_PEN;
wxPen* const wxGREY_PEN;
wxPen* const wxMEDIUM_GREY_PEN;
wxPen* const wxLIGHT_GREY_PEN;
wxBrush* const wxBLUE_BRUSH;
wxBrush* const wxGREEN_BRUSH;
wxBrush* const wxWHITE_BRUSH;
wxBrush* const wxBLACK_BRUSH;
wxBrush* const wxTRANSPARENT_BRUSH;
wxBrush* const wxCYAN_BRUSH;
wxBrush* const wxRED_BRUSH;
wxBrush* const wxGREY_BRUSH;
wxBrush* const wxMEDIUM_GREY_BRUSH;
wxBrush* const wxLIGHT_GREY_BRUSH;
wxColour* const wxBLACK;
wxColour* const wxWHITE;
wxColour* const wxRED;
wxColour* const wxBLUE;
wxColour* const wxGREEN;
wxColour* const wxCYAN;
wxColour* const wxLIGHT_GREY;
wxCursor* const wxSTANDARD_CURSOR;
wxCursor* const wxHOURGLASS_CURSOR;
wxCursor* const wxCROSS_CURSOR;
const wxBitmap wxNullBitmap;
const wxIcon wxNullIcon;
const wxCursor wxNullCursor;
const wxPen wxNullPen;
const wxBrush wxNullBrush;
const wxPalette wxNullPalette;
const wxFont wxNullFont;
const wxColour wxNullColour;
wxFontList* const wxTheFontList;
wxPenList* const wxThePenList;
wxBrushList* const wxTheBrushList;
wxColourDatabase* const wxTheColourDatabase;
%mutable;
//---------------------------------------------------------------------------

View File

@@ -1,91 +1,64 @@
/////////////////////////////////////////////////////////////////////////////
// Name: streams.i
// Purpose: SWIG definitions of the wxFileSystem family of classes
// Name: _streams.i
// Purpose: SWIG typemaps and wrappers for wxInputStream
//
// Author: Joerg Baumann and Robin Dunn
// Author: Robin Dunn
//
// Created: 25-Sept-2000
// RCS-ID: $Id$
// Copyright: (c) 2000 by Joerg Baumann
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%module streams
// Not a %module
//---------------------------------------------------------------------------
%{
#include "helpers.h"
#include "pyistream.h"
#include <wx/stream.h>
#include <wx/list.h>
#include "wx/wxPython/pyistream.h"
%}
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
%newgroup
%include typemaps.i
%include my_typemaps.i
// Import some definitions of other classes, etc.
%import _defs.i
%pragma(python) code = "import wx"
//----------------------------------------------------------------------
// typemaps for wxInputStream
%typemap(python,in) wxInputStream * (wxPyInputStream* temp, bool created) {
if (SWIG_GetPtrObj($source, (void **) &temp, "_wxPyInputStream_p") == 0) {
$target = temp->m_wxis;
created = FALSE;
%typemap(in) wxInputStream* (wxPyInputStream* temp, bool created) {
if (wxPyConvertSwigPtr($input, (void **)&temp, wxT("wxPyInputStream"))) {
$1 = temp->m_wxis;
created = false;
} else {
$target = wxPyCBInputStream_create($source, FALSE);
if ($target == NULL) {
PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object.");
return NULL;
PyErr_Clear(); // clear the failure of the wxPyConvert above
$1 = wxPyCBInputStream_create($input, false);
if ($1 == NULL) {
PyErr_SetString(PyExc_TypeError, "Expected wxInputStream or Python file-like object.");
SWIG_fail;
}
created = TRUE;
created = true;
}
}
%typemap(python, freearg) wxInputStream * {
if (created)
delete $source;
%typemap(freearg) wxInputStream* {
if (created$argnum)
delete $1;
}
// typemaps for wxInputStream
%typemap(python,out) wxInputStream* {
%typemap(in) wxInputStream& = wxInputStream*;
%typemap(freearg) wxInputStream& = wxInputStream*;
%typemap(out) wxInputStream* {
wxPyInputStream * _ptr = NULL;
if ($source) {
_ptr = new wxPyInputStream($source);
if ($1) {
_ptr = new wxPyInputStream($1);
}
$target = wxPyConstructObject(_ptr, wxT("wxInputStream"), TRUE);
$result = wxPyConstructObject(_ptr, wxT("wxPyInputStream"), true);
}
//----------------------------------------------------------------------
// // wxStringPtrList* to python list of strings typemap
// %typemap(python, out) wxStringPtrList* {
// if ($source) {
// $target = PyList_New($source->GetCount());
// wxStringPtrList::Node *node = $source->GetFirst();
// for (int i=0; node; i++) {
// wxString *s = node->GetData();
// #if wxUSE_UNICODE
// PyList_SetItem($target, i, PyUnicode_FromUnicode(s->c_str(), s->Len()));
// #else
// PyList_SetItem($target, i, PyString_FromStringAndSize(s->c_str(), s->Len()));
// #endif
// node = node->GetNext();
// delete s;
// }
// delete $source;
// }
// else
// $target=0;
// }
//---------------------------------------------------------------------------
enum wxSeekMode
{
@@ -96,9 +69,9 @@ enum wxSeekMode
%name(wxInputStream) class wxPyInputStream {
%name(InputStream) class wxPyInputStream {
public:
%addmethods {
%extend {
wxPyInputStream(PyObject* p) {
wxInputStream* wxis = wxPyCBInputStream::create(p);
if (wxis)
@@ -107,6 +80,7 @@ public:
return NULL;
}
}
void close();
void flush();
bool eof();
@@ -133,7 +107,7 @@ public:
long SeekI(long pos, wxSeekMode mode = wxFromStart);
long TellI();
}
};
@@ -155,7 +129,7 @@ public:
void writelines(wxStringPtrList);
*/
%addmethods {
%extend {
void write(PyObject* obj) {
// We use only strings for the streams, not unicode
PyObject* str = PyObject_Str(obj);
@@ -171,15 +145,8 @@ public:
};
// restore except and typemaps
%typemap(python,out) wxStringPtrList*;
%typemap(python,out) wxPyInputStream*;
//----------------------------------------------------------------------
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxInputStream", "wxPyInputStream");
%}
//----------------------------------------------------------------------
//---------------------------------------------------------------------------

105
wxPython/src/_taskbar.i Normal file
View File

@@ -0,0 +1,105 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _taskbar.i
// Purpose: SWIG interface defs for wxTaskBarIcon
//
// Author: Robin Dunn
//
// Created: 2-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
%}
//---------------------------------------------------------------------------
%newgroup;
%{
#ifdef __WXMAC__
// implement dummy classes and such for wxMac
class wxTaskBarIcon : public wxEvtHandler
{
public:
wxTaskBarIcon() { PyErr_SetNone(PyExc_NotImplementedError); }
};
class wxTaskBarIconEvent : public wxEvent
{
public:
wxTaskBarIconEvent(wxEventType, wxTaskBarIcon *)
{ PyErr_SetNone(PyExc_NotImplementedError); }
virtual wxEvent* Clone() const { return NULL; }
};
enum {
wxEVT_TASKBAR_MOVE = 0,
wxEVT_TASKBAR_LEFT_DOWN = 0,
wxEVT_TASKBAR_LEFT_UP = 0,
wxEVT_TASKBAR_RIGHT_DOWN = 0,
wxEVT_TASKBAR_RIGHT_UP = 0,
wxEVT_TASKBAR_LEFT_DCLICK = 0,
wxEVT_TASKBAR_RIGHT_DCLICK = 0,
};
#endif
%}
class wxTaskBarIcon : public wxEvtHandler
{
public:
wxTaskBarIcon();
~wxTaskBarIcon();
#ifndef __WXMAC__
bool IsOk() const;
bool IsIconInstalled() const;
bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxPyEmptyString);
bool RemoveIcon(void);
bool PopupMenu(wxMenu *menu);
#endif
};
class wxTaskBarIconEvent : public wxEvent
{
public:
wxTaskBarIconEvent(wxEventType evtType, wxTaskBarIcon *tbIcon);
};
%constant wxEventType wxEVT_TASKBAR_MOVE;
%constant wxEventType wxEVT_TASKBAR_LEFT_DOWN;
%constant wxEventType wxEVT_TASKBAR_LEFT_UP;
%constant wxEventType wxEVT_TASKBAR_RIGHT_DOWN;
%constant wxEventType wxEVT_TASKBAR_RIGHT_UP;
%constant wxEventType wxEVT_TASKBAR_LEFT_DCLICK;
%constant wxEventType wxEVT_TASKBAR_RIGHT_DCLICK;
%pythoncode {
EVT_TASKBAR_MOVE = wx.PyEventBinder ( wxEVT_TASKBAR_MOVE )
EVT_TASKBAR_LEFT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DOWN )
EVT_TASKBAR_LEFT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_UP )
EVT_TASKBAR_RIGHT_DOWN = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DOWN )
EVT_TASKBAR_RIGHT_UP = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_UP )
EVT_TASKBAR_LEFT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_LEFT_DCLICK )
EVT_TASKBAR_RIGHT_DCLICK = wx.PyEventBinder ( wxEVT_TASKBAR_RIGHT_DCLICK )
}
//---------------------------------------------------------------------------

21
wxPython/src/_template.i Normal file
View File

@@ -0,0 +1,21 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _????.i
// Purpose: SWIG interface for wx????
//
// Author: Robin Dunn
//
// Created: 9-Aug-2003
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
//---------------------------------------------------------------------------

328
wxPython/src/_textctrl.i Normal file
View File

@@ -0,0 +1,328 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _textctrl.i
// Purpose: SWIG interface defs for wxTextCtrl and related classes
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
DECLARE_DEF_STRING(TextCtrlNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
enum {
// Style flags
wxTE_NO_VSCROLL,
wxTE_AUTO_SCROLL,
wxTE_READONLY,
wxTE_MULTILINE,
wxTE_PROCESS_TAB,
// alignment flags
wxTE_LEFT,
wxTE_CENTER,
wxTE_RIGHT,
wxTE_CENTRE,
// this style means to use RICHEDIT control and does something only under
// wxMSW and Win32 and is silently ignored under all other platforms
wxTE_RICH,
wxTE_PROCESS_ENTER,
wxTE_PASSWORD,
// automatically detect the URLs and generate the events when mouse is
// moved/clicked over an URL
//
// this is for Win32 richedit controls only so far
wxTE_AUTO_URL,
// by default, the Windows text control doesn't show the selection when it
// doesn't have focus - use this style to force it to always show it
wxTE_NOHIDESEL,
// use wxHSCROLL to not wrap text at all, wxTE_LINEWRAP to wrap it at any
// position and wxTE_WORDWRAP to wrap at words boundary
wxTE_DONTWRAP,
wxTE_LINEWRAP,
wxTE_WORDWRAP,
// force using RichEdit version 2.0 or 3.0 instead of 1.0 (default) for
// wxTE_RICH controls - can be used together with or instead of wxTE_RICH
wxTE_RICH2,
};
enum wxTextAttrAlignment
{
wxTEXT_ALIGNMENT_DEFAULT,
wxTEXT_ALIGNMENT_LEFT,
wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_RIGHT,
wxTEXT_ALIGNMENT_JUSTIFIED
};
enum {
// Flags to indicate which attributes are being applied
wxTEXT_ATTR_TEXT_COLOUR,
wxTEXT_ATTR_BACKGROUND_COLOUR,
wxTEXT_ATTR_FONT_FACE,
wxTEXT_ATTR_FONT_SIZE,
wxTEXT_ATTR_FONT_WEIGHT,
wxTEXT_ATTR_FONT_ITALIC,
wxTEXT_ATTR_FONT_UNDERLINE,
wxTEXT_ATTR_FONT,
wxTEXT_ATTR_ALIGNMENT,
wxTEXT_ATTR_LEFT_INDENT,
wxTEXT_ATTR_RIGHT_INDENT,
wxTEXT_ATTR_TABS
};
//---------------------------------------------------------------------------
// wxTextAttr: a structure containing the visual attributes of a text
class wxTextAttr
{
public:
%nokwargs wxTextAttr;
wxTextAttr();
wxTextAttr(const wxColour& colText,
const wxColour& colBack = wxNullColour,
const wxFont& font = wxNullFont,
wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
// operations
void Init();
// setters
void SetTextColour(const wxColour& colText);
void SetBackgroundColour(const wxColour& colBack);
void SetFont(const wxFont& font, long flags = wxTEXT_ATTR_FONT);
void SetAlignment(wxTextAttrAlignment alignment);
void SetTabs(const wxArrayInt& tabs);
void SetLeftIndent(int indent);
void SetRightIndent(int indent);
void SetFlags(long flags);
// accessors
bool HasTextColour() const;
bool HasBackgroundColour() const;
bool HasFont() const;
bool HasAlignment() const;
bool HasTabs() const;
bool HasLeftIndent() const;
bool HasRightIndent() const;
bool HasFlag(long flag) const;
const wxColour& GetTextColour() const;
const wxColour& GetBackgroundColour() const;
const wxFont& GetFont() const;
wxTextAttrAlignment GetAlignment() const;
const wxArrayInt& GetTabs() const;
long GetLeftIndent() const;
long GetRightIndent() const;
long GetFlags() const;
// returns false if we have any attributes set, true otherwise
bool IsDefault() const;
// return the attribute having the valid font and colours: it uses the
// attributes set in attr and falls back first to attrDefault and then to
// the text control font/colours for those attributes which are not set
static wxTextAttr Combine(const wxTextAttr& attr,
const wxTextAttr& attrDef,
const wxTextCtrl *text);
};
//---------------------------------------------------------------------------
// wxTextCtrl: a single or multiple line text zone where user can enter and
// edit text
class wxTextCtrl : public wxControl
{
public:
%addtofunc wxTextCtrl "self._setOORInfo(self)"
%addtofunc wxTextCtrl() ""
wxTextCtrl(wxWindow* parent, wxWindowID id,
const wxString& value = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyTextCtrlNameStr);
%name(PreTextCtrl)wxTextCtrl();
bool Create(wxWindow* parent, wxWindowID id,
const wxString& value = wxPyEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyTextCtrlNameStr);
virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
virtual wxString GetRange(long from, long to) const;
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const;
virtual bool IsModified() const;
virtual bool IsEditable() const;
// more readable flag testing methods
bool IsSingleLine() const;
bool IsMultiLine() const;
// If the return values from and to are the same, there is no selection.
virtual void GetSelection(long* OUTPUT, long* OUTPUT) const;
virtual wxString GetStringSelection() const;
// editing
virtual void Clear();
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
// load/save the controls contents from/to the file
virtual bool LoadFile(const wxString& file);
virtual bool SaveFile(const wxString& file = wxPyEmptyString);
// sets/clears the dirty flag
virtual void MarkDirty();
virtual void DiscardEdits();
// set the max number of characters which may be entered in a single line
// text control
virtual void SetMaxLength(unsigned long len);
// writing text inserts it at the current position, appending always
// inserts it at the end
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text);
// insert the character which would have resulted from this key event,
// return TRUE if anything has been inserted
virtual bool EmulateKeyPress(const wxKeyEvent& event);
// text control under some platforms supports the text styles: these
// methods allow to apply the given text style to the given selection or to
// set/get the style which will be used for all appended text
virtual bool SetStyle(long start, long end, const wxTextAttr& style);
virtual bool GetStyle(long position, wxTextAttr& style);
virtual bool SetDefaultStyle(const wxTextAttr& style);
virtual const wxTextAttr& GetDefaultStyle() const;
// translate between the position (which is just an index in the text ctrl
// considering all its contents as a single strings) and (x, y) coordinates
// which represent column and line.
virtual long XYToPosition(long x, long y) const;
virtual /*bool*/ void PositionToXY(long pos, long *OUTPUT, long *OUTPUT) const;
virtual void ShowPosition(long pos);
// Clipboard operations
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
// Undo/redo
virtual void Undo();
virtual void Redo();
virtual bool CanUndo() const;
virtual bool CanRedo() const;
// Insertion point
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SelectAll();
virtual void SetEditable(bool editable);
#ifdef __WXMSW__
// Caret handling (Windows only)
bool ShowNativeCaret(bool show = true);
bool HideNativeCaret();
#endif
%extend {
// TODO: Add more file-like methods
void write(const wxString& text) {
self->AppendText(text);
}
}
// TODO: replace this when the method is really added to wxTextCtrl
%extend {
wxString GetString(long from, long to) {
return self->GetValue().Mid(from, to - from);
}
}
};
//---------------------------------------------------------------------------
%constant wxEventType wxEVT_COMMAND_TEXT_UPDATED;
%constant wxEventType wxEVT_COMMAND_TEXT_ENTER;
%constant wxEventType wxEVT_COMMAND_TEXT_URL;
%constant wxEventType wxEVT_COMMAND_TEXT_MAXLEN;
class wxTextUrlEvent : public wxCommandEvent
{
public:
wxTextUrlEvent(int winid, const wxMouseEvent& evtMouse,
long start, long end);
// get the mouse event which happend over the URL
const wxMouseEvent& GetMouseEvent();
// get the start of the URL
long GetURLStart() const;
// get the end of the URL
long GetURLEnd() const;
};
%pythoncode {
EVT_TEXT = wx.PyEventBinder( wxEVT_COMMAND_TEXT_UPDATED, 1)
EVT_TEXT_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TEXT_ENTER, 1)
EVT_TEXT_URL = wx.PyEventBinder( wxEVT_COMMAND_TEXT_URL, 1)
EVT_TEXT_MAXLEN = wx.PyEventBinder( wxEVT_COMMAND_TEXT_MAXLEN, 1)
}
//---------------------------------------------------------------------------

88
wxPython/src/_tglbtn.i Normal file
View File

@@ -0,0 +1,88 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _tglbtn.i
// Purpose: SWIG interface defs for wxToggleButton
//
// Author: Robin Dunn
//
// Created: 10-June-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
wxChar* wxToggleButtonNameStr = _T("wxToggleButton");
DECLARE_DEF_STRING(ToggleButtonNameStr);
%}
//---------------------------------------------------------------------------
%newgroup
%{
#ifdef __WXMAC__
// implement dummy classes and such for wxMac
#define wxEVT_COMMAND_TOGGLEBUTTON_CLICKED 0
class wxToggleButton : public wxControl
{
public:
wxToggleButton(wxWindow *, wxWindowID, const wxString&,
const wxPoint&, const wxSize&, long,
const wxValidator&, const wxString&)
{ PyErr_SetNone(PyExc_NotImplementedError); }
wxToggleButton()
{ PyErr_SetNone(PyExc_NotImplementedError); }
};
#endif
%}
%constant wxEventType wxEVT_COMMAND_TOGGLEBUTTON_CLICKED;
%pythoncode {
EVT_TOGGLEBUTTON = wx.PyEventBinder( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 1)
}
class wxToggleButton : public wxControl
{
public:
%addtofunc wxToggleButton "self._setOORInfo(self)"
%addtofunc wxToggleButton() ""
wxToggleButton(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyToggleButtonNameStr);
%name(PreToggleButton)wxToggleButton();
#ifndef __WXMAC__
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxPyToggleButtonNameStr);
void SetValue(bool value);
bool GetValue() const ;
void SetLabel(const wxString& label);
#endif
};
//---------------------------------------------------------------------------

121
wxPython/src/_timer.i Normal file
View File

@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _timer.i
// Purpose: SWIG interface definitions wxTimer
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
enum {
// generate notifications periodically until the timer is stopped (default)
wxTIMER_CONTINUOUS,
// only send the notification once and then stop the timer
wxTIMER_ONE_SHOT,
};
// Timer event type
%constant wxEventType wxEVT_TIMER;
//---------------------------------------------------------------------------
%{
IMP_PYCALLBACK__(wxPyTimer, wxTimer, Notify);
%}
%name(Timer) class wxPyTimer : public wxEvtHandler
{
public:
// if you don't call SetOwner() or provide an owner in the contstructor
// then you must override Notify() inorder to receive the timer
// notification. If the owner is set then it will get the timer
// notifications which can be handled with EVT_TIMER.
wxPyTimer(wxEvtHandler *owner=NULL, int id = -1);
virtual ~wxPyTimer();
// Set the owner instance that will receive the EVT_TIMER events using the
// given id.
void SetOwner(wxEvtHandler *owner, int id = -1);
// start the timer: if milliseconds == -1, use the same value as for the
// last Start()
//
// it is now valid to call Start() multiple times: this just restarts the
// timer if it is already running
virtual bool Start(int milliseconds = -1, bool oneShot = FALSE);
// stop the timer
virtual void Stop();
// override this in your wxTimer-derived class if you want to process timer
// messages in it, use non default ctor or SetOwner() otherwise
virtual void Notify();
// return TRUE if the timer is running
virtual bool IsRunning() const;
// get the (last) timer interval in the milliseconds
int GetInterval() const;
// return TRUE if the timer is one shot
bool IsOneShot() const;
};
%pythoncode {
%# For backwards compatibility with 2.4
class PyTimer(Timer):
def __init__(self, notify):
Timer.__init__(self)
self.notify = notify
def Notify(self):
if self.notify:
self.notify()
EVT_TIMER = wx.PyEventBinder( wxEVT_TIMER, 1 )
};
class wxTimerEvent : public wxEvent
{
public:
wxTimerEvent(int timerid = 0, int interval = 0);
int GetInterval() const;
};
// wxTimerRunner: starts the timer in its ctor, stops in the dtor
class wxTimerRunner
{
public:
%nokwargs wxTimerRunner;
wxTimerRunner(wxTimer& timer);
wxTimerRunner(wxTimer& timer, int milli, bool oneShot = FALSE);
~wxTimerRunner();
void Start(int milli, bool oneShot = FALSE);
};
//---------------------------------------------------------------------------

95
wxPython/src/_tipdlg.i Normal file
View File

@@ -0,0 +1,95 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _tipdlg.i
// Purpose: SWIG defs for wxTip classes and such
//
// Author: Robin Dunn
//
// Created: 18-June-1999
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/tipdlg.h>
%}
//---------------------------------------------------------------------------
// wxTipProvider - a class which is used by wxTipDialog to get the text of the
// tips
class wxTipProvider
{
public:
// wxTipProvider(size_t currentTip); **** Abstract base class
~wxTipProvider();
// get the current tip and update the internal state to return the next tip
// when called for the next time
virtual wxString GetTip();
// get the current tip "index" (or whatever allows the tip provider to know
// from where to start the next time)
size_t GetCurrentTip();
// Allows any user-derived class to optionally override this function to
// modify the tip as soon as it is read. If return wxEmptyString, then
// the tip is skipped, and the next one is read.
virtual wxString PreprocessTip(const wxString& tip);
};
// The C++ version of wxPyTipProvider
%{
class wxPyTipProvider : public wxTipProvider {
public:
wxPyTipProvider(size_t currentTip)
: wxTipProvider(currentTip) {}
DEC_PYCALLBACK_STRING__pure(GetTip);
DEC_PYCALLBACK_STRING_STRING(PreprocessTip);
PYPRIVATE;
};
IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip);
IMP_PYCALLBACK_STRING_STRING(wxPyTipProvider, wxTipProvider, PreprocessTip);
%}
// Now let SWIG know about it
class wxPyTipProvider : public wxTipProvider {
public:
wxPyTipProvider(size_t currentTip);
void _setCallbackInfo(PyObject* self, PyObject* _class);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyTipProvider)"
};
// A dialog which shows a "tip" - a short and helpful messages describing to
// the user some program characteristic. Many programs show the tips at
// startup, so the dialog has "Show tips on startup" checkbox which allows to
// the user to disable this (however, it's the program which should show, or
// not, the dialog on startup depending on its value, not this class).
//
// The function returns TRUE if this checkbox is checked, FALSE otherwise.
bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE);
// a function which returns an implementation of wxTipProvider using the
// specified text file as the source of tips (each line is a tip).
%newobject wxCreateFileTipProvider;
wxTipProvider* wxCreateFileTipProvider(const wxString& filename, size_t currentTip);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

56
wxPython/src/_tipwin.i Normal file
View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _tipwin.i
// Purpose: SWIG interface defs for wxTipWindow
//
// Author: Robin Dunn
//
// Created: 22-Dec-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/tipwin.h>
%}
//---------------------------------------------------------------------------
%newgroup;
class wxTipWindow :
#ifndef __WXMAC__
public wxPyPopupTransientWindow
#else
public wxFrame
#endif
{
public:
%addtofunc wxTipWindow "self._setOORInfo(self)"
%extend {
wxTipWindow(wxWindow *parent,
const wxString* text,
wxCoord maxLength = 100,
wxRect* rectBound = NULL) {
wxString tmp = *text;
return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound);
}
}
// If rectBound is not NULL, the window will disappear automatically when
// the mouse leave the specified rect: note that rectBound should be in the
// screen coordinates!
void SetBoundingRect(const wxRect& rectBound);
// Hide and destroy the window
void Close();
};
//---------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More