widgetmodel/alfwidgetmodel/inc/alfeventoutput.h
changeset 17 3eca7e70b1b8
parent 3 4526337fb576
equal deleted inserted replaced
3:4526337fb576 17:3eca7e70b1b8
     1 /*
       
     2 * Copyright (c) 2007 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:   Class for various output events, including custom events.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ALFEVENTOUTPUT_H
       
    20 #define ALFEVENTOUTPUT_H
       
    21 
       
    22 
       
    23 #include <osn/osndefines.h>
       
    24 #include <alf/alfcommand.h>
       
    25 #include <alf/alftypes.h>
       
    26 
       
    27 #include <osn/osntypes.h>
       
    28 #include <osn/ustring.h>
       
    29 using namespace osncore;
       
    30 
       
    31 #include <memory>
       
    32 using namespace std;
       
    33 
       
    34 #ifdef RD_TACTILE_FEEDBACK
       
    35 #include <touchfeedback.h>
       
    36 #endif // RD_TACTILE_FEEDBACK
       
    37 
       
    38 namespace Alf
       
    39     {
       
    40 
       
    41 class CAlfWidgetControl;
       
    42 class AlfReferenceToVisual;
       
    43 class IAlfVariantType;
       
    44 class AlfAttribute;
       
    45 class IAlfEventOutputSignalSubscriber;
       
    46 class IAlfAppEventListener;
       
    47 
       
    48 /**
       
    49  *  Event output. Internal.
       
    50  */
       
    51 OSN_NONSHARABLE_CLASS( AlfEventOutput )
       
    52     {
       
    53 public:
       
    54 
       
    55     /**
       
    56      * If the event is to be broadcast, aTargetWidget is set to an empty string.
       
    57      */
       
    58     AlfEventOutput(int aEventType, int aEventID, const char* aTargetWidget, unsigned int aDelay );
       
    59 
       
    60     ~AlfEventOutput();
       
    61 
       
    62 public:
       
    63     /**
       
    64      * Executes the event output.
       
    65      */
       
    66     void execute( const CAlfWidgetControl& aControl, const TAlfEvent& aEvent );
       
    67 
       
    68 private:
       
    69     AlfEventOutput();
       
    70 
       
    71 public: // data
       
    72 
       
    73     int mEventType; // either custom or key event
       
    74     int mEventID;
       
    75     UString mTargetWidget; // Empty string if the event is to be broadcast.
       
    76     unsigned int mDelay;
       
    77     };
       
    78 
       
    79 /**
       
    80  *  Event cancel output. Internal.
       
    81  */
       
    82 OSN_NONSHARABLE_CLASS( AlfEventCancelOutput )
       
    83     {
       
    84 public:
       
    85     /**
       
    86      * constructor.
       
    87      */
       
    88     AlfEventCancelOutput( const char* aTargetWidget, int aEventID, bool aCancelAll );
       
    89 
       
    90     ~AlfEventCancelOutput();
       
    91 
       
    92 public:
       
    93     /**
       
    94        * Executes the event output.
       
    95        */
       
    96     void execute( const CAlfWidgetControl& aControl );
       
    97     /**
       
    98     * returns target widget id.
       
    99     */
       
   100     inline const UString& targetWidget() const
       
   101         {
       
   102         return mTargetWidget;
       
   103         }
       
   104 
       
   105 private:
       
   106     /**
       
   107        * cancels the excecution.
       
   108        */
       
   109     AlfEventCancelOutput();
       
   110 
       
   111 private: // data
       
   112 
       
   113     UString mTargetWidget;
       
   114     int mEventID;
       
   115     bool mCancelAll;
       
   116     };
       
   117 
       
   118 /**
       
   119  *  Animation Event cancel output. Internal.
       
   120  */
       
   121 OSN_NONSHARABLE_CLASS( AlfAnimationCancelOutput )
       
   122     {
       
   123 public:
       
   124     /**
       
   125      * constructor.
       
   126      */
       
   127     AlfAnimationCancelOutput(const char* aElementName,const char* aVisualName, TAlfOp aOperation, bool aCancelAll );
       
   128     /**
       
   129      * destructor.
       
   130      */
       
   131     ~AlfAnimationCancelOutput();
       
   132 
       
   133 public:
       
   134     /**
       
   135         * excecutes the command.
       
   136         */
       
   137     void execute( CAlfWidgetControl& aControl, int aDataID );
       
   138 
       
   139 private:
       
   140     /**
       
   141         * constructor
       
   142         */
       
   143     AlfAnimationCancelOutput();
       
   144 
       
   145 
       
   146 private: // data
       
   147 
       
   148     auto_ptr<AlfReferenceToVisual> mVisualRef;
       
   149     TAlfOp mOperation;
       
   150     bool mCancelAll;
       
   151     };
       
   152 
       
   153 
       
   154 OSN_NONSHARABLE_CLASS( AlfWidgetAttributeOutput )
       
   155     {
       
   156 public:
       
   157     /**
       
   158     * Constructor.
       
   159     */
       
   160     AlfWidgetAttributeOutput( AlfAttribute& aAttribute, 
       
   161         const char* aWidgetId );
       
   162 
       
   163     ~AlfWidgetAttributeOutput();
       
   164 
       
   165 public:
       
   166     /**
       
   167        * Executes the event output.
       
   168        */
       
   169     void execute( CAlfWidgetControl& aControl );
       
   170 
       
   171 private:
       
   172     /**
       
   173        * constructor
       
   174        */
       
   175     AlfWidgetAttributeOutput();
       
   176 
       
   177 private: // data
       
   178     AlfAttribute* mAttr;
       
   179     
       
   180     // Reference to outside widget
       
   181     UString mWidgetId;
       
   182     };
       
   183 
       
   184 /**
       
   185  *  State change output. Internal.
       
   186  */
       
   187 OSN_NONSHARABLE_CLASS( AlfStateChangeOutput )
       
   188     {
       
   189 public:
       
   190     /**
       
   191      * constructor.
       
   192      *
       
   193      * @exception Alf::AlfWidgetException value osncore::EInvalidWidget 
       
   194      *     if aTaretWidget is NULL or empty
       
   195      * @exception Alf::AlfWidgetException value osncore::EInvalidArgument 
       
   196      *     if aDisableStates and aEnableStates have a common bit set 
       
   197      */
       
   198     AlfStateChangeOutput( const char* aTargetWidget, uint aEnableStates, uint aDisableStates );
       
   199 
       
   200     ~AlfStateChangeOutput();
       
   201 
       
   202 public:
       
   203     /**
       
   204      * Executes the event output.
       
   205      */
       
   206     void execute( const CAlfWidgetControl& aControl );
       
   207 
       
   208     /**
       
   209      * returns target widget id.
       
   210      */
       
   211     inline const UString& targetWidget() const
       
   212         {
       
   213         return mTargetWidget;
       
   214         }
       
   215 
       
   216 private: // data
       
   217 
       
   218     UString mTargetWidget;
       
   219     uint mEnableStates;
       
   220     uint mDisableStates;
       
   221     };
       
   222 
       
   223 
       
   224 #ifdef RD_TACTILE_FEEDBACK
       
   225 OSN_NONSHARABLE_CLASS( AlfTactileOutput )
       
   226     {
       
   227 public:
       
   228 
       
   229     /**
       
   230      * Constructor.
       
   231      */
       
   232     AlfTactileOutput( TTouchLogicalFeedback aFeedbackType );
       
   233 
       
   234     /**
       
   235      * Destructor.
       
   236      */
       
   237     ~AlfTactileOutput();
       
   238 
       
   239 public:
       
   240 
       
   241     /**
       
   242      * Executes the event output.
       
   243      */
       
   244     void execute();
       
   245 
       
   246 private:
       
   247 
       
   248     /**
       
   249      * Constructor.
       
   250      */
       
   251     AlfTactileOutput();
       
   252 
       
   253 private: // data
       
   254 
       
   255     TTouchLogicalFeedback mFeedbackType;
       
   256 
       
   257     };
       
   258 
       
   259 #endif // RD_TACTILE_FEEDBACK
       
   260 
       
   261 /**
       
   262  *  Event output signal. 
       
   263  */
       
   264 OSN_NONSHARABLE_CLASS( AlfEventOutputSignal )
       
   265     {
       
   266 public:
       
   267 	explicit AlfEventOutputSignal( IAlfEventOutputSignalSubscriber& aSubscriber );
       
   268 
       
   269     ~AlfEventOutputSignal();
       
   270 
       
   271     /**
       
   272      * Executes the event output.
       
   273      */
       
   274     void execute();
       
   275 
       
   276 private: // data
       
   277 	IAlfEventOutputSignalSubscriber* mSubscriber;
       
   278     };
       
   279 
       
   280 OSN_NONSHARABLE_CLASS( AlfEventPasserOutput)
       
   281     {
       
   282 public:
       
   283 
       
   284     /**
       
   285      * Constructor.
       
   286      */
       
   287     AlfEventPasserOutput( const char* aSourceWidget , const char* aTargetWidget );
       
   288    
       
   289     /**
       
   290      * Constructor. Occurred event is mapped to a new event (specified by aNewEventId)
       
   291      */
       
   292     AlfEventPasserOutput::AlfEventPasserOutput( const char* aSourceWidget , const char* aTargetWidget, 
       
   293                                                 int aNewEventId , int aNewEventCustomData );
       
   294     /**
       
   295      * Destructor.
       
   296      */
       
   297     ~AlfEventPasserOutput();
       
   298 
       
   299 public:
       
   300 
       
   301     /**
       
   302      * Executes the event output.
       
   303      */
       
   304     void execute( const CAlfWidgetControl* aControl , const TAlfEvent& aEvent );
       
   305 
       
   306 private:
       
   307 
       
   308     /**
       
   309      * Constructor.
       
   310      */
       
   311     AlfEventPasserOutput();
       
   312 
       
   313 private: // data
       
   314 
       
   315     const char* mSourceWidget;
       
   316     const char* mTargetWidget;
       
   317     bool mEventMappingData;
       
   318     int mNewEventId;
       
   319     int mNewEventCustomData; 
       
   320     };
       
   321 
       
   322 /**
       
   323  *  Application Event output.
       
   324  */
       
   325 OSN_NONSHARABLE_CLASS( AlfAppEventOutput )
       
   326     {
       
   327 public:
       
   328 	explicit AlfAppEventOutput( const UString& aCmd, IAlfAppEventListener& aAppEvent );
       
   329 
       
   330     ~AlfAppEventOutput();
       
   331 
       
   332     /**
       
   333      * Executes the event output.
       
   334      */
       
   335     void execute(const TAlfEvent& aEvent);
       
   336 
       
   337 private: // data
       
   338 	IAlfAppEventListener* mAppEvent;
       
   339 	UString mCmd;
       
   340     };
       
   341 
       
   342     } // namespace Alf
       
   343 
       
   344 #endif // ALFEVENTOUTPUT_H