667
edits
Changes
no edit summary
}
// doc is now an nsIDocument
</pre>
===How do I get from a Window (nsIDOMWindow) to a Widget (nsIWidget, nsBaseWidget, nsWindow, etc)?===
Answer: Given aWindow, see http://dxr.mozilla.org/mozilla/mozilla-central/toolkit/xre/nsNativeAppSupportUnix.cpp.html#l201
<pre>
nsCOMPtr<nsPIDOMWindow> domWindow(do_QueryInterface(aWindow));
if (!domWindow)
return NULL;
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(domWindow->GetDocShell());
if (!baseWindow)
return NULL;
nsCOMPtr<nsIWidget> widget;
baseWindow->GetMainWidget(getter_AddRefs(widget));
// widget is now your widget
</pre>