homescreensrv_plat/hs_widget_publisher_api/inc/hsdataobserver.h
changeset 0 79c6a41cd166
child 23 ace62b58f4b2
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Updates applications and icons in Operator Tile.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __HSDATAOBSERVER_H__
       
    20 #define __HSDATAOBSERVER_H__
       
    21 
       
    22 #include <string>
       
    23 
       
    24 namespace Hs {
       
    25 /**
       
    26  * An observer interface. 
       
    27  * Client must implement it to be able to get information
       
    28  * about occuring Execute actions from the Homescreen Publishing API.
       
    29  *
       
    30  * @code
       
    31  * class ObserverClass : public IHsDataObserver
       
    32  * {
       
    33  *      void handleEvent( std::string aWidgetName, 
       
    34  *			IHsDataObserver::EEvent aEvent)
       
    35  *      {
       
    36  *      }
       
    37  * 
       
    38  *      void handleItemEvent( std::string aWidgetName,
       
    39  *        	std::string aWidgetItemName,
       
    40  *       	IHsDataObserver::EItemEvent aEvent)
       
    41  *      {
       
    42  *      }
       
    43  * }
       
    44  * ObserverClass* dataObserver = new ObserverClass();
       
    45  * HsWidgetPublisher* hsPublisher = new HsWidgetPublisher( dataObserver );
       
    46  * @endcode
       
    47  */
       
    48 class IHsDataObserver
       
    49     {
       
    50 public:
       
    51     
       
    52 	/**
       
    53 	 * Defines the events that may take place for a homescreen widget.
       
    54 	 */
       
    55 	enum EEvent
       
    56 	    {
       
    57 	    EUnknown    = 0, ///< Unknown event: Means that event has not been defined.
       
    58 	    EActivate   = 1, ///< Activation event: Means that widget has been added to HS as content.
       
    59 	    EDeactivate = 2, ///< Deactivation event: Means that widget has been removed frm.
       
    60 	    ESuspend    = 3, ///< Suspension event: Means that HS reading widget data is suspended.
       
    61 	    EResume     = 4  ///< Resume event. Means that HS reading widget data is resumed.
       
    62 	    };
       
    63     
       
    64 	/**
       
    65 	 * Defines the events that may take place for a homescreen widget item.
       
    66 	 */
       
    67 	enum EItemEvent
       
    68 	    {
       
    69 	    EUnknownItemEvent = 0, ///< Unknown event: Means that event has note been defined.
       
    70 	    ESelect           = 1  ///< Selection event: Means that the widget item has been selected.
       
    71 	    };
       
    72     
       
    73 public:
       
    74 
       
    75 	/**
       
    76 	 * Intended to handle an event that occured on a widget.
       
    77 	 * This would include EActivate, EDeactivate, ESuspend, EReusume.
       
    78 	 *
       
    79 	 * @param aWidgetName Name of the widget that event is envoked for.
       
    80 	 * @param aEvent Event type that has taken place.
       
    81 	 */
       
    82 	virtual void handleEvent( std::string aWidgetName, 
       
    83 			IHsDataObserver::EEvent aEvent) = 0;
       
    84 	
       
    85 	/**
       
    86 	 * Intended to handle an event that occured on a widget's item.
       
    87 	 * This would include ESelection.
       
    88 	 *
       
    89 	 * @param aWidgetName Name of the widget that event is envoked for.
       
    90 	 * @param awidgetItemName Name of the item that event is envoked for.
       
    91 	 * @param aAEvent Event type that has taken place
       
    92 	 */    
       
    93 	virtual void handleItemEvent( std::string aWidgetName,
       
    94 			std::string aWidgetItemName,
       
    95 			IHsDataObserver::EItemEvent aEvent) = 0;
       
    96     };
       
    97 }
       
    98 
       
    99 #endif /*__HSDATAOBSERVER_H__*/