Madhu Tadiparthi
2011-02-14 14:04:30 UTC
Hi,
I do have native C++ code to interact with the document. The code simply
tries to get the widget of the document type nsIDocument*. Here the document
reference is correct as it is properly giving url/title values say for
google page. This code is working find for Gecko SDK 1.9.2. Now I am trying
to make it work for Gecko SDK 2.0 and I have seen that getPrimaryShell() is
no more supported in the SDK 2.0 and I used getShell() instead but it is
returning NULL pointer. Could any one help me how to over come this problem
by properly getting the widget of the document. Here is the sample code I
used. This is blocking me to proceed further. Please let me know if any
thing I am doing wrong here and is there any better way to get the widget.
nsIWidget* CNSHtmlDocument::getWidget(nsIDOMHTMLDocument* m_htmlDocument)
{
nsCOMPtr<nsIWidget> widget_moz19 = 0;
nsIDocumentPtr docPtr =
NSQIUtils::doQI_nsIDocument(do_QueryInterface(m_htmlDocument));
nsCOMPtr<nsIPresShell> presShell;
#ifdef FFDOMAIN_MOZ20
presShell = docPtr->GetShell(); //Not sure this is valid method to use or
not
#else
presShell = docPtr->GetPrimaryShell();
#endif
nsIViewManager* vm = 0;
if(presShell !=0)
vm = presShell->GetViewManager();
if (vm)
{
vm->GetRootWidget(getter_AddRefs(widget_moz19));
}
return widget_moz19;
}
Thanks in advance
Madhu Tadiparthi
I do have native C++ code to interact with the document. The code simply
tries to get the widget of the document type nsIDocument*. Here the document
reference is correct as it is properly giving url/title values say for
google page. This code is working find for Gecko SDK 1.9.2. Now I am trying
to make it work for Gecko SDK 2.0 and I have seen that getPrimaryShell() is
no more supported in the SDK 2.0 and I used getShell() instead but it is
returning NULL pointer. Could any one help me how to over come this problem
by properly getting the widget of the document. Here is the sample code I
used. This is blocking me to proceed further. Please let me know if any
thing I am doing wrong here and is there any better way to get the widget.
nsIWidget* CNSHtmlDocument::getWidget(nsIDOMHTMLDocument* m_htmlDocument)
{
nsCOMPtr<nsIWidget> widget_moz19 = 0;
nsIDocumentPtr docPtr =
NSQIUtils::doQI_nsIDocument(do_QueryInterface(m_htmlDocument));
nsCOMPtr<nsIPresShell> presShell;
#ifdef FFDOMAIN_MOZ20
presShell = docPtr->GetShell(); //Not sure this is valid method to use or
not
#else
presShell = docPtr->GetPrimaryShell();
#endif
nsIViewManager* vm = 0;
if(presShell !=0)
vm = presShell->GetViewManager();
if (vm)
{
vm->GetRootWidget(getter_AddRefs(widget_moz19));
}
return widget_moz19;
}
Thanks in advance
Madhu Tadiparthi