inherite in IDL...

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

inherite in IDL...

zen2 mee
hi all,
how can i inherit the nsIWebProgressListener in my IDL?

thanks
_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom
Reply | Threaded
Open this post in threaded view
|

Re: inherite in IDL...

Neil Stansbury
Replace nsISupports with nsIWebProgressListener

Thus:

interface myInterface : nsIWebProgressListener {
        attribute string someval;
}


N


zen wrote:
> hi all,
> how can i inherit the nsIWebProgressListener in my IDL?
>
> thanks
_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom
Reply | Threaded
Open this post in threaded view
|

Re: inherite in IDL...

zen2 mee
Hi Neil,

Thanks for the response. However, it couldn't compile when I include the
onStateChange(), etc into the IDL. It says `onStateChange' conflicts
with nsIWebProgressListener.idl
Below is my code:

#include "nsIWebProgressListener.idl"
.
.
interface nsITTB : nsIWebProgressListener
{
    void onStateChange(in nsIWebProgress aWebProgress,
                      in nsIRequest aRequest,
                      in unsigned long aStateFlags,
                      in nsresult aStatus);
};

zen



Neil Stansbury wrote:

> Replace nsISupports with nsIWebProgressListener
>
> Thus:
>
> interface myInterface : nsIWebProgressListener    {
>     attribute string someval;
> }
>
>
> N
>
>
> zen wrote:
>
>> hi all,
>> how can i inherit the nsIWebProgressListener in my IDL?
>>
>> thanks
_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom
Reply | Threaded
Open this post in threaded view
|

Re: inherite in IDL...

Michael Nachbaur
Since onStateChange is defined in nsIWebProgressListener, you don't  
have to re-define it in your interface definition.  Your progress  
listener will simply inherit the capabilities of your inherited  
interfaces.  Just define what is different in your interface.  You're  
even allowed to have an empty interface list if you want.  For  
example, see nsIDOMDocumentFragment.idl

On Dec 5, 2005, at 4:35 AM, zen wrote:

> Hi Neil,
>
> Thanks for the response. However, it couldn't compile when I  
> include the onStateChange(), etc into the IDL. It says  
> `onStateChange' conflicts with nsIWebProgressListener.idl
> Below is my code:
>
> #include "nsIWebProgressListener.idl"
> .
> .
> interface nsITTB : nsIWebProgressListener
> {
>    void onStateChange(in nsIWebProgress aWebProgress,
>                      in nsIRequest aRequest,
>                      in unsigned long aStateFlags,
>                      in nsresult aStatus);
> };
>
> zen
>
>
>
> Neil Stansbury wrote:
>> Replace nsISupports with nsIWebProgressListener
>> Thus:
>> interface myInterface : nsIWebProgressListener    {
>>     attribute string someval;
>> }
>> N
>> zen wrote:
>>> hi all,
>>> how can i inherit the nsIWebProgressListener in my IDL?
>>>
>>> thanks
> _______________________________________________
> Mozilla-xpcom mailing list
> [hidden email]
> http://mail.mozilla.org/listinfo/mozilla-xpcom

_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom
Reply | Threaded
Open this post in threaded view
|

Re: inherite in IDL...

zen2 mee
In reply to this post by zen2 mee
Can i override the onStateChange() then?

zen

Michael Nachbaur wrote:

> Since onStateChange is defined in nsIWebProgressListener, you don't  
> have to re-define it in your interface definition.  Your progress  
> listener will simply inherit the capabilities of your inherited  
> interfaces.  Just define what is different in your interface.  You're  
> even allowed to have an empty interface list if you want.  For  example,
> see nsIDOMDocumentFragment.idl
>
> On Dec 5, 2005, at 4:35 AM, zen wrote:
>
>> Hi Neil,
>>
>> Thanks for the response. However, it couldn't compile when I  include
>> the onStateChange(), etc into the IDL. It says  `onStateChange'
>> conflicts with nsIWebProgressListener.idl
>> Below is my code:
>>
>> #include "nsIWebProgressListener.idl"
>> .
>> .
>> interface nsITTB : nsIWebProgressListener
>> {
>>    void onStateChange(in nsIWebProgress aWebProgress,
>>                      in nsIRequest aRequest,
>>                      in unsigned long aStateFlags,
>>                      in nsresult aStatus);
>> };
>>
>> zen
>>
>>
>>
>> Neil Stansbury wrote:
>>
>>> Replace nsISupports with nsIWebProgressListener
>>> Thus:
>>> interface myInterface : nsIWebProgressListener    {
>>>     attribute string someval;
>>> }
>>> N
>>> zen wrote:
>>>
>>>> hi all,
>>>> how can i inherit the nsIWebProgressListener in my IDL?
>>>>
>>>> thanks
>>
>> _______________________________________________
>> Mozilla-xpcom mailing list
>> [hidden email]
>> http://mail.mozilla.org/listinfo/mozilla-xpcom
>
>
_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom
Reply | Threaded
Open this post in threaded view
|

Re: inherite in IDL...

Neil Stansbury-2
Zen you don't need to redefine them as they are already defined by the
parent class. You just need to implement the properties/methods you want
to override, plus whatever else you need.

Every interface inherits from nsISupports giving you the
QueryInterface() method, which your interface will reimplement in the
fashion you need. The principle is the same for other ifaces.

As long as you createInstance() of your interface, it will have all the
attributes of the parent class, plus whatever you've defined and/or
implemented. This is what QueryInterface() is for, to allow you to cast
to different but inherited interfaces.

N


zen wrote:

> Can i override the onStateChange() then?
>
> zen
>
> Michael Nachbaur wrote:
>> Since onStateChange is defined in nsIWebProgressListener, you don't  
>> have to re-define it in your interface definition.  Your progress  
>> listener will simply inherit the capabilities of your inherited  
>> interfaces.  Just define what is different in your interface.  You're  
>> even allowed to have an empty interface list if you want.  For  
>> example, see nsIDOMDocumentFragment.idl
>>
>> On Dec 5, 2005, at 4:35 AM, zen wrote:
>>
>>> Hi Neil,
>>>
>>> Thanks for the response. However, it couldn't compile when I  include
>>> the onStateChange(), etc into the IDL. It says  `onStateChange'
>>> conflicts with nsIWebProgressListener.idl
>>> Below is my code:
>>>
>>> #include "nsIWebProgressListener.idl"
>>> .
>>> .
>>> interface nsITTB : nsIWebProgressListener
>>> {
>>>    void onStateChange(in nsIWebProgress aWebProgress,
>>>                      in nsIRequest aRequest,
>>>                      in unsigned long aStateFlags,
>>>                      in nsresult aStatus);
>>> };
>>>
>>> zen
>>>
>>>
>>>
>>> Neil Stansbury wrote:
>>>
>>>> Replace nsISupports with nsIWebProgressListener
>>>> Thus:
>>>> interface myInterface : nsIWebProgressListener    {
>>>>     attribute string someval;
>>>> }
>>>> N
>>>> zen wrote:
>>>>
>>>>> hi all,
>>>>> how can i inherit the nsIWebProgressListener in my IDL?
>>>>>
>>>>> thanks
>>>
>>> _______________________________________________
>>> Mozilla-xpcom mailing list
>>> [hidden email]
>>> http://mail.mozilla.org/listinfo/mozilla-xpcom
>>
>>
_______________________________________________
Mozilla-xpcom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-xpcom