mirror of
https://github.com/python/cpython.git
synced 2025-11-19 02:39:15 +00:00
Adapted to Universal Headers 3.3.2. More to follow.
This commit is contained in:
parent
c6c2838403
commit
f7d5aa61d3
28 changed files with 3445 additions and 957 deletions
|
|
@ -10,6 +10,13 @@
|
|||
|
||||
#include <Dialogs.h>
|
||||
|
||||
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
|
||||
#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
|
||||
#define SetPortDialogPort(dlg) SetPort(dlg)
|
||||
#define GetDialogPort(dlg) ((CGrafPtr)(dlg))
|
||||
#define GetDialogFromWindow(win) ((DialogRef)(win))
|
||||
#endif
|
||||
|
||||
/* XXX Shouldn't this be a stack? */
|
||||
static PyObject *Dlg_FilterProc_callback = NULL;
|
||||
|
||||
|
|
@ -399,6 +406,63 @@ static PyObject *DlgObj_ShortenDITL(_self, _args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_CARBON
|
||||
|
||||
static PyObject *DlgObj_InsertDialogItem(_self, _args)
|
||||
DialogObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
OSStatus _err;
|
||||
DialogItemIndex afterItem;
|
||||
DialogItemType itemType;
|
||||
Handle itemHandle;
|
||||
Rect box;
|
||||
if (!PyArg_ParseTuple(_args, "hhO&O&",
|
||||
&afterItem,
|
||||
&itemType,
|
||||
ResObj_Convert, &itemHandle,
|
||||
PyMac_GetRect, &box))
|
||||
return NULL;
|
||||
_err = InsertDialogItem(_self->ob_itself,
|
||||
afterItem,
|
||||
itemType,
|
||||
itemHandle,
|
||||
&box);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_CARBON
|
||||
|
||||
static PyObject *DlgObj_RemoveDialogItems(_self, _args)
|
||||
DialogObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
OSStatus _err;
|
||||
DialogItemIndex itemNo;
|
||||
DialogItemIndex amountToRemove;
|
||||
Boolean disposeItemData;
|
||||
if (!PyArg_ParseTuple(_args, "hhb",
|
||||
&itemNo,
|
||||
&amountToRemove,
|
||||
&disposeItemData))
|
||||
return NULL;
|
||||
_err = RemoveDialogItems(_self->ob_itself,
|
||||
itemNo,
|
||||
amountToRemove,
|
||||
disposeItemData);
|
||||
if (_err != noErr) return PyMac_Error(_err);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *DlgObj_StdFilterProc(_self, _args)
|
||||
DialogObject *_self;
|
||||
PyObject *_args;
|
||||
|
|
@ -666,7 +730,21 @@ static PyObject *DlgObj_GetDialogWindow(_self, _args)
|
|||
return NULL;
|
||||
_rv = GetDialogWindow(_self->ob_itself);
|
||||
_res = Py_BuildValue("O&",
|
||||
WinObj_WhichWindow, _rv);
|
||||
WinObj_New, _rv);
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *DlgObj_GetDialogTextEditHandle(_self, _args)
|
||||
DialogObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
TEHandle _rv;
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
_rv = GetDialogTextEditHandle(_self->ob_itself);
|
||||
_res = Py_BuildValue("O&",
|
||||
ResObj_New, _rv);
|
||||
return _res;
|
||||
}
|
||||
|
||||
|
|
@ -712,6 +790,33 @@ static PyObject *DlgObj_GetDialogKeyboardFocusItem(_self, _args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *DlgObj_SetPortDialogPort(_self, _args)
|
||||
DialogObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
SetPortDialogPort(_self->ob_itself);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *DlgObj_GetDialogPort(_self, _args)
|
||||
DialogObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
CGrafPtr _rv;
|
||||
if (!PyArg_ParseTuple(_args, ""))
|
||||
return NULL;
|
||||
_rv = GetDialogPort(_self->ob_itself);
|
||||
_res = Py_BuildValue("O&",
|
||||
GrafObj_New, _rv);
|
||||
return _res;
|
||||
}
|
||||
|
||||
#if !TARGET_API_MAC_CARBON
|
||||
|
||||
static PyObject *DlgObj_SetGrafPortOfDialog(_self, _args)
|
||||
|
|
@ -759,6 +864,16 @@ static PyMethodDef DlgObj_methods[] = {
|
|||
"() -> (DialogItemIndex _rv)"},
|
||||
{"ShortenDITL", (PyCFunction)DlgObj_ShortenDITL, 1,
|
||||
"(DialogItemIndex numberItems) -> None"},
|
||||
|
||||
#if TARGET_API_MAC_CARBON
|
||||
{"InsertDialogItem", (PyCFunction)DlgObj_InsertDialogItem, 1,
|
||||
"(DialogItemIndex afterItem, DialogItemType itemType, Handle itemHandle, Rect box) -> None"},
|
||||
#endif
|
||||
|
||||
#if TARGET_API_MAC_CARBON
|
||||
{"RemoveDialogItems", (PyCFunction)DlgObj_RemoveDialogItems, 1,
|
||||
"(DialogItemIndex itemNo, DialogItemIndex amountToRemove, Boolean disposeItemData) -> None"},
|
||||
#endif
|
||||
{"StdFilterProc", (PyCFunction)DlgObj_StdFilterProc, 1,
|
||||
"() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)"},
|
||||
{"SetDialogDefaultItem", (PyCFunction)DlgObj_SetDialogDefaultItem, 1,
|
||||
|
|
@ -787,12 +902,18 @@ static PyMethodDef DlgObj_methods[] = {
|
|||
"() -> (EventMask outMask)"},
|
||||
{"GetDialogWindow", (PyCFunction)DlgObj_GetDialogWindow, 1,
|
||||
"() -> (WindowPtr _rv)"},
|
||||
{"GetDialogTextEditHandle", (PyCFunction)DlgObj_GetDialogTextEditHandle, 1,
|
||||
"() -> (TEHandle _rv)"},
|
||||
{"GetDialogDefaultItem", (PyCFunction)DlgObj_GetDialogDefaultItem, 1,
|
||||
"() -> (SInt16 _rv)"},
|
||||
{"GetDialogCancelItem", (PyCFunction)DlgObj_GetDialogCancelItem, 1,
|
||||
"() -> (SInt16 _rv)"},
|
||||
{"GetDialogKeyboardFocusItem", (PyCFunction)DlgObj_GetDialogKeyboardFocusItem, 1,
|
||||
"() -> (SInt16 _rv)"},
|
||||
{"SetPortDialogPort", (PyCFunction)DlgObj_SetPortDialogPort, 1,
|
||||
"() -> None"},
|
||||
{"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1,
|
||||
"() -> (CGrafPtr _rv)"},
|
||||
|
||||
#if !TARGET_API_MAC_CARBON
|
||||
{"SetGrafPortOfDialog", (PyCFunction)DlgObj_SetGrafPortOfDialog, 1,
|
||||
|
|
@ -1168,6 +1289,33 @@ static PyObject *Dlg_ResetAlertStage(_self, _args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
#if TARGET_API_MAC_CARBON
|
||||
|
||||
static PyObject *Dlg_GetParamText(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
Str255 param0;
|
||||
Str255 param1;
|
||||
Str255 param2;
|
||||
Str255 param3;
|
||||
if (!PyArg_ParseTuple(_args, "O&O&O&O&",
|
||||
PyMac_GetStr255, param0,
|
||||
PyMac_GetStr255, param1,
|
||||
PyMac_GetStr255, param2,
|
||||
PyMac_GetStr255, param3))
|
||||
return NULL;
|
||||
GetParamText(param0,
|
||||
param1,
|
||||
param2,
|
||||
param3);
|
||||
Py_INCREF(Py_None);
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static PyObject *Dlg_NewFeaturesDialog(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
|
|
@ -1209,6 +1357,22 @@ static PyObject *Dlg_NewFeaturesDialog(_self, _args)
|
|||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Dlg_GetDialogFromWindow(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
DialogPtr _rv;
|
||||
WindowPtr window;
|
||||
if (!PyArg_ParseTuple(_args, "O&",
|
||||
WinObj_Convert, &window))
|
||||
return NULL;
|
||||
_rv = GetDialogFromWindow(window);
|
||||
_res = Py_BuildValue("O&",
|
||||
DlgObj_New, _rv);
|
||||
return _res;
|
||||
}
|
||||
|
||||
static PyObject *Dlg_SetUserItemHandler(_self, _args)
|
||||
PyObject *_self;
|
||||
PyObject *_args;
|
||||
|
|
@ -1273,8 +1437,15 @@ static PyMethodDef Dlg_methods[] = {
|
|||
"(SInt16 fontNum) -> None"},
|
||||
{"ResetAlertStage", (PyCFunction)Dlg_ResetAlertStage, 1,
|
||||
"() -> None"},
|
||||
|
||||
#if TARGET_API_MAC_CARBON
|
||||
{"GetParamText", (PyCFunction)Dlg_GetParamText, 1,
|
||||
"(Str255 param0, Str255 param1, Str255 param2, Str255 param3) -> None"},
|
||||
#endif
|
||||
{"NewFeaturesDialog", (PyCFunction)Dlg_NewFeaturesDialog, 1,
|
||||
"(Rect inBoundsRect, Str255 inTitle, Boolean inIsVisible, SInt16 inProcID, WindowPtr inBehind, Boolean inGoAwayFlag, SInt32 inRefCon, Handle inItemListHandle, UInt32 inFlags) -> (DialogPtr _rv)"},
|
||||
{"GetDialogFromWindow", (PyCFunction)Dlg_GetDialogFromWindow, 1,
|
||||
"(WindowPtr window) -> (DialogPtr _rv)"},
|
||||
{"SetUserItemHandler", (PyCFunction)Dlg_SetUserItemHandler, 1,
|
||||
NULL},
|
||||
{NULL, NULL, 0}
|
||||
|
|
@ -1282,6 +1453,17 @@ static PyMethodDef Dlg_methods[] = {
|
|||
|
||||
|
||||
|
||||
/* Return the WindowPtr corresponding to a DialogObject */
|
||||
|
||||
WindowPtr
|
||||
DlgObj_ConvertToWindow(self)
|
||||
PyObject *self;
|
||||
{
|
||||
if ( DlgObj_Check(self) )
|
||||
return GetDialogWindow(((DialogObject *)self)->ob_itself);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void initDlg()
|
||||
{
|
||||
|
|
@ -1296,7 +1478,7 @@ void initDlg()
|
|||
Dlg_Error = PyMac_GetOSErrException();
|
||||
if (Dlg_Error == NULL ||
|
||||
PyDict_SetItemString(d, "Error", Dlg_Error) != 0)
|
||||
Py_FatalError("can't initialize Dlg.Error");
|
||||
return;
|
||||
Dialog_Type.ob_type = &PyType_Type;
|
||||
Py_INCREF(&Dialog_Type);
|
||||
if (PyDict_SetItemString(d, "DialogType", (PyObject *)&Dialog_Type) != 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue