+// find the native Cocoa NSWindow handle so we can parent the dialog and show
+// it window-modal.
+ NSWindow* cocoaWindow = nil;
+ std::vector<osgViewer::GraphicsWindow*> windows;
+ globals->get_renderer()->getViewer()->getWindows(windows);
+
+ BOOST_FOREACH(osgViewer::GraphicsWindow* gw, windows) {
+ // OSG doesn't use RTTI, so no dynamic cast. Let's check the class type
+ // using OSG's own system, before we blindly static_cast<> and break
+ // everything.
+ if (strcmp(gw->className(), "GraphicsWindowCocoa")) {
+ continue;
+ }
+
+ osgViewer::GraphicsWindowCocoa* gwCocoa = static_cast<osgViewer::GraphicsWindowCocoa*>(gw);
+ cocoaWindow = (NSWindow*) gwCocoa->getWindow();
+ break;
+ }
+
+// setup the panel fields now we have collected all the data