browserplugins/browseraudiovideoplugin/inc/BavpView.h
branchRCL_3
changeset 65 8e6fa1719340
equal deleted inserted replaced
64:6385c4c93049 65:8e6fa1719340
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:  Uses the interface MPluginAdapter to notify browser of construction 
       
    15 				 and destruction of the plug-in, implements interface MPluginOptionHandler
       
    16 				 to add menus and draws animated images while video player loading the data
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef BAVPVIEW_H
       
    22 #define BAVPVIEW_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <coecntrl.h>
       
    26 #include <coedef.h>
       
    27 
       
    28 #include "BrowserAudioVideoPlugin.hrh"
       
    29 #include <pluginadapterinterface.h>
       
    30 
       
    31 // CLASS DECLARATION
       
    32 class CBavpPlugin;
       
    33 class CBavpController;
       
    34 class CAknBitmapAnimation;
       
    35 
       
    36 /**
       
    37 *  MBavpView
       
    38 *  Handles window controls for the Browser Audio Video Plugin
       
    39 *  @lib npBrowserVideoPlugin.lib
       
    40 *  @since 3.2
       
    41 */
       
    42 class MBavpView
       
    43 	{
       
    44     public:
       
    45 		/**
       
    46         * Handles the player animation state changes
       
    47 		* @since 3.2
       
    48         * @param  none
       
    49         * @return void
       
    50         */
       
    51 		virtual void UpdateView() = 0;
       
    52 
       
    53 		/**
       
    54         * Returns CCoeControl instance 
       
    55 		* @since 3.2
       
    56         * @param  none
       
    57         * @return CCoeControl instance itself
       
    58         */
       
    59 		virtual CCoeControl& CoeControl() = 0;
       
    60 
       
    61 		/**
       
    62         * Returns handle to a standard window
       
    63 		* @since 3.2
       
    64         * @param  none
       
    65         * @return void
       
    66         */
       
    67 		virtual RWindow& WindowInst() = 0;
       
    68 
       
    69 		/**
       
    70         * Check if the window is the top window instance
       
    71 		* @since 3.2
       
    72         * @param  none
       
    73         * @return void
       
    74         */
       
    75 		virtual TBool IsTopWindowL() = 0;
       
    76 
       
    77 		/**
       
    78         * Check controller status 
       
    79 		* @since 3.2
       
    80         * @param  none
       
    81         * @return void
       
    82         */
       
    83         virtual void ControllerStateChangedL() = 0;
       
    84 
       
    85         virtual TRect WindowRect() = 0;
       
    86         virtual CBavpPlugin* bavPlugin() = 0;
       
    87 	};
       
    88 
       
    89 
       
    90 /**
       
    91 *  CBavpView
       
    92 *  Implent the interface of MBavpView
       
    93 *  @lib npBrowserVideoPlugin.lib
       
    94 *  @since 3.2
       
    95 */
       
    96 class CBavpView : public CCoeControl,
       
    97 				  public MBavpView,
       
    98 				  public MOptionMenuHandler
       
    99     {
       
   100     public:
       
   101 
       
   102         /**
       
   103         * Two-phased constructor.
       
   104         */
       
   105         static CBavpView* NewL( const CCoeControl* aParent, const TRect& aRect, CBavpPlugin* aBavPlugin );
       
   106 
       
   107         /**
       
   108         * Destructor.
       
   109         */
       
   110         ~CBavpView();
       
   111 
       
   112     public: // New functions
       
   113 
       
   114 		/**
       
   115 		* Sets the controller instance on the view
       
   116 		* @since 3.2
       
   117         * @param CBavpController aController
       
   118         * @return void
       
   119 		*/
       
   120 		void SetBavpController( CBavpController* aController )
       
   121 		                        { iBavpController = aController; }
       
   122 
       
   123 		/**
       
   124         * Sets the control's extent, specifying a TRect
       
   125 		* @since 3.2
       
   126         * @param  TRect aRect:The rectangle that defines the control's extent 
       
   127         * @return void
       
   128         */
       
   129 		void SetRect( NPWindow* aWindow );
       
   130 
       
   131 	public: // Methods from MOptionMenuHandler
       
   132 
       
   133 		/**
       
   134         * AddPluginOptionMenuItemsL
       
   135         * Add the Option Menu items to the menuPane, these will be handled by plugin.
       
   136 		* @since 3.2
       
   137         * @param aMenuPane handle of the menu that will contain the options 
       
   138         * @param aCommandBase base id that needs to be added to the command ID 
       
   139         * @param aAfter Plugin options should be added after this index
       
   140         * @return void
       
   141         */
       
   142 		void AddPluginOptionMenuItemsL( CEikMenuPane& aMenuPane, TInt aCommandBase,
       
   143 		                                TInt aAfter );
       
   144 
       
   145         /**
       
   146         * HandlePluginCommandL
       
   147         * Handle the user command from the option menu to the plugin.
       
   148 		* @since 3.2
       
   149         * @param aCommand the command ID of the option
       
   150         * @return void
       
   151         */
       
   152 		void HandlePluginCommandL( TInt aCommand );
       
   153 
       
   154 	public:// Methods from MBavpView
       
   155 
       
   156 		/**
       
   157         * Handles the animation start or cancel status
       
   158 		* @since 3.2
       
   159         * @param  none
       
   160         * @return void
       
   161         */
       
   162 		void UpdateView();
       
   163 
       
   164 		/**
       
   165         * CCoeControl instance 
       
   166 		* @since 3.2
       
   167         * @param none
       
   168         * @return CCoeControl instance itself
       
   169         */
       
   170 		CCoeControl& CoeControl() { return *this; }
       
   171 
       
   172 		/**
       
   173         * Returns RWidnows 
       
   174 		* @since 3.2
       
   175         * @param  none
       
   176         * @return RWindow: handle to a standard window
       
   177         */
       
   178 		RWindow& WindowInst() { return Window(); }
       
   179 		TRect WindowRect() { return iWindowRect; }
       
   180 
       
   181 		/**
       
   182         * Check if the window is the top window instance
       
   183 		* @since 3.2
       
   184         * @param  none
       
   185         * @return void
       
   186         */
       
   187 		TBool IsTopWindowL();
       
   188 
       
   189 		/**
       
   190         * Monitor the controller's status and display mode changes
       
   191 		* @since 3.2
       
   192         * @param  none
       
   193         * @return void
       
   194         */
       
   195 		void ControllerStateChangedL();
       
   196 
       
   197     public:     // Methods from CCoeControl
       
   198 
       
   199         /**
       
   200         * OfferKeyEventL 
       
   201 		* Handle Key press event
       
   202 		* @since 3.2
       
   203         * @param aKeyEvent : The Keyevent that is going to be passed in
       
   204         * @param aType : The type of eventcode  that is going to be passed in
       
   205         * @return TKeyResponse
       
   206         */
       
   207 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   208 		
       
   209 		void HandlePointerEventL(const TPointerEvent &aPointerEvent);
       
   210 
       
   211 	protected:  // Methods from CCoeControl
       
   212 
       
   213 		/**
       
   214 		* Responds to size changes to sets the size and position of the contents of this control. 
       
   215 		* @param none
       
   216 		* @return void
       
   217 		*/
       
   218 		void SizeChanged();
       
   219 
       
   220 		/**
       
   221 		* Called when focus changes
       
   222 		* @param aDrawNow: Flag to redraw now 
       
   223 		* @return void
       
   224 		*/
       
   225         void FocusChanged( TDrawNow /*aDrawNow*/ );
       
   226 
       
   227 		/**
       
   228         * Draw from CCoeControl 
       
   229 		* @param aRect: The rect to draw
       
   230 		* @return void
       
   231 		*/
       
   232         void Draw(const TRect& aRect) const;
       
   233 
       
   234 	public:
       
   235 	    CBavpPlugin* bavPlugin() { return iBavPlugin; }
       
   236     private:    // methods
       
   237 
       
   238         /**
       
   239 		* C++ default constructor.
       
   240         */
       
   241         CBavpView();
       
   242 
       
   243         /**
       
   244         * By default Symbian 2nd phase constructor is private.
       
   245         */
       
   246         void ConstructL( const CCoeControl* aParent, 
       
   247                          const TRect& aRect, CBavpPlugin* aBavPlugin );
       
   248 
       
   249 		/**
       
   250 		* Allows us to insert plugin specific option menu items
       
   251 		*/
       
   252 		void InsertOneMenuItemL( CEikMenuPane& aMenuPane,
       
   253                                  TInt aCommand, TInt aResourceId, TInt index );
       
   254 
       
   255 		/**
       
   256 		* Stops all animations and run the one specified
       
   257 		*/
       
   258         void RunAnimation( CAknBitmapAnimation* aAnimation, TBool &aAnimRunning );
       
   259         
       
   260 	private:    // Data
       
   261 
       
   262         // Pointer to controller
       
   263 		CBavpController* iBavpController;
       
   264 
       
   265 		// The window server session
       
   266         RWsSession iWsSession; 
       
   267 
       
   268 		// Window id
       
   269 		TInt iWindowId;
       
   270 
       
   271 		// Rectangle that defines the control's extent
       
   272 		TRect iRect;
       
   273 		TRect iWindowRect;
       
   274 		TRect iClipRect;
       
   275 
       
   276 		// Flag to add a control from the control stack
       
   277 		TBool iIsOnStack;
       
   278 
       
   279 		// Flag to check if video buffering animation running
       
   280 		TBool iIsVideoBuffAnimRunning;
       
   281 		CAknBitmapAnimation* iVideoBuffAnimation;
       
   282 
       
   283         // Flag to check if bad content animation is running 
       
   284 		TBool iIsBadContentAnimRunning;
       
   285 		CAknBitmapAnimation* iBadContentAnimation;
       
   286         
       
   287         // Flag to check if video stopped animation is running 
       
   288 		TBool iIsVideoStoppedAnimRunning;
       
   289 		CAknBitmapAnimation* iVideoStoppedAnimation;
       
   290         
       
   291         // Flag to check if video paused animation is running 
       
   292 		TBool iIsVideoPausedAnimRunning;
       
   293 		CAknBitmapAnimation* iVideoPausedAnimation;
       
   294         
       
   295 		// Flag to check if audio playing animation running 
       
   296 		TBool iIsAudioPlayAnimRunning;
       
   297 		CAknBitmapAnimation* iAudioPlayAnimation;
       
   298 
       
   299         // Flag to check if audio stopped animation is running 
       
   300 		TBool iIsAudioStoppedAnimRunning;
       
   301 		CAknBitmapAnimation* iAudioStoppedAnimation;
       
   302         
       
   303         // Flag to check if audio paused animation is running 
       
   304 		TBool iIsAudioPausedAnimRunning;
       
   305 		CAknBitmapAnimation* iAudioPausedAnimation;
       
   306         
       
   307 		// Command Id that webengine passed in for plugin
       
   308 		TInt iCommandBase;
       
   309 		CBavpPlugin* iBavPlugin;
       
   310     };
       
   311 
       
   312 #endif      // CBavpVIEW_H
       
   313 
       
   314 // End of File