summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-09-23 15:49:43 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-09-23 15:49:43 (GMT)
commit04df9d5ad4a85cbab59b7a5e78756b9d7a475fd8 (patch)
tree2d222ec79faa7340f5295b43443f36b8f6c558d3 /Mac
parentd96cb5088a41d218bfa6e4db444fc4b671c00c9b (diff)
downloadcpython-04df9d5ad4a85cbab59b7a5e78756b9d7a475fd8.zip
cpython-04df9d5ad4a85cbab59b7a5e78756b9d7a475fd8.tar.gz
cpython-04df9d5ad4a85cbab59b7a5e78756b9d7a475fd8.tar.bz2
Added dialog-centering code to splash()
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/macosmodule.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c
index 0220eed..26e2701 100644
--- a/Mac/Modules/macosmodule.c
+++ b/Mac/Modules/macosmodule.c
@@ -502,6 +502,10 @@ MacOS_splash(PyObject *self, PyObject *args)
{
int resid = -1;
static DialogPtr curdialog;
+ WindowRef theWindow;
+ CGrafPtr thePort;
+ short item;
+ short xpos, ypos, width, height, swidth, sheight;
if (!PyArg_ParseTuple(args, "|i", &resid))
return NULL;
@@ -510,8 +514,19 @@ MacOS_splash(PyObject *self, PyObject *args)
if ( resid != -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);
+ }
}
Py_INCREF(Py_None);
return Py_None;