javauis/mmapi_qt/baseline/inc/cmmavideocontrol.h
branchRCL_3
changeset 24 0fd27995241b
child 26 dc7c549001d5
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
       
     1 /*
       
     2 * Copyright (c) 2002-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:  This class is a VideoControl.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMMAVIDEOCONTROL_H
       
    20 #define CMMAVIDEOCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "cmmacontrol.h"
       
    24 #include "mmmasnapshotreadycallback.h"
       
    25 
       
    26 // mobitv fix  // 3.x QT based UI
       
    27 //#include "CMIDToolkit.h"
       
    28 //#include "lcdui.h"
       
    29 // FORWARD DECLARATIONS
       
    30 class MMIDComponent;
       
    31 class MMMAEventPoster;
       
    32 class MMMAGuiPlayer;
       
    33 class MMMADisplay;
       
    34 class CMMASnapshot;
       
    35 class MMAFunctionServer;
       
    36 class CMMAEvent;
       
    37 
       
    38 //  CLASS DECLARATION
       
    39 /**
       
    40 *   This class is native side of the VideoControl java object.
       
    41 *
       
    42 *
       
    43 */
       
    44 class CMMAVideoControl :
       
    45         public CMMAControl,
       
    46         public MMMASnapshotReadyCallback/*,    // 3.x QT based UI
       
    47         public MMIDEnvObserver*/
       
    48 {
       
    49 public:
       
    50     /**
       
    51      * @param aGuiPlayer Player that will be used.
       
    52      */
       
    53     IMPORT_C CMMAVideoControl(MMMAGuiPlayer* aGuiPlayer);
       
    54 
       
    55     /**
       
    56      * Deletes owned objects and removes global reference to
       
    57      * associated displayable object.
       
    58      */
       
    59     IMPORT_C ~CMMAVideoControl();
       
    60 
       
    61     /**
       
    62      * Finishes video control construction. This construction step
       
    63      * must be called from JNI, because JNIEnv is needed to create
       
    64      * callback methods to Java side.
       
    65      *
       
    66      * @param aVideoControl Used video control.
       
    67      * @param aControlObject Corresponding Java object.
       
    68      * @param aJni JNI environment used.
       
    69      * @param aEventPoster Used to post repaint and
       
    70      *                     snapshot ready events.
       
    71      */
       
    72     static void ConstructL(CMMAVideoControl* aVideoControl,
       
    73                            jobject aControlObject,
       
    74                            MMAFunctionServer* aEventSource,
       
    75                            JNIEnv* aJni,
       
    76                            MMMAEventPoster* aEventPoster/*,
       
    77                            CMIDToolkit* aToolkit*/); // mobitv fix // 3.x QT based UI
       
    78 
       
    79 public: // New methods
       
    80     /**
       
    81      * Initializes display. Called when java display mode is initialized.
       
    82      * Created MMMADisplay object and sets it to associated gui player.
       
    83      *
       
    84      * @param aVideoControl Used video control.
       
    85      * @param aComponent Component that will be used to create display.
       
    86      * @param aDisplayHandle Java handle to created display will be set to
       
    87      *                       this variable. Still owned by video control.
       
    88      * @param aDeleteRefEvent Event posted in the destructor.
       
    89      */
       
    90     static void StaticInitL(CMMAVideoControl* aVideoControl,
       
    91                             jobject javaDisplayObject,
       
    92                             MMAFunctionServer* aEventSource,
       
    93                             TInt* aDisplayHandle,
       
    94                             CMMAEvent* aDeleteRefEvent);
       
    95 
       
    96     /**
       
    97      * Dynamic display mode initialization.
       
    98      * @see StaticInitL
       
    99      * @param aVideoControl Used video control.
       
   100      * @param aContentHandle Will contain handle to MMMADirectContent
       
   101      * @param aDeleteRefEvent Event posted in the destructor.
       
   102      */
       
   103     static void StaticInitDynamicModeL(CMMAVideoControl* aVideoControl,
       
   104                                        TInt* aContentHandle,
       
   105                                        MMAFunctionServer* aEventSource,
       
   106                                        jobject aGUIObject,
       
   107                                        CMMAEvent* aDeleteRefEvent);
       
   108 
       
   109 
       
   110     /**
       
   111      * Gets property according to property type.
       
   112      *
       
   113      * @param aControl Used video control.
       
   114      * @param aPropertyType Type defined in Java header.
       
   115      * @param aReturnValue Property value will be set to this parameter.
       
   116      */
       
   117     static void StaticGetPropertyL(CMMAVideoControl* aControl,
       
   118                                    TInt aPropertyType,
       
   119                                    TInt* aReturnValue);
       
   120 
       
   121     /**
       
   122      * Sets property that is defined by type. Amount of propery
       
   123      * parameters used depends on property type.
       
   124      *
       
   125      * @param aControl Used video control.
       
   126      * @param aPropertyType Type defined in Java header.
       
   127      * @param aPropertyA First value.
       
   128      * @param aPropertyB Second value.
       
   129      */
       
   130     static void StaticSetPropertyL(CMMAVideoControl* aControl,
       
   131                                    TInt aPropertyType,
       
   132                                    TInt aPropertyA,
       
   133                                    TInt aPropertyB);
       
   134 
       
   135     /**
       
   136      * Takes snapshot from the associated gui player. When ready
       
   137      * Java side will be informed with iSnapshotReadyMethod.
       
   138      *
       
   139      * @param aControl Used video control.
       
   140      * @param aProperties Properties used to create snapshot.
       
   141      */
       
   142     static void TakeSnapShotL(CMMAVideoControl* aControl,
       
   143                               const TDesC* aProperties);
       
   144     static void StaticSetForegroundL(CMMAVideoControl* aControl,
       
   145                                      TInt aForeground) ;
       
   146 
       
   147 public: // From MMMASnapshotReadyCallback
       
   148     IMPORT_C void SnapshotReady();
       
   149 
       
   150 public: // From CMMAControl
       
   151     IMPORT_C const TDesC& ClassName() const;
       
   152 public:
       
   153     TBool IsForeground();
       
   154     void SetDisplayHandleToJavaPeer(MMAFunctionServer* eventSource ,jobject javaVideoControlPeer);
       
   155 
       
   156 protected:
       
   157 	// 3.x QT based UI
       
   158   //  void RegisterForegroundListenerL(CMIDToolkit* aToolkit); // mobitv fix
       
   159 
       
   160 //public: // from MMIDEnvObserver
       
   161 
       
   162    // void HandleSwitchOnL(TBool /*aSwitchOn*/);
       
   163 
       
   164     //Handles the case when the MIDlet is brought to the foreground.
       
   165  //   void HandleForegroundL(TBool /*aForeground*/);
       
   166 
       
   167     // Handles a change to resources which are shared accross the environment.
       
   168 //    void HandleResourceChangeL(TInt /*aType*/);
       
   169 
       
   170 private:
       
   171 
       
   172     void SetForeground(TBool aForeground, TBool aUseEventServer);
       
   173 
       
   174 protected:
       
   175     /**
       
   176      * Not owned.
       
   177      */
       
   178     MMMAEventPoster* iEventPoster;
       
   179 
       
   180     /**
       
   181      * Not owned.
       
   182      */
       
   183     MMMAGuiPlayer* iGuiPlayer;
       
   184 
       
   185     /**
       
   186      * Not owned.
       
   187      */
       
   188     JNIEnv* iJni;
       
   189 
       
   190     /**
       
   191      * Owned object. Used to control displayable object.
       
   192      */
       
   193     MMMADisplay* iDisplay;
       
   194 
       
   195     /**
       
   196      * Owned object. Created when snapshot is taken and destroyed
       
   197      * when snapshot is ready. Destroyed also in destuctor if control is
       
   198      * destroyed when taking snapshot.
       
   199      */
       
   200     CMMASnapshot* iSnapshot;
       
   201 
       
   202     /**
       
   203      * Java video control object.
       
   204      */
       
   205     jobject iListenerObject;
       
   206 
       
   207     /**
       
   208      * Used inform Java side when snapshot is ready or error occures.
       
   209      */
       
   210     jmethodID iSnapshotReadyMethod;
       
   211 
       
   212     /**
       
   213      * Owned object. Not created by the class.
       
   214      * Event is used to destroy reference to associated displayable object,
       
   215      * when video control is destroyed.
       
   216      */
       
   217     CMMAEvent* iDeleteRefEvent;
       
   218 
       
   219     /**
       
   220      * When video display is set to full screen mode, old
       
   221      * video position & size is stored to this member. When
       
   222      * full screen mode is turned off, this member is used to
       
   223      * find out if display size has been changed during full
       
   224      * screen mode. This is needed to generate a SIZE_CHANGED
       
   225      * event.
       
   226      */
       
   227     TSize iOldDisplaySize;
       
   228     // mobitv fix
       
   229     //CMIDToolkit* iToolkit;
       
   230    // MMIDEnv* iMidEnv;
       
   231     TBool iIsForeground;
       
   232 
       
   233 };
       
   234 
       
   235 #endif // CMMAVIDEOCONTROL_H