> I guess nsIWebProgress is a virtual class/class template and I need
some specific way to realize it?

Yes, you're right.
In my code this is done in such a way:

.h
class CBrowserWnd : *many public base classes, and among them:* public
nsIWebProgressListener
{
//many NS_DECL_* and among them:
    NS_DECL_NSIWEBPROGRESSLISTENER //this macro contains declarations
for methods from nsIWebProgressListener, no need to type them manyally

};

.cpp

NS_IMPL_ADDREF(CBrowserWnd)
NS_IMPL_RELEASE(CBrowserWnd)

NS_INTERFACE_MAP_BEGIN(CBrowserWnd)
//many NS_INTERFACE_MAP_ENTRY and some
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS
   NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_END


//and later in the same .cpp the implementation of 5 methods of
nsIWebProgressListener:

NS_IMETHODIMP CBrowserWnd::OnProgressChange(nsIWebProgress *progress,
nsIRequest *request,
                                                  PRInt32
curSelfProgress, PRInt32 maxSelfProgress,
                                                  PRInt32
curTotalProgress, PRInt32 maxTotalProgress)
{
//some code
}

NS_IMETHODIMP CBrowserWnd::OnStateChange ( nsIWebProgress *progress,
nsIRequest *request, PRUint32 progressStateFlags, nsresult status )
{
//some code
}

NS_IMETHODIMP CBrowserWnd::OnLocationChange ( nsIWebProgress*
aWebProgress, nsIRequest* aRequest, nsIURI *location )
{
//the code from my prev. message
}

NS_IMETHODIMP CBrowserWnd::OnStatusChange ( nsIWebProgress*
aWebProgress, nsIRequest* aRequest, nsresult aStatus, const PRUnichar*
aMessage )
{
    return NS_OK;
}

NS_IMETHODIMP CBrowserWnd::OnSecurityChange ( nsIWebProgress
*aWebProgress, nsIRequest *aRequest, PRUint32 state )
{
    return NS_OK;
}

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to