504 Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
505 {
506 TRY;
507
508 // as peer object is used later on another thread, create global ref here
509 jobject peerGlobalRef = env->NewGlobalRef(peer);
510 DASSERT(peerGlobalRef != NULL);
511 jobject target = env->GetObjectField(peerGlobalRef, AwtObject::targetID);
512
513 jobject parent = env->GetObjectField(peerGlobalRef, AwtPrintDialog::parentID);
514
515 jobject page = env->GetObjectField(target, AwtPrintDialog::pageID);
516 DASSERT(page != NULL);
517
518 jobject self = env->GetObjectField(target, AwtPrintDialog::controlID);
519 DASSERT(self != NULL);
520
521 AwtComponent *awtParent = (parent != NULL) ? (AwtComponent *)JNI_GET_PDATA(parent) : NULL;
522 HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
523
524 jboolean doIt = JNI_FALSE; // Assume the user will cancel the dialog.
525 PAGESETUPDLG setup;
526 memset(&setup, 0, sizeof(setup));
527
528 setup.lStructSize = sizeof(setup);
529
530 /*
531 Fix for 6488834.
532 To disable Win32 native parent modality we have to set
533 hwndOwner field to either NULL or some hidden window. For
534 parentless dialogs we use NULL to show them in the taskbar,
535 and for all other dialogs AwtToolkit's HWND is used.
536 */
537 if (awtParent != NULL)
538 {
539 setup.hwndOwner = AwtToolkit::GetInstance().GetHWnd();
540 }
541 else
542 {
543 setup.hwndOwner = NULL;
544 }
545
546 setup.hDevMode = NULL;
547 setup.hDevNames = NULL;
548 setup.Flags = PSD_RETURNDEFAULT | PSD_DEFAULTMINMARGINS;
549 // setup.ptPaperSize =
550 // setup.rtMinMargin =
551 // setup.rtMargin =
552 setup.hInstance = NULL;
553 setup.lCustData = (LPARAM)peerGlobalRef;
554 setup.lpfnPageSetupHook = reinterpret_cast<LPPAGESETUPHOOK>(pageDlgHook);
555 setup.lpfnPagePaintHook = NULL;
556 setup.lpPageSetupTemplateName = NULL;
557 setup.hPageSetupTemplate = NULL;
|
504 Java_sun_awt_windows_WPageDialogPeer__1show(JNIEnv *env, jobject peer)
505 {
506 TRY;
507
508 // as peer object is used later on another thread, create global ref here
509 jobject peerGlobalRef = env->NewGlobalRef(peer);
510 DASSERT(peerGlobalRef != NULL);
511 jobject target = env->GetObjectField(peerGlobalRef, AwtObject::targetID);
512
513 jobject parent = env->GetObjectField(peerGlobalRef, AwtPrintDialog::parentID);
514
515 jobject page = env->GetObjectField(target, AwtPrintDialog::pageID);
516 DASSERT(page != NULL);
517
518 jobject self = env->GetObjectField(target, AwtPrintDialog::controlID);
519 DASSERT(self != NULL);
520
521 AwtComponent *awtParent = (parent != NULL) ? (AwtComponent *)JNI_GET_PDATA(parent) : NULL;
522 HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
523
524
525 jboolean doIt = JNI_FALSE; // Assume the user will cancel the dialog.
526 PAGESETUPDLG setup;
527 memset(&setup, 0, sizeof(setup));
528
529 setup.lStructSize = sizeof(setup);
530
531 HWND parentID = AwtPrintControl::getParentID(env, self);
532 if (parentID != NULL) {
533 // windows native modality is requested (used by JavaFX).
534 setup.hwndOwner = parentID;
535 }
536 /*
537 Fix for 6488834.
538 To disable Win32 native parent modality we have to set
539 hwndOwner field to either NULL or some hidden window. For
540 parentless dialogs we use NULL to show them in the taskbar,
541 and for all other dialogs AwtToolkit's HWND is used.
542 */
543 else if (awtParent != NULL)
544 {
545 setup.hwndOwner = AwtToolkit::GetInstance().GetHWnd();
546 }
547 else
548 {
549 setup.hwndOwner = NULL;
550 }
551
552 setup.hDevMode = NULL;
553 setup.hDevNames = NULL;
554 setup.Flags = PSD_RETURNDEFAULT | PSD_DEFAULTMINMARGINS;
555 // setup.ptPaperSize =
556 // setup.rtMinMargin =
557 // setup.rtMargin =
558 setup.hInstance = NULL;
559 setup.lCustData = (LPARAM)peerGlobalRef;
560 setup.lpfnPageSetupHook = reinterpret_cast<LPPAGESETUPHOOK>(pageDlgHook);
561 setup.lpfnPagePaintHook = NULL;
562 setup.lpPageSetupTemplateName = NULL;
563 setup.hPageSetupTemplate = NULL;
|