Thanks for your help but GetMainWidget return the parent widget of
chrome window and not chrome widget pointer.
I tried following code but that seems to be very complex ..

                        nsCOMPtr<nsIWebBrowser> webBrowser;
                        nsCOMPtr<nsIWebNavigation> webNavigation;
                        nsCOMPtr<nsIDocShell> docshell;
                        nsCOMPtr<nsIPresContext> presContext;
                        nsCOMPtr<nsIDOMWindow> contentWin;
                        nsCOMPtr<nsIDocument> doc;
                        nsCOMPtr<nsIContentViewer> ContentViewer; 
                        nsIView *view = nsnull;
                if (chrome)
                        {
        
BroPtr->chrome->GetWebBrowser(getter_AddRefs(webBrowser));
        
webBrowser->GetContentDOMWindow(getter_AddRefs(contentWin));
                                webNavigation =
do_QueryInterface(webBrowser);
                                docshell = do_GetInterface(webBrowser);
        
docshell->GetContentViewer(getter_AddRefs(ContentViewer));
                                if(ContentViewer)
                                {
                                nsCOMPtr<nsIDocumentViewer>
DocViewer(do_QueryInterface(ContentViewer));

                                if (DocViewer) 
        
DocViewer->GetDocument(getter_AddRefs(doc));
                                docshell->GetPresContext
(getter_AddRefs(presContext));
                                if(presContext)
        
presContext->GetViewManager()->GetRootView (view);
                                view->GetWidget();
                                }
                                
                   }

Neeraj

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Niky Williams
Sent: Wednesday, July 20, 2005 1:44 AM
To: [email protected]
Subject: Re: Getting nsWindow from chrome


It looks like the documentation typedefs the nsWindow as an
nsBaseWidget.
So maybe you can try something like this:

//----------------------------------------------------------------------
----
---
nsIWebBrowser *piwbWebBrowser = nsnull;
nsIBaseWindow *pibwBaseWindow = nsnull;
nsWindow *pWindow = nsnull;

chrome->GetWebBrowser (&piwbWebBrowser);
piwbWebBrowser->QueryInterface (NS_GET_IID (nsIBaseWindow), (void**)
&pibwBaseWindow);
piwbWebBrowser->Release ();
piwbWebBrowser = nsnull;
pibwBaseWindow->GetMainWidget (&pWindow);
piwbBaseWindow->Release ();
piwbBaseWindow = nsnull;

//Do your GUI stuff here

pWindow->Release ();
pWindow = nsnull;
//----------------------------------------------------------------------
----
---

That should work for up to at least GetMainWidget(), but I'm not sure
about
actually getting an nsWindow object from that.  I hope that helps.  If I
find anything else I'll reply again.

Niky Williams


"Neeraj Tewari, Noida" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi ,
> Can anyone help me to get nsWindow pointer from
chrome(nsIWebBrowserChrome) pointer.As i want to redraw the chrome
> region in some situation.
>
> thanks in advance
> Neeraj
>


_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to