data/publisherif/inc/hswidgetobserver.h
changeset 0 b856a9924bbc
equal deleted inserted replaced
-1:000000000000 0:b856a9924bbc
       
     1 /*
       
     2 * Copyright (c) {Year(s)} {Copyright owner}.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * {Name} {Company} ? Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * {Name} {Company} ? {{Description of contribution}}
       
    14 *
       
    15 * Description:
       
    16 * {{Description of the file}}
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __HSWIDGETOBSERVER_H__
       
    22 #define __HSWIDGETOBSERVER_H__
       
    23 
       
    24 //  System includes 
       
    25 #include <e32base.h>    
       
    26 
       
    27 // User includes
       
    28 
       
    29 // Forward declarations
       
    30 
       
    31 //  Constants
       
    32 
       
    33 //  Class Definitions
       
    34 class MHsWidgetObserver
       
    35     {
       
    36 public:
       
    37     enum EState
       
    38         {
       
    39         /** 
       
    40          * Widget instance should enter to suspended state.
       
    41          * This means that Homescreen is not visible anymore. 
       
    42          */
       
    43         ESuspend = 0,
       
    44         /** 
       
    45          * Widget instance should enter to alive state.
       
    46          * This means that Homescreen visible. Resource consumption and publishing is allowed.
       
    47          */                
       
    48         EAlive,
       
    49         /**
       
    50          * Widget instance may enter to online state.
       
    51          * This means that it may consume network resources.
       
    52          */
       
    53         EOnline,
       
    54         /**
       
    55          * Widget instance must enter to offline state.
       
    56          * This means that it is not allowed to consume network resources.
       
    57          */
       
    58         EOffline        
       
    59         };
       
    60     
       
    61     enum EStartReason
       
    62         {
       
    63         /**
       
    64          * Widget was started because system starts-up. 
       
    65          */
       
    66         ESystemStart = 1,
       
    67         /**
       
    68          * Widget was started because of Homescreen page change. 
       
    69          */
       
    70         EPageStart,
       
    71         /**
       
    72          * Widget was started because of it was added to Homescreen. 
       
    73          */
       
    74         EWidgetStart
       
    75         };
       
    76 
       
    77     enum EStopReason
       
    78         {
       
    79         /**
       
    80          * Widget was stopped because system shutsdown.
       
    81          */
       
    82         ESystemStop = 1,
       
    83         /**
       
    84          * Widget was stopped because of Homescreen page change.
       
    85          */
       
    86         EPageStop,
       
    87         /**
       
    88          * Widget was stopped because it was removed from Homescreen. 
       
    89          */
       
    90         EWidgetStop
       
    91         };
       
    92         
       
    93     /**
       
    94      * Requests this publisher's identity.
       
    95      * 
       
    96      * @return Publisher identity in <UID:PublisherName> format.
       
    97      *         The identity must map to xml <configuration> element, i.e.:
       
    98      *         <configuration name="publisher" value="MyUid:MyPublisherName"/>
       
    99      */
       
   100     virtual const TDesC& Identity() = 0;    
       
   101     
       
   102     /**
       
   103      * Notifies that Homescreen has started widget.
       
   104      * 
       
   105      * @param aWidgetId Widget Id identifying the widget instance.
       
   106      * @param aReason Reason why Homescreen started the widget instance. 
       
   107      */
       
   108     virtual void NotifyWidgetStarted( 
       
   109         const TDesC& aWidgetId, 
       
   110         EStartReason aReason ) = 0;
       
   111 
       
   112     /**
       
   113      * Notifies that Homescreen has stopped widget.
       
   114      * 
       
   115      * @param aWidgetId Widget Id identifying the widget instance.
       
   116      * @param aReason Reason why Homescreen stopped the widget instance. 
       
   117      */    
       
   118     virtual void NotifyWidgetStopped( 
       
   119         const TDesC& aWidgetId, 
       
   120         EStopReason aReason ) = 0;
       
   121 
       
   122     /**
       
   123      * Notifies that Homescreen has changed widget state.
       
   124      * 
       
   125      * @param aWidgetId Widget Id identifying the widget instance.
       
   126      * @param aState New state for the widget instance. 
       
   127      */        
       
   128     virtual void NotifyWidgetState( 
       
   129         const TDesC& aWidgetId, 
       
   130         EState aState ) = 0;    
       
   131 
       
   132     /**
       
   133      * Notifies a widget specific event.
       
   134      * 
       
   135      * @param aWidgetId Widget Id identifying the widget instance.
       
   136      * @param aEvent Event from the widget instance. 
       
   137      * @param aParam Event parameter from the widget instance.
       
   138      */            
       
   139     virtual void NotifyWidgetEvent(
       
   140         const TDesC& aWidgetId,
       
   141         const TDesC& aEvent,
       
   142         const TDesC& aParam ) = 0;
       
   143     };
       
   144 
       
   145 #endif // __HSWIDGETOBSERVER_H__
       
   146 
       
   147 // End of file