Ticket #12187: wxWidgets-workswhenmodal.2.diff
File wxWidgets-workswhenmodal.2.diff, 1.7 KB (added by gmeeker, 11 years ago) |
---|
-
src/osx/cocoa/nonownedwnd.mm
14 14 #include "wx/nonownedwnd.h" 15 15 #include "wx/frame.h" 16 16 #include "wx/app.h" 17 #include "wx/dialog.h" 17 18 #endif 18 19 19 20 #include "wx/osx/private.h" … … 408 409 } 409 410 } 410 411 411 void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), const wxPoint& pos, const wxSize& size,412 void wxNonOwnedWindowCocoaImpl::Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, 412 413 long style, long extraStyle, const wxString& WXUNUSED(name) ) 413 414 { 414 415 static wxNonOwnedWindowController* controller = NULL; … … 516 517 defer:NO 517 518 ]; 518 519 520 // If the parent is modal, wxFRAME_FLOAT_ON_PARENT 521 // needs to be in kCGUtilityWindowLevel not kCGFloatingWindowLevel 522 // to stay above the parent. 523 wxDialog* parentDialog = wxDynamicCast(parent, wxDialog); 524 if (parentDialog != NULL && parentDialog->IsModal()) 525 { 526 if (level == kCGFloatingWindowLevel) 527 { 528 level = kCGUtilityWindowLevel; 529 } 530 531 // Cocoa's modal loop does not process other windows by default, 532 // but don't call this on normal window levels so 533 // nested modal dialogs will still behave modally. 534 if (level != kCGNormalWindowLevel) 535 { 536 if ([m_macWindow isKindOfClass:[NSPanel class]]) 537 { 538 [(NSPanel*)m_macWindow setWorksWhenModal:YES]; 539 } 540 } 541 } 542 519 543 [m_macWindow setLevel:level]; 520 544 521 545 [m_macWindow setDelegate:controller];