data/testpublisher/inc/testpublisherappview.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 #ifndef __TESTPUBLISHERAPPVIEW_h__
       
    21 #define __TESTPUBLISHERAPPVIEW_h__
       
    22 
       
    23 // INCLUDES
       
    24 #include <coecntrl.h>
       
    25 #include <babitflags.h>
       
    26 #include <badesca.h>
       
    27 
       
    28 #include "hswidgetobserver.h"
       
    29 
       
    30 class CHsPublisher;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 class CTestPublisherAppView : public CCoeControl, public MHsWidgetObserver
       
    34     {
       
    35 public:
       
    36     // New methods
       
    37 
       
    38     /**
       
    39      * NewL.
       
    40      * Two-phased constructor.
       
    41      * Create a CTestPublisherAppView object, which will draw itself to aRect.
       
    42      * @param aRect The rectangle this view will be drawn to.
       
    43      * @return a pointer to the created instance of CTestPublisherAppView.
       
    44      */
       
    45     static CTestPublisherAppView* NewL(const TRect& aRect);
       
    46 
       
    47     /**
       
    48      * NewLC.
       
    49      * Two-phased constructor.
       
    50      * Create a CTestPublisherAppView object, which will draw itself
       
    51      * to aRect.
       
    52      * @param aRect Rectangle this view will be drawn to.
       
    53      * @return A pointer to the created instance of CTestPublisherAppView.
       
    54      */
       
    55     static CTestPublisherAppView* NewLC(const TRect& aRect);
       
    56 
       
    57     /**
       
    58      * ~CTestPublisherAppView
       
    59      * Virtual Destructor.
       
    60      */
       
    61     virtual ~CTestPublisherAppView();
       
    62 
       
    63 public:
       
    64     // Functions from base classes
       
    65 
       
    66     /**
       
    67      * From CCoeControl, Draw
       
    68      * Draw this CTestPublisherAppView to the screen.
       
    69      * @param aRect the rectangle of this view that needs updating
       
    70      */
       
    71     void Draw(const TRect& aRect) const;
       
    72 
       
    73     /**
       
    74      * From CoeControl, SizeChanged.
       
    75      * Called by framework when the view size is changed.
       
    76      */
       
    77     virtual void SizeChanged();
       
    78 
       
    79     /**
       
    80      * From CoeControl, HandlePointerEventL.
       
    81      * Called by framework when a pointer touch event occurs.
       
    82      * Note: although this method is compatible with earlier SDKs, 
       
    83      * it will not be called in SDKs without Touch support.
       
    84      * @param aPointerEvent the information about this event
       
    85      */
       
    86     virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
    87 
       
    88 private:
       
    89     // from MHsWidgetObserver
       
    90     
       
    91     /**
       
    92      * @see MHsWidgetObserver
       
    93      */
       
    94     const TDesC& Identity();    
       
    95     
       
    96     /**
       
    97      * @see MHsWidgetObserver
       
    98      */
       
    99     void NotifyWidgetStarted( 
       
   100         const TDesC& aWidgetId, 
       
   101         MHsWidgetObserver::EStartReason aReason );
       
   102     
       
   103     /**
       
   104      * @see MHsWidgetObserver
       
   105      */
       
   106     void NotifyWidgetStopped( 
       
   107         const TDesC& aWidgetId, 
       
   108         MHsWidgetObserver::EStopReason aReason );
       
   109     
       
   110     /**
       
   111      * @see MHsWidgetObserver
       
   112      */
       
   113     void NotifyWidgetState( 
       
   114         const TDesC& aWidgetId, 
       
   115         MHsWidgetObserver::EState aState );
       
   116 
       
   117     /**
       
   118      * @see MHsWidgetObserver
       
   119      */
       
   120     void NotifyWidgetEvent(
       
   121         const TDesC& aWidgetId,
       
   122         const TDesC& aEvent,
       
   123         const TDesC& aParam );
       
   124     
       
   125 private:
       
   126     // Constructors
       
   127 
       
   128     /**
       
   129      * ConstructL
       
   130      * 2nd phase constructor.
       
   131      * Perform the second phase construction of a
       
   132      * CTestPublisherAppView object.
       
   133      * @param aRect The rectangle this view will be drawn to.
       
   134      */
       
   135     void ConstructL(const TRect& aRect);
       
   136 
       
   137     /**
       
   138      * CTestPublisherAppView.
       
   139      * C++ default constructor.
       
   140      */
       
   141     CTestPublisherAppView();
       
   142     
       
   143     void PublishL( const TDesC& aWidgetId );
       
   144 private:
       
   145     // data
       
   146     
       
   147     /** Publisher, owned */
       
   148     CHsPublisher* iPublisher;
       
   149     /** Id of active widget instance, owned */
       
   150     CDesCArrayFlat* iWidgetIds;
       
   151     /** Flags */
       
   152     TBitFlags iFlags;  
       
   153     /** Helper to alternate published image */
       
   154     TBool iFeedCnt;
       
   155     };
       
   156 
       
   157 #endif // __TESTPUBLISHERAPPVIEW_h__
       
   158 // End of File