browserplugins/browseraudiovideoplugin/inc/BavpView.h
changeset 0 84ad3b177aa3
child 5 e45c3f40ea5f
equal deleted inserted replaced
-1:000000000000 0:84ad3b177aa3
       
     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 	protected:  // Methods from CCoeControl
       
   210 
       
   211 		/**
       
   212 		* Responds to size changes to sets the size and position of the contents of this control. 
       
   213 		* @param none
       
   214 		* @return void
       
   215 		*/
       
   216 		void SizeChanged();
       
   217 
       
   218 		/**
       
   219 		* Called when focus changes
       
   220 		* @param aDrawNow: Flag to redraw now 
       
   221 		* @return void
       
   222 		*/
       
   223         void FocusChanged( TDrawNow /*aDrawNow*/ );
       
   224 
       
   225 		/**
       
   226         * Draw from CCoeControl 
       
   227 		* @param aRect: The rect to draw
       
   228 		* @return void
       
   229 		*/
       
   230         void Draw(const TRect& aRect) const;
       
   231 
       
   232 	public:
       
   233 	    CBavpPlugin* bavPlugin() { return iBavPlugin; }
       
   234     private:    // methods
       
   235 
       
   236         /**
       
   237 		* C++ default constructor.
       
   238         */
       
   239         CBavpView();
       
   240 
       
   241         /**
       
   242         * By default Symbian 2nd phase constructor is private.
       
   243         */
       
   244         void ConstructL( const CCoeControl* aParent, 
       
   245                          const TRect& aRect, CBavpPlugin* aBavPlugin );
       
   246 
       
   247 		/**
       
   248 		* Allows us to insert plugin specific option menu items
       
   249 		*/
       
   250 		void InsertOneMenuItemL( CEikMenuPane& aMenuPane,
       
   251                                  TInt aCommand, TInt aResourceId, TInt index );
       
   252 
       
   253 		/**
       
   254 		* Stops all animations and run the one specified
       
   255 		*/
       
   256         void RunAnimation( CAknBitmapAnimation* aAnimation, TBool &aAnimRunning );
       
   257         
       
   258 	private:    // Data
       
   259 
       
   260         // Pointer to controller
       
   261 		CBavpController* iBavpController;
       
   262 
       
   263 		// The window server session
       
   264         RWsSession iWsSession; 
       
   265 
       
   266 		// Window id
       
   267 		TInt iWindowId;
       
   268 
       
   269 		// Rectangle that defines the control's extent
       
   270 		TRect iRect;
       
   271 		TRect iWindowRect;
       
   272 		TRect iClipRect;
       
   273 
       
   274 		// Flag to add a control from the control stack
       
   275 		TBool iIsOnStack;
       
   276 
       
   277 		// Flag to check if video buffering animation running
       
   278 		TBool iIsVideoBuffAnimRunning;
       
   279 		CAknBitmapAnimation* iVideoBuffAnimation;
       
   280 
       
   281         // Flag to check if bad content animation is running 
       
   282 		TBool iIsBadContentAnimRunning;
       
   283 		CAknBitmapAnimation* iBadContentAnimation;
       
   284         
       
   285         // Flag to check if video stopped animation is running 
       
   286 		TBool iIsVideoStoppedAnimRunning;
       
   287 		CAknBitmapAnimation* iVideoStoppedAnimation;
       
   288         
       
   289         // Flag to check if video paused animation is running 
       
   290 		TBool iIsVideoPausedAnimRunning;
       
   291 		CAknBitmapAnimation* iVideoPausedAnimation;
       
   292         
       
   293 		// Flag to check if audio playing animation running 
       
   294 		TBool iIsAudioPlayAnimRunning;
       
   295 		CAknBitmapAnimation* iAudioPlayAnimation;
       
   296 
       
   297         // Flag to check if audio stopped animation is running 
       
   298 		TBool iIsAudioStoppedAnimRunning;
       
   299 		CAknBitmapAnimation* iAudioStoppedAnimation;
       
   300         
       
   301         // Flag to check if audio paused animation is running 
       
   302 		TBool iIsAudioPausedAnimRunning;
       
   303 		CAknBitmapAnimation* iAudioPausedAnimation;
       
   304         
       
   305 		// Command Id that webengine passed in for plugin
       
   306 		TInt iCommandBase;
       
   307 		CBavpPlugin* iBavPlugin;
       
   308     };
       
   309 
       
   310 #endif      // CBavpVIEW_H
       
   311 
       
   312 // End of File