svgtopt/SVG/SVGEngine/src/SVGEvent.cpp
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     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:  SVG Engine source file
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "SVGEvent.h"
       
    20 
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // Constructor
       
    24 // Initialized with x, y coordinates info and event type
       
    25 // ---------------------------------------------------------------------------
       
    26 TSvgUiMouseEvent::TSvgUiMouseEvent( TSvgEngineEventType aEtype, TFloatFixPt aX, TFloatFixPt aY ) :
       
    27          iEtype( aEtype ), iX( aX ), iY( aY )
       
    28     {
       
    29     }
       
    30 
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 // ---------------------------------------------------------------------------
       
    34 TUint8 TSvgUiMouseEvent::EventMask()
       
    35     {
       
    36     return KSvgEventMaskExternalUI;
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Accessor for the event type
       
    41 // ---------------------------------------------------------------------------
       
    42 TSvgEngineEventType TSvgUiMouseEvent::EventType()
       
    43     {
       
    44     return iEtype;
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Accessor for x coordinate
       
    49 // ---------------------------------------------------------------------------
       
    50 TFloatFixPt TSvgUiMouseEvent::X()
       
    51     {
       
    52     return iX;
       
    53     }
       
    54 // ---------------------------------------------------------------------------
       
    55 // Accessor for y coordinate
       
    56 // ---------------------------------------------------------------------------
       
    57 TFloatFixPt TSvgUiMouseEvent::Y()
       
    58     {
       
    59     return iY;
       
    60     }
       
    61 
       
    62 /*********************************************/
       
    63 // ---------------------------------------------------------------------------
       
    64 // Constructor
       
    65 // Initialized for the key code
       
    66 // ---------------------------------------------------------------------------
       
    67 TSvgUiKeyEvent::TSvgUiKeyEvent( TUint32 aKeyCode ) : iKeyCode( aKeyCode )
       
    68     {
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // Accessor for the event mask
       
    73 // ---------------------------------------------------------------------------
       
    74 TUint8 TSvgUiKeyEvent::EventMask()
       
    75     {
       
    76     return KSvgEventMaskExternalUI;
       
    77     }
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // Accessor for the event type
       
    81 // ---------------------------------------------------------------------------
       
    82 TSvgEngineEventType TSvgUiKeyEvent::EventType()
       
    83     {
       
    84     return ESvgEngineEventKeyPress;
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // Accessor for the key code of this event
       
    89 // ---------------------------------------------------------------------------
       
    90 TUint32 TSvgUiKeyEvent::KeyCode()
       
    91     {
       
    92     return iKeyCode;
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // Accessor for the time of the event
       
    97 // ---------------------------------------------------------------------------
       
    98 TInt32 TSvgUiKeyEvent::Time()
       
    99     {
       
   100     return  iTime;
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------------------------
       
   104 // Set accessor for the time of the event
       
   105 // ---------------------------------------------------------------------------
       
   106 void TSvgUiKeyEvent::SetTime( TInt32 aTime )
       
   107     {
       
   108     iTime = aTime;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // Accessor for the begin time of the event
       
   113 // ---------------------------------------------------------------------------
       
   114 TInt32 TSvgUiKeyEvent::BeginTime()
       
   115     {
       
   116     return iBeginTime;
       
   117     }
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // Set accessor for the begin time of the event
       
   121 // ---------------------------------------------------------------------------
       
   122 void TSvgUiKeyEvent::SetBeginTime( TInt32 aTime )
       
   123     {
       
   124     iBeginTime = aTime;
       
   125     }
       
   126 
       
   127 /**********************************************/
       
   128 // ---------------------------------------------------------------------------
       
   129 // Constructor
       
   130 // Initialized for the time of the event
       
   131 // ---------------------------------------------------------------------------
       
   132 TSvgTimerEventPrep::TSvgTimerEventPrep( TUint32 aTime ) : iTime( aTime )
       
   133     {
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // Accessor for the event mask
       
   138 // ---------------------------------------------------------------------------
       
   139 TUint8 TSvgTimerEventPrep::EventMask()
       
   140     {
       
   141     return KSvgEventMaskTimer;
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // Accessor for the event type
       
   146 // ---------------------------------------------------------------------------
       
   147 TSvgEngineEventType TSvgTimerEventPrep::EventType()
       
   148     {
       
   149     return ESvgEngineEventTimerPrep;
       
   150     }
       
   151 
       
   152 // ---------------------------------------------------------------------------
       
   153 // Accessor for the time of the event
       
   154 // ---------------------------------------------------------------------------
       
   155 TUint32 TSvgTimerEventPrep::Time()
       
   156     {
       
   157     return (TUint32) iTime;
       
   158     }
       
   159 
       
   160 /*********************************************/
       
   161 
       
   162 // ---------------------------------------------------------------------------
       
   163 // Constructor
       
   164 // Initialized for the time span of the event
       
   165 // ---------------------------------------------------------------------------
       
   166 TSvgTimerEvent::TSvgTimerEvent( TUint32 aTime ) : iTime( aTime )
       
   167     {
       
   168     }
       
   169 
       
   170 // ---------------------------------------------------------------------------
       
   171 // Accessor for the event mask
       
   172 // ---------------------------------------------------------------------------
       
   173 TUint8 TSvgTimerEvent::EventMask()
       
   174     {
       
   175     return KSvgEventMaskTimer;
       
   176     }
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // Accessor for the event type
       
   180 // ---------------------------------------------------------------------------
       
   181 TSvgEngineEventType TSvgTimerEvent::EventType()
       
   182     {
       
   183     return ESvgEngineEventTimer;
       
   184     }
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // Accessor for the time of the event
       
   188 // ---------------------------------------------------------------------------
       
   189 TUint32 TSvgTimerEvent::Time()
       
   190     {
       
   191     return (TUint32)iTime;
       
   192     }
       
   193 
       
   194 
       
   195 // ---------------------------------------------------------------------------
       
   196 // Accessor for the time of the event
       
   197 // ---------------------------------------------------------------------------
       
   198 void TSvgTimerEvent::SetTime(TInt32 aTime)
       
   199     {
       
   200     iTime = aTime;
       
   201     }
       
   202 
       
   203 
       
   204 // ---------------------------------------------------------------------------
       
   205 // Accessor for the begin time of the event
       
   206 // ---------------------------------------------------------------------------
       
   207 TInt32 TSvgTimerEvent::BeginTime()
       
   208     {
       
   209     return iBeginTime;
       
   210     }
       
   211 
       
   212 // ---------------------------------------------------------------------------
       
   213 // Set accessor for the begin time of the event
       
   214 // ---------------------------------------------------------------------------
       
   215 void TSvgTimerEvent::SetBeginTime( TInt32 aTime )
       
   216     {
       
   217     iBeginTime = aTime;
       
   218     }
       
   219 
       
   220 
       
   221 /*********************************************/
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 // Constructor
       
   225 // Initialized with the event and the SVG element that is registered for this
       
   226 // event
       
   227 // ---------------------------------------------------------------------------
       
   228 TSvgInternalEvent::TSvgInternalEvent( TSvgEvent aEvent, CSvgElementImpl* aElement ) :
       
   229                             iEvent( aEvent ),
       
   230 							iElement( aElement ),
       
   231 							IsUserSeek( EFalse)
       
   232     {
       
   233     }
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // Constructor
       
   237 // Initialized with the event, the SVG element that is registered for this
       
   238 // event and the eventtime
       
   239 // For SetMediaTime implementation.
       
   240 // ---------------------------------------------------------------------------
       
   241 TSvgInternalEvent::TSvgInternalEvent( TSvgEvent aEvent, CSvgElementImpl* aElement, TInt32 aTime ) :
       
   242                             iEvent( aEvent ),
       
   243 							iElement( aElement ),
       
   244 							iTime(aTime),
       
   245 							IsUserSeek(ETrue)
       
   246     {
       
   247     }
       
   248 
       
   249 
       
   250 // ---------------------------------------------------------------------------
       
   251 // is the event generated in a user seek
       
   252 // ---------------------------------------------------------------------------
       
   253 TBool TSvgInternalEvent::UserSeek()
       
   254     {
       
   255     return IsUserSeek;
       
   256     }
       
   257 
       
   258 // ---------------------------------------------------------------------------
       
   259 // Accessor for the event mask
       
   260 // ---------------------------------------------------------------------------
       
   261 TUint8 TSvgInternalEvent::EventMask()
       
   262     {
       
   263     return KSvgEventMaskInternal;
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------------------------
       
   267 // Accessor for the event type
       
   268 // ---------------------------------------------------------------------------
       
   269 TSvgEngineEventType TSvgInternalEvent::EventType()
       
   270     {
       
   271     return ESvgEngineInternalEvent;
       
   272     }
       
   273 
       
   274 // ---------------------------------------------------------------------------
       
   275 // Accessor for the registered object (a SVG element)
       
   276 // ---------------------------------------------------------------------------
       
   277 CSvgElementImpl* TSvgInternalEvent::ObjectAddress()
       
   278     {
       
   279     return iElement;
       
   280     }
       
   281 
       
   282 // ---------------------------------------------------------------------------
       
   283 // Accessor for the SVG Event
       
   284 // ---------------------------------------------------------------------------
       
   285 TSvgEvent TSvgInternalEvent::SvgEvent()
       
   286     {
       
   287     return iEvent;
       
   288     }
       
   289 
       
   290 // ---------------------------------------------------------------------------
       
   291 // Accessor for the time of the event
       
   292 // ---------------------------------------------------------------------------
       
   293 TInt32 TSvgInternalEvent::Time()
       
   294     {
       
   295     return iTime;
       
   296     }
       
   297 
       
   298 // ---------------------------------------------------------------------------
       
   299 // Set accessor for the time of the event
       
   300 // ---------------------------------------------------------------------------
       
   301 void TSvgInternalEvent::SetTime( TInt32 aTime )
       
   302     {
       
   303     iTime = aTime;
       
   304     }
       
   305 
       
   306 // ---------------------------------------------------------------------------
       
   307 // Accessor for the begin time of the event
       
   308 // ---------------------------------------------------------------------------
       
   309 TInt32 TSvgInternalEvent::BeginTime()
       
   310     {
       
   311     return iBeginTime;
       
   312     }
       
   313 
       
   314 // ---------------------------------------------------------------------------
       
   315 // Set accessor for the begin time of the event
       
   316 // ---------------------------------------------------------------------------
       
   317 void TSvgInternalEvent::SetBeginTime( TInt32 aTime )
       
   318     {
       
   319     iBeginTime = aTime;
       
   320     }
       
   321 
       
   322 // ---------------------------------------------------------------------------
       
   323 // Accessor for the event mask
       
   324 // ---------------------------------------------------------------------------
       
   325 TUint8 TSvgScreenUpdateEvent::EventMask()
       
   326     {
       
   327     return KSvgEventMaskNone;
       
   328     }
       
   329 
       
   330 // ---------------------------------------------------------------------------
       
   331 // Accessor for the event type
       
   332 // ---------------------------------------------------------------------------
       
   333 TSvgEngineEventType TSvgScreenUpdateEvent::EventType()
       
   334     {
       
   335     return ESvgEngineEventScreenUpdate;
       
   336     }