1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Definitions and stuff
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
14 //---------------------------------------------------------------------------
15 // Globally turn on the autodoc feature
17 %feature("autodoc", "1"); // 0 == no param types, 1 == show param types
19 //---------------------------------------------------------------------------
20 // Tell SWIG to wrap all the wrappers with our thread protection by default
23 PyThreadState* __tstate = wxPyBeginAllowThreads();
25 wxPyEndAllowThreads(__tstate);
26 if (PyErr_Occurred()) SWIG_fail;
30 // This one can be used to add a check for an existing wxApp before the real
31 // work is done. An exception is raised if there isn't one.
32 %define MustHaveApp(name)
34 if (!wxPyCheckForApp()) SWIG_fail;
35 PyThreadState* __tstate = wxPyBeginAllowThreads();
37 wxPyEndAllowThreads(__tstate);
38 if (PyErr_Occurred()) SWIG_fail;
44 //---------------------------------------------------------------------------
45 // some type definitions to simplify things for SWIG
47 typedef int wxEventType;
48 typedef unsigned int size_t;
49 typedef unsigned int time_t;
50 typedef unsigned char byte;
51 typedef unsigned long wxUIntPtr;
53 #define wxWindowID int
56 #define wxUint32 unsigned int
59 //----------------------------------------------------------------------
60 // Various SWIG macros and such
62 #define %pythonAppend %feature("pythonappend")
63 #define %pythonPrepend %feature("pythonprepend")
64 #define %kwargs %feature("kwargs")
65 #define %nokwargs %feature("nokwargs")
66 #define %noautodoc %feature("noautodoc")
70 //#define %shadow %insert("shadow")
74 #define %pythoncode %insert("python")
80 // Given the name of a wxChar (or wxString) constant in C++, make
81 // a static wxString for wxPython, and also let SWIG wrap it.
82 %define MAKE_CONST_WXSTRING(strname)
83 %{ static const wxString wxPy##strname(wx##strname); %}
85 %rename(strname) wxPy##strname;
86 const wxString wxPy##strname;
90 %define MAKE_CONST_WXSTRING2(strname, val)
91 %{ static const wxString wxPy##strname(val); %}
93 %rename(strname) wxPy##strname;
94 const wxString wxPy##strname;
98 %define MAKE_CONST_WXSTRING_NOSWIG(strname)
99 %{ static const wxString wxPy##strname(wx##strname); %}
102 // Generate code in the module init for the event types, since they may not be
103 // initialized yet when they are used in the static swig_const_table.
104 %typemap(consttab) wxEventType; // TODO: how to prevent code inserted into the consttab?
105 %typemap(constcode) wxEventType "PyDict_SetItemString(d, \"$symname\", PyInt_FromLong($value));";
109 //----------------------------------------------------------------------
110 // Macros for the docstring and autodoc features of SWIG. These will
111 // help make the code look more readable, and pretty, as well as help
112 // reduce typing in some cases.
114 // Set the docsring for the given full or partial declaration
116 %define DocStr(decl, docstr, details)
117 %feature("docstring") decl docstr details;
120 %define DocStr(decl, docstr, details)
121 %feature("docstring") decl docstr;
126 // Set the autodoc string for a full or partial declaration
127 %define DocA(decl, astr)
128 %feature("autodoc") decl astr;
132 // Set both the autodoc and docstring for a full or partial declaration
134 %define DocAStr(decl, astr, docstr, details)
135 %feature("autodoc") decl astr;
136 %feature("docstring") decl docstr details
139 %define DocAStr(decl, astr, docstr, details)
140 %feature("autodoc") decl astr;
141 %feature("docstring") decl docstr
148 // Set the docstring for a decl and then define the decl too. Must use the
149 // full declaration of the item.
151 %define DocDeclStr(type, decl, docstr, details)
152 %feature("docstring") decl docstr details;
156 %define DocDeclStr(type, decl, docstr, details)
157 %feature("docstring") decl docstr;
164 // As above, but also give the decl a new %name
166 %define DocDeclStrName(type, decl, docstr, details, newname)
167 %feature("docstring") decl docstr details;
168 %rename(newname) decl;
172 %define DocDeclStrName(type, decl, docstr, details, newname)
173 %feature("docstring") decl docstr;
174 %rename(newname) decl;
180 // Set the autodoc string for a decl and then define the decl too. Must use the
181 // full declaration of the item.
182 %define DocDeclA(type, decl, astr)
183 %feature("autodoc") decl astr;
187 // As above, but also give the decl a new %name
188 %define DocDeclAName(type, decl, astr, newname)
189 %feature("autodoc") decl astr;
190 %rename(newname) decl;
196 // Set the autodoc and the docstring for a decl and then define the decl too.
197 // Must use the full declaration of the item.
199 %define DocDeclAStr(type, decl, astr, docstr, details)
200 %feature("autodoc") decl astr;
201 %feature("docstring") decl docstr details;
205 %define DocDeclAStr(type, decl, astr, docstr, details)
206 %feature("autodoc") decl astr;
207 %feature("docstring") decl docstr;
213 // As above, but also give the decl a new %name
215 %define DocDeclAStrName(type, decl, astr, docstr, details, newname)
216 %feature("autodoc") decl astr;
217 %feature("docstring") decl docstr details;
218 %rename(newname) decl;
222 %define DocDeclAStrName(type, decl, astr, docstr, details, newname)
223 %feature("autodoc") decl astr;
224 %feature("docstring") decl docstr;
225 %rename(newname) decl;
232 // Set the docstring for a constructor decl and then define the decl too.
233 // Must use the full declaration of the item.
235 %define DocCtorStr(decl, docstr, details)
236 %feature("docstring") decl docstr details;
240 %define DocCtorStr(decl, docstr, details)
241 %feature("docstring") decl docstr;
247 // As above, but also give the decl a new %name
249 %define DocCtorStrName(decl, docstr, details, newname)
250 %feature("docstring") decl docstr details;
251 %rename(newname) decl;
255 %define DocCtorStrName(decl, docstr, details, newname)
256 %feature("docstring") decl docstr;
257 %rename(newname) decl;
263 // Set the autodoc string for a constructor decl and then define the decl too.
264 // Must use the full declaration of the item.
265 %define DocCtorA(decl, astr)
266 %feature("autodoc") decl astr;
270 // As above, but also give the decl a new %name
271 %define DocCtorAName(decl, astr, newname)
272 %feature("autodoc") decl astr;
273 %rename(newname) decl;
279 // Set the autodoc and the docstring for a constructor decl and then define
280 // the decl too. Must use the full declaration of the item.
282 %define DocCtorAStr(decl, astr, docstr, details)
283 %feature("autodoc") decl astr;
284 %feature("docstring") decl docstr details;
288 %define DocCtorAStr(decl, astr, docstr, details)
289 %feature("autodoc") decl astr;
290 %feature("docstring") decl docstr;
297 // As above, but also give the decl a new %name
299 %define DocCtorAStrName(decl, astr, docstr, details, newname)
300 %feature("autodoc") decl astr;
301 %feature("docstring") decl docstr details;
302 %rename(newname) decl;
306 %define DocCtorAStrName(decl, astr, docstr, details, newname)
307 %feature("autodoc") decl astr;
308 %feature("docstring") decl docstr;
309 %rename(newname) decl;
318 %#---------------------------------------------------------------------------
323 // A set of macros to make using %rename easier, since %name has been
325 %define %Rename(newname, type, decl)
326 %rename(newname) decl;
330 %define %RenameCtor(newname, decl)
331 %rename(newname) decl;
336 %define %RenameDocCtor(newname, docstr, details, decl)
337 %feature("docstring") decl docstr details;
338 %rename(newname) decl;
342 %define %RenameDocCtor(newname, docstr, details, decl)
343 %feature("docstring") decl docstr;
344 %rename(newname) decl;
349 //---------------------------------------------------------------------------
350 // Forward declarations and %renames for some classes, so the autodoc strings
351 // will be able to use the right types even when the real class declaration is
352 // not in the module being processed or seen by %import's.
354 #ifdef BUILDING_RENAMERS
355 #define FORWARD_DECLARE(wxName, Name)
357 %define FORWARD_DECLARE(wxName, Name)
358 %rename(Name) wxName;
363 FORWARD_DECLARE(wxString, String);
364 FORWARD_DECLARE(wxBitmap, Bitmap);
365 FORWARD_DECLARE(wxDateTime, DateTime);
366 FORWARD_DECLARE(wxInputStream, InputStream);
367 FORWARD_DECLARE(wxDC, DC);
368 FORWARD_DECLARE(wxCursor, Cursor);
369 FORWARD_DECLARE(wxRegion, Region);
370 FORWARD_DECLARE(wxColour, Colour);
371 FORWARD_DECLARE(wxFont, Font);
372 FORWARD_DECLARE(wxCaret, Caret);
373 FORWARD_DECLARE(wxToolTip, ToolTip);
374 FORWARD_DECLARE(wxPyDropTarget, DropTarget);
375 FORWARD_DECLARE(wxImageList, ImageList);
376 FORWARD_DECLARE(wxMemoryDC, MemoryDC);
377 FORWARD_DECLARE(wxHtmlTagHandler, HtmlTagHandler);
378 FORWARD_DECLARE(wxConfigBase, ConfigBase);
379 FORWARD_DECLARE(wxIcon, Icon);
380 FORWARD_DECLARE(wxStaticBox, StaticBox);
383 //---------------------------------------------------------------------------
386 #if !WXWIN_COMPATIBILITY_2_4
387 #define wxHIDE_READONLY 0
392 // General numeric #define's and etc. Making them all enums makes SWIG use the
393 // real macro when making the Python Int
411 wxTRANSPARENT_WINDOW,
413 wxDEFAULT_CONTROL_BORDER,
414 wxDEFAULT_STATUSBAR_STYLE,
499 wxSIZE_ALLOW_MINUS_ONE,
502 wxPRINT_QUALITY_HIGH,
503 wxPRINT_QUALITY_MEDIUM,
505 wxPRINT_QUALITY_DRAFT,
527 wxID_HELP_PROCEDURES,
546 wxID_VIEW_LARGEICONS,
547 wxID_VIEW_SMALLICONS,
607 wxID_REVERT_TO_SAVED,
638 wxNO_FULL_REPAINT_ON_RESIZE,
639 wxFULL_REPAINT_ON_RESIZE,
644 wxWS_EX_VALIDATE_RECURSIVELY,
645 wxWS_EX_BLOCK_EVENTS,
648 wxWS_EX_THEMED_BACKGROUND,
649 wxWS_EX_PROCESS_IDLE,
650 wxWS_EX_PROCESS_UI_UPDATES,
653 // Mapping modes (as per Windows)
666 // It looks like wxTabCtrl may rise from the dead. Uncomment these if
667 // it gets an implementation for all platforms...
668 // wxTC_RIGHTJUSTIFY,
681 enum wxGeometryCentre
716 wxALIGN_CENTER_HORIZONTAL,
717 wxALIGN_CENTRE_HORIZONTAL,
722 wxALIGN_CENTER_VERTICAL,
723 wxALIGN_CENTRE_VERTICAL,
757 enum wxBackgroundStyle
789 wxSTIPPLE_MASK_OPAQUE,
806 wxXOR, // src XOR dst
808 wxOR_REVERSE, // src OR (NOT dst)
809 wxAND_REVERSE,// src AND (NOT dst)
811 wxAND, // src AND dst
812 wxAND_INVERT, // (NOT src) AND dst
814 wxNOR, // (NOT src) AND (NOT dst)
815 wxEQUIV, // (NOT src) XOR dst
816 wxSRC_INVERT, // (NOT src)
817 wxOR_INVERT, // (NOT src) OR dst
818 wxNAND, // (NOT src) OR (NOT dst)
821 // wxSRC_OR, // source _bitmap_ OR destination
822 // wxSRC_AND // source _bitmap_ AND destination
845 WXK_PRIOR, /* Page up */
846 WXK_NEXT, /* Page down */
927 WXK_NUMPAD_SEPARATOR,
938 // Hardware-specific buttons
964 wxPAPER_NONE, // Use specific dimensions
965 wxPAPER_LETTER, // Letter, 8 1/2 by 11 inches
966 wxPAPER_LEGAL, // Legal, 8 1/2 by 14 inches
967 wxPAPER_A4, // A4 Sheet, 210 by 297 millimeters
968 wxPAPER_CSHEET, // C Sheet, 17 by 22 inches
969 wxPAPER_DSHEET, // D Sheet, 22 by 34 inches
970 wxPAPER_ESHEET, // E Sheet, 34 by 44 inches
971 wxPAPER_LETTERSMALL, // Letter Small, 8 1/2 by 11 inches
972 wxPAPER_TABLOID, // Tabloid, 11 by 17 inches
973 wxPAPER_LEDGER, // Ledger, 17 by 11 inches
974 wxPAPER_STATEMENT, // Statement, 5 1/2 by 8 1/2 inches
975 wxPAPER_EXECUTIVE, // Executive, 7 1/4 by 10 1/2 inches
976 wxPAPER_A3, // A3 sheet, 297 by 420 millimeters
977 wxPAPER_A4SMALL, // A4 small sheet, 210 by 297 millimeters
978 wxPAPER_A5, // A5 sheet, 148 by 210 millimeters
979 wxPAPER_B4, // B4 sheet, 250 by 354 millimeters
980 wxPAPER_B5, // B5 sheet, 182-by-257-millimeter paper
981 wxPAPER_FOLIO, // Folio, 8-1/2-by-13-inch paper
982 wxPAPER_QUARTO, // Quarto, 215-by-275-millimeter paper
983 wxPAPER_10X14, // 10-by-14-inch sheet
984 wxPAPER_11X17, // 11-by-17-inch sheet
985 wxPAPER_NOTE, // Note, 8 1/2 by 11 inches
986 wxPAPER_ENV_9, // #9 Envelope, 3 7/8 by 8 7/8 inches
987 wxPAPER_ENV_10, // #10 Envelope, 4 1/8 by 9 1/2 inches
988 wxPAPER_ENV_11, // #11 Envelope, 4 1/2 by 10 3/8 inches
989 wxPAPER_ENV_12, // #12 Envelope, 4 3/4 by 11 inches
990 wxPAPER_ENV_14, // #14 Envelope, 5 by 11 1/2 inches
991 wxPAPER_ENV_DL, // DL Envelope, 110 by 220 millimeters
992 wxPAPER_ENV_C5, // C5 Envelope, 162 by 229 millimeters
993 wxPAPER_ENV_C3, // C3 Envelope, 324 by 458 millimeters
994 wxPAPER_ENV_C4, // C4 Envelope, 229 by 324 millimeters
995 wxPAPER_ENV_C6, // C6 Envelope, 114 by 162 millimeters
996 wxPAPER_ENV_C65, // C65 Envelope, 114 by 229 millimeters
997 wxPAPER_ENV_B4, // B4 Envelope, 250 by 353 millimeters
998 wxPAPER_ENV_B5, // B5 Envelope, 176 by 250 millimeters
999 wxPAPER_ENV_B6, // B6 Envelope, 176 by 125 millimeters
1000 wxPAPER_ENV_ITALY, // Italy Envelope, 110 by 230 millimeters
1001 wxPAPER_ENV_MONARCH, // Monarch Envelope, 3 7/8 by 7 1/2 inches
1002 wxPAPER_ENV_PERSONAL, // 6 3/4 Envelope, 3 5/8 by 6 1/2 inches
1003 wxPAPER_FANFOLD_US, // US Std Fanfold, 14 7/8 by 11 inches
1004 wxPAPER_FANFOLD_STD_GERMAN, // German Std Fanfold, 8 1/2 by 12 inches
1005 wxPAPER_FANFOLD_LGL_GERMAN, // German Legal Fanfold, 8 1/2 by 13 inches
1007 wxPAPER_ISO_B4, // B4 (ISO) 250 x 353 mm
1008 wxPAPER_JAPANESE_POSTCARD, // Japanese Postcard 100 x 148 mm
1009 wxPAPER_9X11, // 9 x 11 in
1010 wxPAPER_10X11, // 10 x 11 in
1011 wxPAPER_15X11, // 15 x 11 in
1012 wxPAPER_ENV_INVITE, // Envelope Invite 220 x 220 mm
1013 wxPAPER_LETTER_EXTRA, // Letter Extra 9 \275 x 12 in
1014 wxPAPER_LEGAL_EXTRA, // Legal Extra 9 \275 x 15 in
1015 wxPAPER_TABLOID_EXTRA, // Tabloid Extra 11.69 x 18 in
1016 wxPAPER_A4_EXTRA, // A4 Extra 9.27 x 12.69 in
1017 wxPAPER_LETTER_TRANSVERSE, // Letter Transverse 8 \275 x 11 in
1018 wxPAPER_A4_TRANSVERSE, // A4 Transverse 210 x 297 mm
1019 wxPAPER_LETTER_EXTRA_TRANSVERSE, // Letter Extra Transverse 9\275 x 12 in
1020 wxPAPER_A_PLUS, // SuperA/SuperA/A4 227 x 356 mm
1021 wxPAPER_B_PLUS, // SuperB/SuperB/A3 305 x 487 mm
1022 wxPAPER_LETTER_PLUS, // Letter Plus 8.5 x 12.69 in
1023 wxPAPER_A4_PLUS, // A4 Plus 210 x 330 mm
1024 wxPAPER_A5_TRANSVERSE, // A5 Transverse 148 x 210 mm
1025 wxPAPER_B5_TRANSVERSE, // B5 (JIS) Transverse 182 x 257 mm
1026 wxPAPER_A3_EXTRA, // A3 Extra 322 x 445 mm
1027 wxPAPER_A5_EXTRA, // A5 Extra 174 x 235 mm
1028 wxPAPER_B5_EXTRA, // B5 (ISO) Extra 201 x 276 mm
1029 wxPAPER_A2, // A2 420 x 594 mm
1030 wxPAPER_A3_TRANSVERSE, // A3 Transverse 297 x 420 mm
1031 wxPAPER_A3_EXTRA_TRANSVERSE // A3 Extra Transverse 322 x 445 mm
1036 wxDUPLEX_SIMPLEX, // Non-duplex
1037 wxDUPLEX_HORIZONTAL,
1043 // menu and toolbar item kinds
1059 wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE,
1060 wxHT_SCROLLBAR_ARROW_LINE_1, // left or upper arrow to scroll by line
1061 wxHT_SCROLLBAR_ARROW_LINE_2, // right or down
1062 wxHT_SCROLLBAR_ARROW_PAGE_1, // left or upper arrow to scroll by page
1063 wxHT_SCROLLBAR_ARROW_PAGE_2, // right or down
1064 wxHT_SCROLLBAR_THUMB, // on the thumb
1065 wxHT_SCROLLBAR_BAR_1, // bar to the left/above the thumb
1066 wxHT_SCROLLBAR_BAR_2, // bar to the right/below the thumb
1067 wxHT_SCROLLBAR_LAST,
1070 wxHT_WINDOW_OUTSIDE, // not in this window at all
1071 wxHT_WINDOW_INSIDE, // in the client area
1072 wxHT_WINDOW_VERT_SCROLLBAR, // on the vertical scrollbar
1073 wxHT_WINDOW_HORZ_SCROLLBAR, // on the horizontal scrollbar
1074 wxHT_WINDOW_CORNER, // on the corner between 2 scrollbars
1082 enum wxHotkeyModifier
1090 #define wxEVT_HOTKEY 9999
1094 enum wxHotkeyModifier
1106 wxUPDATE_UI_NONE = 0x0000,
1107 wxUPDATE_UI_RECURSE = 0x0001,
1108 wxUPDATE_UI_FROMIDLE = 0x0002 // Invoked from On(Internal)Idle
1113 //---------------------------------------------------------------------------