Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 330f576

Browse files
committed
- Added support for PicHandle
- Added (by hand, through winedit.py) support for WindowPeek accessor functions that are currently declared as macros.
1 parent a01a8f7 commit 330f576

6 files changed

Lines changed: 368 additions & 4 deletions

File tree

Mac/Lib/toolbox/Windows.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:Windows.h'
1+
# Generated from 'Sap:CodeWarrior7:Metrowerks CodeWarrior:MacOS Support:Headers:Universal Headers:Windows.h'
22

3+
kWindowDefProcType = 'WDEF'
34
kStandardWindowDefinition = 0
45
kRoundWindowDefinition = 1
56
kFloatingWindowDefinition = 124

Mac/Modules/win/Winmodule.c

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,36 @@ static PyObject *WinObj_GetWRefCon(_self, _args)
340340
return _res;
341341
}
342342

343+
static PyObject *WinObj_SetWindowPic(_self, _args)
344+
WindowObject *_self;
345+
PyObject *_args;
346+
{
347+
PyObject *_res = NULL;
348+
PicHandle pic;
349+
if (!PyArg_ParseTuple(_args, "O&",
350+
ResObj_Convert, &pic))
351+
return NULL;
352+
SetWindowPic(_self->ob_itself,
353+
pic);
354+
Py_INCREF(Py_None);
355+
_res = Py_None;
356+
return _res;
357+
}
358+
359+
static PyObject *WinObj_GetWindowPic(_self, _args)
360+
WindowObject *_self;
361+
PyObject *_args;
362+
{
363+
PyObject *_res = NULL;
364+
PicHandle _rv;
365+
if (!PyArg_ParseTuple(_args, ""))
366+
return NULL;
367+
_rv = GetWindowPic(_self->ob_itself);
368+
_res = Py_BuildValue("O&",
369+
ResObj_New, _rv);
370+
return _res;
371+
}
372+
343373
static PyObject *WinObj_ClipAbove(_self, _args)
344374
WindowObject *_self;
345375
PyObject *_args;
@@ -501,6 +531,195 @@ static PyObject *WinObj_DragWindow(_self, _args)
501531
return _res;
502532
}
503533

534+
static PyObject *WinObj_SetPortWindowPort(_self, _args)
535+
WindowObject *_self;
536+
PyObject *_args;
537+
{
538+
PyObject *_res = NULL;
539+
if (!PyArg_ParseTuple(_args, ""))
540+
return NULL;
541+
SetPortWindowPort(_self->ob_itself);
542+
Py_INCREF(Py_None);
543+
_res = Py_None;
544+
return _res;
545+
}
546+
547+
static PyObject *WinObj_GetWindowKind(_self, _args)
548+
WindowObject *_self;
549+
PyObject *_args;
550+
{
551+
PyObject *_res = NULL;
552+
short _rv;
553+
if (!PyArg_ParseTuple(_args, ""))
554+
return NULL;
555+
_rv = GetWindowKind(_self->ob_itself);
556+
_res = Py_BuildValue("h",
557+
_rv);
558+
return _res;
559+
}
560+
561+
static PyObject *WinObj_SetWindowKind(_self, _args)
562+
WindowObject *_self;
563+
PyObject *_args;
564+
{
565+
PyObject *_res = NULL;
566+
short wKind;
567+
if (!PyArg_ParseTuple(_args, "h",
568+
&wKind))
569+
return NULL;
570+
SetWindowKind(_self->ob_itself,
571+
wKind);
572+
Py_INCREF(Py_None);
573+
_res = Py_None;
574+
return _res;
575+
}
576+
577+
static PyObject *WinObj_IsWindowVisible(_self, _args)
578+
WindowObject *_self;
579+
PyObject *_args;
580+
{
581+
PyObject *_res = NULL;
582+
Boolean _rv;
583+
if (!PyArg_ParseTuple(_args, ""))
584+
return NULL;
585+
_rv = IsWindowVisible(_self->ob_itself);
586+
_res = Py_BuildValue("b",
587+
_rv);
588+
return _res;
589+
}
590+
591+
static PyObject *WinObj_IsWindowHilited(_self, _args)
592+
WindowObject *_self;
593+
PyObject *_args;
594+
{
595+
PyObject *_res = NULL;
596+
Boolean _rv;
597+
if (!PyArg_ParseTuple(_args, ""))
598+
return NULL;
599+
_rv = IsWindowHilited(_self->ob_itself);
600+
_res = Py_BuildValue("b",
601+
_rv);
602+
return _res;
603+
}
604+
605+
static PyObject *WinObj_GetWindowGoAwayFlag(_self, _args)
606+
WindowObject *_self;
607+
PyObject *_args;
608+
{
609+
PyObject *_res = NULL;
610+
Boolean _rv;
611+
if (!PyArg_ParseTuple(_args, ""))
612+
return NULL;
613+
_rv = GetWindowGoAwayFlag(_self->ob_itself);
614+
_res = Py_BuildValue("b",
615+
_rv);
616+
return _res;
617+
}
618+
619+
static PyObject *WinObj_GetWindowZoomFlag(_self, _args)
620+
WindowObject *_self;
621+
PyObject *_args;
622+
{
623+
PyObject *_res = NULL;
624+
Boolean _rv;
625+
if (!PyArg_ParseTuple(_args, ""))
626+
return NULL;
627+
_rv = GetWindowZoomFlag(_self->ob_itself);
628+
_res = Py_BuildValue("b",
629+
_rv);
630+
return _res;
631+
}
632+
633+
static PyObject *WinObj_GetWindowTitleWidth(_self, _args)
634+
WindowObject *_self;
635+
PyObject *_args;
636+
{
637+
PyObject *_res = NULL;
638+
short _rv;
639+
if (!PyArg_ParseTuple(_args, ""))
640+
return NULL;
641+
_rv = GetWindowTitleWidth(_self->ob_itself);
642+
_res = Py_BuildValue("h",
643+
_rv);
644+
return _res;
645+
}
646+
647+
static PyObject *WinObj_GetNextWindow(_self, _args)
648+
WindowObject *_self;
649+
PyObject *_args;
650+
{
651+
PyObject *_res = NULL;
652+
WindowPtr _rv;
653+
if (!PyArg_ParseTuple(_args, ""))
654+
return NULL;
655+
_rv = GetNextWindow(_self->ob_itself);
656+
_res = Py_BuildValue("O&",
657+
WinObj_WhichWindow, _rv);
658+
return _res;
659+
}
660+
661+
static PyObject *WinObj_GetWindowStandardState(_self, _args)
662+
WindowObject *_self;
663+
PyObject *_args;
664+
{
665+
PyObject *_res = NULL;
666+
Rect r;
667+
if (!PyArg_ParseTuple(_args, ""))
668+
return NULL;
669+
GetWindowStandardState(_self->ob_itself,
670+
&r);
671+
_res = Py_BuildValue("O&",
672+
PyMac_BuildRect, &r);
673+
return _res;
674+
}
675+
676+
static PyObject *WinObj_GetWindowUserState(_self, _args)
677+
WindowObject *_self;
678+
PyObject *_args;
679+
{
680+
PyObject *_res = NULL;
681+
Rect r;
682+
if (!PyArg_ParseTuple(_args, ""))
683+
return NULL;
684+
GetWindowUserState(_self->ob_itself,
685+
&r);
686+
_res = Py_BuildValue("O&",
687+
PyMac_BuildRect, &r);
688+
return _res;
689+
}
690+
691+
static PyObject *WinObj_SetWindowStandardState(_self, _args)
692+
WindowObject *_self;
693+
PyObject *_args;
694+
{
695+
PyObject *_res = NULL;
696+
Rect r;
697+
if (!PyArg_ParseTuple(_args, "O&",
698+
PyMac_GetRect, &r))
699+
return NULL;
700+
SetWindowStandardState(_self->ob_itself,
701+
&r);
702+
Py_INCREF(Py_None);
703+
_res = Py_None;
704+
return _res;
705+
}
706+
707+
static PyObject *WinObj_SetWindowUserState(_self, _args)
708+
WindowObject *_self;
709+
PyObject *_args;
710+
{
711+
PyObject *_res = NULL;
712+
Rect r;
713+
if (!PyArg_ParseTuple(_args, "O&",
714+
PyMac_GetRect, &r))
715+
return NULL;
716+
SetWindowUserState(_self->ob_itself,
717+
&r);
718+
Py_INCREF(Py_None);
719+
_res = Py_None;
720+
return _res;
721+
}
722+
504723
static PyMethodDef WinObj_methods[] = {
505724
{"GetWTitle", (PyCFunction)WinObj_GetWTitle, 1,
506725
"() -> (Str255 title)"},
@@ -534,6 +753,10 @@ static PyMethodDef WinObj_methods[] = {
534753
"(long data) -> None"},
535754
{"GetWRefCon", (PyCFunction)WinObj_GetWRefCon, 1,
536755
"() -> (long _rv)"},
756+
{"SetWindowPic", (PyCFunction)WinObj_SetWindowPic, 1,
757+
"(PicHandle pic) -> None"},
758+
{"GetWindowPic", (PyCFunction)WinObj_GetWindowPic, 1,
759+
"() -> (PicHandle _rv)"},
537760
{"ClipAbove", (PyCFunction)WinObj_ClipAbove, 1,
538761
"() -> None"},
539762
{"SaveOld", (PyCFunction)WinObj_SaveOld, 1,
@@ -554,6 +777,32 @@ static PyMethodDef WinObj_methods[] = {
554777
"(Point thePt) -> (Boolean _rv)"},
555778
{"DragWindow", (PyCFunction)WinObj_DragWindow, 1,
556779
"(Point startPt, Rect boundsRect) -> None"},
780+
{"SetPortWindowPort", (PyCFunction)WinObj_SetPortWindowPort, 1,
781+
"() -> None"},
782+
{"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1,
783+
"() -> (short _rv)"},
784+
{"SetWindowKind", (PyCFunction)WinObj_SetWindowKind, 1,
785+
"(short wKind) -> None"},
786+
{"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1,
787+
"() -> (Boolean _rv)"},
788+
{"IsWindowHilited", (PyCFunction)WinObj_IsWindowHilited, 1,
789+
"() -> (Boolean _rv)"},
790+
{"GetWindowGoAwayFlag", (PyCFunction)WinObj_GetWindowGoAwayFlag, 1,
791+
"() -> (Boolean _rv)"},
792+
{"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1,
793+
"() -> (Boolean _rv)"},
794+
{"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1,
795+
"() -> (short _rv)"},
796+
{"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
797+
"() -> (WindowPtr _rv)"},
798+
{"GetWindowStandardState", (PyCFunction)WinObj_GetWindowStandardState, 1,
799+
"() -> (Rect r)"},
800+
{"GetWindowUserState", (PyCFunction)WinObj_GetWindowUserState, 1,
801+
"() -> (Rect r)"},
802+
{"SetWindowStandardState", (PyCFunction)WinObj_SetWindowStandardState, 1,
803+
"(Rect r) -> None"},
804+
{"SetWindowUserState", (PyCFunction)WinObj_SetWindowUserState, 1,
805+
"(Rect r) -> None"},
557806
{NULL, NULL, 0}
558807
};
559808

Mac/Modules/win/winedit.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# These are inline-routines/defines, so we do them "by hand"
2+
#
3+
4+
f = Method(void, 'SetPortWindowPort',
5+
(WindowRef, 'theWindow', InMode),
6+
)
7+
methods.append(f)
8+
9+
f = Method(short, 'GetWindowKind',
10+
(WindowRef, 'theWindow', InMode),
11+
)
12+
methods.append(f)
13+
14+
f = Method(void, 'SetWindowKind',
15+
(WindowRef, 'theWindow', InMode),
16+
(short, 'wKind', InMode),
17+
)
18+
methods.append(f)
19+
20+
21+
f = Method(Boolean, 'IsWindowVisible',
22+
(WindowRef, 'theWindow', InMode),
23+
)
24+
methods.append(f)
25+
26+
f = Method(Boolean, 'IsWindowHilited',
27+
(WindowRef, 'theWindow', InMode),
28+
)
29+
methods.append(f)
30+
31+
f = Method(Boolean, 'GetWindowGoAwayFlag',
32+
(WindowRef, 'theWindow', InMode),
33+
)
34+
methods.append(f)
35+
36+
f = Method(Boolean, 'GetWindowZoomFlag',
37+
(WindowRef, 'theWindow', InMode),
38+
)
39+
methods.append(f)
40+
41+
if 0:
42+
# Regions are not implemented yet..
43+
f = Method(void, 'GetWindowStructureRgn',
44+
(WindowRef, 'theWindow', InMode),
45+
(RgnHandle, 'r', InMode),
46+
)
47+
methods.append(f)
48+
49+
f = Method(void, 'GetWindowContentRgn',
50+
(WindowRef, 'theWindow', InMode),
51+
(RgnHandle, 'r', InMode),
52+
)
53+
methods.append(f)
54+
55+
f = Method(void, 'GetWindowUpdateRgn',
56+
(WindowRef, 'theWindow', InMode),
57+
(RgnHandle, 'r', InMode),
58+
)
59+
methods.append(f)
60+
61+
f = Method(short, 'GetWindowTitleWidth',
62+
(WindowRef, 'theWindow', InMode),
63+
)
64+
methods.append(f)
65+
66+
f = Method(ExistingWindowPtr, 'GetNextWindow',
67+
(WindowRef, 'theWindow', InMode),
68+
)
69+
methods.append(f)
70+
71+
f = Method(void, 'GetWindowStandardState',
72+
(WindowRef, 'theWindow', InMode),
73+
(Rect, 'r', OutMode),
74+
)
75+
methods.append(f)
76+
77+
f = Method(void, 'GetWindowUserState',
78+
(WindowRef, 'theWindow', InMode),
79+
(Rect, 'r', OutMode),
80+
)
81+
methods.append(f)
82+
83+
84+
f = Method(void, 'SetWindowStandardState',
85+
(WindowRef, 'theWindow', InMode),
86+
(Rect, 'r', InMode),
87+
)
88+
methods.append(f)
89+
90+
f = Method(void, 'SetWindowUserState',
91+
(WindowRef, 'theWindow', InMode),
92+
(Rect, 'r', InMode),
93+
)
94+
methods.append(f)
95+

0 commit comments

Comments
 (0)