Hi,

I think I've gotten it to work by following the code sample in
\\mozilla\embedding\browser\webBrowser\nsWebBrowser.cpp.

Basically, by creating a child widget inside a nativeWindow,
you are able to intercept NS_PAINT msg and draw into the gecko's
memory buffer.

Steve

Neeraj Tewari, Noida wrote:
Hi,
        I am able to get nsWidget not nsWindow interface but unable to repaint 
the invalid region after that also.
Can I overload chrome window event loop and then inside trap NS_PAINT to draw 
my own drawing .
If posible please help me wth some code.
Neeraj

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of slu
Sent: Wednesday, July 20, 2005 8:07 PM
To: [email protected]
Subject: Re: Getting nsWindow from chrome


Hi,

IMO, the nsWindow interface is being hidden for security reason.
Note that nsWindow.h is not in the mozilla/dist/ directory.

The only way to redraw is when the region is part of
your own widget.  And to create your own widget, do a
search on "custom widget" in the xpfe mailing list.

(I've tried to compile and include nsWindow and BaseWidget libs
independent of mozilla and it did not seem to work.)

Steve
just my 2 cents.



Neeraj Tewari, Noida wrote:

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

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

Reply via email to