annotate Modules/stdwinmodule.c @ 6719:faebc1940432 legacy-trunk

Understand -Xlinker option.
author Guido van Rossum <guido@python.org>
date Tue, 02 Dec 1997 20:38:11 +0000
parents 879130f1ff5f
children 07dae6fdae79
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
1 /***********************************************************
2061
172ba04a5191 Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
172ba04a5191 Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
3 The Netherlands.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
4
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
5 All Rights Reserved
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
6
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
7 Permission to use, copy, modify, and distribute this software and its
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
8 documentation for any purpose and without fee is hereby granted,
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
9 provided that the above copyright notice appear in all copies and that
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
10 both that copyright notice and this permission notice appear in
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
11 supporting documentation, and that the names of Stichting Mathematisch
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
12 Centrum or CWI or Corporation for National Research Initiatives or
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
13 CNRI not be used in advertising or publicity pertaining to
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
14 distribution of the software without specific, written prior
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
15 permission.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
16
4503
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
17 While CWI is the initial source for this software, a modified version
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
18 is made available by the Corporation for National Research Initiatives
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
19 (CNRI) at the Internet address ftp://ftp.python.org.
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
20
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65d2d8e67da3 New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents: 2975
diff changeset
28 PERFORMANCE OF THIS SOFTWARE.
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
29
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
30 ******************************************************************/
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 142
diff changeset
31
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 /* Stdwin module */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
33
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
34 /* Stdwin itself is a module, not a separate object type.
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
35 Object types defined here:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 wp: a window
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 dp: a drawing structure (only one can exist at a time)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 mp: a menu
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 tp: a textedit block
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
40 bp: a bitmap
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
42
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 /* Rules for translating C stdwin function calls into Python stwin:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 - All names drop their initial letter 'w'
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 - Functions with a window as first parameter are methods of window objects
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
46 - There is no equivalent for wclose(); just delete the window object
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 (all references to it!) (XXX maybe this is a bad idea)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 - w.begindrawing() returns a drawing object
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
49 - There is no equivalent for wenddrawing(win); just delete the drawing
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 object (all references to it!) (XXX maybe this is a bad idea)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 - Functions that may only be used inside wbegindrawing / wendddrawing
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 are methods of the drawing object; this includes the text measurement
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 functions (which however have doubles as module functions).
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 - Methods of the drawing object drop an initial 'draw' from their name
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 if they have it, e.g., wdrawline() --> d.line()
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
56 - The obvious type conversions: int --> intobject; string --> stringobject
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 - A text parameter followed by a length parameter is only a text (string)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
58 parameter in Python
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
59 - A point or other pair of horizontal and vertical coordinates is always
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 a pair of integers in Python
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
61 - Two points forming a rectangle or endpoints of a line segment are a
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
62 pair of points in Python
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 - The arguments to d.elarc() are three points.
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 - The functions wgetclip() and wsetclip() are translated into
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
65 stdwin.getcutbuffer() and stdwin.setcutbuffer(); 'clip' is really
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
66 a bad word for what these functions do (clipping has a different
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
67 meaning in the drawing world), while cutbuffer is standard X jargon.
50
b94822f54991 Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
68 XXX This must change again in the light of changes to stdwin!
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
69 - For textedit, similar rules hold, but they are less strict.
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
70 XXX more?
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
71 */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
72
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
73 #include "Python.h"
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
74
2975
82356bddf712 Shuffled include's around (name conflict on Mac wrt teclick())
Jack Jansen <jack.jansen@cwi.nl>
parents: 2506
diff changeset
75 #ifdef macintosh
82356bddf712 Shuffled include's around (name conflict on Mac wrt teclick())
Jack Jansen <jack.jansen@cwi.nl>
parents: 2506
diff changeset
76 #include "macglue.h"
82356bddf712 Shuffled include's around (name conflict on Mac wrt teclick())
Jack Jansen <jack.jansen@cwi.nl>
parents: 2506
diff changeset
77 #endif
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
78
1191
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
79 #ifdef macintosh
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
80 #include ":::stdwin:H:stdwin.h"
1191
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
81 #else /* !macintosh */
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents: 65
diff changeset
82 #include "stdwin.h"
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
83 #define HAVE_BITMAPS
1191
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
84 #endif /* !macintosh */
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
85
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
86 #ifdef WITH_THREAD
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
87
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
88 #include "thread.h"
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
89
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
90 static type_lock StdwinLock; /* Lock held when interpreter not locked */
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
91
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
92 #define BGN_STDWIN Py_BEGIN_ALLOW_THREADS acquire_lock(StdwinLock, 1);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
93 #define RET_STDWIN release_lock(StdwinLock); Py_BLOCK_THREADS
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
94 #define END_STDWIN release_lock(StdwinLock); Py_END_ALLOW_THREADS
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
95
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
96 #else
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
97
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
98 #define BGN_STDWIN Py_BEGIN_ALLOW_THREADS
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
99 #define RET_STDWIN Py_BLOCK_THREADS
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
100 #define END_STDWIN Py_END_ALLOW_THREADS
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
101
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
102 #endif
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
103
6500
879130f1ff5f Add getintarg(), getlongarg(), getstrarg() to macros since these no
Guido van Rossum <guido@python.org>
parents: 6367
diff changeset
104 #define getintarg(v,a) PyArg_Parse(v, "i", a)
879130f1ff5f Add getintarg(), getlongarg(), getstrarg() to macros since these no
Guido van Rossum <guido@python.org>
parents: 6367
diff changeset
105 #define getlongarg(v,a) PyArg_Parse(v, "l", a)
879130f1ff5f Add getintarg(), getlongarg(), getstrarg() to macros since these no
Guido van Rossum <guido@python.org>
parents: 6367
diff changeset
106 #define getstrarg(v,a) PyArg_Parse(v, "s", a)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
107 #define getpointarg(v, a) PyArg_Parse(v, "(ii)", a, (a)+1)
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
108 #define get3pointarg(v, a) PyArg_Parse(v, "((ii)(ii)(ii))", \
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
109 a, a+1, a+2, a+3, a+4, a+5)
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
110 #define getrectarg(v, a) PyArg_Parse(v, "((ii)(ii))", a, a+1, a+2, a+3)
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
111 #define getrectintarg(v, a) PyArg_Parse(v, "(((ii)(ii))i)", \
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
112 a, a+1, a+2, a+3, a+4)
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
113 #define getpointintarg(v, a) PyArg_Parse(v, "((ii)i)", a, a+1, a+2)
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
114 #define getrectpointarg(v, a) PyArg_Parse(v, "(((ii)(ii))(ii))", \
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
115 a, a+1, a+2, a+3, a+4, a+5)
1313
6ee380349c84 * Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Guido van Rossum <guido@python.org>
parents: 1211
diff changeset
116
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
117 static PyObject *StdwinError; /* Exception stdwin.error */
475
e2c3463c4d91 Use new exceptions.
Guido van Rossum <guido@python.org>
parents: 453
diff changeset
118
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
119 /* Window and menu object types declared here because of forward references */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
120
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
121 typedef struct {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
122 PyObject_HEAD
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
123 PyObject *w_title;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
124 WINDOW *w_win;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
125 PyObject *w_attr; /* Attributes dictionary */
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
126 } windowobject;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
127
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
128 staticforward PyTypeObject Windowtype;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
129
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
130 #define is_windowobject(wp) ((wp)->ob_type == &Windowtype)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
131
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
132 typedef struct {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
133 PyObject_HEAD
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
134 MENU *m_menu;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
135 int m_id;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
136 PyObject *m_attr; /* Attributes dictionary */
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
137 } menuobject;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
138
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
139 staticforward PyTypeObject Menutype;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
140
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
141 #define is_menuobject(mp) ((mp)->ob_type == &Menutype)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
142
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
143 typedef struct {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
144 PyObject_HEAD
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
145 BITMAP *b_bitmap;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
146 PyObject *b_attr; /* Attributes dictionary */
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
147 } bitmapobject;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
148
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
149 staticforward PyTypeObject Bitmaptype;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
150
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
151 #define is_bitmapobject(mp) ((mp)->ob_type == &Bitmaptype)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
152
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
153
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
154 /* Strongly stdwin-specific argument handlers */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
155
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
156 static int
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
157 getmenudetail(v, ep)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
158 PyObject *v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
159 EVENT *ep;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
160 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
161 menuobject *mp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
162 if (!PyArg_Parse(v, "(Oi)", &mp, &ep->u.m.item))
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
163 return 0;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
164 if (!is_menuobject(mp))
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
165 return PyErr_BadArgument();
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
166 ep->u.m.id = mp->m_id;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
167 return 1;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
168 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
169
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
170 static int
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
171 geteventarg(v, ep)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
172 PyObject *v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
173 EVENT *ep;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
174 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
175 PyObject *wp, *detail;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
176 int a[4];
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
177 if (!PyArg_Parse(v, "(iOO)", &ep->type, &wp, &detail))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
178 return 0;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
179 if (is_windowobject(wp))
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
180 ep->window = ((windowobject *)wp) -> w_win;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
181 else if (wp == Py_None)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
182 ep->window = NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
183 else
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
184 return PyErr_BadArgument();
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
185 switch (ep->type) {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
186 case WE_CHAR: {
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
187 char c;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
188 if (!PyArg_Parse(detail, "c", &c))
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
189 return 0;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
190 ep->u.character = c;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
191 return 1;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
192 }
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
193 case WE_COMMAND:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
194 return getintarg(detail, &ep->u.command);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
195 case WE_DRAW:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
196 if (!getrectarg(detail, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
197 return 0;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
198 ep->u.area.left = a[0];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
199 ep->u.area.top = a[1];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
200 ep->u.area.right = a[2];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
201 ep->u.area.bottom = a[3];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
202 return 1;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
203 case WE_MOUSE_DOWN:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
204 case WE_MOUSE_UP:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
205 case WE_MOUSE_MOVE:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
206 return PyArg_Parse(detail, "((ii)iii)",
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
207 &ep->u.where.h, &ep->u.where.v,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
208 &ep->u.where.clicks,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
209 &ep->u.where.button,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
210 &ep->u.where.mask);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
211 case WE_MENU:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
212 return getmenudetail(detail, ep);
907
32010d355fb6 added WE_KEY detail format to stdwinmodule.c.
Guido van Rossum <guido@python.org>
parents: 902
diff changeset
213 case WE_KEY:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
214 return PyArg_Parse(detail, "(ii)",
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
215 &ep->u.key.code, &ep->u.key.mask);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
216 default:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
217 return 1;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
218 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
219 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
220
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
221
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
222 /* Return construction tools */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
223
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
224 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
225 makepoint(a, b)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
226 int a, b;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
227 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
228 return Py_BuildValue("(ii)", a, b);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
229 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
230
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
231 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
232 makerect(a, b, c, d)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
233 int a, b, c, d;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
234 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
235 return Py_BuildValue("((ii)(ii))", a, b, c, d);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
236 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
237
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
238
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
239 /* Drawing objects */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
240
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
241 typedef struct {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
242 PyObject_HEAD
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
243 windowobject *d_ref;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
244 } drawingobject;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
245
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
246 static drawingobject *Drawing; /* Set to current drawing object, or NULL */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
247
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
248 /* Drawing methods */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
249
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
250 static PyObject *
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
251 drawing_close(dp)
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
252 drawingobject *dp;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
253 {
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
254 if (dp->d_ref != NULL) {
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
255 wenddrawing(dp->d_ref->w_win);
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
256 Drawing = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
257 Py_DECREF(dp->d_ref);
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
258 dp->d_ref = NULL;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
259 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
260 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
261 return Py_None;
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
262 }
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
263
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
264 static void
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
265 drawing_dealloc(dp)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
266 drawingobject *dp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
267 {
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
268 if (dp->d_ref != NULL) {
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
269 wenddrawing(dp->d_ref->w_win);
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
270 Drawing = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
271 Py_DECREF(dp->d_ref);
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
272 dp->d_ref = NULL;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
273 }
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
274 free((char *)dp);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
275 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
276
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
277 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
278 drawing_generic(dp, args, func)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
279 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
280 PyObject *args;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
281 void (*func) Py_FPROTO((int, int, int, int));
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
282 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
283 int a[4];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
284 if (!getrectarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
285 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
286 (*func)(a[0], a[1], a[2], a[3]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
287 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
288 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
289 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
290
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
291 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
292 drawing_line(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
293 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
294 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
295 {
157
47cc0ce7999c Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
296 return drawing_generic(dp, args, wdrawline);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
297 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
298
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
299 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
300 drawing_xorline(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
301 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
302 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
303 {
157
47cc0ce7999c Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
304 return drawing_generic(dp, args, wxorline);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
305 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
306
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
307 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
308 drawing_circle(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
309 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
310 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
311 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
312 int a[3];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
313 if (!getpointintarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
314 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
315 wdrawcircle(a[0], a[1], a[2]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
316 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
317 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
318 }
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
319
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
320 static PyObject *
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
321 drawing_fillcircle(dp, args)
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
322 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
323 PyObject *args;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
324 {
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
325 int a[3];
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
326 if (!getpointintarg(args, a))
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
327 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
328 wfillcircle(a[0], a[1], a[2]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
329 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
330 return Py_None;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
331 }
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
332
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
333 static PyObject *
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
334 drawing_xorcircle(dp, args)
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
335 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
336 PyObject *args;
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
337 {
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
338 int a[3];
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
339 if (!getpointintarg(args, a))
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
340 return NULL;
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
341 wxorcircle(a[0], a[1], a[2]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
342 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
343 return Py_None;
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
344 }
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
345
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
346 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
347 drawing_elarc(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
348 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
349 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
350 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
351 int a[6];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
352 if (!get3pointarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
353 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
354 wdrawelarc(a[0], a[1], a[2], a[3], a[4], a[5]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
355 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
356 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
357 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
358
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
359 static PyObject *
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
360 drawing_fillelarc(dp, args)
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
361 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
362 PyObject *args;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
363 {
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
364 int a[6];
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
365 if (!get3pointarg(args, a))
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
366 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
367 wfillelarc(a[0], a[1], a[2], a[3], a[4], a[5]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
368 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
369 return Py_None;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
370 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
371
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
372 static PyObject *
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
373 drawing_xorelarc(dp, args)
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
374 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
375 PyObject *args;
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
376 {
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
377 int a[6];
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
378 if (!get3pointarg(args, a))
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
379 return NULL;
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
380 wxorelarc(a[0], a[1], a[2], a[3], a[4], a[5]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
381 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
382 return Py_None;
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
383 }
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
384
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
385 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
386 drawing_box(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
387 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
388 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
389 {
157
47cc0ce7999c Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
390 return drawing_generic(dp, args, wdrawbox);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
391 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
392
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
393 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
394 drawing_erase(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
395 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
396 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
397 {
157
47cc0ce7999c Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
398 return drawing_generic(dp, args, werase);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
399 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
400
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
401 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
402 drawing_paint(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
403 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
404 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
405 {
157
47cc0ce7999c Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
406 return drawing_generic(dp, args, wpaint);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
407 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
408
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
409 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
410 drawing_invert(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
411 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
412 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
413 {
157
47cc0ce7999c Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
414 return drawing_generic(dp, args, winvert);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
415 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
416
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
417 static POINT *
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
418 getpointsarray(v, psize)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
419 PyObject *v;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
420 int *psize;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
421 {
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
422 int n = -1;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
423 PyObject * (*getitem) Py_PROTO((PyObject *, int));
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
424 int i;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
425 POINT *points;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
426
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
427 if (v == NULL)
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
428 ;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
429 else if (PyList_Check(v)) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
430 n = PyList_Size(v);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
431 getitem = PyList_GetItem;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
432 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
433 else if (PyTuple_Check(v)) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
434 n = PyTuple_Size(v);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
435 getitem = PyTuple_GetItem;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
436 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
437
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
438 if (n <= 0) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
439 (void) PyErr_BadArgument();
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
440 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
441 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
442
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
443 points = PyMem_NEW(POINT, n);
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
444 if (points == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
445 (void) PyErr_NoMemory();
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
446 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
447 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
448
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
449 for (i = 0; i < n; i++) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
450 PyObject *w = (*getitem)(v, i);
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
451 int a[2];
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
452 if (!getpointarg(w, a)) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
453 PyMem_DEL(points);
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
454 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
455 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
456 points[i].h = a[0];
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
457 points[i].v = a[1];
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
458 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
459
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
460 *psize = n;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
461 return points;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
462 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
463
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
464 static PyObject *
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
465 drawing_poly(dp, args)
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
466 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
467 PyObject *args;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
468 {
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
469 int n;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
470 POINT *points = getpointsarray(args, &n);
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
471 if (points == NULL)
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
472 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
473 wdrawpoly(n, points);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
474 PyMem_DEL(points);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
475 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
476 return Py_None;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
477 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
478
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
479 static PyObject *
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
480 drawing_fillpoly(dp, args)
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
481 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
482 PyObject *args;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
483 {
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
484 int n;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
485 POINT *points = getpointsarray(args, &n);
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
486 if (points == NULL)
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
487 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
488 wfillpoly(n, points);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
489 PyMem_DEL(points);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
490 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
491 return Py_None;
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
492 }
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
493
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
494 static PyObject *
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
495 drawing_xorpoly(dp, args)
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
496 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
497 PyObject *args;
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
498 {
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
499 int n;
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
500 POINT *points = getpointsarray(args, &n);
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
501 if (points == NULL)
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
502 return NULL;
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
503 wxorpoly(n, points);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
504 PyMem_DEL(points);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
505 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
506 return Py_None;
244
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
507 }
47eb81da46dc Added xor functions.
Guido van Rossum <guido@python.org>
parents: 233
diff changeset
508
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
509 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
510 drawing_cliprect(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
511 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
512 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
513 {
157
47cc0ce7999c Return value of drawing_generic was ignored! Foo!
Guido van Rossum <guido@python.org>
parents: 145
diff changeset
514 return drawing_generic(dp, args, wcliprect);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
515 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
516
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
517 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
518 drawing_noclip(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
519 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
520 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
521 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
522 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
523 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
524 wnoclip();
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
525 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
526 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
527 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
528
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
529 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
530 drawing_shade(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
531 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
532 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
533 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
534 int a[5];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
535 if (!getrectintarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
536 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
537 wshade(a[0], a[1], a[2], a[3], a[4]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
538 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
539 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
540 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
541
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
542 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
543 drawing_text(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
544 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
545 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
546 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
547 int h, v, size;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
548 char *text;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
549 if (!PyArg_Parse(args, "((ii)s#)", &h, &v, &text, &size))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
550 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
551 wdrawtext(h, v, text, size);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
552 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
553 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
554 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
555
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
556 /* The following four are also used as stdwin functions */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
557
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
558 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
559 drawing_lineheight(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
560 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
561 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
562 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
563 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
564 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
565 return PyInt_FromLong((long)wlineheight());
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
566 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
567
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
568 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
569 drawing_baseline(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
570 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
571 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
572 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
573 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
574 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
575 return PyInt_FromLong((long)wbaseline());
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
576 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
577
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
578 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
579 drawing_textwidth(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
580 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
581 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
582 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
583 char *text;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
584 int size;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
585 if (!PyArg_Parse(args, "s#", &text, &size))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
586 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
587 return PyInt_FromLong((long)wtextwidth(text, size));
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
588 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
589
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
590 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
591 drawing_textbreak(dp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
592 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
593 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
594 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
595 char *text;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
596 int size, width;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
597 if (!PyArg_Parse(args, "(s#i)", &text, &size, &width))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
598 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
599 return PyInt_FromLong((long)wtextbreak(text, size, width));
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
600 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
601
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
602 static PyObject *
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
603 drawing_setfont(self, args)
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
604 drawingobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
605 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
606 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
607 char *font;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
608 char style = '\0';
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
609 int size = 0;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
610 if (args == NULL || !PyTuple_Check(args)) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
611 if (!PyArg_Parse(args, "z", &font))
184
1b08df41587b More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents: 171
diff changeset
612 return NULL;
1b08df41587b More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents: 171
diff changeset
613 }
1b08df41587b More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents: 171
diff changeset
614 else {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
615 int n = PyTuple_Size(args);
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
616 if (n == 2) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
617 if (!PyArg_Parse(args, "(zi)", &font, &size))
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
618 return NULL;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
619 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
620 else if (!PyArg_Parse(args, "(zic)", &font, &size, &style)) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
621 PyErr_Clear();
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
622 if (!PyArg_Parse(args, "(zci)", &font, &style, &size))
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
623 return NULL;
184
1b08df41587b More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents: 171
diff changeset
624 }
1b08df41587b More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents: 171
diff changeset
625 }
1191
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
626 if (font != NULL) {
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
627 if (!wsetfont(font)) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
628 PyErr_SetString(StdwinError, "font not found");
1191
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
629 return NULL;
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
630 }
38f0054f44a7 Added separate main program for the Mac: macmain.c
Guido van Rossum <guido@python.org>
parents: 1051
diff changeset
631 }
184
1b08df41587b More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents: 171
diff changeset
632 if (size != 0)
1b08df41587b More flexible font setting (mainly for the Mac).
Guido van Rossum <guido@python.org>
parents: 171
diff changeset
633 wsetsize(size);
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
634 switch (style) {
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
635 case 'b':
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
636 wsetbold();
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
637 break;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
638 case 'i':
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
639 wsetitalic();
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
640 break;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
641 case 'o':
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
642 wsetbolditalic();
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
643 break;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
644 case 'u':
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
645 wsetunderline();
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
646 break;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
647 case 'p':
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
648 wsetplain();
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
649 break;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
650 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
651 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
652 return Py_None;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
653 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
654
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
655 static PyObject *
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
656 drawing_getbgcolor(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
657 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
658 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
659 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
660 if (!PyArg_NoArgs(args))
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
661 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
662 return PyInt_FromLong((long)wgetbgcolor());
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
663 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
664
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
665 static PyObject *
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
666 drawing_getfgcolor(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
667 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
668 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
669 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
670 if (!PyArg_NoArgs(args))
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
671 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
672 return PyInt_FromLong((long)wgetfgcolor());
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
673 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
674
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
675 static PyObject *
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
676 drawing_setbgcolor(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
677 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
678 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
679 {
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
680 long color;
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
681 if (!getlongarg(args, &color))
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
682 return NULL;
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
683 wsetbgcolor((COLOR)color);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
684 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
685 return Py_None;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
686 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
687
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
688 static PyObject *
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
689 drawing_setfgcolor(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
690 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
691 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
692 {
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
693 long color;
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
694 if (!getlongarg(args, &color))
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
695 return NULL;
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
696 wsetfgcolor((COLOR)color);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
697 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
698 return Py_None;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
699 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
700
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
701 #ifdef HAVE_BITMAPS
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
702
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
703 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
704 drawing_bitmap(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
705 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
706 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
707 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
708 int h, v;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
709 PyObject *bp;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
710 PyObject *mask = NULL;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
711 if (!PyArg_Parse(args, "((ii)O)", &h, &v, &bp)) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
712 PyErr_Clear();
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
713 if (!PyArg_Parse(args, "((ii)OO)", &h, &v, &bp, &mask))
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
714 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
715 if (mask == Py_None)
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
716 mask = NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
717 else if (!is_bitmapobject(mask)) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
718 PyErr_BadArgument();
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
719 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
720 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
721 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
722 if (!is_bitmapobject(bp)) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
723 PyErr_BadArgument();
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
724 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
725 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
726 if (((bitmapobject *)bp)->b_bitmap == NULL ||
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
727 mask != NULL && ((bitmapobject *)mask)->b_bitmap == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
728 PyErr_SetString(StdwinError, "bitmap object already close");
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
729 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
730 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
731 if (mask == NULL)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
732 wdrawbitmap(h, v, ((bitmapobject *)bp)->b_bitmap, ALLBITS);
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
733 else
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
734 wdrawbitmap(h, v,
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
735 ((bitmapobject *)bp)->b_bitmap,
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
736 ((bitmapobject *)bp)->b_bitmap);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
737 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
738 return Py_None;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
739 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
740
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
741 #endif /* HAVE_BITMAPS */
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
742
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
743 static PyMethodDef drawing_methods[] = {
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
744 #ifdef HAVE_BITMAPS
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
745 {"bitmap", (PyCFunction)drawing_bitmap},
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
746 #endif
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
747 {"box", (PyCFunction)drawing_box},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
748 {"circle", (PyCFunction)drawing_circle},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
749 {"cliprect", (PyCFunction)drawing_cliprect},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
750 {"close", (PyCFunction)drawing_close},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
751 {"elarc", (PyCFunction)drawing_elarc},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
752 {"enddrawing", (PyCFunction)drawing_close},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
753 {"erase", (PyCFunction)drawing_erase},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
754 {"fillcircle", (PyCFunction)drawing_fillcircle},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
755 {"fillelarc", (PyCFunction)drawing_fillelarc},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
756 {"fillpoly", (PyCFunction)drawing_fillpoly},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
757 {"invert", (PyCFunction)drawing_invert},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
758 {"line", (PyCFunction)drawing_line},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
759 {"noclip", (PyCFunction)drawing_noclip},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
760 {"paint", (PyCFunction)drawing_paint},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
761 {"poly", (PyCFunction)drawing_poly},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
762 {"shade", (PyCFunction)drawing_shade},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
763 {"text", (PyCFunction)drawing_text},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
764 {"xorcircle", (PyCFunction)drawing_xorcircle},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
765 {"xorelarc", (PyCFunction)drawing_xorelarc},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
766 {"xorline", (PyCFunction)drawing_xorline},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
767 {"xorpoly", (PyCFunction)drawing_xorpoly},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
768
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
769 /* Text measuring methods: */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
770 {"baseline", (PyCFunction)drawing_baseline},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
771 {"lineheight", (PyCFunction)drawing_lineheight},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
772 {"textbreak", (PyCFunction)drawing_textbreak},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
773 {"textwidth", (PyCFunction)drawing_textwidth},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
774
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
775 /* Font setting methods: */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
776 {"setfont", (PyCFunction)drawing_setfont},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
777
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
778 /* Color methods: */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
779 {"getbgcolor", (PyCFunction)drawing_getbgcolor},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
780 {"getfgcolor", (PyCFunction)drawing_getfgcolor},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
781 {"setbgcolor", (PyCFunction)drawing_setbgcolor},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
782 {"setfgcolor", (PyCFunction)drawing_setfgcolor},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
783
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
784 {NULL, NULL} /* sentinel */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
785 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
786
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
787 static PyObject *
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
788 drawing_getattr(dp, name)
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
789 drawingobject *dp;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
790 char *name;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
791 {
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
792 if (dp->d_ref == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
793 PyErr_SetString(StdwinError, "drawing object already closed");
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
794 return NULL;
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
795 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
796 return Py_FindMethod(drawing_methods, (PyObject *)dp, name);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
797 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
798
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
799 PyTypeObject Drawingtype = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
800 PyObject_HEAD_INIT(&PyType_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
801 0, /*ob_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
802 "drawing", /*tp_name*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
803 sizeof(drawingobject), /*tp_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
804 0, /*tp_itemsize*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
805 /* methods */
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
806 (destructor)drawing_dealloc, /*tp_dealloc*/
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
807 0, /*tp_print*/
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
808 (getattrfunc)drawing_getattr, /*tp_getattr*/
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
809 0, /*tp_setattr*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
810 0, /*tp_compare*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
811 0, /*tp_repr*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
812 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
813
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
814
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
815 /* Text(edit) objects */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
816
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
817 typedef struct {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
818 PyObject_HEAD
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
819 TEXTEDIT *t_text;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
820 windowobject *t_ref;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
821 PyObject *t_attr; /* Attributes dictionary */
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
822 } textobject;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
823
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
824 staticforward PyTypeObject Texttype;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
825
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
826 static textobject *
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
827 newtextobject(wp, left, top, right, bottom)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
828 windowobject *wp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
829 int left, top, right, bottom;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
830 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
831 textobject *tp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
832 tp = PyObject_NEW(textobject, &Texttype);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
833 if (tp == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
834 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
835 tp->t_attr = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
836 Py_INCREF(wp);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
837 tp->t_ref = wp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
838 tp->t_text = tecreate(wp->w_win, left, top, right, bottom);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
839 if (tp->t_text == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
840 Py_DECREF(tp);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
841 return (textobject *) PyErr_NoMemory();
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
842 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
843 return tp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
844 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
845
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
846 /* Text(edit) methods */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
847
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
848 static void
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
849 text_dealloc(tp)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
850 textobject *tp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
851 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
852 if (tp->t_text != NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
853 tefree(tp->t_text);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
854 Py_XDECREF(tp->t_attr);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
855 Py_XDECREF(tp->t_ref);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
856 PyMem_DEL(tp);
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
857 }
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
858
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
859 static PyObject *
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
860 text_close(tp, args)
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
861 textobject *tp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
862 PyObject *args;
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
863 {
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
864 if (tp->t_text != NULL) {
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
865 tefree(tp->t_text);
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
866 tp->t_text = NULL;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
867 }
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
868 if (tp->t_attr != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
869 Py_DECREF(tp->t_attr);
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
870 tp->t_attr = NULL;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
871 }
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
872 if (tp->t_ref != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
873 Py_DECREF(tp->t_ref);
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
874 tp->t_ref = NULL;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
875 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
876 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
877 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
878 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
879
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
880 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
881 text_arrow(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
882 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
883 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
884 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
885 int code;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
886 if (!getintarg(args, &code))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
887 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
888 tearrow(self->t_text, code);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
889 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
890 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
891 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
892
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
893 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
894 text_draw(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
895 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
896 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
897 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
898 register TEXTEDIT *tp = self->t_text;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
899 int a[4];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
900 int left, top, right, bottom;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
901 if (!getrectarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
902 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
903 if (Drawing != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
904 PyErr_SetString(StdwinError, "already drawing");
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
905 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
906 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
907 /* Clip to text area and ignore if area is empty */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
908 left = tegetleft(tp);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
909 top = tegettop(tp);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
910 right = tegetright(tp);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
911 bottom = tegetbottom(tp);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
912 if (a[0] < left) a[0] = left;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
913 if (a[1] < top) a[1] = top;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
914 if (a[2] > right) a[2] = right;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
915 if (a[3] > bottom) a[3] = bottom;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
916 if (a[0] < a[2] && a[1] < a[3]) {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
917 wbegindrawing(self->t_ref->w_win);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
918 tedrawnew(tp, a[0], a[1], a[2], a[3]);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
919 wenddrawing(self->t_ref->w_win);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
920 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
921 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
922 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
923 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
924
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
925 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
926 text_event(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
927 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
928 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
929 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
930 register TEXTEDIT *tp = self->t_text;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
931 EVENT e;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
932 if (!geteventarg(args, &e))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
933 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
934 if (e.type == WE_MOUSE_DOWN) {
137
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
935 /* Cheat at the margins */
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
936 int width, height;
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
937 wgetdocsize(e.window, &width, &height);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
938 if (e.u.where.h < 0 && tegetleft(tp) == 0)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
939 e.u.where.h = 0;
137
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
940 else if (e.u.where.h > width && tegetright(tp) == width)
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
941 e.u.where.h = width;
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
942 if (e.u.where.v < 0 && tegettop(tp) == 0)
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
943 e.u.where.v = 0;
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
944 else if (e.u.where.v > height && tegetright(tp) == height)
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
945 e.u.where.v = height;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
946 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
947 return PyInt_FromLong((long) teevent(tp, &e));
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
948 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
949
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
950 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
951 text_getfocus(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
952 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
953 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
954 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
955 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
956 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
957 return makepoint(tegetfoc1(self->t_text), tegetfoc2(self->t_text));
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
958 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
959
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
960 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
961 text_getfocustext(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
962 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
963 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
964 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
965 int f1, f2;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
966 char *text;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
967 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
968 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
969 f1 = tegetfoc1(self->t_text);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
970 f2 = tegetfoc2(self->t_text);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
971 text = tegettext(self->t_text);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
972 return PyString_FromStringAndSize(text + f1, f2-f1);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
973 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
974
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
975 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
976 text_getrect(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
977 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
978 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
979 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
980 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
981 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
982 return makerect(tegetleft(self->t_text),
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
983 tegettop(self->t_text),
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
984 tegetright(self->t_text),
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
985 tegetbottom(self->t_text));
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
986 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
987
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
988 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
989 text_gettext(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
990 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
991 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
992 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
993 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
994 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
995 return PyString_FromStringAndSize(tegettext(self->t_text),
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
996 tegetlen(self->t_text));
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
997 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
998
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
999 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1000 text_move(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1001 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1002 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1003 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1004 int a[4];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1005 if (!getrectarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1006 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1007 temovenew(self->t_text, a[0], a[1], a[2], a[3]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1008 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1009 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1010 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1011
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1012 static PyObject *
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1013 text_replace(self, args)
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1014 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1015 PyObject *args;
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1016 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1017 char *text;
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1018 if (!getstrarg(args, &text))
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1019 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1020 tereplace(self->t_text, text);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1021 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1022 return Py_None;
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1023 }
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1024
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1025 static PyObject *
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1026 text_setactive(self, args)
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1027 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1028 PyObject *args;
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1029 {
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1030 int flag;
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1031 if (!getintarg(args, &flag))
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1032 return NULL;
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1033 tesetactive(self->t_text, flag);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1034 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1035 return Py_None;
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1036 }
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1037
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1038 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1039 text_setfocus(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1040 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1041 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1042 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1043 int a[2];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1044 if (!getpointarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1045 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1046 tesetfocus(self->t_text, a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1047 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1048 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1049 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1050
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1051 static PyObject *
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1052 text_settext(self, args)
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1053 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1054 PyObject *args;
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1055 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1056 char *text;
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1057 char *buf;
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1058 int size;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1059 if (!PyArg_Parse(args, "s#", &text, &size))
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1060 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1061 if ((buf = PyMem_NEW(char, size)) == NULL) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1062 return PyErr_NoMemory();
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1063 }
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1064 memcpy(buf, text, size);
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1065 tesetbuf(self->t_text, buf, size); /* Becomes owner of buffer */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1066 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1067 return Py_None;
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1068 }
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1069
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1070 static PyObject *
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1071 text_setview(self, args)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1072 textobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1073 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1074 {
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1075 int a[4];
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1076 if (args == Py_None)
248
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1077 tenoview(self->t_text);
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1078 else {
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1079 if (!getrectarg(args, a))
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1080 return NULL;
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1081 tesetview(self->t_text, a[0], a[1], a[2], a[3]);
9eb13c67ae6f Added text.setactive and text.setview.
Guido van Rossum <guido@python.org>
parents: 244
diff changeset
1082 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1083 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1084 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1085 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1086
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1087 static PyMethodDef text_methods[] = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1088 {"arrow", (PyCFunction)text_arrow},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1089 {"close", (PyCFunction)text_close},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1090 {"draw", (PyCFunction)text_draw},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1091 {"event", (PyCFunction)text_event},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1092 {"getfocus", (PyCFunction)text_getfocus},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1093 {"getfocustext",(PyCFunction)text_getfocustext},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1094 {"getrect", (PyCFunction)text_getrect},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1095 {"gettext", (PyCFunction)text_gettext},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1096 {"move", (PyCFunction)text_move},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1097 {"replace", (PyCFunction)text_replace},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1098 {"setactive", (PyCFunction)text_setactive},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1099 {"setfocus", (PyCFunction)text_setfocus},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1100 {"settext", (PyCFunction)text_settext},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1101 {"setview", (PyCFunction)text_setview},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1102 {NULL, NULL} /* sentinel */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1103 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1104
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1105 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1106 text_getattr(tp, name)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1107 textobject *tp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1108 char *name;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1109 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1110 PyObject *v = NULL;
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1111 if (tp->t_ref == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1112 PyErr_SetString(StdwinError, "text object already closed");
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1113 return NULL;
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1114 }
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1115 if (strcmp(name, "__dict__") == 0) {
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1116 v = tp->t_attr;
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1117 if (v == NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1118 v = Py_None;
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1119 }
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1120 else if (tp->t_attr != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1121 v = PyDict_GetItemString(tp->t_attr, name);
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1122 }
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1123 if (v != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1124 Py_INCREF(v);
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1125 return v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1126 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1127 return Py_FindMethod(text_methods, (PyObject *)tp, name);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1128 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1129
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1130 static int
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1131 text_setattr(tp, name, v)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1132 textobject *tp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1133 char *name;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1134 PyObject *v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1135 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1136 if (tp->t_attr == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1137 tp->t_attr = PyDict_New();
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1138 if (tp->t_attr == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1139 return -1;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1140 }
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1141 if (v == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1142 int rv = PyDict_DelItemString(tp->t_attr, name);
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1143 if (rv < 0)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1144 PyErr_SetString(PyExc_AttributeError,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1145 "delete non-existing text object attribute");
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1146 return rv;
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1147 }
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1148 else
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1149 return PyDict_SetItemString(tp->t_attr, name, v);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1150 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1151
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1152 statichere PyTypeObject Texttype = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1153 PyObject_HEAD_INIT(&PyType_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1154 0, /*ob_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1155 "textedit", /*tp_name*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1156 sizeof(textobject), /*tp_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1157 0, /*tp_itemsize*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1158 /* methods */
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1159 (destructor)text_dealloc, /*tp_dealloc*/
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1160 0, /*tp_print*/
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1161 (getattrfunc)text_getattr, /*tp_getattr*/
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1162 (setattrfunc)text_setattr, /*tp_setattr*/
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1163 0, /*tp_compare*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1164 0, /*tp_repr*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1165 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1166
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1167
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1168 /* Menu objects */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1169
142
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
1170 #define IDOFFSET 10 /* Menu IDs we use start here */
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
1171 #define MAXNMENU 200 /* Max #menus we allow */
142
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
1172 static menuobject *menulist[MAXNMENU];
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1173
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1174 static menuobject *newmenuobject Py_PROTO((char *));
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1175 static menuobject *
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1176 newmenuobject(title)
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1177 char *title;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1178 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1179 int id;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1180 MENU *menu;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1181 menuobject *mp;
142
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
1182 for (id = 0; id < MAXNMENU; id++) {
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1183 if (menulist[id] == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1184 break;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1185 }
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
1186 if (id >= MAXNMENU) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1187 PyErr_SetString(StdwinError, "creating too many menus");
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
1188 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
1189 }
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1190 menu = wmenucreate(id + IDOFFSET, title);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1191 if (menu == NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1192 return (menuobject *) PyErr_NoMemory();
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1193 mp = PyObject_NEW(menuobject, &Menutype);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1194 if (mp != NULL) {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1195 mp->m_menu = menu;
142
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
1196 mp->m_id = id + IDOFFSET;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1197 mp->m_attr = NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1198 menulist[id] = mp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1199 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1200 else
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1201 wmenudelete(menu);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1202 return mp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1203 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1204
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1205 /* Menu methods */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1206
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1207 static void
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1208 menu_dealloc(mp)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1209 menuobject *mp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1210 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1211
142
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
1212 int id = mp->m_id - IDOFFSET;
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
1213 if (id >= 0 && id < MAXNMENU && menulist[id] == mp) {
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1214 menulist[id] = NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1215 }
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1216 if (mp->m_menu != NULL)
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1217 wmenudelete(mp->m_menu);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1218 Py_XDECREF(mp->m_attr);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1219 PyMem_DEL(mp);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1220 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1221
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1222 static PyObject *
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1223 menu_close(mp, args)
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1224 menuobject *mp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1225 PyObject *args;
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1226 {
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1227 int id = mp->m_id - IDOFFSET;
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1228 if (id >= 0 && id < MAXNMENU && menulist[id] == mp) {
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1229 menulist[id] = NULL;
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1230 }
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1231 mp->m_id = -1;
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1232 if (mp->m_menu != NULL)
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1233 wmenudelete(mp->m_menu);
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1234 mp->m_menu = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1235 Py_XDECREF(mp->m_attr);
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1236 mp->m_attr = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1237 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1238 return Py_None;
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1239 }
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1240
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1241 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1242 menu_additem(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1243 menuobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1244 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1245 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1246 char *text;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1247 int shortcut = -1;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1248 if (PyTuple_Check(args)) {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1249 char c;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1250 if (!PyArg_Parse(args, "(sc)", &text, &c))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1251 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1252 shortcut = c;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1253 }
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1254 else if (!getstrarg(args, &text))
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1255 return NULL;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1256 wmenuadditem(self->m_menu, text, shortcut);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1257 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1258 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1259 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1260
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1261 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1262 menu_setitem(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1263 menuobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1264 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1265 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1266 int index;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1267 char *text;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1268 if (!PyArg_Parse(args, "(is)", &index, &text))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1269 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1270 wmenusetitem(self->m_menu, index, text);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1271 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1272 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1273 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1274
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1275 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1276 menu_enable(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1277 menuobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1278 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1279 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1280 int index;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1281 int flag;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1282 if (!PyArg_Parse(args, "(ii)", &index, &flag))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1283 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1284 wmenuenable(self->m_menu, index, flag);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1285 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1286 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1287 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1288
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1289 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1290 menu_check(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1291 menuobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1292 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1293 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1294 int index;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1295 int flag;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1296 if (!PyArg_Parse(args, "(ii)", &index, &flag))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1297 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1298 wmenucheck(self->m_menu, index, flag);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1299 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1300 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1301 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1302
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1303 static PyMethodDef menu_methods[] = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1304 {"additem", (PyCFunction)menu_additem},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1305 {"setitem", (PyCFunction)menu_setitem},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1306 {"enable", (PyCFunction)menu_enable},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1307 {"check", (PyCFunction)menu_check},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1308 {"close", (PyCFunction)menu_close},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1309 {NULL, NULL} /* sentinel */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1310 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1311
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1312 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1313 menu_getattr(mp, name)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1314 menuobject *mp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1315 char *name;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1316 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1317 PyObject *v = NULL;
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1318 if (mp->m_menu == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1319 PyErr_SetString(StdwinError, "menu object already closed");
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1320 return NULL;
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1321 }
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1322 if (strcmp(name, "__dict__") == 0) {
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1323 v = mp->m_attr;
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1324 if (v == NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1325 v = Py_None;
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1326 }
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1327 else if (mp->m_attr != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1328 v = PyDict_GetItemString(mp->m_attr, name);
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1329 }
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1330 if (v != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1331 Py_INCREF(v);
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1332 return v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1333 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1334 return Py_FindMethod(menu_methods, (PyObject *)mp, name);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1335 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1336
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1337 static int
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1338 menu_setattr(mp, name, v)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1339 menuobject *mp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1340 char *name;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1341 PyObject *v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1342 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1343 if (mp->m_attr == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1344 mp->m_attr = PyDict_New();
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1345 if (mp->m_attr == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1346 return -1;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1347 }
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1348 if (v == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1349 int rv = PyDict_DelItemString(mp->m_attr, name);
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1350 if (rv < 0)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1351 PyErr_SetString(PyExc_AttributeError,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1352 "delete non-existing menu object attribute");
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1353 return rv;
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1354 }
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1355 else
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1356 return PyDict_SetItemString(mp->m_attr, name, v);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1357 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1358
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1359 statichere PyTypeObject Menutype = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1360 PyObject_HEAD_INIT(&PyType_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1361 0, /*ob_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1362 "menu", /*tp_name*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1363 sizeof(menuobject), /*tp_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1364 0, /*tp_itemsize*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1365 /* methods */
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1366 (destructor)menu_dealloc, /*tp_dealloc*/
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1367 0, /*tp_print*/
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1368 (getattrfunc)menu_getattr, /*tp_getattr*/
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1369 (setattrfunc)menu_setattr, /*tp_setattr*/
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1370 0, /*tp_compare*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1371 0, /*tp_repr*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1372 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1373
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1374
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
1375 #ifdef HAVE_BITMAPS
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
1376
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1377 /* Bitmaps objects */
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1378
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1379 static bitmapobject *newbitmapobject Py_PROTO((int, int));
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1380 static bitmapobject *
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1381 newbitmapobject(width, height)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1382 int width, height;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1383 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1384 BITMAP *bitmap;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1385 bitmapobject *bp;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1386 bitmap = wnewbitmap(width, height);
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1387 if (bitmap == NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1388 return (bitmapobject *) PyErr_NoMemory();
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1389 bp = PyObject_NEW(bitmapobject, &Bitmaptype);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1390 if (bp != NULL) {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1391 bp->b_bitmap = bitmap;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1392 bp->b_attr = NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1393 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1394 else
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1395 wfreebitmap(bitmap);
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1396 return bp;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1397 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1398
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1399 /* Bitmap methods */
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1400
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1401 static void
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1402 bitmap_dealloc(bp)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1403 bitmapobject *bp;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1404 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1405 if (bp->b_bitmap != NULL)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1406 wfreebitmap(bp->b_bitmap);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1407 Py_XDECREF(bp->b_attr);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1408 PyMem_DEL(bp);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1409 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1410
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1411 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1412 bitmap_close(bp, args)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1413 bitmapobject *bp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1414 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1415 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1416 if (bp->b_bitmap != NULL)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1417 wfreebitmap(bp->b_bitmap);
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1418 bp->b_bitmap = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1419 Py_XDECREF(bp->b_attr);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1420 bp->b_attr = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1421 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1422 return Py_None;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1423 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1424
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1425 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1426 bitmap_setbit(self, args)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1427 bitmapobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1428 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1429 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1430 int a[3];
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1431 if (!getpointintarg(args, a))
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1432 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1433 wsetbit(self->b_bitmap, a[0], a[1], a[2]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1434 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1435 return Py_None;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1436 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1437
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1438 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1439 bitmap_getbit(self, args)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1440 bitmapobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1441 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1442 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1443 int a[2];
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1444 if (!getpointarg(args, a))
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1445 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1446 return PyInt_FromLong((long) wgetbit(self->b_bitmap, a[0], a[1]));
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1447 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1448
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1449 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1450 bitmap_getsize(self, args)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1451 bitmapobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1452 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1453 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1454 int width, height;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1455 if (!PyArg_NoArgs(args))
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1456 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1457 wgetbitmapsize(self->b_bitmap, &width, &height);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1458 return Py_BuildValue("(ii)", width, height);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1459 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1460
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1461 static PyMethodDef bitmap_methods[] = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1462 {"close", (PyCFunction)bitmap_close},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1463 {"getsize", (PyCFunction)bitmap_getsize},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1464 {"getbit", (PyCFunction)bitmap_getbit},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1465 {"setbit", (PyCFunction)bitmap_setbit},
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1466 {NULL, NULL} /* sentinel */
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1467 };
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1468
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1469 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1470 bitmap_getattr(bp, name)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1471 bitmapobject *bp;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1472 char *name;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1473 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1474 PyObject *v = NULL;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1475 if (bp->b_bitmap == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1476 PyErr_SetString(StdwinError, "bitmap object already closed");
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1477 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1478 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1479 if (strcmp(name, "__dict__") == 0) {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1480 v = bp->b_attr;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1481 if (v == NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1482 v = Py_None;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1483 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1484 else if (bp->b_attr != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1485 v = PyDict_GetItemString(bp->b_attr, name);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1486 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1487 if (v != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1488 Py_INCREF(v);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1489 return v;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1490 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1491 return Py_FindMethod(bitmap_methods, (PyObject *)bp, name);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1492 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1493
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1494 static int
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1495 bitmap_setattr(bp, name, v)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1496 bitmapobject *bp;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1497 char *name;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1498 PyObject *v;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1499 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1500 if (bp->b_attr == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1501 bp->b_attr = PyDict_New();
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1502 if (bp->b_attr == NULL)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1503 return -1;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1504 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1505 if (v == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1506 int rv = PyDict_DelItemString(bp->b_attr, name);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1507 if (rv < 0)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1508 PyErr_SetString(PyExc_AttributeError,
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1509 "delete non-existing bitmap object attribute");
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1510 return rv;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1511 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1512 else
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1513 return PyDict_SetItemString(bp->b_attr, name, v);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1514 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1515
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1516 statichere PyTypeObject Bitmaptype = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1517 PyObject_HEAD_INIT(&PyType_Type)
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1518 0, /*ob_size*/
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1519 "bitmap", /*tp_name*/
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1520 sizeof(bitmapobject), /*tp_size*/
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1521 0, /*tp_itemsize*/
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1522 /* methods */
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1523 (destructor)bitmap_dealloc, /*tp_dealloc*/
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1524 0, /*tp_print*/
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1525 (getattrfunc)bitmap_getattr, /*tp_getattr*/
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1526 (setattrfunc)bitmap_setattr, /*tp_setattr*/
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1527 0, /*tp_compare*/
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1528 0, /*tp_repr*/
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1529 };
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1530
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
1531 #endif /* HAVE_BITMAPS */
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
1532
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1533
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1534 /* Windows */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1535
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1536 #define MAXNWIN 50
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1537 static windowobject *windowlist[MAXNWIN];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1538
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1539 /* Window methods */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1540
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1541 static void
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1542 window_dealloc(wp)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1543 windowobject *wp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1544 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1545 if (wp->w_win != NULL) {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1546 int tag = wgettag(wp->w_win);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1547 if (tag >= 0 && tag < MAXNWIN)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1548 windowlist[tag] = NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1549 else
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1550 fprintf(stderr, "XXX help! tag %d in window_dealloc\n",
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1551 tag);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1552 wclose(wp->w_win);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1553 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1554 Py_DECREF(wp->w_title);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1555 if (wp->w_attr != NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1556 Py_DECREF(wp->w_attr);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1557 free((char *)wp);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1558 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1559
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1560 static PyObject *
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1561 window_close(wp, args)
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1562 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1563 PyObject *args;
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1564 {
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1565 if (wp->w_win != NULL) {
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1566 int tag = wgettag(wp->w_win);
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1567 if (tag >= 0 && tag < MAXNWIN)
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1568 windowlist[tag] = NULL;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1569 wclose(wp->w_win);
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1570 wp->w_win = NULL;
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1571 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1572 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1573 return Py_None;
453
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1574 }
34abca182f18 Enclosed method lists in braces.
Guido van Rossum <guido@python.org>
parents: 397
diff changeset
1575
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1576 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1577 window_begindrawing(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1578 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1579 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1580 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1581 drawingobject *dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1582 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1583 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1584 if (Drawing != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1585 PyErr_SetString(StdwinError, "already drawing");
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1586 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1587 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1588 dp = PyObject_NEW(drawingobject, &Drawingtype);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1589 if (dp == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1590 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1591 Drawing = dp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1592 Py_INCREF(wp);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1593 dp->d_ref = wp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1594 wbegindrawing(wp->w_win);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1595 return (PyObject *)dp;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1596 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1597
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1598 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1599 window_change(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1600 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1601 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1602 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1603 int a[4];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1604 if (!getrectarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1605 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1606 wchange(wp->w_win, a[0], a[1], a[2], a[3]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1607 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1608 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1609 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1610
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1611 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1612 window_gettitle(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1613 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1614 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1615 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1616 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1617 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1618 Py_INCREF(wp->w_title);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1619 return wp->w_title;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1620 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1621
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1622 static PyObject *
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1623 window_getwinpos(wp, args)
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1624 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1625 PyObject *args;
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1626 {
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1627 int h, v;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1628 if (!PyArg_NoArgs(args))
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1629 return NULL;
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1630 wgetwinpos(wp->w_win, &h, &v);
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1631 return makepoint(h, v);
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1632 }
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
1633
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1634 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1635 window_getwinsize(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1636 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1637 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1638 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1639 int width, height;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1640 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1641 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1642 wgetwinsize(wp->w_win, &width, &height);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1643 return makepoint(width, height);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1644 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1645
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1646 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1647 window_setwinpos(wp, args)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1648 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1649 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1650 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1651 int a[2];
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1652 if (!getpointarg(args, a))
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1653 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1654 wsetwinpos(wp->w_win, a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1655 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1656 return Py_None;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1657 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1658
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1659 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1660 window_setwinsize(wp, args)
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1661 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1662 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1663 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1664 int a[2];
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1665 if (!getpointarg(args, a))
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1666 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1667 wsetwinsize(wp->w_win, a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1668 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1669 return Py_None;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1670 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
1671
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1672 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1673 window_getdocsize(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1674 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1675 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1676 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1677 int width, height;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1678 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1679 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1680 wgetdocsize(wp->w_win, &width, &height);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1681 return makepoint(width, height);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1682 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1683
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1684 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1685 window_getorigin(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1686 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1687 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1688 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1689 int width, height;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1690 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1691 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1692 wgetorigin(wp->w_win, &width, &height);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1693 return makepoint(width, height);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1694 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1695
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1696 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1697 window_scroll(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1698 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1699 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1700 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1701 int a[6];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1702 if (!getrectpointarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1703 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1704 wscroll(wp->w_win, a[0], a[1], a[2], a[3], a[4], a[5]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1705 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1706 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1707 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1708
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1709 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1710 window_setdocsize(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1711 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1712 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1713 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1714 int a[2];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1715 if (!getpointarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1716 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1717 wsetdocsize(wp->w_win, a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1718 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1719 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1720 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1721
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1722 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1723 window_setorigin(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1724 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1725 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1726 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1727 int a[2];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1728 if (!getpointarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1729 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1730 wsetorigin(wp->w_win, a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1731 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1732 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1733 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1734
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1735 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1736 window_settitle(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1737 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1738 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1739 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1740 PyObject *title;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1741 if (!PyArg_Parse(args, "S", &title))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1742 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1743 Py_DECREF(wp->w_title);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1744 Py_INCREF(title);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1745 wp->w_title = title;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1746 wsettitle(wp->w_win, PyString_AsString(title));
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1747 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1748 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1749 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1750
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1751 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1752 window_show(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1753 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1754 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1755 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1756 int a[4];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1757 if (!getrectarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1758 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1759 wshow(wp->w_win, a[0], a[1], a[2], a[3]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1760 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1761 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1762 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1763
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1764 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1765 window_settimer(wp, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1766 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1767 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1768 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1769 int a;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1770 if (!getintarg(args, &a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1771 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1772 wsettimer(wp->w_win, a);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1773 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1774 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1775 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1776
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1777 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1778 window_menucreate(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1779 windowobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1780 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1781 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1782 menuobject *mp;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1783 char *title;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1784 if (!getstrarg(args, &title))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1785 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1786 wmenusetdeflocal(1);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1787 mp = newmenuobject(title);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1788 if (mp == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1789 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1790 wmenuattach(self->w_win, mp->m_menu);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1791 return (PyObject *)mp;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1792 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1793
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1794 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1795 window_textcreate(self, args)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1796 windowobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1797 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1798 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1799 int a[4];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1800 if (!getrectarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1801 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1802 return (PyObject *)newtextobject(self, a[0], a[1], a[2], a[3]);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1803 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1804
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1805 static PyObject *
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1806 window_setselection(self, args)
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1807 windowobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1808 PyObject *args;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1809 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1810 int sel, size, ok;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1811 char *text;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1812 if (!PyArg_Parse(args, "(is#)", &sel, &text, &size))
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1813 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1814 ok = wsetselection(self->w_win, sel, text, size);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1815 return PyInt_FromLong(ok);
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1816 }
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1817
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1818 static PyObject *
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1819 window_setwincursor(self, args)
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1820 windowobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1821 PyObject *args;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1822 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1823 char *name;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1824 CURSOR *c;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1825 if (!PyArg_Parse(args, "z", &name))
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1826 return NULL;
657
3e626c413bbf Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents: 635
diff changeset
1827 if (name == NULL)
3e626c413bbf Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents: 635
diff changeset
1828 c = NULL;
3e626c413bbf Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents: 635
diff changeset
1829 else {
3e626c413bbf Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents: 635
diff changeset
1830 c = wfetchcursor(name);
3e626c413bbf Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents: 635
diff changeset
1831 if (c == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1832 PyErr_SetString(StdwinError, "no such cursor");
657
3e626c413bbf Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents: 635
diff changeset
1833 return NULL;
3e626c413bbf Fixed getargs() call in setfont.
Guido van Rossum <guido@python.org>
parents: 635
diff changeset
1834 }
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1835 }
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1836 wsetwincursor(self->w_win, c);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1837 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1838 return Py_None;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1839 }
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
1840
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1841 static PyObject *
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1842 window_setactive(self, args)
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1843 windowobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1844 PyObject *args;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1845 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1846 if (!PyArg_NoArgs(args))
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1847 return NULL;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1848 wsetactive(self->w_win);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1849 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1850 return Py_None;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1851 }
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
1852
325
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1853 #ifdef CWI_HACKS
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1854 static PyObject *
325
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1855 window_getxwindowid(self, args)
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1856 windowobject *self;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1857 PyObject *args;
325
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1858 {
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1859 long wid = wgetxwindowid(self->w_win);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1860 return PyInt_FromLong(wid);
325
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1861 }
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1862 #endif
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1863
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1864 static PyMethodDef window_methods[] = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1865 {"begindrawing",(PyCFunction)window_begindrawing},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1866 {"change", (PyCFunction)window_change},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1867 {"close", (PyCFunction)window_close},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1868 {"getdocsize", (PyCFunction)window_getdocsize},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1869 {"getorigin", (PyCFunction)window_getorigin},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1870 {"gettitle", (PyCFunction)window_gettitle},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1871 {"getwinpos", (PyCFunction)window_getwinpos},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1872 {"getwinsize", (PyCFunction)window_getwinsize},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1873 {"menucreate", (PyCFunction)window_menucreate},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1874 {"scroll", (PyCFunction)window_scroll},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1875 {"setactive", (PyCFunction)window_setactive},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1876 {"setdocsize", (PyCFunction)window_setdocsize},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1877 {"setorigin", (PyCFunction)window_setorigin},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1878 {"setselection",(PyCFunction)window_setselection},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1879 {"settimer", (PyCFunction)window_settimer},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1880 {"settitle", (PyCFunction)window_settitle},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1881 {"setwincursor",(PyCFunction)window_setwincursor},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1882 {"setwinpos", (PyCFunction)window_setwinpos},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1883 {"setwinsize", (PyCFunction)window_setwinsize},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1884 {"show", (PyCFunction)window_show},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1885 {"textcreate", (PyCFunction)window_textcreate},
325
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1886 #ifdef CWI_HACKS
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1887 {"getxwindowid",(PyCFunction)window_getxwindowid},
325
baada20762b0 Added getxwindowin() method
Guido van Rossum <guido@python.org>
parents: 285
diff changeset
1888 #endif
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1889 {NULL, NULL} /* sentinel */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1890 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1891
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1892 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1893 window_getattr(wp, name)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1894 windowobject *wp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1895 char *name;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1896 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1897 PyObject *v = NULL;
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1898 if (wp->w_win == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1899 PyErr_SetString(StdwinError, "window already closed");
594
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1900 return NULL;
47c42ea67a8b Added close method for menus.
Guido van Rossum <guido@python.org>
parents: 499
diff changeset
1901 }
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1902 if (strcmp(name, "__dict__") == 0) {
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1903 v = wp->w_attr;
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1904 if (v == NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1905 v = Py_None;
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1906 }
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1907 else if (wp->w_attr != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1908 v = PyDict_GetItemString(wp->w_attr, name);
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1909 }
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1910 if (v != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1911 Py_INCREF(v);
397
4cdcc16bd080 Added __dict__ attributes all over the place.
Guido van Rossum <guido@python.org>
parents: 325
diff changeset
1912 return v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1913 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1914 return Py_FindMethod(window_methods, (PyObject *)wp, name);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1915 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1916
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1917 static int
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1918 window_setattr(wp, name, v)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1919 windowobject *wp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1920 char *name;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1921 PyObject *v;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1922 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1923 if (wp->w_attr == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1924 wp->w_attr = PyDict_New();
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1925 if (wp->w_attr == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1926 return -1;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1927 }
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1928 if (v == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1929 int rv = PyDict_DelItemString(wp->w_attr, name);
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1930 if (rv < 0)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1931 PyErr_SetString(PyExc_AttributeError,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1932 "delete non-existing menu object attribute");
1031
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1933 return rv;
7a11a70f7f44 classobject.c moduleobject.c stdwinmodule.c xxobject.c:
Guido van Rossum <guido@python.org>
parents: 926
diff changeset
1934 }
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1935 else
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1936 return PyDict_SetItemString(wp->w_attr, name, v);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1937 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1938
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1939 statichere PyTypeObject Windowtype = {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1940 PyObject_HEAD_INIT(&PyType_Type)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1941 0, /*ob_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1942 "window", /*tp_name*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1943 sizeof(windowobject), /*tp_size*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1944 0, /*tp_itemsize*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1945 /* methods */
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1946 (destructor)window_dealloc, /*tp_dealloc*/
1051
f54e64c8b9b7 * Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents: 1031
diff changeset
1947 0, /*tp_print*/
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1948 (getattrfunc)window_getattr, /*tp_getattr*/
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
1949 (setattrfunc)window_setattr, /*tp_setattr*/
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1950 0, /*tp_compare*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1951 0, /*tp_repr*/
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1952 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1953
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1954 /* Stdwin methods */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1955
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1956 static PyObject *
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1957 stdwin_done(sw, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1958 PyObject *sw;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1959 PyObject *args;
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1960 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1961 if (!PyArg_NoArgs(args))
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1962 return NULL;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1963 wdone();
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1964 /* XXX There is no protection against continued use of
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1965 XXX stdwin functions or objects after this call is made.
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1966 XXX Use at own risk */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1967 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1968 return Py_None;
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1969 }
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
1970
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1971 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1972 stdwin_open(sw, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1973 PyObject *sw;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1974 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1975 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1976 int tag;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1977 PyObject *title;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1978 windowobject *wp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1979 if (!PyArg_Parse(args, "S", &title))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1980 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1981 for (tag = 0; tag < MAXNWIN; tag++) {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1982 if (windowlist[tag] == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1983 break;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1984 }
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
1985 if (tag >= MAXNWIN) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1986 PyErr_SetString(StdwinError, "creating too many windows");
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
1987 return NULL;
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
1988 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1989 wp = PyObject_NEW(windowobject, &Windowtype);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1990 if (wp == NULL)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1991 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1992 Py_INCREF(title);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1993 wp->w_title = title;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1994 wp->w_win = wopen(PyString_AsString(title), (void (*)()) NULL);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1995 wp->w_attr = NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1996 if (wp->w_win == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
1997 Py_DECREF(wp);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1998 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1999 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2000 windowlist[tag] = wp;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2001 wsettag(wp->w_win, tag);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2002 return (PyObject *)wp;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2003 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2004
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2005 static PyObject *
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2006 window2object(win)
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2007 WINDOW *win;
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2008 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2009 PyObject *w;
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2010 if (win == NULL)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2011 w = Py_None;
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2012 else {
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2013 int tag = wgettag(win);
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2014 if (tag < 0 || tag >= MAXNWIN || windowlist[tag] == NULL ||
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2015 windowlist[tag]->w_win != win)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2016 w = Py_None;
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2017 else
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2018 w = (PyObject *)windowlist[tag];
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2019 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2020 Py_INCREF(w);
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2021 return w;
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2022 }
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2023
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2024 static PyObject *
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2025 stdwin_get_poll_event(poll, args)
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2026 int poll;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2027 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2028 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2029 EVENT e;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2030 PyObject *u, *v, *w;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2031 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2032 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2033 if (Drawing != NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2034 PyErr_SetString(StdwinError,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2035 "cannot getevent() while drawing");
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2036 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2037 }
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2038 again:
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2039 BGN_STDWIN
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2040 if (poll) {
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2041 if (!wpollevent(&e)) {
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2042 RET_STDWIN
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2043 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2044 return Py_None;
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2045 }
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2046 }
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2047 else
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2048 wgetevent(&e);
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2049 END_STDWIN
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2050 if (e.type == WE_COMMAND && e.u.command == WC_CANCEL) {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2051 /* Turn keyboard interrupts into exceptions */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2052 PyErr_SetNone(PyExc_KeyboardInterrupt);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2053 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2054 }
65
a72c0a7dc993 Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents: 51
diff changeset
2055 if (e.type == WE_COMMAND && e.u.command == WC_CLOSE) {
a72c0a7dc993 Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents: 51
diff changeset
2056 /* Turn WC_CLOSE commands into WE_CLOSE events */
a72c0a7dc993 Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents: 51
diff changeset
2057 e.type = WE_CLOSE;
a72c0a7dc993 Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents: 51
diff changeset
2058 }
818
e157c12cd6e7 Use mkvalue() instead of painfully constructing values
Guido van Rossum <guido@python.org>
parents: 795
diff changeset
2059 v = window2object(e.window);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2060 switch (e.type) {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2061 case WE_CHAR:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2062 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2063 char c[1];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2064 c[0] = e.u.character;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2065 w = PyString_FromStringAndSize(c, 1);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2066 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2067 break;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2068 case WE_COMMAND:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2069 w = PyInt_FromLong((long)e.u.command);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2070 break;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2071 case WE_DRAW:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2072 w = makerect(e.u.area.left, e.u.area.top,
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2073 e.u.area.right, e.u.area.bottom);
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2074 break;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2075 case WE_MOUSE_DOWN:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2076 case WE_MOUSE_MOVE:
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2077 case WE_MOUSE_UP:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2078 w = Py_BuildValue("((ii)iii)",
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2079 e.u.where.h, e.u.where.v,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2080 e.u.where.clicks,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2081 e.u.where.button,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2082 e.u.where.mask);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2083 break;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2084 case WE_MENU:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2085 if (e.u.m.id >= IDOFFSET &&
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2086 e.u.m.id < IDOFFSET+MAXNMENU &&
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2087 menulist[e.u.m.id - IDOFFSET] != NULL)
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2088 {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2089 w = Py_BuildValue("(Oi)",
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2090 menulist[e.u.m.id - IDOFFSET],
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2091 e.u.m.item);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2092 }
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2093 else {
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2094 /* Ghost menu event.
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2095 Can occur only on the Mac if another part
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2096 of the aplication has installed a menu;
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2097 like the THINK C console library. */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2098 Py_DECREF(v);
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2099 goto again;
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2100 }
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2101 break;
907
32010d355fb6 added WE_KEY detail format to stdwinmodule.c.
Guido van Rossum <guido@python.org>
parents: 902
diff changeset
2102 case WE_KEY:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2103 w = Py_BuildValue("(ii)", e.u.key.code, e.u.key.mask);
907
32010d355fb6 added WE_KEY detail format to stdwinmodule.c.
Guido van Rossum <guido@python.org>
parents: 902
diff changeset
2104 break;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2105 case WE_LOST_SEL:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2106 w = PyInt_FromLong((long)e.u.sel);
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2107 break;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2108 default:
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2109 w = Py_None;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2110 Py_INCREF(w);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2111 break;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2112 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2113 if (w == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2114 Py_DECREF(v);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2115 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2116 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2117 u = Py_BuildValue("(iOO)", e.type, v, w);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2118 Py_XDECREF(v);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2119 Py_XDECREF(w);
818
e157c12cd6e7 Use mkvalue() instead of painfully constructing values
Guido van Rossum <guido@python.org>
parents: 795
diff changeset
2120 return u;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2121 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2122
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2123 static PyObject *
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2124 stdwin_getevent(sw, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2125 PyObject *sw;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2126 PyObject *args;
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2127 {
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2128 return stdwin_get_poll_event(0, args);
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2129 }
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2130
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2131 static PyObject *
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2132 stdwin_pollevent(sw, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2133 PyObject *sw;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2134 PyObject *args;
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2135 {
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2136 return stdwin_get_poll_event(1, args);
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2137 }
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2138
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2139 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2140 stdwin_setdefwinpos(sw, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2141 PyObject *sw;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2142 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2143 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2144 int a[2];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2145 if (!getpointarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2146 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2147 wsetdefwinpos(a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2148 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2149 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2150 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2151
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2152 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2153 stdwin_setdefwinsize(sw, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2154 PyObject *sw;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2155 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2156 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2157 int a[2];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2158 if (!getpointarg(args, a))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2159 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2160 wsetdefwinsize(a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2161 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2162 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2163 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2164
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2165 static PyObject *
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2166 stdwin_setdefscrollbars(sw, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2167 PyObject *sw;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2168 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2169 {
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2170 int a[2];
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2171 if (!getpointarg(args, a))
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2172 return NULL;
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2173 wsetdefscrollbars(a[0], a[1]);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2174 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2175 return Py_None;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2176 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2177
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2178 static PyObject *
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2179 stdwin_getdefwinpos(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2180 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2181 PyObject *args;
137
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2182 {
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2183 int h, v;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2184 if (!PyArg_NoArgs(args))
137
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2185 return NULL;
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2186 wgetdefwinpos(&h, &v);
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2187 return makepoint(h, v);
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2188 }
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2189
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2190 static PyObject *
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2191 stdwin_getdefwinsize(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2192 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2193 PyObject *args;
137
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2194 {
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2195 int width, height;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2196 if (!PyArg_NoArgs(args))
137
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2197 return NULL;
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2198 wgetdefwinsize(&width, &height);
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2199 return makepoint(width, height);
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2200 }
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2201
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2202 static PyObject *
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2203 stdwin_getdefscrollbars(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2204 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2205 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2206 {
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2207 int h, v;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2208 if (!PyArg_NoArgs(args))
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2209 return NULL;
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2210 wgetdefscrollbars(&h, &v);
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2211 return makepoint(h, v);
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2212 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2213
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2214 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2215 stdwin_menucreate(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2216 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2217 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2218 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2219 char *title;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2220 if (!getstrarg(args, &title))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2221 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2222 wmenusetdeflocal(0);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2223 return (PyObject *)newmenuobject(title);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2224 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2225
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2226 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2227 stdwin_askfile(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2228 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2229 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2230 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2231 char *prompt, *dflt;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2232 int new, ret;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2233 char buf[256];
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2234 if (!PyArg_Parse(args, "(ssi)", &prompt, &dflt, &new))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2235 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2236 strncpy(buf, dflt, sizeof buf);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2237 buf[sizeof buf - 1] = '\0';
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2238 BGN_STDWIN
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2239 ret = waskfile(prompt, buf, sizeof buf, new);
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2240 END_STDWIN
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2241 if (!ret) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2242 PyErr_SetNone(PyExc_KeyboardInterrupt);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2243 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2244 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2245 return PyString_FromString(buf);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2246 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2247
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2248 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2249 stdwin_askync(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2250 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2251 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2252 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2253 char *prompt;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2254 int new, ret;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2255 if (!PyArg_Parse(args, "(si)", &prompt, &new))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2256 return NULL;
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2257 BGN_STDWIN
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2258 ret = waskync(prompt, new);
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2259 END_STDWIN
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2260 if (ret < 0) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2261 PyErr_SetNone(PyExc_KeyboardInterrupt);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2262 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2263 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2264 return PyInt_FromLong((long)ret);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2265 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2266
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2267 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2268 stdwin_askstr(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2269 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2270 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2271 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2272 char *prompt, *dflt;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2273 int ret;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2274 char buf[256];
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2275 if (!PyArg_Parse(args, "(ss)", &prompt, &dflt))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2276 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2277 strncpy(buf, dflt, sizeof buf);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2278 buf[sizeof buf - 1] = '\0';
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2279 BGN_STDWIN
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2280 ret = waskstr(prompt, buf, sizeof buf);
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2281 END_STDWIN
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2282 if (!ret) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2283 PyErr_SetNone(PyExc_KeyboardInterrupt);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2284 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2285 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2286 return PyString_FromString(buf);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2287 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2288
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2289 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2290 stdwin_message(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2291 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2292 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2293 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2294 char *msg;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2295 if (!getstrarg(args, &msg))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2296 return NULL;
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2297 BGN_STDWIN
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2298 wmessage(msg);
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2299 END_STDWIN
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2300 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2301 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2302 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2303
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2304 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2305 stdwin_fleep(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2306 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2307 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2308 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2309 if (!PyArg_NoArgs(args))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2310 return NULL;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2311 wfleep();
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2312 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2313 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2314 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2315
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2316 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2317 stdwin_setcutbuffer(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2318 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2319 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2320 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2321 int i, size;
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2322 char *str;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2323 if (!PyArg_Parse(args, "(is#)", &i, &str, &size))
65
a72c0a7dc993 Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents: 51
diff changeset
2324 return NULL;
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2325 wsetcutbuffer(i, str, size);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2326 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2327 return Py_None;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2328 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2329
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2330 static PyObject *
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2331 stdwin_getactive(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2332 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2333 PyObject *args;
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2334 {
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2335 return window2object(wgetactive());
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2336 }
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2337
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2338 static PyObject *
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2339 stdwin_getcutbuffer(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2340 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2341 PyObject *args;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2342 {
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2343 int i;
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2344 char *str;
50
b94822f54991 Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
2345 int len;
65
a72c0a7dc993 Turn close commands into WE_CLOSE events.
Guido van Rossum <guido@python.org>
parents: 51
diff changeset
2346 if (!getintarg(args, &i))
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2347 return NULL;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2348 str = wgetcutbuffer(i, &len);
50
b94822f54991 Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
2349 if (str == NULL) {
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2350 str = "";
50
b94822f54991 Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
2351 len = 0;
b94822f54991 Change set/getcutbuffer to use the new stdwin interface.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
2352 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2353 return PyString_FromStringAndSize(str, len);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2354 }
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2355
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2356 static PyObject *
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2357 stdwin_rotatecutbuffers(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2358 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2359 PyObject *args;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2360 {
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2361 int i;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2362 if (!getintarg(args, &i))
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2363 return NULL;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2364 wrotatecutbuffers(i);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2365 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2366 return Py_None;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2367 }
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2368
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2369 static PyObject *
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2370 stdwin_getselection(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2371 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2372 PyObject *args;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2373 {
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2374 int sel;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2375 char *data;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2376 int len;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2377 if (!getintarg(args, &sel))
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2378 return NULL;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2379 data = wgetselection(sel, &len);
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2380 if (data == NULL) {
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2381 data = "";
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2382 len = 0;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2383 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2384 return PyString_FromStringAndSize(data, len);
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2385 }
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2386
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2387 static PyObject *
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2388 stdwin_resetselection(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2389 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2390 PyObject *args;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2391 {
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2392 int sel;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2393 if (!getintarg(args, &sel))
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2394 return NULL;
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2395 wresetselection(sel);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2396 Py_INCREF(Py_None);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2397 return Py_None;
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2398 }
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2399
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2400 static PyObject *
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2401 stdwin_fetchcolor(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2402 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2403 PyObject *args;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2404 {
635
784a09a52375 Use getargs() function.
Guido van Rossum <guido@python.org>
parents: 629
diff changeset
2405 char *colorname;
1198
2937897a7d8b * Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents: 1191
diff changeset
2406 COLOR color;
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2407 if (!getstrarg(args, &colorname))
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2408 return NULL;
1198
2937897a7d8b * Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents: 1191
diff changeset
2409 color = wfetchcolor(colorname);
2937897a7d8b * Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents: 1191
diff changeset
2410 #ifdef BADCOLOR
2937897a7d8b * Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents: 1191
diff changeset
2411 if (color == BADCOLOR) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2412 PyErr_SetString(StdwinError, "color name not found");
1198
2937897a7d8b * Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents: 1191
diff changeset
2413 return NULL;
2937897a7d8b * Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents: 1191
diff changeset
2414 }
2937897a7d8b * Added Fixcprt.py: script to fix copyright message.
Guido van Rossum <guido@python.org>
parents: 1191
diff changeset
2415 #endif
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2416 return PyInt_FromLong((long)color);
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2417 }
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2418
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2419 static PyObject *
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2420 stdwin_getscrsize(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2421 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2422 PyObject *args;
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2423 {
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2424 int width, height;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2425 if (!PyArg_NoArgs(args))
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2426 return NULL;
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2427 wgetscrsize(&width, &height);
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2428 return makepoint(width, height);
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2429 }
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2430
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2431 static PyObject *
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2432 stdwin_getscrmm(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2433 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2434 PyObject *args;
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2435 {
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2436 int width, height;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2437 if (!PyArg_NoArgs(args))
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2438 return NULL;
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2439 wgetscrmm(&width, &height);
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2440 return makepoint(width, height);
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2441 }
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2442
902
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2443 #ifdef unix
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2444 static PyObject *
902
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2445 stdwin_connectionnumber(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2446 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2447 PyObject *args;
902
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2448 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2449 if (!PyArg_NoArgs(args))
902
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2450 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2451 return PyInt_FromLong((long) wconnectionnumber());
902
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2452 }
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2453 #endif
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2454
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2455 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2456 stdwin_listfontnames(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2457 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2458 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2459 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2460 char *pattern;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2461 char **fontnames;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2462 int count;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2463 PyObject *list;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2464 if (!PyArg_Parse(args, "z", &pattern))
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2465 return NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2466 fontnames = wlistfontnames(pattern, &count);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2467 list = PyList_New(count);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2468 if (list != NULL) {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2469 int i;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2470 for (i = 0; i < count; i++) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2471 PyObject *v = PyString_FromString(fontnames[i]);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2472 if (v == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2473 Py_DECREF(list);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2474 list = NULL;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2475 break;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2476 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2477 PyList_SetItem(list, i, v);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2478 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2479 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2480 return list;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2481 }
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2482
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
2483 #ifdef HAVE_BITMAPS
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2484 static PyObject *
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2485 stdwin_newbitmap(self, args)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2486 PyObject *self;
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2487 PyObject *args;
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2488 {
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2489 int width, height;
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2490 bitmapobject *bp;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2491 if (!PyArg_Parse(args, "(ii)", &width, &height))
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2492 return NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2493 return (PyObject *)newbitmapobject(width, height);
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2494 }
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
2495 #endif
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2496
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2497 static PyMethodDef stdwin_methods[] = {
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2498 {"askfile", stdwin_askfile},
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2499 {"askstr", stdwin_askstr},
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2500 {"askync", stdwin_askync},
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2501 {"done", stdwin_done},
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
2502 {"fetchcolor", stdwin_fetchcolor},
902
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2503 #ifdef unix
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2504 {"fileno", stdwin_connectionnumber},
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2505 {"connectionnumber", stdwin_connectionnumber},
a4793ae26682 Changes for new UNIX-specific built-in module 'select' and new header for
Guido van Rossum <guido@python.org>
parents: 818
diff changeset
2506 #endif
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2507 {"fleep", stdwin_fleep},
252
6811912f672d Don't suppress wsetfont("");
Guido van Rossum <guido@python.org>
parents: 248
diff changeset
2508 {"getactive", stdwin_getactive},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2509 {"getcutbuffer", stdwin_getcutbuffer},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2510 {"getdefscrollbars", stdwin_getdefscrollbars},
137
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2511 {"getdefwinpos", stdwin_getdefwinpos},
82ef94b8b902 Add getdefwinpos, getdefwinsize;
Guido van Rossum <guido@python.org>
parents: 114
diff changeset
2512 {"getdefwinsize", stdwin_getdefwinsize},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2513 {"getevent", stdwin_getevent},
233
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2514 {"getscrmm", stdwin_getscrmm},
8f62a5457319 Added many new functions
Guido van Rossum <guido@python.org>
parents: 207
diff changeset
2515 {"getscrsize", stdwin_getscrsize},
207
9ab329697dda Add filled drawing methods and polygon methods.
Guido van Rossum <guido@python.org>
parents: 186
diff changeset
2516 {"getselection", stdwin_getselection},
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2517 {"listfontnames", stdwin_listfontnames},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2518 {"menucreate", stdwin_menucreate},
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2519 {"message", stdwin_message},
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
2520 #ifdef HAVE_BITMAPS
1211
406860dfaac7 * stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents: 1198
diff changeset
2521 {"newbitmap", stdwin_newbitmap},
1332
e5fb9cdbe050 Final touch before release.
Guido van Rossum <guido@python.org>
parents: 1313
diff changeset
2522 #endif
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2523 {"open", stdwin_open},
114
1efb8ed6afd3 Added pollevent(); returns None if no event available.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
2524 {"pollevent", stdwin_pollevent},
51
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2525 {"resetselection", stdwin_resetselection},
ebcb626cfddf Added w.setwincursor(), selection, and new cut buffer interface.
Guido van Rossum <guido@python.org>
parents: 50
diff changeset
2526 {"rotatecutbuffers", stdwin_rotatecutbuffers},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2527 {"setcutbuffer", stdwin_setcutbuffer},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2528 {"setdefscrollbars", stdwin_setdefscrollbars},
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2529 {"setdefwinpos", stdwin_setdefwinpos},
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2530 {"setdefwinsize", stdwin_setdefwinsize},
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2531
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2532 /* Text measuring methods borrow code from drawing objects: */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2533 {"baseline", (PyCFunction)drawing_baseline},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2534 {"lineheight", (PyCFunction)drawing_lineheight},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2535 {"textbreak", (PyCFunction)drawing_textbreak},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2536 {"textwidth", (PyCFunction)drawing_textwidth},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2537
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2538 /* Same for font setting methods: */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2539 {"setfont", (PyCFunction)drawing_setfont},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2540
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2541 /* Same for color setting/getting methods: */
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2542 {"getbgcolor", (PyCFunction)drawing_getbgcolor},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2543 {"getfgcolor", (PyCFunction)drawing_getfgcolor},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2544 {"setbgcolor", (PyCFunction)drawing_setbgcolor},
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2545 {"setfgcolor", (PyCFunction)drawing_setfgcolor},
171
0cee01b68d9c Added font, color and default scroll bars interfaces.
Guido van Rossum <guido@python.org>
parents: 157
diff changeset
2546
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2547 {NULL, NULL} /* sentinel */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2548 };
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2549
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
2550 #ifndef macintosh
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2551 static int
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2552 checkstringlist(args, ps, pn)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2553 PyObject *args;
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2554 char ***ps;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2555 int *pn;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2556 {
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2557 int i, n;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2558 char **s;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2559 if (!PyList_Check(args)) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2560 PyErr_SetString(PyExc_TypeError, "list of strings expected");
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2561 return 0;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2562 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2563 n = PyList_Size(args);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2564 s = PyMem_NEW(char *, n+1);
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2565 if (s == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2566 PyErr_NoMemory();
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2567 return 0;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2568 }
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2569 for (i = 0; i < n; i++) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2570 PyObject *item = PyList_GetItem(args, i);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2571 if (!PyString_Check(item)) {
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2572 PyErr_SetString(PyExc_TypeError,
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2573 "list of strings expected");
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2574 return 0;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2575 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2576 s[i] = PyString_AsString(item);
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2577 }
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2578 s[n] = NULL; /* In case caller wants a NULL-terminated list */
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2579 *ps = s;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2580 *pn = n;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2581 return 1;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2582 }
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2583
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2584 static int
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2585 putbackstringlist(list, s, n)
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2586 PyObject *list;
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2587 char **s;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2588 int n;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2589 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2590 int oldsize = PyList_Size(list);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2591 PyObject *newlist;
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2592 int i;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2593 if (n == oldsize)
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2594 return 1;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2595 newlist = PyList_New(n);
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2596 for (i = 0; i < n && newlist != NULL; i++) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2597 PyObject *item = PyString_FromString(s[i]);
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2598 if (item == NULL) {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2599 Py_DECREF(newlist);
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2600 newlist = NULL;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2601 }
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2602 else
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2603 PyList_SetItem(newlist, i, item);
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2604 }
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2605 if (newlist == NULL)
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2606 return 0;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2607 (*list->ob_type->tp_as_sequence->sq_ass_slice)
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2608 (list, 0, oldsize, newlist);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2609 Py_DECREF(newlist);
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2610 return 1;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2611 }
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
2612 #endif /* macintosh */
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2613
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2614 void
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2615 initstdwin()
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2616 {
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2617 PyObject *m, *d;
499
80e2e5d67b49 Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents: 475
diff changeset
2618 static int inited = 0;
80e2e5d67b49 Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents: 475
diff changeset
2619
142
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
2620 if (!inited) {
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
2621 #ifdef macintosh
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
2622 winit();
2263
7895a97313e5 Changed the way mac mainloop event checking is turned off
Jack Jansen <jack.jansen@cwi.nl>
parents: 2253
diff changeset
2623 PyMac_DoYieldEnabled = 0;
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
2624 #else
2235
01ed4cd21576 unused vars
Guido van Rossum <guido@python.org>
parents: 2061
diff changeset
2625 char buf[1000];
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2626 int argc = 0;
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2627 char **argv = NULL;
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2628 PyObject *sys_argv = PySys_GetObject("argv");
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2629 if (sys_argv != NULL) {
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2630 if (!checkstringlist(sys_argv, &argv, &argc))
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2631 PyErr_Clear();
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2632 }
1410
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2633 if (argc > 0) {
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2634 /* If argv[0] has a ".py" suffix, remove the suffix */
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2635 char *p = strrchr(argv[0], '.');
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2636 if (p != NULL && strcmp(p, ".py") == 0) {
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2637 int n = p - argv[0];
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2638 if (n >= sizeof(buf))
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2639 n = sizeof(buf)-1;
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2640 strncpy(buf, argv[0], n);
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2641 buf[n] = '\0';
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2642 argv[0] = buf;
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2643 }
315272ec4d5b * import.c (get_module): total rewrite, to ensure proper search order: for
Guido van Rossum <guido@python.org>
parents: 1353
diff changeset
2644 }
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2645 winitargs(&argc, &argv);
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2646 if (argv != NULL) {
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2647 if (!putbackstringlist(sys_argv, argv, argc))
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2648 PyErr_Clear();
1353
a6355c83578d * stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is
Guido van Rossum <guido@python.org>
parents: 1332
diff changeset
2649 }
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
2650 #endif
142
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
2651 inited = 1;
c7ea60491e68 Call winit() here instead of in main initialization.
Guido van Rossum <guido@python.org>
parents: 137
diff changeset
2652 }
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2653 m = Py_InitModule("stdwin", stdwin_methods);
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2654 d = PyModule_GetDict(m);
499
80e2e5d67b49 Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents: 475
diff changeset
2655
80e2e5d67b49 Change errors into new StdwinError.
Guido van Rossum <guido@python.org>
parents: 475
diff changeset
2656 /* Initialize stdwin.error exception */
6367
2c29b8982643 Apply two changes, systematically:
Guido van Rossum <guido@python.org>
parents: 4703
diff changeset
2657 StdwinError = PyErr_NewException("stdwin.error", NULL, NULL);
4703
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2658 if (StdwinError == NULL ||
e0bb1dac2dbf Renamed, but *not* tested or compiled. I don't even have the STDWIN
Barry Warsaw <barry@python.org>
parents: 4503
diff changeset
2659 PyDict_SetItemString(d, "error", StdwinError) != 0)
6367
2c29b8982643 Apply two changes, systematically:
Guido van Rossum <guido@python.org>
parents: 4703
diff changeset
2660 return;
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1410
diff changeset
2661 #ifdef WITH_THREAD
926
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2662 StdwinLock = allocate_lock();
c156d4960c2b * Makefile: cosmetics
Guido van Rossum <guido@python.org>
parents: 907
diff changeset
2663 #endif
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2664 }