imageeditor/inc/DrawUtils.h
changeset 1 edfc90759b9f
equal deleted inserted replaced
0:57d4cdd99204 1:edfc90759b9f
       
     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 * Draw utility class header file.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef DRAWUTILS_H
       
    22 #define DRAWUTILS_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <gdi.h>
       
    26 #include <e32base.h>
       
    27 #include <badesca.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CAknWaitDialog;
       
    31 class CAknProgressDialog;
       
    32 class MProgressDialogCallback;
       
    33 class CAknInfoPopupNoteController;
       
    34 
       
    35 /*  CLASS: SDrawUtils
       
    36 *
       
    37 *	SDrawUtils wraps often used UI drawing utilities into single class
       
    38 */ 
       
    39 class SDrawUtils
       
    40 {
       
    41 
       
    42 public:
       
    43 
       
    44 /** @name TypeDefs:*/
       
    45 //@{
       
    46     enum TGuideType
       
    47     {
       
    48         //  Invalid
       
    49         EGuideTypeMin,
       
    50         //  Guide arrow up
       
    51         EGuideTypeUp,
       
    52         //  Guide arrow down
       
    53         EGuideTypeDown,
       
    54         //  Guide arrow left
       
    55         EGuideTypeLeft,
       
    56         //  Guide arrow right
       
    57         EGuideTypeRight,
       
    58         //  Invalid
       
    59         EGuideTypeMax
       
    60     };
       
    61 
       
    62 //@}
       
    63 
       
    64 /** @name Methods:*/
       
    65 //@{
       
    66 
       
    67 	/** DrawGuide
       
    68 	*
       
    69     *   Draws arrow guide to CWindowGc.
       
    70     *
       
    71 	*	@param aGc -		grapics context
       
    72 	*	@param aRect -		surrouding rectangle
       
    73 	*	@param aType -		guide type
       
    74 	*	@param aColor -		guide color
       
    75 	*	@return -
       
    76 	*/
       
    77     IMPORT_C static void DrawGuide (
       
    78         CGraphicsContext &  aGc,
       
    79         const TRect &       aRect,
       
    80         const TGuideType    aType,
       
    81         const TRgb &        aColor
       
    82         );
       
    83 
       
    84 	/** DrawBeveledRect
       
    85 	*
       
    86     *   Draws a 3D beveled rectangle.
       
    87     *
       
    88 	*	@param aGc -		grapics context
       
    89 	*	@param aRect -		surrouding rectangle (includes the borders)
       
    90 	*	@param aColor -		rectangle color
       
    91 	*	@param aLight -		light color
       
    92 	*	@param aShadow -	shadow color
       
    93 	*	@return -
       
    94 	*/
       
    95     IMPORT_C static void DrawBeveledRect (
       
    96         CGraphicsContext &  aGc,
       
    97         const TRect &       aRect,
       
    98         const TRgb &        aColor,
       
    99         const TRgb &        aLight,
       
   100         const TRgb &        aShadow
       
   101         );
       
   102 
       
   103 	/** DrawFlatRect
       
   104 	*
       
   105     *   Draws a 3D flat rectangle.
       
   106     *
       
   107 	*	@param aGc -		grapics context
       
   108 	*	@param aRect -		surrouding rectangle (includes the borders)
       
   109 	*	@param aColor -		rectangle color
       
   110 	*	@param aLight -		light color
       
   111 	*	@param aShadow -	shadow color
       
   112 	*	@return -
       
   113 	*/
       
   114     IMPORT_C static void DrawFlatRect (
       
   115         CGraphicsContext &  aGc,
       
   116         const TRect &       aRect,
       
   117         const TRgb &        aColor,
       
   118         const TRgb &        aLight,
       
   119         const TRgb &        aShadow
       
   120         );
       
   121 
       
   122 	/** LaunchQueryDialogL
       
   123 	*
       
   124     *   Launches a confirmation query dialog.
       
   125     *
       
   126 	*	@param aPrompt - dialog prompt descriptor
       
   127 	*	@return -
       
   128 	*/
       
   129     IMPORT_C static TInt LaunchQueryDialogL (const TDesC & aPrompt);
       
   130 
       
   131 	/** LaunchQueryDialogOkOnlyL
       
   132 	*
       
   133     *   Launches a confirmation query dialog with only OK softkey
       
   134     *   available.
       
   135     *
       
   136 	*	@param aPrompt - dialog prompt descriptor
       
   137 	*	@return -
       
   138 	*/
       
   139     IMPORT_C static TInt LaunchQueryDialogOkOnlyL (const TDesC & aPrompt);
       
   140 
       
   141 	/** LaunchTextQueryDialogL
       
   142 	*
       
   143     *   Launches a text query dialog and returns the queried descriptor.
       
   144 	*	aData includes the data shown in the edit window and on return,
       
   145 	*	includes the edited text data.
       
   146     *
       
   147 	*	@param aData -		data descriptor
       
   148 	*	@param aPrompt -	dialog prompt descriptor
       
   149 	*	@return -
       
   150 	*/
       
   151     IMPORT_C static TInt LaunchTextQueryDialogL (
       
   152         TDes &			aData,
       
   153 	    const TDesC &	aPrompt
       
   154         );
       
   155 
       
   156 	/** LaunchMultiLineTextQueryDialogL
       
   157 	*
       
   158     *   Launches a multiline text query dialog and returns the queried descriptor.
       
   159 	*	aData includes the data shown in the edit window and on return,
       
   160 	*	includes the edited text data.
       
   161     *
       
   162 	*	@param aData -		data descriptor
       
   163 	*	@param aPrompt -	dialog prompt descriptor
       
   164 	*	@return -
       
   165 	*/
       
   166     IMPORT_C static TInt LaunchMultiLineTextQueryDialogL (
       
   167         TDes &			aData,
       
   168 	    const TDesC &	aPrompt
       
   169         );
       
   170 
       
   171     /** LaunchListQueryDialogL
       
   172 	*
       
   173     *   Launches a list query dialog and returns the selected index.
       
   174 	*	aData includes the descriptor array of selection items.
       
   175     *
       
   176 	*	@param aTextItems - text item descriptor array
       
   177 	*	@param aPrompt - dialog prompt descriptor
       
   178 	*	@return -
       
   179 	*/
       
   180     IMPORT_C static TInt LaunchListQueryDialogL (
       
   181 		MDesCArray *		aTextItems,
       
   182 		const TDesC &		aPrompt
       
   183         );
       
   184 
       
   185 	/** LaunchWaitNoteL
       
   186 	*
       
   187     *   Creates and launches a wait note dialog and returns a pointer to
       
   188 	*	it.
       
   189 	*   @param -	aSelfPtr
       
   190     *				The wait dialog is allocated at this pointer.
       
   191 	*				The pointer needs to be valid when the dialog 
       
   192 	*				is dismissed and must be a class member.
       
   193 	*	@param 		aResourceID - resource ID for prompt
       
   194 	*	@param 		aPrompt - wait dialog prompt
       
   195 	*   @param 		aCallback
       
   196 	*				The wait dialog callback.
       
   197 	*				Pass NULL if no callback is needed.
       
   198 	*	@return - pointer to wait dialog
       
   199 	*/
       
   200 	IMPORT_C static void LaunchWaitNoteL (
       
   201 		CAknWaitDialog** 			aSelfPtr,
       
   202 		TInt						aResourceID,
       
   203 		const TDesC &				aPrompt,
       
   204         MProgressDialogCallback*	aCallback = NULL
       
   205 		);
       
   206 
       
   207 	/** LaunchProgressNoteL
       
   208 	*
       
   209     *   Creates and launches a wait note dialog and returns a pointer to
       
   210 	*	it.
       
   211 	*   @param -	aSelfPtr
       
   212     *				The wait dialog is allocated at this pointer.
       
   213 	*				The pointer needs to be valid when the dialog 
       
   214 	*				is dismissed and must be a class member.
       
   215 	*	@param 		aResourceID - resource ID for prompt
       
   216 	*	@param 		aPrompt - wait dialog prompt
       
   217 	*	@param 		aFinalValue     Final value for the process
       
   218 	*   @param 		aCallback
       
   219 	*				The wait dialog callback.
       
   220 	*				Pass NULL if no callback is needed.
       
   221 	*	@return - pointer to wait dialog
       
   222 	*/
       
   223 	IMPORT_C static void LaunchProgressNoteL (
       
   224 		CAknProgressDialog** 		aSelfPtr,
       
   225 		TInt						aResourceID,
       
   226 		const TDesC &				aPrompt,
       
   227 		TInt						aFinalValue = 0,
       
   228         MProgressDialogCallback*	aCallback = NULL
       
   229 		);
       
   230 
       
   231 	/** LaunchColorSelectionGridL
       
   232 	*
       
   233     *   Launches a color selection grid inside a pop-up list. Returns 
       
   234     *   KErrNone if color was selected.
       
   235     *
       
   236 	*	@param aColor - includes the selected color on return
       
   237 	*	@return - KErrNone if color selected
       
   238 	*/
       
   239     IMPORT_C static TInt LaunchColorSelectionGridL (TRgb & aColor);
       
   240     
       
   241     /** LaunchColorSelectionPopupL
       
   242 	*
       
   243     *   Launches a semi-transparent 35 color selection popup component. 
       
   244     *   Color grid is launched via a dialog. 
       
   245     *   
       
   246     *	@param aPreview - a constant pointer to a bitmap image that should be
       
   247     *                     drawn to background
       
   248     *	@param aRect - rectangle of calling control (use main pane rect)
       
   249 	*	@param aColor - includes the selected color on return
       
   250 	*	@return - KErrNone if color selected
       
   251 	*/
       
   252     IMPORT_C static TInt LaunchColorSelectionPopupL (const CFbsBitmap* aPreview,
       
   253                                                            TRect aRect, 
       
   254                                                            TRgb & aColor);
       
   255     
       
   256     
       
   257 	/** GetIndicatorBitmapL
       
   258 	*
       
   259     *   Load the indicator cursor bitmap and mask.
       
   260     *
       
   261 	*	@param aChBitmap	- reference to cursor bitmap pointer
       
   262 	*	@param aChMask		- reference to cursor mask pointer
       
   263 	*	@param aBmpIndex	- bitmap MBM index
       
   264 	*	@param aMaskIndex	- mask MBM index
       
   265 	*	@return - KErrNone if successful
       
   266 	*/
       
   267     IMPORT_C static TInt GetIndicatorBitmapL (
       
   268 		CFbsBitmap *&	aChBitmap,
       
   269 		CFbsBitmap *&	aChMask,
       
   270 		TInt			aBmpIndex,
       
   271 		TInt			aMaskIndex
       
   272 		);
       
   273 		
       
   274     /** ShowToolTip
       
   275     *
       
   276     *   Show a tooltip note on the screen. This function calculates the
       
   277     *   relative position on the screen for the tooltip.
       
   278     *
       
   279     *   @param aPopupController - pointer to popup note controller
       
   280     *   @param aCallingControl - pointer to a calling control
       
   281     *   @param aPositionRect - position rect where the tooltip should be shown
       
   282     *   @param aText - text to be shown
       
   283     *   @return - 
       
   284     */
       
   285     IMPORT_C static void ShowToolTip ( 
       
   286         CAknInfoPopupNoteController* aPopupController,
       
   287         CCoeControl* aCallingControl, 
       
   288         TRect aPositionRect,
       
   289         const TDesC& aText
       
   290         );
       
   291     
       
   292     /** ShowToolTip
       
   293     *
       
   294     *   Show a tooltip note on the screen. This function calculates the
       
   295     *   relative position on the screen for the tooltip.
       
   296     *
       
   297     *   @param aPopupController - pointer to popup note controller
       
   298     *   @param aCallingControl - pointer to a calling control
       
   299     *   @param aPosition - position where the tooltip should be shown
       
   300     *   @param aAlignment - GUI alignment to use
       
   301     *   @param aText - text to be shown
       
   302     *   @return - 
       
   303     */
       
   304     IMPORT_C static void ShowToolTip ( 
       
   305         CAknInfoPopupNoteController* aPopupController,
       
   306         CCoeControl* aCallingControl,
       
   307         TPoint aPosition, 
       
   308         TGulAlignmentValue aAlignment,
       
   309         const TDesC& aText
       
   310         );  
       
   311 
       
   312 //@}
       
   313 
       
   314 protected:
       
   315 
       
   316 /** @name Methods:*/
       
   317 //@{
       
   318 
       
   319 //@}
       
   320 
       
   321 /** @name Members:*/
       
   322 //@{
       
   323 	/// 
       
   324 //@}
       
   325 
       
   326 private:
       
   327 
       
   328 /** @name Methods:*/
       
   329 //@{
       
   330 
       
   331 //@}
       
   332 
       
   333 /** @name Members:*/
       
   334 //@{
       
   335 
       
   336 //@}
       
   337 
       
   338 };
       
   339 
       
   340 
       
   341 #endif
       
   342 
       
   343 // End of File
       
   344