videditor/VideoEditorUiComponents/inc/VeiCutterBar.h
changeset 0 951a5db380a0
child 6 82f48373d3dd
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "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 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 * Declares CVeiCutterBar control for the Video Editor.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef VEICUTTERBAR_H
       
    23 #define VEICUTTERBAR_H
       
    24 
       
    25 #include <coecntrl.h>
       
    26 
       
    27 class CPeriodic;
       
    28 
       
    29 /**
       
    30  * CVeiCutterBar control class.
       
    31  */
       
    32 class CVeiCutterBar : public CCoeControl, public MCoeControlObserver
       
    33     {
       
    34     public:
       
    35     		/**
       
    36 		 * CVeiCutterBar components.
       
    37 		 */
       
    38 		 enum TCutterBarComponent
       
    39 			{
       
    40 			EScissorsIcon = 1,
       
    41 			EProgressBar,
       
    42 			ESliderLeftEndIcon,
       
    43 			ESliderMiddleIcon,
       
    44 			ESliderRightEndIcon,
       
    45 			ESliderSelectedLeftEndIcon,
       
    46 			ESliderSelectedMiddleIcon,
       
    47 			ESliderSelectedRightEndIcon,
       
    48 			EPlayheadIcon,
       
    49 			ECutAreaBorderIcon,
       
    50 			EStartMarkIcon,
       
    51 			EEndMarkIcon,
       
    52 			EPlayheadTouch,
       
    53 			EStartMarkTouch,
       
    54 			EEndMarkTouch
       
    55 			};
       
    56         
       
    57         // CVeiCutterBar icons that can be in pressed state
       
    58         enum TCutterBarPressedIcon
       
    59 			{
       
    60 			ENoPressedIcon = 0,
       
    61 			EPressedPlayheadTouch,
       
    62 			EPressedStartMarkTouch,
       
    63 			EPressedEndMarkTouch
       
    64 			};
       
    65     public:
       
    66         /**
       
    67          * Destructor.
       
    68          */
       
    69         IMPORT_C virtual ~CVeiCutterBar();
       
    70 
       
    71 		/** 
       
    72 		 * Static factory method.
       
    73 		 * 
       
    74 		 * @param aCont  pointer to the container
       
    75 		 *
       
    76 		 * @return  the created CVeiCutterBar object
       
    77 		 */
       
    78 		IMPORT_C static CVeiCutterBar* NewL( const CCoeControl* aParent, TBool aDrawBorder = EFalse );
       
    79 
       
    80 		/** 
       
    81 		 * Static factory method. Leaves the created object in the cleanup
       
    82 		 * stack.
       
    83 		 * 
       
    84 		 * @param aCont  pointer to the container
       
    85 		 *
       
    86 		 * @return  the created CVeiCutterBar object
       
    87 		 */
       
    88 		IMPORT_C static CVeiCutterBar* NewLC( const CCoeControl* aParent, TBool aDrawBorder = EFalse  );
       
    89 
       
    90     public:
       
    91 
       
    92 		IMPORT_C virtual void SetPlayHeadVisible( TBool aVisible );
       
    93 		/**
       
    94 		 * Sets the mark in point.
       
    95 		 *
       
    96 		 * @param aIn  new In-point
       
    97 		 */
       
    98 		IMPORT_C virtual void SetInPoint( const TTimeIntervalMicroSeconds& aIn );
       
    99 
       
   100 		/**
       
   101 		 * Sets the mark out point.
       
   102 		 *
       
   103 		 * @param aOut  new Out-point
       
   104 		 */
       
   105 		IMPORT_C virtual void SetOutPoint( const TTimeIntervalMicroSeconds& aOut );
       
   106 
       
   107 		/**
       
   108 		 * Sets the "finished" status, i.e., if the clip is finished, the
       
   109 		 * leftover areas outside in/out points are grayed out.
       
   110 		 *
       
   111 		 * @param aStatus  <code>ETrue</code> for "is finished";
       
   112 		 *                 <code>EFalse</code> for "not finished"
       
   113 		 */
       
   114 		IMPORT_C virtual void SetFinishedStatus( TBool aStatus );
       
   115 
       
   116 		IMPORT_C virtual void SetTotalDuration( const TTimeIntervalMicroSeconds& aDuration );
       
   117 
       
   118 		IMPORT_C virtual void SetCurrentPoint( TInt aLocation );
       
   119 
       
   120 		IMPORT_C virtual void Dim( TBool aDimmed );
       
   121 
       
   122 		/** 
       
   123 		 * Getter for iCutBarRect
       
   124 		 * CVeiCutterBar's rect covers also the scissor icon area but iCutBarRect 
       
   125 		 * is the visible area of the progress bar
       
   126 		 * 
       
   127 		 * @param -
       
   128 		 *
       
   129 		 * @return  the progress bar rect
       
   130 		 */
       
   131 		IMPORT_C TRect ProgressBarRect(); 
       
   132 		
       
   133 		/** 
       
   134 		 * Returns the playhead rectangle.
       
   135 		 * If the playheadhasn't been set, returns an empty rect
       
   136 		 * 
       
   137 		 * @param -
       
   138 		 *
       
   139 		 * @return  playhead rect or empty rect
       
   140 		 */		
       
   141 		IMPORT_C TRect PlayHeadRect(); 
       
   142 
       
   143 		/** 
       
   144 		 * Returns the start mark rectangle.
       
   145 		 * If the start mark hasn't been set, returns an empty rect
       
   146 		 * 
       
   147 		 * @param -
       
   148 		 *
       
   149 		 * @return  start mark rect or empty rect
       
   150 		 */		
       
   151 		IMPORT_C TRect StartMarkRect(); 
       
   152 
       
   153 		/** 
       
   154 		 * Returns the end mark rectangle.
       
   155 		 * If the end mark hasn't been set, returns an empty rect
       
   156 		 * 
       
   157 		 * @param -
       
   158 		 *
       
   159 		 * @return  end mark rect or empty rect
       
   160 		 */		
       
   161 		IMPORT_C TRect EndMarkRect(); 
       
   162 
       
   163 		/** 
       
   164 		 * Returns the start mark position in progress bar
       
   165 		 * 
       
   166 		 * @param -
       
   167 		 *
       
   168 		 * @return  the start mark position
       
   169 		 */		
       
   170 		IMPORT_C TUint StartMarkPoint(); 
       
   171 		
       
   172 		/** 
       
   173 		 * Returns the end mark position in progress bar
       
   174 		 * 
       
   175 		 * @param -
       
   176 		 *
       
   177 		 * @return  the end mark position
       
   178 		 */		
       
   179 		IMPORT_C TUint EndMarkPoint(); 
       
   180 
       
   181 		/** 
       
   182 		 * Sets the rect of a component
       
   183 		 * 
       
   184 		 * @param aComponentIndex specifies the component
       
   185 		 * @param aRect the rect that the component is set
       
   186 		 *
       
   187 		 * @return  the end mark position
       
   188 		 */		
       
   189 		IMPORT_C void SetComponentRect(TCutterBarComponent aComponentIndex, TRect aRect);
       
   190 		
       
   191 		/** 
       
   192 		 * Sets one of the cutterbar components to pressed state. This function
       
   193 		 * can also be used to set ENoPressedIcon as pressed component (= none
       
   194 		 * of the components is pressed) 
       
   195 		 * 
       
   196 		 * @param aComponentIndex specifies the component that should be 
       
   197 		 *          set to pressed state
       
   198 		 *
       
   199 		 * @return -
       
   200 		 */	
       
   201 		IMPORT_C void SetPressedComponent(TCutterBarPressedIcon aComponentIndex);
       
   202 
       
   203     public:
       
   204 
       
   205 		/**
       
   206 		 * Handles key events from framework.
       
   207 		 * 
       
   208 		 * @param aKeyEvent  the key event
       
   209 		 * @param aType  the type of key event
       
   210 		 *
       
   211 		 * @return always <code>EKeyWasNotConsumed</code>
       
   212 		 */
       
   213 		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
       
   214 			TEventCode aType);        
       
   215 
       
   216     private:
       
   217 
       
   218         /**
       
   219          * Default constructor.
       
   220 		 *
       
   221          * @param aCont  pointer to the container
       
   222          */
       
   223         void ConstructL( const CCoeControl* aParent, TBool aDrawBorder );
       
   224 
       
   225        /**
       
   226         * From CoeControl,SizeChanged.
       
   227         */
       
   228         void SizeChanged();
       
   229 
       
   230        /**
       
   231         * From CoeControl,CountComponentControls.
       
   232 		*
       
   233 		* @return  number of component controls in this control
       
   234         */
       
   235         TInt CountComponentControls() const;
       
   236 
       
   237        /**
       
   238         * From CCoeControl,ComponentControl.
       
   239 		*
       
   240 		* @param aIndex  index of the control to return
       
   241         */
       
   242         CCoeControl* ComponentControl(TInt aIndex) const;
       
   243 
       
   244        /**
       
   245         * From CCoeControl,Draw.
       
   246 		*
       
   247 		* @param aRect  rectangle to draw
       
   248         */
       
   249         void Draw(const TRect& aRect) const;
       
   250 
       
   251        /**
       
   252         * From MCoeControlObserver, called when there is a control event
       
   253 		* to handle.
       
   254 		*
       
   255 		* @param aControl  control originating the event
       
   256 		* @param aEventType  event type
       
   257         */
       
   258         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   259                 
       
   260         // for test use
       
   261         void DrawCoordinate(TInt aX, TInt aY, TInt aData1, TInt aData2, const TDesC& aInfo) const;
       
   262 
       
   263 		/**
       
   264 		 * Calculates the rect of the slider area that the user 
       
   265 		 * has selected to be cut
       
   266 		 * 
       
   267 		 * @param -
       
   268 		 *
       
   269 		 * @return rect of the area to be cut
       
   270 		 */
       
   271         TRect CVeiCutterBar::CalculateCutAreaRect() const;
       
   272 
       
   273     private:
       
   274 
       
   275 		/** In point. */
       
   276 		TUint iInPoint;
       
   277 
       
   278 		/** Out point. */
       
   279 		TUint iOutPoint;
       
   280 
       
   281 		TUint iTotalDuration;
       
   282 		/** Current point. This is where the vertical bar is drawn. */
       
   283 		TUint iCurrentPoint;
       
   284 
       
   285 		/** Flag for marking when the editing is finished. */
       
   286 		TBool iFinished;
       
   287 
       
   288 		TRect iCutBarRect;
       
   289 		TRect iScissorsIconRect;
       
   290 		
       
   291 		TBool iDimmed;
       
   292 		TBool iDrawBorder;
       
   293 		TBool iDrawPlayHead;
       
   294 		
       
   295 		/** Slider Graphics */
       
   296 		CFbsBitmap*		iScissorsIcon;
       
   297 		CFbsBitmap*		iScissorsIconMask;
       
   298 		CFbsBitmap*		iSliderLeftEndIcon;
       
   299 		CFbsBitmap*		iSliderLeftEndIconMask;
       
   300 		CFbsBitmap*		iSliderMiddleIcon;
       
   301 		CFbsBitmap*		iSliderMiddleIconMask;
       
   302 		CFbsBitmap*		iSliderRightEndIcon;
       
   303 		CFbsBitmap*		iSliderRightEndIconMask;		
       
   304 		CFbsBitmap*		iSliderSelectedLeftEndIcon;
       
   305 		CFbsBitmap*		iSliderSelectedLeftEndIconMask;
       
   306 		CFbsBitmap*		iSliderSelectedMiddleIcon;
       
   307 		CFbsBitmap*		iSliderSelectedMiddleIconMask;
       
   308 		CFbsBitmap*		iSliderSelectedRightEndIcon;
       
   309 		CFbsBitmap*		iSliderSelectedRightEndIconMask;		
       
   310 		CFbsBitmap*		iPlayheadIcon;
       
   311 		CFbsBitmap*		iPlayheadIconMask;
       
   312 		CFbsBitmap*		iPlayheadIconPressed;
       
   313 		CFbsBitmap*		iPlayheadIconPressedMask;
       
   314 		CFbsBitmap*		iStartMarkIcon;
       
   315 		CFbsBitmap*		iStartMarkIconMask;	
       
   316 		CFbsBitmap*		iStartMarkIconPressed;
       
   317 		CFbsBitmap*		iStartMarkIconPressedMask;	
       
   318 		CFbsBitmap*		iEndMarkIcon;
       
   319 		CFbsBitmap*		iEndMarkIconMask;
       
   320 		CFbsBitmap*		iEndMarkIconPressed;
       
   321 		CFbsBitmap*		iEndMarkIconPressedMask;		
       
   322 		CFbsBitmap*		iCutAreaBorderIcon;
       
   323 		CFbsBitmap*		iCutAreaBorderIconMask;		
       
   324 
       
   325 		/** Rects for the slider graphics */
       
   326 		TRect  iSliderLeftEndIconRect;
       
   327 		TRect  iSliderRightEndIconRect;
       
   328 		TRect  iSliderMiddleIconRect;
       
   329 		TRect  iSliderSelectedLeftEndIconRect;
       
   330 		TRect  iSliderSelectedMiddleIconRect;
       
   331 		TRect  iSliderSelectedRightEndIconRect;
       
   332 		TRect  iPlayheadIconRect;
       
   333 		TRect  iCutAreaBorderIconRect;
       
   334 
       
   335 		/** Start mark rect. Position moves dynamically. */
       
   336         TRect iStartMarkRect;
       
   337 
       
   338 		/** End mark rect. Position moves dynamically. */        
       
   339         TRect iEndMarkRect;
       
   340 
       
   341         TRect iStartMarkTouchRect;
       
   342         TRect iEndMarkTouchRect;
       
   343 		TRect iPlayheadTouchRect;
       
   344 		
       
   345 		// Tells what cutter bar component is pressed if any
       
   346 		TCutterBarPressedIcon iPressedComponent;
       
   347 
       
   348     };
       
   349 #endif
       
   350 
       
   351 // End of File