mirror of
https://github.com/python/cpython.git
synced 2025-11-08 21:52:45 +00:00
Added dialog-centering code to splash()
This commit is contained in:
parent
d96cb5088a
commit
04df9d5ad4
1 changed files with 16 additions and 1 deletions
|
|
@ -502,6 +502,10 @@ MacOS_splash(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int resid = -1;
|
int resid = -1;
|
||||||
static DialogPtr curdialog;
|
static DialogPtr curdialog;
|
||||||
|
WindowRef theWindow;
|
||||||
|
CGrafPtr thePort;
|
||||||
|
short item;
|
||||||
|
short xpos, ypos, width, height, swidth, sheight;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "|i", &resid))
|
if (!PyArg_ParseTuple(args, "|i", &resid))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -510,8 +514,19 @@ MacOS_splash(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
if ( resid != -1 ) {
|
if ( resid != -1 ) {
|
||||||
curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
|
curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1);
|
||||||
if ( curdialog )
|
if ( curdialog ) {
|
||||||
|
theWindow = GetDialogWindow(curdialog);
|
||||||
|
thePort = GetWindowPort(theWindow);
|
||||||
|
width = thePort->portRect.right - thePort->portRect.left;
|
||||||
|
height = thePort->portRect.bottom - thePort->portRect.top;
|
||||||
|
swidth = qd.screenBits.bounds.right - qd.screenBits.bounds.left;
|
||||||
|
sheight = qd.screenBits.bounds.bottom - qd.screenBits.bounds.top - LMGetMBarHeight();
|
||||||
|
xpos = (swidth-width)/2;
|
||||||
|
ypos = (sheight-height)/5 + LMGetMBarHeight();
|
||||||
|
MoveWindow(theWindow, xpos, ypos, 0);
|
||||||
|
ShowWindow(theWindow);
|
||||||
DrawDialog(curdialog);
|
DrawDialog(curdialog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue