idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/inc/xnnewstickeradapter.h
branchRCL_3
changeset 26 1b758917cafc
parent 2 08c6ee43b396
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    27 class CXnNodePluginIf;
    27 class CXnNodePluginIf;
    28 class CXnNewstickerControl;
    28 class CXnNewstickerControl;
    29 class CAknMarqueeControl;
    29 class CAknMarqueeControl;
    30 
    30 
    31 // CONSTANTS
    31 // CONSTANTS
    32 // The default values for the newsticker control
       
    33 const TInt KXnNewstickerDelay = 1000000;   // start scrolling after a delay of 1 second
       
    34 const TInt KXnNewstickerInterval = 100000; // scroll 10 times in a second
       
    35 const TInt KXnNewstickerScrollAmount = 6;  // scroll 6 pixels at time
       
    36 const TInt KXnNewstickerLoops = 1;         // loop amount
       
    37 const TInt KNoDelay = 0;                   //  No delay to start the animation
       
    38 const TInt KAnimationTime = 6000000;       //  The animation lasts 6 seconds
       
    39 
    32 
    40 // CLASS DECLARATION
    33 // CLASS DECLARATION
    41 
    34 
    42 /**
    35 /**
    43 * @ingroup group_xnnewstickerfactory
    36 * @ingroup group_xnnewstickerfactory
    45 *  Newsticker adapter class implementation.
    38 *  Newsticker adapter class implementation.
    46 *
    39 *
    47 *  @lib xnnewstickerfactory.dll
    40 *  @lib xnnewstickerfactory.dll
    48 *  @since Series 60 3.2
    41 *  @since Series 60 3.2
    49 */
    42 */
    50 class CXnNewstickerAdapter : public CXnControlAdapter,
    43 class CXnNewstickerAdapter : public CXnControlAdapter    
    51             XnNewstickerInterface::MXnNewstickerCallbackInterface
       
    52     {
    44     {
    53     public:
    45     public:
    54           
    46           
    55         enum TScrollBehaviour
    47         enum TScrollBehaviour
    56             {
    48             {
   118          * Delete all titles.
   110          * Delete all titles.
   119          */
   111          */
   120         void ClearTitles();
   112         void ClearTitles();
   121 
   113 
   122         /**
   114         /**
   123          * Set callback interface.
   115          * Restarts current title
   124          * @param aCallback The callback interface pointer.
   116          */
   125          */
   117         void Restart();
   126         void SetCallbackInterfaceL(
   118         
   127             XnNewstickerInterface::MXnNewstickerCallbackInterface* aCallback );
       
   128 
       
   129         /**
   119         /**
   130          * Start showing the titles.
   120          * Start showing the titles.
   131          */
   121          */
   132         void Start();
   122         void Start( TBool aSelectTitle = EFalse );
   133 
   123 
   134         /**
   124         /**
   135          * Stop showing the titles.
   125          * Stop showing the titles.
   136          */
   126          */
   137         void Stop();
   127         void Stop();
   155          * Callback which will be called by the CPeriodic.
   145          * Callback which will be called by the CPeriodic.
   156          * @param aPtr User defined pointer.
   146          * @param aPtr User defined pointer.
   157          * @return ETrue if the method should be called again.
   147          * @return ETrue if the method should be called again.
   158          */
   148          */
   159         static TInt PeriodicEventL( TAny * aPtr );
   149         static TInt PeriodicEventL( TAny * aPtr );
   160      
   150 
       
   151     public: // from base classes
       
   152 
       
   153         /**
       
   154         * See CCoeControl documentation
       
   155         */      
   161         void MakeVisible( TBool aVisible );
   156         void MakeVisible( TBool aVisible );
   162         
       
   163     public: // from base classes
       
   164 
       
   165         //  From MXnNewstickerCallbackInterface
       
   166         /**
       
   167          * Called when the title has been shown and is now offscreen.
       
   168          * @param aTitleIndex The title that has been completely shown.
       
   169          */
       
   170         void TitleScrolled( TInt aTitleIndex );
       
   171 
   157 
   172         /**
   158         /**
   173         * See CCoeControl documentation
   159         * See CCoeControl documentation
   174         */    	
   160         */    	
   175         void SizeChanged();
   161         void SizeChanged();
   206         
   192         
   207         /**
   193         /**
   208         * Reports newsticker event
   194         * Reports newsticker event
   209         * 
   195         * 
   210         */   
   196         */   
   211         void ReportNewstickerEvent( const TDesC8& aEventName );
   197         void ReportNewstickerEvent( const TDesC8& aEventName, TInt aIndex );
   212         
   198         
   213         /**
   199         /**
   214         * Draws text
   200         * Draws text
   215         * Text drawing function is selected by scrolling behaviour
   201         * Text drawing function is selected by scrolling behaviour
   216         */
   202         */
   217         void DrawText( const TDesC& aText, const TRect& aRect  );
   203         void DrawText( const TDesC& aText );
   218         
   204         
   219         /**
       
   220         * ETrue if marquee control redrawing is needed. EFalse if truncated text is needed
       
   221         */
       
   222         TBool Redraw() { return iRedraw; }
       
   223 
       
   224 
       
   225     private:
   205     private:
   226 
   206 
   227     	CXnNewstickerAdapter( CXnControlAdapter* aParent, CXnNodePluginIf& aNode );
   207     	CXnNewstickerAdapter( CXnControlAdapter* aParent, CXnNodePluginIf& aNode );
   228 
   208 
   229     	void ConstructL( CXnControlAdapter* aParent );
   209     	void ConstructL( CXnControlAdapter* aParent );
   254         static TInt RedrawCallback( TAny* aPtr );
   234         static TInt RedrawCallback( TAny* aPtr );
   255         
   235         
   256         /**
   236         /**
   257         *  FScrolls alternative text. Function is called by periodic timer
   237         *  FScrolls alternative text. Function is called by periodic timer
   258         */    
   238         */    
   259         void DoScroll();
   239         void DoScroll( TBool aEndOfLoop );
   260         
   240         
   261         /**
   241         /**
   262         *  Draws text directly to screen if scrollins is not needed
   242         *  Draws text directly to screen if scrollins is not needed
   263         */  
   243         */  
   264         void DrawStaticText( CWindowGc& aGc, const TDesC& aText ) const;
   244         void DrawStaticText( CWindowGc& aGc, const TDesC& aText, TBool aTruncate = ETrue ) const;
   265         
   245         
   266         /**
   246         /**
   267         *  Draws scrolling text to screen via marquee control
   247         *  Draws scrolling text to screen via marquee control
   268         */ 
   248         */ 
   269         TBool DrawMarqueeText( CWindowGc& aGc, const TDesC& aText ) const;               
   249         TBool DrawMarqueeText( CWindowGc& aGc, const TDesC& aText ) const;               
   273         /**
   253         /**
   274         * The timer to use for scrolling events.
   254         * The timer to use for scrolling events.
   275         * Own.
   255         * Own.
   276         */
   256         */
   277 	    CPeriodic*                  iPeriodicTimer;
   257 	    CPeriodic*                  iPeriodicTimer;
   278 
       
   279         /**
       
   280         * The callback interface which is used when a title has been shown.
       
   281         * Not own.
       
   282         */
       
   283         XnNewstickerInterface::MXnNewstickerCallbackInterface*  iCallback;
       
   284 
   258 
   285         /**
   259         /**
   286         * The control handling the text title showing
   260         * The control handling the text title showing
   287         * Own.
   261         * Own.
   288         */
   262         */
   289         CXnNewstickerControl*       iControl;
   263         CXnNewstickerControl*       iControl;
   290 	    
   264 	    
   291         /**
   265         /**
   292          * The delay before first event
   266          * Alternate delay, i.e. display time
   293          */  
   267          */  
   294 	    TInt                        iAlternateDelay;
   268 	    TInt                        iAlternateDelay;        
   295         
       
   296         /**
       
   297          * The alternate interval between ticks.
       
   298          */	    
       
   299 	    TInt                        iAlternateInterval;
       
   300 
   269 
   301         /**
   270         /**
   302         * UI node
   271         * UI node
   303         * Not own.
   272         * Not own.
   304         */
   273         */
   358        
   327        
   359        /**
   328        /**
   360        * Current strikethrough behaviour
   329        * Current strikethrough behaviour
   361        */ 
   330        */ 
   362        TFontStrikethrough          iStrikethrough;
   331        TFontStrikethrough          iStrikethrough;
   363        
   332               
   364        /**
       
   365        * is scroll looping activated
       
   366        */ 
       
   367        TBool                    iScrollLooping;
       
   368        
       
   369        /**
   333        /**
   370        * is marquee control redraw needed
   334        * is marquee control redraw needed
   371        */ 
   335        */ 
   372        TBool                    iRedraw;
   336        TBool                    iRedraw;
   373         
       
   374         
       
   375         
       
   376     };
   337     };
   377 
   338 
   378 #endif // XNNEWSTICKERADAPTER_H
   339 #endif // XNNEWSTICKERADAPTER_H
   379             
   340             
   380 // End of File
   341 // End of File