idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/inc/xnnewstickercontrol.h
changeset 2 08c6ee43b396
parent 0 f72a12da539e
child 17 b8fae6b8a148
--- a/idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/inc/xnnewstickercontrol.h	Thu Jan 07 12:39:41 2010 +0200
+++ b/idlehomescreen/xmluirendering/renderingplugins/xnnewstickerfactory/inc/xnnewstickercontrol.h	Mon Jan 18 20:10:36 2010 +0200
@@ -24,7 +24,6 @@
 
 // FORWARD DECLARATIONS
 class CXnNewstickerAdapter;
-class CFont;
 
 // CLASS DECLARATION
 
@@ -49,27 +48,7 @@
          * @param aStartDelay The delay before the animation starts
          * @return Pointer to this.
          */
-        static CXnNewstickerControl* NewL(CXnNewstickerAdapter* aAdapter);
-        
-        /** 
-        * Sets newsticker scroll amount.
-        * @param aScrollAmount A scroll amount.
-        * @return void
-        */
-        void SetScrollAmount(TInt aScrollAmount);
-
-        /** 
-        * Sets the rect of the visible area.
-        * @param aContentRect The visible rect.
-        * @return void
-        */        
-        void SetNewstickerRect(TRect& aContentRect);
-
-        /** 
-        * Checks whether a western layout is used.
-        * @return Returns true if wesern layout is in use.
-        */
-        TBool IsWestern();
+        static CXnNewstickerControl* NewL( CXnNewstickerAdapter* aAdapter );
 
         // Routed from MXnNewstickerInterface.
 
@@ -77,47 +56,40 @@
          * Append new title to the end of the title list.
          * @param aTitle The new title to add.
          */
-        void AppendTitleL(const TDesC& aTitle);
+        void AppendTitleL( const TDesC& aTitle );
 
         /**
          * Insert new title to the end of the title list.
          * @param aTitle The new title to add.
          * @param aIndex The place to add the title.
          */
-        void InsertTitleL(const TDesC& aTitle, TInt aIndex);
+        void InsertTitleL( const TDesC& aTitle, TInt aIndex );
 
         /**
          * Update title in the title list.
          * @param aTitle The new title to add.
          * @param aIndex The place to add the title.
          */
-        void UpdateTitleL(const TDesC& aTitle, TInt aIndex);
+        void UpdateTitleL( const TDesC& aTitle, TInt aIndex );
 
         /**
          * Delete the title.
          * @param aIndex The title index to delete.
          */
-        void DeleteTitleL(TInt aIndex);
+        void DeleteTitleL( TInt aIndex );
 
     	/**
     	 * Returns index of the currently selected title.
     	 * @return The index of the current title.
     	 */
-        TInt CurrentTitleIndex();
+        TInt CurrentTitleIndex() const;
 
     	/**
     	 * Return the title of the given index.
     	 * @param aIndex The index to return the title.
     	 * @return The title of the given index.
     	 */
-        const TDesC& Title(TInt aIndex);
-
-    	/**
-    	 * Set the separator image for all titles.
-    	 * @param aIcon The separator image. This must be mif icon.
-    	 * @return KErrNone if successful, KErrArgument if the icon is not mif.
-    	 */
-        TInt SetSeparatorImageL(CGulIcon* aIcon);
+        const TDesC& Title(TInt aIndex) const;
 
         /**
          * Delete all titles.
@@ -125,198 +97,34 @@
         void ClearTitles();
 
         /**
-         * Append the SVG title to be shown.
-         * @param aByteData The SVG data.
-         */
-        void AppendSvgTitleL(const TDesC8& aByteData);
-
-        /**
-         * Insert the SVG title to be shown.
-         * @param aByteData The SVG data.
-         */
-        void InsertSvgTitleL(const TDesC8& aByteData, TInt aIndex);
-
-        /**
-         * Return the current svg title.
-         * @return The current svg title.
-         */
-        const TDesC8& CurrentSvgTitle();
-
-        /**
          * Return the number of titles in the list.
          * @return The number of titles in the list.
          */
         TInt TitleCount() const;
-
-	    /**
-        * Move to the next title.
-        */
-        void MoveToNextL();
-
-	    /**
-        * Move to the previous title.
-        */
-        void MoveToPrevL();
-
-        /**
-         * Move to first title
-         */
-        void MoveToFirstL();
-
-        /**
-         * Move to last title
-         */
-        void MoveToLastL();
-	    
-        /**
-        * Move to the previous title.
-        */
-        void MoveToCurrent();
-
-        /**
-         * Sets font for bitmap graphic context.
-         * @param aFont Font family.
-         */
-        void SetFont(CFont* aFont);
-
-        /**
-         * Sets text color for bitmap graphic context.
-         * @param aColor Color in RGB format.
-         */
-        void SetTextColor(TRgb aColor);
-
-        /**
-         * Sets the underline style for all subsequently drawn text.
-         * @param aStyle Underline style, which can be either on of off.
-         */
-        void SetTextUnderlineStyle(TFontUnderline aStyle);
-
-        /**
-         * Sets the strikethrough style for all subsequently drawn text.
-         * @param aStyle Strikethrough style, which can be either on of off.
-         */
-        void SetTextStrikethroughStyle(TFontStrikethrough aStyle);
         
         /** 
         * Destructor
         */
         virtual ~CXnNewstickerControl();
 
-        /**
-         * Creates background bitmap
-         */	
-        void CreateBufferBitmapL();
-
 	    /**
-        * Advance text and issue a callback to parent
+        * Selects title to be shown
         */
-        void DoScrollL();
-
-	    /**
-        * Blit visible stuff to d-buffer. Drawing direction is left-to-right.
-        */
-        void PrepareToDrawLtrL();
-
-	    /**
-        * Blit visible stuff to d-buffer. Drawing direction is right-to-left.
-        */
-        void PrepareToDrawRtlL();
-
-	    /**
-        * Blit double buffer to gc.
-        */
-        void Draw();
+        const TDesC& SelectTitle();
         
         /**
-         * Blit double buffer to gc. Draws only the last title truncated.
-         */
-        void DrawStatic();
-
-	    /**
-        * Sets iFirstdrawingOffset as a start position.
-        */
-        void SetBeginningState();
-
-        /**
-        * Return the font
-        * @return font
-        */
-        inline const CFont* Font() { return iFont; };
-
-        /**
-        * Return the text color.
-        * @return Text color.
-        */
-        inline const TRgb TextColor() { return iTextColor; };
-
-        /**
-        * Return font underline flag.
-        * @return Font underline flag.
-        */
-        inline const TFontUnderline TextUnderlineStyle() { return iUnderlining; };
-
-        /**
-        * Return the font strikethrough flag.
-        * @return Font strikethrough flag.
+        * Sets the current title to default ( last one ) or move to next one
         */
-        inline const TFontStrikethrough TextStrikethroughStyle() { return iStrikethrough; };
-        
-        /**
-         * Set scroll looping property
-         */
-        void SetScrollLooping( TBool aLoop );
-        
-        /**
-         * Return scroll looping property
-         * @return TBool
-         */                
-        TBool ScrollLooping();
-        
-        /**
-         * @return ETrue if all the text fits on the drawing rect. In that case no scrolling and 
-         * text alignment should be used
-         */ 
-        TBool TextFitInNewstickerRect();
-        
-        /**
-         * @param aAlignment ( ELayoutAlignCenter, ELayoutAlignLeft or ELayoutAlignRight )
-         * ELayoutAlignLeft default in western, ELayoutAlignRight in AH.
-         */
-        void SetTextAlignment(TInt aAlignment);
-        
-        /**
-         * @return ETrue if the current text fits on
-         * the drawing rect (when scrolling behaviour is scroll-alternate)
-         * EFalse otherwise. 
-         * If this is ETrue then no scrolling and text alignment should be used
-         */ 
-        TBool CalculateCurrentTextFitInNewstickerRect();
+        TBool SetCurrentTitle( TBool aSetDefault = EFalse );
+
 
     private: 
 
         CXnNewstickerControl(CXnNewstickerAdapter* aAdapter);
 
         void ConstructL();
-
-        /**
-        * Calculate the indexes and offset after new title has been inserted.
-        * @param aIndex The inserted index.
-        */
-        void CountIndexAfterInsertL(TInt aIndex);
         
         /**
-         * @return ETrue if all the text fits on the drawing rect (when scrolling behaviour is slide)
-         * EFalse otherwise. 
-         * If this is ETrue then no scrolling and text alignment should be used
-         */ 
-        TBool CalculateTextFitInNewstickerRect();
-        
-        /**
-         * @return text alignment from properties if text fits to the rect or scroll behaviour is alternate.
-         * otherwise returns default alignment value (left in western, right in AH).  
-         */
-        CGraphicsContext::TTextAlign TextAlignment();
-        /**
          * Get the index of the next title that has content
          * 
          * @param aStartSearch The index where to start search
@@ -324,213 +132,26 @@
          * 
          * @return The next index that has content or -1 if nothing was found 
          */
-        TInt GetNextTitleWithContent( TInt aStartSearch, TBool aBackwards = EFalse );
-
-        TBool IsVisibleTitles();
-        
-    private:    // Data
+        TInt GetNextTitleWithContent( TInt aStartSearch, TBool aBackwards = EFalse ) const;
 
         /**
-        *  Helper class containing the title text and its length in pixels.
-        *
-        *  @lib xnnewstickerfactory.dll
-        *  @since Series 60 3.2
+        * Checks is there any visible titles in array
         */
-        class CTitleData : public CBase
-            {
-            public:
-
-                /** 
-                * Destructor
-                */
-                virtual ~CTitleData();
-
-                /**
-                * Two-phased constructor.
-                * @param aTitle The title text.
-                * @param aLenghtInPixels The lenght of title text in pixels.
-                * @return Pointer to this.
-                */
-                static CTitleData* NewL(const TDesC& aTitle, TInt aLenghtInPixels);
-
-                /**
-                * Two-phased constructor.
-                * @param aTitle The title text.
-                * @param aLenghtInPixels The lenght of title text in pixels.
-                * @return Pointer to this.
-                */
-                static CTitleData* NewLC(const TDesC& aTitle, TInt aLenghtInPixels);
-
-                /**
-                * Two-phased constructor.
-                * @param aByteData The SVG title.
-                * @param aLenghtInPixels The lenght of title text in pixels.
-                * @return Pointer to this.
-                */
-                static CTitleData* NewL(const TDesC8& aByteData);
-
-                /**
-                * Two-phased constructor.
-                * @param aByteData The SVG title.
-                * @param aLenghtInPixels The lenght of title text in pixels.
-                * @return Pointer to this.
-                */
-                static CTitleData* NewLC(const TDesC8& aByteData);
-
-                /** 
-                * Return the title text.
-                * @return The title text.
-                */
-                const TDesC& TitleText();
-                
-                /**
-                 * Set new title text
-                 */
-                void SetTitleTextL(const TDesC& aTitle);
-                
-                /** 
-                * Return the title text lenght in pixels.
-                * @return The title text lenght in pixels.
-                */
-                TInt TitleTextLengthInPixels();
-
-                /** 
-                * Return the title text lenght in pixels.
-                * @param aLenghtInPixels The lenght of title text in pixels.
-                */
-                void SetTitleTextLengthInPixels(TInt aLenghtInPixels);
-
-                /** 
-                * ETrue if the title is svg, EFalse if it is text.
-                * @return ETrue if the title is svg, EFalse if it is text.
-                */
-                TBool IsSvgTitle();
-
-                /**
-                * Return the svg title data.
-                * @return The svg title data.
-                */
-                const TDesC8& SvgTitleData();            
-
-            private:
-
-                CTitleData(TInt aLenghtInPixels = 0);
-
-                void ConstructL(const TDesC& aTitle);
-
-                void ConstructL(const TDesC8& aByteData);
-
-            private:    //  Data
-
-                /**
-                * ETrue if the title is SVG, EFalse if it is text.
-                */
-                TBool   iTitleIsSvg;
-
-                /**
-                * The title text. Owned.
-                */
-                HBufC*  iText;
-
-                /**
-                * The svg title. Owned.
-                */
-                HBufC8*  iData;
-
-                /**
-                * The title text length in pixels.
-                */
-                TInt    iTextLenghtInPixels;
-            };
-
+        TBool IsVisibleTitles() const;
+        
+    private:    // Data
+        
         /**
-        * List of titles to show.
-        */
-        RPointerArray<CTitleData>   iTitles;
-
-        /**
-        * The index of the title which is drawn first.
+        * The array for title texts
+        * owned
         */
-        TInt                        iFirstDrawingTitleIndex;
-
-        /**
-        * The number of pixels of the first title and separator image which
-        * have already been shown. In other words, the number of the pixels
-        * that are not visible in the screen. The iFirstDrawingTitleIndex
-        * is updated when:
-        * iFirstDrawingOffset > iTextLenghtInPixels + iSeparatorImageWidth
-        */
-        TInt                        iFirstDrawingOffset;
-
-        /**
-        * The width of the.separator image.
-        */
-        TInt                        iImageWidthInPixels;
+        RPointerArray<HBufC>        iTitleTexts;
         
         /**
         * The index of the title which is selected if user activates the
         * control.
         */
         TInt                        iCurrentTitleIndex;
-
-        /**
-        * The separator image. 
-        * Owned.
-        */
-        CGulIcon*                   iSeparatorimage;
-
-        /**
-        * The separator image including the gap between image and text. 
-        * Owned.
-        */
-        TInt                        iSeparatorImageWidth;
-
-        /**
-         * Font
-         * Not own.
-         */
-    	CFont* 	                    iFont;
-
-        /**
-         * Baseline for the text.
-         */
-        TInt                        iTextBaseline;
-        
-        /**
-         *  Color for the text
-         */
-        TRgb                        iTextColor;
-
-        /**
-         *  Whether to use underlining for the text
-         */
-        TFontUnderline              iUnderlining;
-
-        /**
-         *  Whether to use strikethrough for the text
-         */
-        TFontStrikethrough          iStrikethrough;
-
-        /**
-         * A rect in which the scrolling text is shown.
-         */
-        TRect                       iContentRect;
-
-        /**
-         * Amount of pixels the text moves in a tick.
-         */	    
-	    TInt                        iSpeed;
-	    
-	    /**
-	     * Whether the scrolling texts will loop or not.
-	     * If false, the scrolling will end at the last index.
-	     */
-	    TBool                       iScrollLooping;
-
-        /**
-         * Whether the text direction is LTR or RTL.
-         */	    
-        TBool                       iIsWestern;
         
         /**
          * Parent control adapter
@@ -538,15 +159,9 @@
          */	            
         CXnNewstickerAdapter*       iAdapter;
         
-        /**
-         * ETrue if there is only one title, it fits in the rect and 
-         * scroll behaviour is slide
-         */
-        TBool                       iTextFitInNewstickerRect;
-        /**
-         * Text alignment from the properties
-         */
-        TInt                        iTextAlignment;        
+
+
+        
     };
 
 #endif // XNNEWSTICKERCONTROL_H