diff -r 000000000000 -r 2f259fa3e83a uifw/EikStd/coctlinc/smileyiconrecord.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uifw/EikStd/coctlinc/smileyiconrecord.h Tue Feb 02 01:00:49 2010 +0200 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: smiley utility class +* +*/ + +#ifndef C_SMILEYICONRECORD_H +#define C_SMILEYICONRECORD_H + +#include +#include +#include "smileymanager.h" + +class CSmileyImageData; + +NONSHARABLE_CLASS( CSmileyIcon ) : public CBase + { + friend class CSmileyTextLink; +public: + CSmileyIcon( TText aCode ); + ~CSmileyIcon(); +// new functions + void SetRect( TRect aRect ){ iRect = aRect; }; + TRect Rect(){ return iRect; }; + void SetPlayTimes( TInt aPlayTimes ){ iLoop = aPlayTimes; }; + TInt PlayTimes(){ return iLoop; }; + void EnableHighlight( TBool aEnable ){ iHighlight = aEnable; }; + TBool IsHighlight(){ return iHighlight; }; + void SetImageData( CSmileyImageData* aImage ){ iImage = aImage; }; + CSmileyImageData* ImageData(){ return iImage; }; + TText Code(){ return iCode; }; + void IncreasePlayCount(){ iPlayCount++; }; + TInt PlayCount(){ return iPlayCount; }; + void PlayOneTime(){ iPlayCount = iLoop - 1; }; + void ResetPlayCount(){ iPlayCount = 0; }; + TBool IsPlayFinished(){ return ( iPlayCount >= iLoop ); }; + TInt DocPos(){ return iDocPos; }; + void SetDocPos( TInt aDocPos ){ iDocPos = aDocPos; }; + + TInt SmileyLength(){ return iStr.Length(); }; + TInt EndPos(){ return iDocPos + iStr.Length(); }; + void SetSmileyString( const TDesC& aString ); + const TDesC& SmileyString(){ return iStr; }; + + TBool IsDisabled(){ return iDisabled; }; + void DisableIcon( TBool aDisable = ETrue ){ iDisabled = aDisable; }; + +private: // data + TText iCode; + TRect iRect; + TInt iDocPos; + TInt iLoop; + TInt iPlayCount; + TBool iHighlight; + // not own + CSmileyImageData* iImage; + TBuf iStr; + TBool iDisabled; + }; + +NONSHARABLE_CLASS( CSmileyIconRecord ) : public CBase + { +public: + CSmileyIconRecord(); + ~CSmileyIconRecord(); + + void InsertIconL( CSmileyIcon* aIcon ); + void HandleTextDelete( TInt aStart, TInt aLength ); + void HandleTextInsert( TInt aStart, TInt aLength ); + void CancelSelection(); + void SetSelection( TInt aStart, TInt aLength ); + CSmileyIcon* SmileyIconAtPos( TInt aDocPos ); + TBool HasSmileyIcon(); + +private: + void InsertIconAtL( CSmileyIcon* aIcon, TInt aIndex ); + void DeleteIconsIn( TInt aStart, TInt aLength ); + TInt FirstIndexAfter( TInt aDocPos, TInt aSearchStart = 0 ); + TInt FirstIndexIn( TInt aStart, TInt aLength ); + TInt LastIndexIn( TInt aStart, TInt aLength, TInt aStartIndex ); + +private: // data + RPointerArray iIconArray; + }; + +#endif // C_SMILEYICONRECORD_H