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

Skip to content

Commit d96cb50

Browse files
committed
Added support for GetDialogWindow and other accessor functions
1 parent 0d1069e commit d96cb50

2 files changed

Lines changed: 93 additions & 0 deletions

File tree

Mac/Modules/dlg/Dlgmodule.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,75 @@ static PyObject *DlgObj_SetDialogTracksCursor(_self, _args)
479479
return _res;
480480
}
481481

482+
static PyObject *DlgObj_GetDialogWindow(_self, _args)
483+
DialogObject *_self;
484+
PyObject *_args;
485+
{
486+
PyObject *_res = NULL;
487+
DialogPtr _rv;
488+
if (!PyArg_ParseTuple(_args, ""))
489+
return NULL;
490+
_rv = GetDialogWindow(_self->ob_itself);
491+
_res = Py_BuildValue("O&",
492+
WinObj_WhichWindow, _rv);
493+
return _res;
494+
}
495+
496+
static PyObject *DlgObj_GetDialogDefaultItem(_self, _args)
497+
DialogObject *_self;
498+
PyObject *_args;
499+
{
500+
PyObject *_res = NULL;
501+
SInt16 _rv;
502+
if (!PyArg_ParseTuple(_args, ""))
503+
return NULL;
504+
_rv = GetDialogDefaultItem(_self->ob_itself);
505+
_res = Py_BuildValue("h",
506+
_rv);
507+
return _res;
508+
}
509+
510+
static PyObject *DlgObj_GetDialogCancelItem(_self, _args)
511+
DialogObject *_self;
512+
PyObject *_args;
513+
{
514+
PyObject *_res = NULL;
515+
SInt16 _rv;
516+
if (!PyArg_ParseTuple(_args, ""))
517+
return NULL;
518+
_rv = GetDialogCancelItem(_self->ob_itself);
519+
_res = Py_BuildValue("h",
520+
_rv);
521+
return _res;
522+
}
523+
524+
static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args)
525+
DialogObject *_self;
526+
PyObject *_args;
527+
{
528+
PyObject *_res = NULL;
529+
SInt16 _rv;
530+
if (!PyArg_ParseTuple(_args, ""))
531+
return NULL;
532+
_rv = GetDialogKeyboardFocusItem(_self->ob_itself);
533+
_res = Py_BuildValue("h",
534+
_rv);
535+
return _res;
536+
}
537+
538+
static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args)
539+
DialogObject *_self;
540+
PyObject *_args;
541+
{
542+
PyObject *_res = NULL;
543+
if (!PyArg_ParseTuple(_args, ""))
544+
return NULL;
545+
SetGrafPortOfDialog(_self->ob_itself);
546+
Py_INCREF(Py_None);
547+
_res = Py_None;
548+
return _res;
549+
}
550+
482551
static PyMethodDef DlgObj_methods[] = {
483552
{"DrawDialog", (PyCFunction)DlgObj_DrawDialog, 1,
484553
"() -> None"},
@@ -518,6 +587,16 @@ static PyMethodDef DlgObj_methods[] = {
518587
"(short newItem) -> None"},
519588
{"SetDialogTracksCursor", (PyCFunction)DlgObj_SetDialogTracksCursor, 1,
520589
"(Boolean tracks) -> None"},
590+
{"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
591+
"() -> (DialogPtr _rv)"},
592+
{"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
593+
"() -> (SInt16 _rv)"},
594+
{"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1,
595+
"() -> (SInt16 _rv)"},
596+
{"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1,
597+
"() -> (SInt16 _rv)"},
598+
{"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1,
599+
"() -> None"},
521600
{NULL, NULL, 0}
522601
};
523602

Mac/Modules/dlg/dlgsupport.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,20 @@ def outputFreeIt(self, itselfname):
129129
for f in functions: module.add(f)
130130
for f in methods: object.add(f)
131131

132+
# Some methods that are currently macro's in C, but will be real routines
133+
# in MacOS 8.
134+
135+
f = Method(ExistingDialogPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode))
136+
object.add(f)
137+
f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode))
138+
object.add(f)
139+
f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode))
140+
object.add(f)
141+
f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode))
142+
object.add(f)
143+
f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode))
144+
object.add(f)
145+
132146
# generate output
133147
SetOutputFileName('Dlgmodule.c')
134148
module.generate()

0 commit comments

Comments
 (0)