📄 wxpython_int.h
字号:
////////////////////////////////////////////////////////////////////////////
// Name: wxPython_int.h (int == internal)
// Purpose: Helper functions/classes for the wxPython extension module
// This header should only be inclued directly by those source
// modules included in the wx._core module. All others should
// include wx/wxPython/wxPython.h instead.
//
// Author: Robin Dunn
//
// Created: 1-July-1997
// RCS-ID: $Id: wxPython_int.h,v 1.57 2006/07/08 02:13:55 RD Exp $
// Copyright: (c) 1998 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __wxp_helpers__
#define __wxp_helpers__
#include <wx/wx.h>
#include <wx/busyinfo.h>
#include <wx/caret.h>
#include <wx/choicebk.h>
#include <wx/clipbrd.h>
#include <wx/colordlg.h>
#include <wx/config.h>
#include <wx/cshelp.h>
#include <wx/dcmirror.h>
#include <wx/dcps.h>
#include <wx/dirctrl.h>
#include <wx/dirdlg.h>
#include <wx/numdlg.h>
#include <wx/dnd.h>
#include <wx/docview.h>
#include <wx/encconv.h>
#include <wx/fdrepdlg.h>
#include <wx/fileconf.h>
#include <wx/filesys.h>
#include <wx/fontdlg.h>
#include <wx/fs_inet.h>
#include <wx/fs_mem.h>
#include <wx/fs_zip.h>
#include <wx/gbsizer.h>
#include <wx/geometry.h>
#include <wx/htmllbox.h>
#include <wx/image.h>
#include <wx/imaglist.h>
#include <wx/intl.h>
#include <wx/laywin.h>
#include <wx/listbook.h>
#include <wx/minifram.h>
#include <wx/notebook.h>
#include <wx/print.h>
#include <wx/printdlg.h>
#include <wx/process.h>
#include <wx/progdlg.h>
#include <wx/sashwin.h>
#include <wx/spinbutt.h>
#include <wx/spinctrl.h>
#include <wx/splash.h>
#include <wx/splitter.h>
#include <wx/statline.h>
#include <wx/stream.h>
#include <wx/sysopt.h>
#include <wx/taskbar.h>
#include <wx/tglbtn.h>
#include <wx/tipwin.h>
#include <wx/toolbook.h>
#include <wx/tooltip.h>
#include <wx/treebook.h>
#include <wx/vlbox.h>
#include <wx/vscroll.h>
#include <wx/dateevt.h>
#include <wx/datectrl.h>
#include <wx/power.h>
#include <wx/hyperlink.h>
#include <wx/pickerbase.h>
#include <wx/clrpicker.h>
#include <wx/filepicker.h>
#include <wx/fontpicker.h>
#ifdef _MSC_VER
# pragma warning(disable:4800)
# pragma warning(disable:4190)
#endif
#ifdef __WXMAC__ // avoid a bug in Carbon headers
#define scalb scalbn
#endif
//---------------------------------------------------------------------------
#ifndef wxHAS_POWER_EVENTS
class wxPowerEvent : public wxEvent
{
public:
wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) {}
void Veto() {}
bool IsVetoed() const { return false; }
virtual wxEvent *Clone() const { return new wxPowerEvent(*this); }
};
#endif
//---------------------------------------------------------------------------
typedef unsigned char byte;
typedef wxPoint2DDouble wxPoint2D;
#ifndef SWIG_TYPE_TABLE
#define SWIG_TYPE_TABLE wxPython_type_table
#endif
#ifdef __WXGTK__
#define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE
#else
#define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP
#endif
#ifndef wxPyUSE_EXPORTED_API
void __wxPyPreStart(PyObject*);
void __wxPyCleanup();
PyObject* __wxPySetDictionary(PyObject*, PyObject* args);
void wxSetDefaultPyEncoding(const char* encoding);
const char* wxGetDefaultPyEncoding();
void wxPyEventThunker(wxObject*, wxEvent& event);
bool wxPyCheckSwigType(const wxChar* className);
PyObject* wxPyConstructObject(void* ptr,
const wxChar* className,
int setThisOwn=0);
bool wxPyConvertSwigPtr(PyObject* obj, void **ptr,
const wxChar* className);
PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* classname);
PyObject* wx2PyString(const wxString& src);
wxString Py2wxString(PyObject* source);
PyObject* wxPyMake_wxObject(wxObject* source, bool setThisOwn, bool checkEvtHandler=true);
PyObject* wxPyMake_wxSizer(wxSizer* source, bool setThisOwn);
void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName);
PyObject* wxPy_ConvertList(wxListBase* list);
long wxPyGetWinHandle(wxWindow* win);
void wxPy_ReinitStockObjects(int pass);
bool wxPyInstance_Check(PyObject* obj);
bool wxPySwigInstance_Check(PyObject* obj);
#endif // wxPyUSE_EXPORTED_API
//---------------------------------------------------------------------------
// if we want to handle threads and Python threads are available...
#if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
#define WXP_WITH_THREAD
#else // no Python threads...
#undef WXP_WITH_THREAD
#endif
// In Python 2.3 and later there are the PyGILState_* APIs that we can use for
// blocking threads when calling back into Python. Using them instead of my
// home-grown hacks greatly simplifies wxPyBeginBlockThreads and
// wxPyEndBlockThreads.
//
// Unfortunatly there is a bug somewhere when using these new APIs on Python
// 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
// at breakpoints located in event handlers. I think that the cause may be
// something like the original PyThreadState for the main thread is not being
// restored for the callbacks, but I can't see where that could be
// happening... So we'll only activate this new change for Python 2.4+ :-(
#if PY_VERSION_HEX < 0x02040000
#define wxPyUSE_GIL_STATE 0
typedef bool wxPyBlock_t;
#else
#define wxPyUSE_GIL_STATE 1
typedef PyGILState_STATE wxPyBlock_t;
#endif
// Python 2.5 changes the type of some API parameter and return types. Using
// this typedef for versions < 2.5 will help with the transition...
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#endif
#ifndef wxPyUSE_EXPORTED_API
// For Python --> C++
PyThreadState* wxPyBeginAllowThreads();
void wxPyEndAllowThreads(PyThreadState* state);
// For C++ --> Python
wxPyBlock_t wxPyBeginBlockThreads();
void wxPyEndBlockThreads(wxPyBlock_t blocked);
#endif // wxPyUSE_EXPORTED_API
// A macro that will help to execute simple statments wrapped in
// StartBlock/EndBlockThreads calls
#define wxPyBLOCK_THREADS(stmt) \
{ wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
// Raise the NotImplementedError exception (blocking threads)
#define wxPyRaiseNotImplemented() \
wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
// Raise any exception with a string value (blocking threads)
#define wxPyErr_SetString(err, str) \
wxPyBLOCK_THREADS(PyErr_SetString(err, str))
//---------------------------------------------------------------------------
// These are helpers used by the typemaps
#ifndef wxPyUSE_EXPORTED_API
wxString* wxString_in_helper(PyObject* source);
byte* byte_LIST_helper(PyObject* source);
int* int_LIST_helper(PyObject* source);
long* long_LIST_helper(PyObject* source);
char** string_LIST_helper(PyObject* source);
wxPoint* wxPoint_LIST_helper(PyObject* source, int* npoints);
wxBitmap** wxBitmap_LIST_helper(PyObject* source);
wxString* wxString_LIST_helper(PyObject* source);
wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
wxPen** wxPen_LIST_helper(PyObject* source);
bool wxSize_helper(PyObject* source, wxSize** obj);
bool wxPoint_helper(PyObject* source, wxPoint** obj);
bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj);
bool wxRect_helper(PyObject* source, wxRect** obj);
bool wxColour_helper(PyObject* source, wxColour** obj);
bool wxPoint2D_helper(PyObject* source, wxPoint2D** obj);
bool wxPySimple_typecheck(PyObject* source, const wxChar* classname, int seqLen);
bool wxColour_typecheck(PyObject* source);
bool wxPyCheckForApp();
// Other helpful stuff
bool wxPy2int_seq_helper(PyObject* source, int* i1, int* i2);
bool wxPy4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4);
PyObject* wxArrayString2PyList_helper(const wxArrayString& arr);
PyObject* wxArrayInt2PyList_helper(const wxArrayInt& arr);
#endif // wxPyUSE_EXPORTED_API
//---------------------------------------------------------------------------
#if PYTHON_API_VERSION < 1009
#define PySequence_Fast_GET_ITEM(o, i) \
(PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
#endif
#define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -