All the Window and GDI (pen, bitmap, etc.) classes and also many

toplevel functions will now check that a wx.App object has already
been created and will raise a wx.PyNoAppError exception if not.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-06-01 21:38:05 +00:00
parent 68da5113e3
commit ab1f7d2aa9
79 changed files with 433 additions and 30 deletions

View File

@@ -186,6 +186,10 @@ identical bitmap for different client values!
of the categories above)
");
MustHaveApp(wxPyArtProvider);
MustHaveApp(wxPyArtProvider::GetBitmap);
MustHaveApp(wxPyArtProvider::GetIcon);
%name(ArtProvider) class wxPyArtProvider /*: public wxObject*/
{
public:

View File

@@ -65,6 +65,8 @@ converted to a wx.Bitmap, so any image file format supported by
");
MustHaveApp(wxBitmap);
class wxBitmap : public wxGDIObject
{
public:
@@ -306,6 +308,8 @@ A mask may be associated with a `wx.Bitmap`. It is used in
`wx.MemoryDC` with a `wx.Bitmap` selected into it that contains a
mask.", "");
MustHaveApp(wxMask);
class wxMask : public wxObject {
public:

View File

@@ -33,6 +33,8 @@ a `wx.DC`. It has a colour and a style.", "
:see: `wx.BrushList`, `wx.DC`, `wx.DC.SetBrush`
");
MustHaveApp(wxBrush);
class wxBrush : public wxGDIObject {
public:
DocCtorStr(

View File

@@ -58,6 +58,8 @@ Events
:see: `wx.BitmapButton`
");
MustHaveApp(wxButton);
class wxButton : public wxControl
{
public:
@@ -143,6 +145,8 @@ Events
:see: `wx.Button`, `wx.Bitmap`
");
MustHaveApp(wxBitmapButton);
class wxBitmapButton : public wxButton
{
public:

View File

@@ -78,6 +78,8 @@ Events
MustHaveApp(wxCheckBox);
class wxCheckBox : public wxControl
{
public:

View File

@@ -34,6 +34,8 @@ Events
");
MustHaveApp(wxChoice);
class wxChoice : public wxControlWithItems
{
public:

View File

@@ -80,6 +80,8 @@ integer between 0 and 15. The default custom colours are all white.", "");
DocStr(wxColourDialog,
"This class represents the colour chooser dialog.", "");
MustHaveApp(wxColourDialog);
class wxColourDialog : public wxDialog {
public:
%pythonAppend wxColourDialog "self._setOORInfo(self)"
@@ -113,6 +115,8 @@ Window Styles
==================== ==========================================
");
MustHaveApp(wxDirDialog);
class wxDirDialog : public wxDialog {
public:
%pythonAppend wxDirDialog "self._setOORInfo(self)"
@@ -198,6 +202,8 @@ Window Styles
MustHaveApp(wxFileDialog);
class wxFileDialog : public wxDialog {
public:
%pythonAppend wxFileDialog "self._setOORInfo(self)"
@@ -334,6 +340,8 @@ enum { wxCHOICEDLG_STYLE };
DocStr(wxMultiChoiceDialog,
"A simple dialog with a multi selection listbox.", "");
MustHaveApp(wxMultiChoiceDialog);
class wxMultiChoiceDialog : public wxDialog
{
public:
@@ -374,6 +382,8 @@ integers.", "");
DocStr(wxSingleChoiceDialog,
"A simple dialog with a single selection listbox.", "");
MustHaveApp(wxSingleChoiceDialog);
class wxSingleChoiceDialog : public wxDialog {
public:
%pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)"
@@ -418,6 +428,8 @@ public:
DocStr(wxTextEntryDialog,
"A dialog with text control, [ok] and [cancel] buttons", "");
MustHaveApp(wxTextEntryDialog);
class wxTextEntryDialog : public wxDialog {
public:
%pythonAppend wxTextEntryDialog "self._setOORInfo(self)"
@@ -528,6 +540,8 @@ DocStr(wxFontDialog,
:see: `wx.FontData`
", "");
MustHaveApp(wxFontDialog);
class wxFontDialog : public wxDialog {
public:
%pythonAppend wxFontDialog "self._setOORInfo(self)"
@@ -575,6 +589,8 @@ Window Styles
");
MustHaveApp(wxMessageDialog);
class wxMessageDialog : public wxDialog {
public:
%pythonAppend wxMessageDialog "self._setOORInfo(self)"
@@ -625,6 +641,8 @@ Window Styles
");
MustHaveApp(wxProgressDialog);
class wxProgressDialog : public wxFrame {
public:
%pythonAppend wxProgressDialog "self._setOORInfo(self)"
@@ -841,6 +859,8 @@ Window Styles
===================== =========================================
");
MustHaveApp(wxFindReplaceDialog);
class wxFindReplaceDialog : public wxDialog {
public:
%pythonAppend wxFindReplaceDialog "self._setOORInfo(self)"

View File

@@ -56,6 +56,8 @@ Events
MustHaveApp(wxComboBox);
#ifdef __WXMSW__
class wxComboBox : public wxChoice
#else

View File

@@ -27,6 +27,8 @@ DocStr(wxControl,
A control is generally a small window which processes user input
and/or displays one or more item of data.", "");
MustHaveApp(wxControl);
class wxControl : public wxWindow
{
public:

View File

@@ -206,7 +206,9 @@ static wxPyCoreAPI API = {
wxPyCBInputStream_create,
wxPyInstance_Check,
wxPySwigInstance_Check
wxPySwigInstance_Check,
wxPyCheckForApp
};

View File

@@ -133,6 +133,8 @@ There are a couple of ways to invoke this behaviour implicitly:
:see: `wx.ContextHelpButton`
", "");
MustHaveApp(wxContextHelp);
class wxContextHelp : public wxObject {
public:
DocCtorStr(
@@ -178,6 +180,8 @@ similar buttons.
:see: `wx.ContextHelp`, `wx.ContextHelpButton`
", "");
MustHaveApp(wxContextHelpButton);
class wxContextHelpButton : public wxBitmapButton {
public:
%pythonAppend wxContextHelpButton "self._setOORInfo(self)"

View File

@@ -61,6 +61,8 @@ Stock Cursor IDs
");
MustHaveApp(wxCursor);
class wxCursor : public wxGDIObject
{
public:

View File

@@ -626,6 +626,8 @@ static void wxDC_GetBoundingBox(wxDC* dc, int* x1, int* y1, int* x2, int* y2) {
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxMemoryDC);
class wxMemoryDC : public wxDC {
public:
wxMemoryDC();
@@ -643,6 +645,8 @@ public:
%}
MustHaveApp(wxBufferedDC);
class wxBufferedDC : public wxMemoryDC
{
public:
@@ -680,6 +684,7 @@ public:
MustHaveApp(wxBufferedPaintDC);
// Creates a double buffered wxPaintDC, optionally allowing the
// user to specify their own buffer to use.
@@ -696,6 +701,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxScreenDC);
class wxScreenDC : public wxDC {
public:
wxScreenDC();
@@ -708,6 +715,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxClientDC);
class wxClientDC : public wxDC {
public:
wxClientDC(wxWindow* win);
@@ -716,6 +725,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxPaintDC);
class wxPaintDC : public wxDC {
public:
wxPaintDC(wxWindow* win);
@@ -724,6 +735,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxWindowDC);
class wxWindowDC : public wxDC {
public:
wxWindowDC(wxWindow* win);
@@ -732,6 +745,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxMirrorDC);
class wxMirrorDC : public wxDC
{
public:
@@ -751,6 +766,8 @@ public:
#include <wx/dcps.h>
%}
MustHaveApp(wxPostScriptDC);
class wxPostScriptDC : public wxDC {
public:
wxPostScriptDC(const wxPrintData& printData);
@@ -769,6 +786,10 @@ public:
%newgroup
MustHaveApp(wxMetaFile);
MustHaveApp(wxMetaFileDC);
#if defined(__WXMSW__) || defined(__WXMAC__)
%{
@@ -843,6 +864,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxPrinterDC);
#if defined(__WXMSW__) || defined(__WXMAC__)
class wxPrinterDC : public wxDC {

View File

@@ -11,17 +11,40 @@
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
// Globally turn on the autodoc feature
%feature("autodoc", "1"); // 0 == no param types, 1 == show param types
//---------------------------------------------------------------------------
// Tell SWIG to wrap all the wrappers with our thread protection by default
%exception {
PyThreadState* __tstate = wxPyBeginAllowThreads();
$action
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
// This one can be used to add a check for an existing wxApp before the real
// work is done. An exception is raised if there isn't one.
%define MustHaveApp(name)
%exception name {
if (!wxPyCheckForApp()) SWIG_fail;
PyThreadState* __tstate = wxPyBeginAllowThreads();
$action
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
%enddef
//---------------------------------------------------------------------------
// some type definitions to simplify things for SWIG
// typedef int wxWindowID;
// typedef int wxCoord;
// typedef int wxInt32;
// typedef unsigned int wxUint32;
typedef int wxEventType;
typedef unsigned int size_t;
typedef unsigned int time_t;
@@ -31,10 +54,6 @@ typedef unsigned char byte;
#define wxCoord int
#define wxInt32 int
#define wxUint32 unsigned int
//#define wxEventType int
//#define size_t unsigned int
//#define time_t unsigned int
//#define byte unsigned char
//----------------------------------------------------------------------

View File

@@ -54,6 +54,8 @@ public:
MustHaveApp(wxGenericDirCtrl);
class wxGenericDirCtrl: public wxControl
{
public:
@@ -136,6 +138,8 @@ leaf), done is set to True.
MustHaveApp(wxDirFilterListCtrl);
class wxDirFilterListCtrl: public wxChoice
{
public:

View File

@@ -24,6 +24,8 @@
MustHaveApp(wxGenericDragImage);
%name (DragImage) class wxGenericDragImage : public wxObject
{
public:

View File

@@ -430,6 +430,10 @@ public:
%newgroup
MustHaveApp(wxFont);
MustHaveApp(wxFont::GetDefaultEncoding);
MustHaveApp(wxFont::SetDefaultEncoding);
class wxFont : public wxGDIObject {
public:
%pythonPrepend wxFont "if kwargs.has_key('faceName'): kwargs['face'] = kwargs['faceName'];del kwargs['faceName']"
@@ -533,6 +537,8 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc
%}
MustHaveApp(wxPyFontEnumerator);
%name(FontEnumerator) class wxPyFontEnumerator {
public:
%pythonAppend wxPyFontEnumerator "self._setCallbackInfo(self, FontEnumerator, 0)"

View File

@@ -27,11 +27,15 @@ long wxNewId();
void wxRegisterId(long id);
long wxGetCurrentId();
MustHaveApp(wxBell);
void wxBell();
MustHaveApp(wxEndBusyCursor);
void wxEndBusyCursor();
long wxGetElapsedTime(bool resetTimer = True);
MustHaveApp(wxGetMousePosition);
DocDeclA(
void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
"GetMousePosition() -> (x,y)");
@@ -63,6 +67,7 @@ enum wxShutdownFlags
};
// Shutdown or reboot the PC
MustHaveApp(wxShutdown);
bool wxShutdown(wxShutdownFlags wFlags);
@@ -88,6 +93,7 @@ void wxTrap();
// Dialog Functions
MustHaveApp(wxFileSelector);
wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
const wxString& default_path = wxPyEmptyString,
const wxString& default_filename = wxPyEmptyString,
@@ -101,24 +107,28 @@ wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
// Ask for filename to load
MustHaveApp(wxLoadFileSelector);
wxString wxLoadFileSelector(const wxString& what,
const wxString& extension,
const wxString& default_name = wxPyEmptyString,
wxWindow *parent = NULL);
// Ask for filename to save
MustHaveApp(wxSaveFileSelector);
wxString wxSaveFileSelector(const wxString& what,
const wxString& extension,
const wxString& default_name = wxPyEmptyString,
wxWindow *parent = NULL);
MustHaveApp(wxDirSelector);
wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
const wxString& defaultPath = wxPyEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
wxWindow *parent = NULL);
MustHaveApp(wxGetTextFromUser);
wxString wxGetTextFromUser(const wxString& message,
const wxString& caption = wxPyEmptyString,
const wxString& default_value = wxPyEmptyString,
@@ -126,6 +136,7 @@ wxString wxGetTextFromUser(const wxString& message,
int x = -1, int y = -1,
bool centre = True);
MustHaveApp(wxGetPasswordFromUser);
wxString wxGetPasswordFromUser(const wxString& message,
const wxString& caption = wxPyEmptyString,
const wxString& default_value = wxPyEmptyString,
@@ -140,6 +151,7 @@ wxString wxGetPasswordFromUser(const wxString& message,
// bool centre = True, int width=150, int height=200);
MustHaveApp(wxGetSingleChoice);
wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
int choices, wxString* choices_array,
wxWindow *parent = NULL,
@@ -147,6 +159,7 @@ wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
bool centre = True,
int width=150, int height=200);
MustHaveApp(wxGetSingleChoiceIndex);
int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
int choices, wxString* choices_array,
wxWindow *parent = NULL,
@@ -155,12 +168,14 @@ int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
int width=150, int height=200);
MustHaveApp(wxMessageBox);
int wxMessageBox(const wxString& message,
const wxString& caption = wxPyEmptyString,
int style = wxOK | wxCENTRE,
wxWindow *parent = NULL,
int x = -1, int y = -1);
MustHaveApp(wxGetNumberFromUser);
long wxGetNumberFromUser(const wxString& message,
const wxString& prompt,
const wxString& caption,
@@ -171,38 +186,60 @@ long wxGetNumberFromUser(const wxString& message,
// GDI Functions
MustHaveApp(wxColourDisplay);
bool wxColourDisplay();
MustHaveApp(wxDisplayDepth);
int wxDisplayDepth();
MustHaveApp(wxGetDisplayDepth);
int wxGetDisplayDepth();
MustHaveApp(wxDisplaySize);
DocDeclA(
void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
"DisplaySize() -> (width, height)");
MustHaveApp(wxGetDisplaySize);
wxSize wxGetDisplaySize();
MustHaveApp(wxDisplaySizeMM);
DocDeclA(
void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
"DisplaySizeMM() -> (width, height)");
MustHaveApp(wxGetDisplaySizeMM);
wxSize wxGetDisplaySizeMM();
MustHaveApp(wxClientDisplayRect);
DocDeclA(
void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
"ClientDisplayRect() -> (x, y, width, height)");
MustHaveApp(wxGetClientDisplayRect);
wxRect wxGetClientDisplayRect();
MustHaveApp(wxSetCursor);
void wxSetCursor(wxCursor& cursor);
// Miscellaneous functions
MustHaveApp(wxBeginBusyCursor);
void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
MustHaveApp(wxGetActiveWindow);
wxWindow * wxGetActiveWindow();
MustHaveApp(wxGenericFindWindowAtPoint);
wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
MustHaveApp(wxFindWindowAtPoint);
wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
MustHaveApp(wxGetTopLevelParent);
wxWindow* wxGetTopLevelParent(wxWindow *win);
//bool wxSpawnBrowser(wxWindow *parent, wxString href);
@@ -210,6 +247,7 @@ wxWindow* wxGetTopLevelParent(wxWindow *win);
MustHaveApp(wxGetKeyState);
DocDeclStr(
bool , wxGetKeyState(wxKeyCode key),
"Get the state of a key (true if pressed or toggled on, false if not.)
@@ -221,6 +259,8 @@ toggle keys. On some platforms those may be the only keys that work.
//---------------------------------------------------------------------------
MustHaveApp(wxWakeUpMainThread);
#if defined(__WXMSW__) || defined(__WXMAC__)
void wxWakeUpMainThread();
#else
@@ -229,10 +269,15 @@ void wxWakeUpMainThread();
%}
#endif
MustHaveApp(wxMutexGuiEnter);
void wxMutexGuiEnter();
MustHaveApp(wxMutexGuiLeave);
void wxMutexGuiLeave();
MustHaveApp(wxMutexGuiLocker);
class wxMutexGuiLocker {
public:
wxMutexGuiLocker();
@@ -240,6 +285,7 @@ public:
};
MustHaveApp(wxThread);
%inline %{
bool wxThread_IsMain() {
#ifdef WXP_WITH_THREAD

View File

@@ -29,6 +29,8 @@ enum {
//---------------------------------------------------------------------------
MustHaveApp(wxGauge);
class wxGauge : public wxControl {
public:
%pythonAppend wxGauge "self._setOORInfo(self)"

View File

@@ -576,6 +576,8 @@ bottom, otherwise it is moved to the left or top respectively.", "",
};
MustHaveApp(wxIntersectRect);
DocAStr(wxIntersectRect,
"IntersectRect(Rect r1, Rect r2) -> Rect",
"Calculate and return the intersection of r1 and r2.", "");

View File

@@ -15,6 +15,8 @@
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxGDIObject);
class wxGDIObject : public wxObject {
public:
wxGDIObject();

View File

@@ -20,6 +20,8 @@
//---------------------------------------------------------------------------
MustHaveApp(wxIcon);
class wxIcon : public wxGDIObject
{
public:

View File

@@ -90,7 +90,8 @@ public:
else
return new wxImage;
}
MustHaveApp(wxImage(const wxBitmap &bitmap));
%name(ImageFromBitmap) wxImage(const wxBitmap &bitmap) {
return new wxImage(bitmap.ConvertToImage());
}
@@ -312,6 +313,9 @@ success flag and rgb values.", "");
static wxString GetImageExtWildcard();
MustHaveApp(ConvertToBitmap);
MustHaveApp(ConvertToMonoBitmap);
%extend {
wxBitmap ConvertToBitmap() {
wxBitmap bitmap(*self);

View File

@@ -33,6 +33,8 @@ enum {
};
MustHaveApp(wxImageList);
// wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to
// images for their items by an index into an image list.

View File

@@ -103,6 +103,8 @@ public:
%}
MustHaveApp(wxJoystick);
class wxJoystick /* : public wxObject */
{
public:

View File

@@ -26,6 +26,8 @@ MAKE_CONST_WXSTRING(ListBoxNameStr);
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxListBox);
class wxListBox : public wxControlWithItems
{
public:
@@ -137,6 +139,8 @@ public:
%newgroup
MustHaveApp(wxCheckListBox);
// wxCheckListBox: a listbox whose items may be checked
class wxCheckListBox : public wxListBox
{

View File

@@ -17,8 +17,8 @@
%{
#include <wx/listctrl.h>
%}
MAKE_CONST_WXSTRING2(ListCtrlNameStr, _T("wxListCtrl"));
//---------------------------------------------------------------------------
@@ -398,6 +398,8 @@ IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr);
MustHaveApp(wxPyListCtrl);
%name(ListCtrl)class wxPyListCtrl : public wxControl {
public:
@@ -778,6 +780,8 @@ details in the second return value (see wxLIST_HITTEST_... flags.)", "");
%newgroup
MustHaveApp(wxListView);
// wxListView: a class which provides a little better API for list control
class wxListView : public wxPyListCtrl
{

View File

@@ -33,6 +33,8 @@
MustHaveApp(wxMDIParentFrame);
class wxMDIParentFrame : public wxFrame {
public:
%pythonAppend wxMDIParentFrame "self._setOORInfo(self)"
@@ -78,6 +80,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxMDIChildFrame);
class wxMDIChildFrame : public wxFrame {
public:
%pythonAppend wxMDIChildFrame "self._setOORInfo(self)"
@@ -109,6 +113,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxMDIClientWindow);
class wxMDIClientWindow : public wxWindow {
public:
%pythonAppend wxMDIClientWindow "self._setOORInfo(self)"

View File

@@ -17,6 +17,8 @@
%newgroup
MustHaveApp(wxMenu);
class wxMenu : public wxEvtHandler
{
public:
@@ -203,6 +205,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxMenuBar);
class wxMenuBar : public wxWindow
{
public:

View File

@@ -19,6 +19,9 @@
#ifndef __WXX11__
MustHaveApp(wxToolTip);
class wxToolTip : public wxObject {
public:
wxToolTip(const wxString &tip);
@@ -35,6 +38,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxCaret);
class wxCaret {
public:
wxCaret(wxWindow* window, const wxSize& size);
@@ -79,6 +84,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxBusyCursor);
class wxBusyCursor {
public:
wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
@@ -87,6 +94,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxWindowDisabler);
class wxWindowDisabler {
public:
wxWindowDisabler(wxWindow *winToSkip = NULL);
@@ -95,6 +104,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxBusyInfo);
class wxBusyInfo : public wxObject {
public:
wxBusyInfo(const wxString& message);

View File

@@ -22,6 +22,8 @@ MAKE_CONST_WXSTRING(NOTEBOOK_NAME);
// TODO: Virtualize this class so other book controls can be derived in Python
MustHaveApp(wxBookCtrl);
// Common base class for wxList/Tree/Notebook
class wxBookCtrl : public wxControl
{
@@ -160,6 +162,8 @@ enum {
MustHaveApp(wxNotebook);
class wxNotebook : public wxBookCtrl {
public:
%pythonAppend wxNotebook "self._setOORInfo(self)"
@@ -286,6 +290,8 @@ enum
MustHaveApp(wxListbook);
// wxListCtrl and wxNotebook combination
class wxListbook : public wxBookCtrl
{

View File

@@ -19,6 +19,8 @@
//---------------------------------------------------------------------------
MustHaveApp(wxPalette);
class wxPalette : public wxGDIObject {
public:
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);

View File

@@ -22,6 +22,8 @@
%newgroup
MustHaveApp(wxPanel);
class wxPanel : public wxWindow
{
public:
@@ -57,6 +59,8 @@ public:
// derive from it and wxPanel. But what to do about wxGTK where this
// is not True?
MustHaveApp(wxScrolledWindow);
class wxScrolledWindow : public wxPanel
{
public:

View File

@@ -29,6 +29,8 @@
%newgroup
MustHaveApp(wxPen);
class wxPen : public wxGDIObject {
public:
wxPen(wxColour& colour, int width=1, int style=wxSOLID);

View File

@@ -23,9 +23,12 @@
#ifndef __WXMAC__
%newgroup;
MustHaveApp(wxPopupWindow);
// wxPopupWindow: a special kind of top level window used for popup menus,
// combobox popups and such.
MustHaveApp(wxPopupWindow);
class wxPopupWindow : public wxWindow {
public:
%pythonAppend wxPopupWindow "self._setOORInfo(self)"
@@ -73,9 +76,11 @@ IMP_PYCALLBACK_BOOL_(wxPyPopupTransientWindow, wxPopupTransientWindow, CanDismis
%}
MustHaveApp(wxPyPopupTransientWindow);
// 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:

View File

@@ -149,6 +149,8 @@ public:
MustHaveApp(wxPageSetupDialog);
class wxPageSetupDialog : public wxDialog {
public:
%pythonAppend wxPageSetupDialog "self._setOORInfo(self)"
@@ -217,6 +219,8 @@ public:
};
MustHaveApp(wxPrintDialog);
class wxPrintDialog : public wxDialog {
public:
%pythonAppend wxPrintDialog "self._setOORInfo(self)"
@@ -243,6 +247,8 @@ enum wxPrinterError
};
MustHaveApp(wxPrinter);
class wxPrinter : public wxObject {
public:
wxPrinter(wxPrintDialogData* data = NULL);
@@ -323,6 +329,8 @@ IMP_PYCALLBACK_BOOL_INT(wxPyPrintout, wxPrintout, HasPage);
%}
MustHaveApp(wxPyPrintout);
// Now define the custom class for SWIGging
%name(Printout) class wxPyPrintout : public wxObject {
public:
@@ -377,6 +385,8 @@ public:
MustHaveApp(wxPreviewCanvas);
class wxPreviewCanvas: public wxScrolledWindow
{
public:
@@ -391,6 +401,8 @@ public:
};
MustHaveApp(wxPreviewFrame);
class wxPreviewFrame : public wxFrame {
public:
%pythonAppend wxPreviewFrame "self._setOORInfo(self)"
@@ -430,6 +442,8 @@ enum {
wxID_PREVIEW_GOTO
};
MustHaveApp(wxPreviewControlBar);
class wxPreviewControlBar: public wxPanel
{
public:
@@ -458,6 +472,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxPrintPreview);
class wxPrintPreview : public wxObject {
public:
%nokwargs wxPrintPreview;
@@ -592,6 +608,8 @@ IMP_PYCALLBACK_VOID_ (wxPyPrintPreview, wxPrintPreview, DetermineScaling)
%}
MustHaveApp(wxPyPrintPreview);
class wxPyPrintPreview : public wxPrintPreview
{
public:
@@ -650,6 +668,8 @@ IMP_PYCALLBACK_VOID_(wxPyPreviewFrame, wxPreviewFrame, CreateControlBar);
%}
MustHaveApp(wxPyPreviewFrame);
class wxPyPreviewFrame : public wxPreviewFrame
{
public:
@@ -704,6 +724,8 @@ IMP_PYCALLBACK_VOID_INT(wxPyPreviewControlBar, wxPreviewControlBar, SetZoomContr
%}
MustHaveApp(wxPyPreviewControlBar);
class wxPyPreviewControlBar : public wxPreviewControlBar
{
public:

View File

@@ -159,6 +159,8 @@ enum
};
MustHaveApp(wxExecute);
long wxExecute(const wxString& command,
int flags = wxEXEC_ASYNC,
wxPyProcess *process = NULL);

View File

@@ -99,6 +99,7 @@ IMP_PYCALLBACK_VIZATTR_(wxPyControl, wxControl, GetDefaultAttributes);
%}
// And now the one for SWIG to see
MustHaveApp(wxPyControl);
class wxPyControl : public wxControl
{
public:

View File

@@ -129,6 +129,7 @@ IMP_PYCALLBACK_VIZATTR_(wxPyWindow, wxWindow, GetDefaultAttributes);
%}
// And now the one for SWIG to see
MustHaveApp(wxPyWindow);
class wxPyWindow : public wxWindow
{
public:
@@ -273,6 +274,7 @@ IMP_PYCALLBACK_VIZATTR_(wxPyPanel, wxPanel, GetDefaultAttributes);
%}
// And now the one for SWIG to see
MustHaveApp(wxPyPanel);
class wxPyPanel : public wxPanel
{
public:
@@ -409,6 +411,7 @@ IMP_PYCALLBACK_VIZATTR_(wxPyScrolledWindow, wxScrolledWindow, GetDefaultAttribut
%}
// And now the one for SWIG to see
MustHaveApp(wxPyScrolledWindow);
class wxPyScrolledWindow : public wxScrolledWindow
{
public:

View File

@@ -21,6 +21,8 @@ MAKE_CONST_WXSTRING(RadioButtonNameStr);
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxRadioBox);
class wxRadioBox : public wxControl
{
public:
@@ -94,6 +96,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxRadioButton);
class wxRadioButton : public wxControl
{
public:

View File

@@ -41,6 +41,8 @@ enum wxRegionContain
MustHaveApp(wxRegion);
class wxRegion : public wxGDIObject {
public:
wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
@@ -108,6 +110,8 @@ public:
MustHaveApp(wxRegionIterator);
class wxRegionIterator : public wxObject {
public:
wxRegionIterator(const wxRegion& region);

View File

@@ -48,6 +48,8 @@ enum wxSashEdgePosition {
// 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.
MustHaveApp(wxSashWindow);
class wxSashWindow: public wxWindow
{
public:
@@ -234,6 +236,8 @@ public:
// 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.
MustHaveApp(wxSashLayoutWindow);
class wxSashLayoutWindow: public wxSashWindow
{
public:

View File

@@ -20,6 +20,8 @@ MAKE_CONST_WXSTRING(ScrollBarNameStr);
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxScrollBar);
class wxScrollBar : public wxControl {
public:
%pythonAppend wxScrollBar "self._setOORInfo(self)"

View File

@@ -148,6 +148,12 @@ enum wxSystemScreenType
//---------------------------------------------------------------------------
MustHaveApp(wxSystemSettings::GetColour);
MustHaveApp(wxSystemSettings::GetFont);
MustHaveApp(wxSystemSettings::GetMetric);
MustHaveApp(wxSystemSettings::HasFeature);
MustHaveApp(wxSystemSettings::GetScreenType);
MustHaveApp(wxSystemSettings::SetScreenType);
class wxSystemSettings
{

View File

@@ -25,6 +25,8 @@ MAKE_CONST_WXSTRING(SliderNameStr);
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxSlider);
class wxSlider : public wxControl {
public:
%pythonPrepend wxSlider "if kwargs.has_key('point'): kwargs['pos'] = kwargs['point'];del kwargs['point']"

View File

@@ -71,6 +71,10 @@ public:
MustHaveApp(wxSound);
MustHaveApp(wxSound::Play);
MustHaveApp(wxSound::Stop);
class wxSound /*: public wxObject*/
{
public:

View File

@@ -38,6 +38,7 @@ enum {
// wxSP_VERTICAL: vertical spin button (the default)
// wxSP_ARROW_KEYS: arrow keys increment/decrement value
// wxSP_WRAP: value wraps at either end
MustHaveApp(wxSpinButton);
class wxSpinButton : public wxControl
{
public:
@@ -80,6 +81,8 @@ public:
// a spin ctrl is a text control with a spin button which is usually used to
// prompt the user for a numeric input
MustHaveApp(wxSpinCtrl);
class wxSpinCtrl : public wxControl
{
public:

View File

@@ -104,6 +104,8 @@ Events
MustHaveApp(wxSplitterWindow);
class wxSplitterWindow: public wxWindow
{
public:

View File

@@ -23,6 +23,8 @@ MAKE_CONST_WXSTRING(StaticTextNameStr);
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxStaticBox);
class wxStaticBox : public wxControl {
public:
%pythonAppend wxStaticBox "self._setOORInfo(self)"
@@ -50,6 +52,8 @@ public:
%newgroup
MustHaveApp(wxStaticLine);
class wxStaticLine : public wxControl {
public:
%pythonAppend wxStaticLine "self._setOORInfo(self)"
@@ -82,6 +86,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxStaticText);
class wxStaticText : public wxControl {
public:
%pythonAppend wxStaticText "self._setOORInfo(self)"
@@ -107,6 +113,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxStaticBitmap);
class wxStaticBitmap : public wxControl {
public:
%pythonAppend wxStaticBitmap "self._setOORInfo(self)"

View File

@@ -24,6 +24,7 @@
// wxStatusBar: a window near the bottom of the frame used for status info
MustHaveApp(wxStatusBar);
class wxStatusBar : public wxWindow
{
public:

View File

@@ -99,6 +99,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxColourDatabase);
class wxColourDatabase : public wxObject {
public:
wxColourDatabase();

View File

@@ -56,6 +56,8 @@ enum {
MustHaveApp(wxTaskBarIcon);
class wxTaskBarIcon : public wxEvtHandler
{
public:

View File

@@ -161,6 +161,7 @@ public:
// wxTextCtrl: a single or multiple line text zone where user can enter and
// edit text
MustHaveApp(wxTextCtrl);
class wxTextCtrl : public wxControl
{
public:

View File

@@ -50,6 +50,8 @@ public:
}
MustHaveApp(wxToggleButton);
class wxToggleButton : public wxControl
{
public:

View File

@@ -53,6 +53,8 @@ void wxPyTimer::base_Notify() {
MustHaveApp(wxPyTimer);
%name(Timer) class wxPyTimer : public wxEvtHandler
{
public:
@@ -130,6 +132,7 @@ public:
// wxTimerRunner: starts the timer in its ctor, stops in the dtor
MustHaveApp(wxTimerRunner);
class wxTimerRunner
{
public:

View File

@@ -81,11 +81,13 @@ public:
// not, the dialog on startup depending on its value, not this class).
//
// The function returns True if this checkbox is checked, False otherwise.
MustHaveApp(wxShowTip);
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;
MustHaveApp(wxCreateFileTipProvider);
wxTipProvider* wxCreateFileTipProvider(const wxString& filename, size_t currentTip);

View File

@@ -23,6 +23,8 @@
%newgroup;
MustHaveApp(wxTipWindow);
class wxTipWindow :
#ifndef __WXMAC__
public wxPyPopupTransientWindow

View File

@@ -384,6 +384,8 @@ public:
MustHaveApp(wxToolBar);
class wxToolBar : public wxToolBarBase {
public:
%pythonAppend wxToolBar "self._setOORInfo(self)"

View File

@@ -145,6 +145,8 @@ public:
// is accounted for in client size calculations - all others should be taken
// care of manually.
MustHaveApp(wxFrame);
class wxFrame : public wxTopLevelWindow {
public:
%pythonAppend wxFrame "self._setOORInfo(self)"
@@ -255,6 +257,8 @@ public:
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxDialog);
class wxDialog : public wxTopLevelWindow {
public:
%pythonAppend wxDialog "self._setOORInfo(self)"
@@ -311,6 +315,8 @@ public:
%newgroup
MustHaveApp(wxMiniFrame);
class wxMiniFrame : public wxFrame {
public:
%pythonAppend wxMiniFrame "self._setOORInfo(self)"
@@ -345,6 +351,8 @@ enum {
};
MustHaveApp(wxSplashScreenWindow);
class wxSplashScreenWindow: public wxWindow
{
public:
@@ -361,6 +369,8 @@ public:
};
MustHaveApp(wxSplashScreen);
class wxSplashScreen : public wxFrame {
public:
%pythonAppend wxSplashScreen "self._setOORInfo(self)"

View File

@@ -309,6 +309,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxPyTreeCtrl, wxTreeCtrl);
MustHaveApp(wxPyTreeCtrl);
%name(TreeCtrl)class wxPyTreeCtrl : public wxControl {
public:
%pythonAppend wxPyTreeCtrl "self._setOORInfo(self);self._setCallbackInfo(self, TreeCtrl)"

View File

@@ -125,6 +125,8 @@ IMP_PYCALLBACK_COORD_const (wxPyVScrolledWindow, wxVScrolledWindow, Est
of the window and not its entire client area.
*/
MustHaveApp(wxPyVScrolledWindow);
%name(VScrolledWindow) class wxPyVScrolledWindow : public wxPanel
{
public:
@@ -282,6 +284,8 @@ IMP_PYCALLBACK__DCRECTSIZET_const (wxPyVListBox, wxVListBox, OnDrawBackground
It emits the same events as wxListBox and the same event macros may be used
with it.
*/
MustHaveApp(wxPyVListBox);
%name(VListBox) class wxPyVListBox : public wxPyVScrolledWindow
{
public:
@@ -478,6 +482,7 @@ IMP_PYCALLBACK_STRING_SIZET (wxPyHtmlListBox, wxHtmlListBox, OnGetItemMarkup
// wxHtmlListBox is a listbox whose items are wxHtmlCells
MustHaveApp(wxPyHtmlListBox);
%name(HtmlListBox) class wxPyHtmlListBox : public wxPyVListBox
{
public:

View File

@@ -187,6 +187,10 @@ Extra Styles
");
MustHaveApp(wxWindow);
MustHaveApp(wxWindow::FindFocus);
MustHaveApp(wxWindow::GetCapture);
MustHaveApp(wxWindow::GetClassDefaultAttributes);
class wxWindow : public wxEvtHandler
{
@@ -1850,6 +1854,10 @@ non-None, the search will be limited to the given window
hierarchy. The search is recursive in both cases.", "");
MustHaveApp(wxFindWindowById);
MustHaveApp(wxFindWindowByName);
MustHaveApp(wxFindWindowByLabel);
%inline %{
wxWindow* wxFindWindowById( long id, const wxWindow *parent = NULL ) {
return wxWindow::FindWindowById(id, parent);

View File

@@ -211,6 +211,8 @@ event.
");
MustHaveApp(wxCalendarCtrl);
class wxCalendarCtrl : public wxControl
{
public:

View File

@@ -1546,6 +1546,8 @@ typedef wxGrid::wxGridSelectionModes WXGRIDSELECTIONMODES;
MustHaveApp(wxGrid);
class wxGrid : public wxScrolledWindow
{
public:

View File

@@ -79,6 +79,7 @@ wxMutex* wxPyTMutex = NULL;
static PyObject* wxPython_dict = NULL;
static PyObject* wxPyAssertionError = NULL;
static PyObject* wxPyNoAppError = NULL;
PyObject* wxPyPtrTypeMap = NULL;
@@ -567,7 +568,8 @@ PyObject* __wxPySetDictionary(PyObject* /* self */, PyObject* args)
return NULL;
if (!PyDict_Check(wxPython_dict)) {
PyErr_SetString(PyExc_TypeError, "_wxPySetDictionary must have dictionary object!");
PyErr_SetString(PyExc_TypeError,
"_wxPySetDictionary must have dictionary object!");
return NULL;
}
@@ -580,6 +582,12 @@ PyObject* __wxPySetDictionary(PyObject* /* self */, PyObject* args)
PyExc_AssertionError, NULL);
PyDict_SetItemString(wxPython_dict, "PyAssertionError", wxPyAssertionError);
// Create an exception object to use when the app object hasn't been created yet
wxPyNoAppError = PyErr_NewException("wx._core.PyNoAppError",
PyExc_RuntimeError, NULL);
PyDict_SetItemString(wxPython_dict, "PyNoAppError", wxPyNoAppError);
#ifdef __WXMOTIF__
#define wxPlatform "__WXMOTIF__"
@@ -636,7 +644,12 @@ PyObject* __wxPySetDictionary(PyObject* /* self */, PyObject* args)
_AddInfoString("gtk1");
#endif
#endif
#ifdef __WXDEBUG__
_AddInfoString("wx-assertions-on");
#else
_AddInfoString("wx-assertions-off");
#endif
#undef _AddInfoString
PyObject* PlatInfoTuple = PyList_AsTuple(PlatInfo);
@@ -823,6 +836,22 @@ void wxPy_ReinitStockObjects(int pass)
//---------------------------------------------------------------------------
// Check for existence of a wxApp, setting an exception if there isn't one.
// This doesn't need to aquire the GIL because it should only be called from
// an %exception before the lock is released.
bool wxPyCheckForApp() {
if (wxTheApp != NULL)
return true;
else {
PyErr_SetString(wxPyNoAppError, "The wx.App object must be created first!");
return false;
}
}
//---------------------------------------------------------------------------
void wxPyClientData_dtor(wxPyClientData* self) {
if (! wxPyDoingCleanup) { // Don't do it during cleanup as Python
// may have already garbage collected the object...

View File

@@ -785,6 +785,8 @@ wxHtmlOpeningStatus wxPyHtmlWindow::OnOpeningURL(wxHtmlURLType type,
MustHaveApp(wxPyHtmlWindow);
%name(HtmlWindow) class wxPyHtmlWindow : public wxScrolledWindow {
public:
%pythonAppend wxPyHtmlWindow "self._setCallbackInfo(self, HtmlWindow); self._setOORInfo(self)"
@@ -919,6 +921,8 @@ public:
%newgroup
MustHaveApp(wxHtmlDCRenderer);
class wxHtmlDCRenderer : public wxObject {
public:
wxHtmlDCRenderer();
@@ -956,6 +960,8 @@ enum {
};
MustHaveApp(wxHtmlPrintout);
class wxHtmlPrintout : public wxPyPrintout {
public:
wxHtmlPrintout(const wxString& title = wxPyHtmlPrintoutTitleStr);
@@ -991,6 +997,8 @@ public:
MustHaveApp(wxHtmlEasyPrinting);
class wxHtmlEasyPrinting : public wxObject {
public:
wxHtmlEasyPrinting(const wxString& name = wxPyHtmlPrintingTitleStr,
@@ -1104,6 +1112,8 @@ public:
//---------------------------------------------------------------------------
MustHaveApp(wxHtmlHelpFrame);
class wxHtmlHelpFrame : public wxFrame {
public:
%pythonAppend wxHtmlHelpFrame "self._setOORInfo(self)"
@@ -1141,6 +1151,8 @@ enum {
};
MustHaveApp(wxHtmlHelpController);
class wxHtmlHelpController : public wxEvtHandler {
public:
%pythonAppend wxHtmlHelpController "self._setOORInfo(self)"

View File

@@ -17,8 +17,7 @@
%{
#include "wx/wxPython/wxPython.h"
#include "wx/wxPython/pyclasses.h"
#include "wx/wxPython/pyistream.h"
#include "wx/wxPython/pyistream.h"
%}
//---------------------------------------------------------------------------

View File

@@ -11,17 +11,6 @@
/////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
// Tell SWIG to wrap all the wrappers with our thread protection
%exception {
PyThreadState* __tstate = wxPyBeginAllowThreads();
$action
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
//----------------------------------------------------------------------
// Typemaps to convert a list of items to an int (size) and an array

View File

@@ -84,6 +84,7 @@ public:
//
// Other than GetNext/Prev() functions, wxWizardPage is just a panel and may be
// used as such (i.e. controls may be placed directly on it &c).
MustHaveApp(wxWizardPage);
class wxWizardPage : public wxPanel
{
public:
@@ -198,6 +199,8 @@ IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWizardPage, wxWizardPage, RemoveChild);
MustHaveApp(wxPyWizardPage);
class wxPyWizardPage : public wxWizardPage {
public:
@@ -275,6 +278,7 @@ public:
// OTOH, it is also possible to dynamicly decide which page to return (i.e.
// depending on the user's choices) as the wizard sample shows - in order to do
// this, you must derive from wxWizardPage directly.
MustHaveApp(wxWizardPageSimple);
class wxWizardPageSimple : public wxWizardPage
{
public:
@@ -307,6 +311,8 @@ public:
//----------------------------------------------------------------------
MustHaveApp(wxWizard);
class wxWizard : public wxDialog
{
public: