epoc32/include/mw/aknwseventobserver.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 aknwseventobserver.h
     1 /*
       
     2 * Copyright (c) 2002-2004 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #if !defined(__AKNWSEVENTOBSERVER_H__)
       
    20 #define __AKNWSEVENTOBSERVER_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32std.h>
       
    24 //#include <w32std.h>
       
    25 #include <coecntrl.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 enum TAknWsEventObserverPanic
       
    30 	{
       
    31 	EAknWsEventObserverFailedToAddObserver,
       
    32 	EAknWsEventObserverUnknownObserverRemoved
       
    33 	};
       
    34 
       
    35 GLREF_C void Panic(TAknWsEventObserverPanic aPanic);
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41 *  Support for events to be sent independent of the control stack to other 
       
    42 *  consumers yet internal to the application.
       
    43 *
       
    44 *  
       
    45 */
       
    46 class MAknWsEventObserver
       
    47 	{
       
    48 public:
       
    49 	virtual void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination) = 0;
       
    50 	};
       
    51 
       
    52 
       
    53 // CLASS DECLARATION
       
    54 
       
    55 /**
       
    56 *  This class distributes events to the window server event observers; 
       
    57 *  It is itself a window server event observer.
       
    58 *
       
    59 *  @since Series 60 0.9
       
    60 */
       
    61 class CAknWsEventMonitor: public CBase, public MAknWsEventObserver
       
    62 {
       
    63 public:
       
    64 
       
    65     /**
       
    66     * Two-phased constructor.
       
    67     */
       
    68 	static CAknWsEventMonitor* NewL();
       
    69 
       
    70     /**
       
    71     * Destructor.
       
    72     */
       
    73 	virtual ~CAknWsEventMonitor();
       
    74 
       
    75     /**
       
    76     * Two-phased constructor.
       
    77     */
       
    78 	void ConstructL();
       
    79 
       
    80     /**
       
    81     * Adds an event observer if there is not one yet.
       
    82     * @param aEventObserver A pointer to the event observer.
       
    83     */
       
    84 	IMPORT_C void AddObserverL(MAknWsEventObserver* aEventObserver);
       
    85 
       
    86     /**
       
    87     * Removes the event observer.
       
    88     * @param aEventObserver A pointer to the event observer. (not used in default implementation)
       
    89     */
       
    90 	IMPORT_C void RemoveObserver(const MAknWsEventObserver* aEventObserver);
       
    91 
       
    92     /**
       
    93     * Window server event handler.
       
    94     * @param aEvent The event.
       
    95     * @param aDestination Event destination.
       
    96     */
       
    97 	IMPORT_C void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination);
       
    98 	
       
    99     /**
       
   100     * Enables / disables event observer. AknAppUi provides all window server events to enabled monitor automatically
       
   101     *
       
   102     * @since S60 3.2
       
   103     */
       
   104     IMPORT_C void Enable(TBool aEnable = ETrue);
       
   105 	
       
   106 	/**
       
   107 	* Internal to Avkon
       
   108 	*
       
   109 	* @since S60 3.2
       
   110 	*/	
       
   111 	TBool IsEnabled();
       
   112 	
       
   113 	
       
   114 
       
   115 private:
       
   116 	RPointerArray<MAknWsEventObserver>* iEventObservers;
       
   117 	TBool iEnabled; // was TInt iSpare;
       
   118 
       
   119 private:
       
   120 // reserved virtual function space
       
   121 	IMPORT_C virtual void Reserved_1();
       
   122 
       
   123 };
       
   124 
       
   125 
       
   126 #endif  // __AKNWSEVENTOBSERVER_H__