msg_plat/smil_engine_api/inc/smilobject.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2003 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 "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: smilobject  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SMILOBJECT_H
       
    21 #define SMILOBJECT_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "smiltextbuf.h"
       
    27 
       
    28 #include "smiltime.h"
       
    29 #include "smiltimelist.h"
       
    30 #include "smilinstancetime.h"
       
    31 #include "smilcondition.h"
       
    32 
       
    33 // CONSTANTS
       
    34 //const TReal32 KFloatIndefinite = KMaxTReal32;
       
    35 #define KFloatIndefinite KMaxTReal32
       
    36 const TReal32 KFloatUnspecified = -12346;
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CSmilTimeContainer;
       
    40 class CSmilRegion;
       
    41 class MSmilRegion;
       
    42 class CSmilAnchor;
       
    43 class CSmilPresentation;
       
    44 class CSmilEvent;
       
    45 class MSmilActive;
       
    46 // CLASS DECLARATION
       
    47 
       
    48 
       
    49 //< -- Fill values -- >
       
    50 enum TFill  {  EFillAuto, EFillRemove, EFillFreeze, EFillHold, EFillTransition };
       
    51 //< -- Restart values -->
       
    52 enum TRestart { ERestartAlways, ERestartNever, ERestartWhenNotActive };
       
    53 //< -- Endsync values -->
       
    54 enum TEndsync { EEndsyncFirst, EEndsyncLast, EEndsyncAll, EEndsyncId };
       
    55 
       
    56 
       
    57 class CSmilObject : public CBase
       
    58     {
       
    59 
       
    60     public:  // Constructors and destructor
       
    61 		
       
    62 		virtual const TDesC* ClassName() const { _LIT(KN,"CSmilObject"); return &KN; } 
       
    63 
       
    64 		/**
       
    65         * Destructor.
       
    66         */
       
    67 		virtual ~CSmilObject();
       
    68 
       
    69 	public:	
       
    70 		/**
       
    71         * Gets anchor object associated with this object.
       
    72         * @return CSmilAnchor* - pointer to the anchor object
       
    73         */
       
    74 		IMPORT_C CSmilAnchor* Anchor() const;
       
    75 
       
    76 		CSmilPresentation* Presentation() { return iPresentation; }
       
    77 		CSmilObject* NextSibling() { return iNext; }
       
    78 		CSmilObject* PreviousSibling() { return iPrevious; }		
       
    79 		CSmilTimeContainer* ParentObject();
       
    80 		virtual CSmilObject* FirstChild() const { return 0; }
       
    81 		virtual CSmilObject* LastChild() const { return 0; }
       
    82 
       
    83 		TSmilTime Duration() const { return iDuration; }				
       
    84 		TRestart Restart() const { return iRestart; }
       
    85 		
       
    86 		TSmilTime Min() const { return iMin; }
       
    87 		TSmilTime Max() const { return iMax; }
       
    88 		TPtrC Id() const;
       
    89 		TPtrC Title() const;
       
    90 		TFill Fill() const;			
       
    91 		TSmilTime RepeatDur() const;
       
    92 		TReal32 RepeatCount() const;
       
    93 
       
    94 		virtual TBool IsTimeContainer() const { return EFalse; }
       
    95 		virtual TBool IsSequence() const { return EFalse; }
       
    96 		virtual TBool IsParallel() const { return EFalse; }
       
    97 		virtual TBool IsExclusive() const { return EFalse; }
       
    98 		virtual TBool IsMedia() const { return EFalse; }
       
    99 		virtual TBool IsPrefetch() const { return EFalse; }
       
   100 		virtual TBool IsArea() const { return EFalse; }
       
   101 		virtual TBool IsA() const { return EFalse; }
       
   102 
       
   103 		virtual TBool IsVisible() const { return EFalse; }
       
   104 		virtual TBool IsScrollable() const { return EFalse; }
       
   105 
       
   106 		struct TInterval
       
   107 			{
       
   108 			TInterval()
       
   109 				{
       
   110 				iBegin = TSmilTime::KUnresolved;
       
   111 				iEnd = TSmilTime::KUnresolved;
       
   112 				}
       
   113 
       
   114 			TInterval(const TSmilTime& aBegin, const TSmilTime& aEnd)
       
   115 				{
       
   116 				iBegin = aBegin;
       
   117 				iEnd = aEnd;
       
   118 				}
       
   119 
       
   120 			TBool IsNull() { return iBegin.IsUnresolved(); }
       
   121 			TSmilTime Duration() { return iEnd - iBegin; }
       
   122 
       
   123 			TSmilTime iBegin;
       
   124 			TSmilTime iEnd;
       
   125 			};
       
   126 
       
   127 		/**
       
   128         * Unfreeze an object.
       
   129         */
       
   130 		virtual void Unfreeze() {};
       
   131 
       
   132 		/**
       
   133         * Propagate an event throught the timing tree.
       
   134         */
       
   135 		virtual void PropagateEventL( const TSmilEvent& aEvent, const TSmilTime& aTime );
       
   136 
       
   137 		/**
       
   138         * A common "proceed" function for all timed objects.
       
   139 		* Called each time a timed object receives the timing signal.
       
   140         */
       
   141 		virtual void ProceedL( const TSmilTime& aTps );
       
   142 		
       
   143 		void ResolveL() { ResolveL(0); }
       
   144 		virtual void ResolveL( const TSmilTime& aTps );
       
   145 
       
   146 		// virtual void Seek( const TSmilTime& aTps, const TSmilTime& aTo );
       
   147 
       
   148 		/**
       
   149         * A common "NotifyDependents" function for all timed objects.
       
   150         */
       
   151 		virtual void NotifyDependents( const TSmilTime& aTime );
       
   152 
       
   153 		/**
       
   154         * Get the implicit duration of an object.
       
   155         */
       
   156 		virtual TSmilTime ImplicitDuration() const;
       
   157 
       
   158 		/**
       
   159         * End an object & geberate an end event.
       
   160         */
       
   161 		virtual void EndL( const TSmilTime& aTime );
       
   162 
       
   163 		/**
       
   164         * Begin an object & generate a begin event.
       
   165         */
       
   166 		virtual void BeginL( const TSmilTime& aTime );
       
   167 		
       
   168 		/**
       
   169         * Reset the timing values of an object.
       
   170         */
       
   171 		virtual void Reset();
       
   172 		
       
   173 		/**
       
   174         * Repeat an object.
       
   175         */
       
   176 		virtual void RepeatL( const TSmilTime& aTime );
       
   177 		
       
   178 		/**
       
   179         * Sets the default timing values of an object.
       
   180         */
       
   181 		void Initialise();
       
   182 		
       
   183 		/**
       
   184         * Get the active time of an object.
       
   185         */
       
   186 		TSmilTime ActiveTime();		
       
   187 		
       
   188 		/**
       
   189         * Does the object have a resolved begin time.?
       
   190         */
       
   191 		TBool HasBeginTime();
       
   192 		
       
   193 		/**
       
   194         * Does the object have a begin condition?
       
   195         */
       
   196 		TBool HasBeginEvent();
       
   197 
       
   198 		/**
       
   199         * Does the object have a resolved end time?.
       
   200         */
       
   201 		TBool HasEndTime();
       
   202 		
       
   203 		TBool HasEndEvent();
       
   204 
       
   205 
       
   206 		void AddConditionL( const TSmilCondition& aCondition, TBool aBeginCondition );
       
   207 		
       
   208 			
       
   209 
       
   210 		void SetRestart( TRestart aVal );
       
   211 
       
   212 		/**
       
   213         * Set the repeatCount value.
       
   214         */
       
   215 		void SetRepeatCount( TReal32 aRC );
       
   216 		
       
   217 		/**
       
   218         * Set the repeatDur value.
       
   219         */
       
   220 		void SetRepeatDur( TSmilTime aRD );
       
   221 
       
   222 		void SetFill(TFill aFill) { iFill = aFill; }
       
   223 
       
   224 		/**
       
   225         * Set the "id" string.
       
   226         */
       
   227 		void SetIdL( const TDesC& aString );
       
   228 		
       
   229 		/**
       
   230         * Set the "title" string.
       
   231         */
       
   232 		void SetTitleL( const TDesC& aString );
       
   233 		
       
   234 
       
   235 		void SetAnchor( CSmilAnchor* aReference );
       
   236 		
       
   237 		void SetDuration( const TSmilTime& aDuration );
       
   238 		
       
   239 		void SetEndTime( const TSmilTime& aEndTime );
       
   240 
       
   241 
       
   242 		void SetMax( const TSmilTime& aMax );
       
   243 		void SetMin( const TSmilTime& aMin );
       
   244 
       
   245 		/**
       
   246         * Set the parent object.
       
   247         */
       
   248 		void SetParent( CSmilTimeContainer* aContainer );
       
   249 
       
   250 		/**
       
   251         * Set the "next sibling.
       
   252         */
       
   253 		void SetNextSibling( CSmilObject* aNext );
       
   254 
       
   255 		/**
       
   256         * Set the previous sibling.
       
   257         */
       
   258 		void SetPreviousSibling( CSmilObject* aPrevious );
       
   259 
       
   260 		/**
       
   261         * Returns the next sibling.
       
   262         */
       
   263 		CSmilObject* NextSibling() const;
       
   264 
       
   265 		/**
       
   266         * Returns the previous sibling.
       
   267         */
       
   268 		CSmilObject* PreviousSibling() const;
       
   269 
       
   270 		CSmilObject* NextAdjacent() const;
       
   271 		CSmilObject* PreviousAdjacent() const;
       
   272 		
       
   273 		CSmilPresentation* Presentation() const;
       
   274 
       
   275 		
       
   276 		virtual void SetEndsyncL(TEndsync /*	aEndsync*/, const TDesC& /*aId*/ = TPtrC()) { }
       
   277 
       
   278 		TSmilTime EndTime() const;
       
   279 		TSmilTime BeginTime() const;
       
   280 
       
   281 		TBool IsPlaying() const;
       
   282 	
       
   283 		void RecalcInterval( const TSmilTime& aTime );
       
   284 
       
   285 		virtual TSmilTime NextActivation( const TSmilTime& aTime ) const;			
       
   286 
       
   287 		TInterval FirstInterval();
       
   288 		TInterval NextInterval();
       
   289 		TBool HasMoreIntervals();
       
   290 
       
   291 		TSmilTime ParentSimpleEnd();
       
   292 
       
   293 		TInt ActualRepeat() const;
       
   294 		
       
   295 		TBool EndSpecified();
       
   296 		TBool BeginSpecified();
       
   297 		
       
   298 		TSmilTime RepeatBeginTime() const;
       
   299 		
       
   300 		TSmilTime CalcActiveEnd( TSmilTime aB ); 
       
   301 		TSmilTime CalcActiveEnd( TSmilTime aB, TSmilTime aEnd );
       
   302 		
       
   303 		void ResolveSimpleDuration();
       
   304 		
       
   305 		TSmilTime CalcIntermediateActiveDuration() const;
       
   306 
       
   307 		virtual void AttachedL();
       
   308 		
       
   309 		virtual void PrintTree(int d=0) const;		
       
   310 
       
   311 		TBool IsRepeating() const;
       
   312 
       
   313 		virtual void SetFocus(TBool ) { }
       
   314 		virtual TBool HasFocus() const { return EFalse; }
       
   315 
       
   316 		virtual void SetFocusable(TBool ) { }
       
   317 		virtual TBool IsFocusable() const{ return EFalse; }
       
   318 		
       
   319 
       
   320 		virtual CSmilObject* FindNamedObject(const TDesC& aName);
       
   321 
       
   322 		void ResolveBeginTimeL(TSmilTime aTime);
       
   323 		void ResolveEndTimeL(TSmilTime aTime);
       
   324 
       
   325 		TSmilTime LocalToGlobal(const TSmilTime& aTime);
       
   326 		TSmilTime GlobalToLocal(const TSmilTime& aTime);
       
   327 
       
   328 		virtual void RewindL(const TSmilTime& aTime, const TSmilTime& aTo);
       
   329 
       
   330 		virtual void SetPaused(TBool /*aPaused*/) {};
       
   331 
       
   332 		virtual void Redraw() {}
       
   333 		virtual MSmilRegion* GetRegion() const { return 0;}
       
   334 		virtual TPoint Center() const { return TPoint();}
       
   335 
       
   336 		void AfterL(MSmilActive* iActive, const TSmilTime& aDelay, TBool aLazy = EFalse);
       
   337 		void CancelActive(MSmilActive* aActive);
       
   338 
       
   339 	protected:
       
   340 
       
   341 		/**
       
   342         * C++ default constructor.
       
   343         */
       
   344 		CSmilObject();
       
   345 		
       
   346 		/**
       
   347         * Base-class Constructor.
       
   348         */
       
   349 		virtual void ConstructL(CSmilPresentation* aPresentation);
       
   350 
       
   351 	protected:	// Data
       
   352 
       
   353 		// style properties		
       
   354 		TSmilTime								iDuration;
       
   355 		TSmilTime								iRepeatDur;
       
   356 		TReal32									iRepeatCount;
       
   357 		TRestart								iRestart;
       
   358 		TFill									iFill;
       
   359 		TSmilTime								iMin;
       
   360 		TSmilTime								iMax;
       
   361 		RPointerArray<TSmilCondition>			iBeginConditions;
       
   362 		RPointerArray<TSmilCondition>			iEndConditions;
       
   363 		CSmilAnchor*							iAnchor;
       
   364 		RSmilTextBuf							iId;
       
   365 		RSmilTextBuf							iTitle;
       
   366 				
       
   367 		
       
   368 		// object state
       
   369 
       
   370 		TInterval								iCurrentInterval;
       
   371 
       
   372 		TBool									iPlaying;
       
   373 		TBool									iFirstInterval;		
       
   374 				
       
   375 		TSmilTimeList							iBeginList;
       
   376 		TSmilTimeList							iEndList;
       
   377 
       
   378 		TSmilTime								iRepeatBeginTime;
       
   379 		TSmilTime								iSimpleDuration;
       
   380 		TSmilTime								iActiveDuration;
       
   381 
       
   382 		TInt									iActualRepeat;
       
   383 
       
   384 		TBool									iMinLimited;
       
   385 
       
   386 		TBool									iForcedRepeat;
       
   387 
       
   388 		// tree management
       
   389 
       
   390 		CSmilPresentation*						iPresentation;
       
   391 		CSmilTimeContainer*						iParentObject;
       
   392 		CSmilObject*							iPrevious;
       
   393 		CSmilObject*							iNext;		
       
   394 
       
   395 };
       
   396 
       
   397 #include "smiltimecontainer.h"
       
   398 
       
   399 #endif      // ?INCLUDE_H   
       
   400             
       
   401 // End of File
       
   402