Added "hack" to allow window import with Qt.
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1393 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
e79415209f
commit
d4a5384da1
@ -90,16 +90,35 @@ myWheelStatus(0.0f)
|
||||
{
|
||||
if (Handle)
|
||||
{
|
||||
if (![(NSWindow *)Handle isKindOfClass:[NSWindow class]])
|
||||
std::cerr << "Cannot import this Window Handle because it is not a <NSWindow *> object"
|
||||
<< "(or one of its subclasses). You gave a <"
|
||||
<< [[(NSWindow *)Handle className] UTF8String]
|
||||
<< "> object." << std::endl;
|
||||
NSWindow *cocoaWindow = nil;
|
||||
|
||||
if ([(id)Handle isKindOfClass:[NSWindow class]])
|
||||
{
|
||||
cocoaWindow = (NSWindow *)Handle;
|
||||
NSLog(@"detected window object");
|
||||
}
|
||||
else if ([(id)Handle isKindOfClass:[NSView class]])
|
||||
{
|
||||
cocoaWindow = [(NSView *)Handle window];
|
||||
NSLog(@"detected view object");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr
|
||||
<< "Cannot import this Window Handle because it is neither"
|
||||
<< "a <NSWindow *> nor <NSView *> object"
|
||||
<< "(or any of its subclasses). You gave a <"
|
||||
<< [[(id)Handle className] UTF8String]
|
||||
<< "> object."
|
||||
<< std::endl;
|
||||
|
||||
}
|
||||
|
||||
if (cocoaWindow)
|
||||
{
|
||||
|
||||
// We create the window according to the given handle
|
||||
myWrapper = [[WindowWrapper alloc] initWithWindow:(NSWindow *)Handle
|
||||
myWrapper = [[WindowWrapper alloc] initWithWindow:cocoaWindow
|
||||
settings:params
|
||||
delegate:this];
|
||||
|
||||
@ -115,6 +134,16 @@ myWheelStatus(0.0f)
|
||||
std::cerr << "Failed to make the public window" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr
|
||||
<< "Could not get a valid NSWindow object from the given handle"
|
||||
<< " (%p <"
|
||||
<< [[(id)Handle className] UTF8String]
|
||||
<< ">"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user