imageeditor/plugins/ClipartPlugin/inc/ClipartSelectionDialog.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 * Dialog for clipart plugin.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CLIPARTSELECTIONDIALOG_H
       
    22 #define CLIPARTSELECTIONDIALOG_H
       
    23 
       
    24 #include <AknDialog.h>
       
    25 #include <aknprogressdialog.h>
       
    26 
       
    27 #include "clipartscaler.h"
       
    28 #include "CallbackMethod.h"
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 class CClipartSelectionGrid;
       
    32 class CGulIcon;
       
    33 class CDir;
       
    34 class CAknIconArray;
       
    35 class CClipartScaler;
       
    36 class CObCallback;
       
    37 
       
    38 
       
    39 class CClipartSelectionDialog : public CEikDialog, 
       
    40                                 public MClipartScalerNotifier, 
       
    41                                 public MProgressDialogCallback,
       
    42                                 public MEikListBoxObserver,
       
    43                                 public MObCallbackMethod
       
    44     {
       
    45 
       
    46     class TClipartListItem
       
    47         {
       
    48     public:
       
    49         TFileName iFilename;
       
    50         TInt iIndex;
       
    51         };
       
    52 
       
    53     typedef RArray<TClipartListItem> RClipartList;
       
    54     
       
    55     enum TState
       
    56         {
       
    57         EIdle,
       
    58         EScalingBitmap,
       
    59         EScalingMask
       
    60         };
       
    61 
       
    62 public:
       
    63 
       
    64   	/** Constructor
       
    65 	*
       
    66 	*	@param aClipartFileName - Clipart filename
       
    67 	*   @param aClipartFileNameIndex - Clipart filename index
       
    68 	*	@return -
       
    69 	*/
       
    70     CClipartSelectionDialog(TFileName& aClipartFileName, TInt& aClipartFileNameIndex);
       
    71 
       
    72   	/** Destructor
       
    73 	*
       
    74 	*	@param  -
       
    75 	*	@return -
       
    76 	*/
       
    77     virtual ~CClipartSelectionDialog();
       
    78 
       
    79   	/** ConstructL
       
    80 	*
       
    81 	*	Second phase constructor
       
    82 	*
       
    83 	*   @param aParent - Parent control
       
    84 	*	
       
    85 	*/
       
    86 	void ConstructL(MCoeControlObserver* aParent);
       
    87 
       
    88     /** OkToExitL
       
    89     * 
       
    90     * From CAknDialog update member variables .
       
    91     * @param aButtonId The ID of the button that was activated.
       
    92     * @return Should return ETrue if the dialog should exit,
       
    93     *    and EFalse if it should not
       
    94     */
       
    95     TBool OkToExitL( TInt aButtonId );
       
    96 
       
    97 	/**	SetBusy
       
    98 	*
       
    99 	* @param aBusy - Set control busy
       
   100 	*
       
   101     */
       
   102     void SetBusy(TBool aBusy);
       
   103 
       
   104     /** SetSizeAndPosition
       
   105     *   
       
   106     *   @see CEikDialog
       
   107     *   
       
   108     */
       
   109 	void SetSizeAndPosition( const TSize& /*aSize*/ );
       
   110 
       
   111     /** ClipartFilenameL
       
   112 	*
       
   113     *   Get select clipart filename and index
       
   114     *
       
   115 	*	@param aFilename - Clipart filename with full path
       
   116     *   @param aIndex    - Clipart index in the MBM file 
       
   117     *	@return -
       
   118 	*/
       
   119     void ClipartFilenameL(TDes& aFilename, TInt& aIndex);
       
   120 
       
   121     /** ClipartScalerOperationReadyL
       
   122 	*
       
   123     *   Called by the Clipart scaler when operation is ready
       
   124     *
       
   125 	*	@see MClipartScalerNotifier
       
   126     *
       
   127 	*/
       
   128     void ClipartScalerOperationReadyL(TInt aError) ;
       
   129 
       
   130     /** DialogDismissedL
       
   131     *   
       
   132     *   @see MProgressDialogCallback
       
   133     *   
       
   134     */
       
   135     void DialogDismissedL( TInt aButtonId );
       
   136 
       
   137     /**
       
   138     *   
       
   139     *   @see MObCallbackMethod
       
   140     *   
       
   141     */
       
   142     TBool CallbackMethodL( TInt aParam );
       
   143 
       
   144     /** PreLayoutDynInitL
       
   145     *   
       
   146     *   @see CEikDialog
       
   147     *   
       
   148     */
       
   149 	void PreLayoutDynInitL();
       
   150 
       
   151     /** CreateCustomControlL
       
   152     *   
       
   153     *   @see CEikDialog
       
   154     *   
       
   155     */
       
   156 	SEikControlInfo CreateCustomControlL(TInt aControlType);
       
   157 	
       
   158 	/** OfferKeyEventL
       
   159     *   
       
   160     *   @see CEikDialog
       
   161     *   
       
   162     */
       
   163 	virtual TKeyResponse OfferKeyEventL (
       
   164         const TKeyEvent &   aKeyEvent,
       
   165         TEventCode          aType
       
   166         );  
       
   167 
       
   168 	virtual void HandleDialogPageEventL(TInt /*aEventId*/);
       
   169 
       
   170 	virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   171 
       
   172 	void HandleResourceChange(TInt aType);
       
   173 private:
       
   174 
       
   175 	/*	SetupGrid
       
   176 	*
       
   177 	*	Sets up grid every time the grid size changes.
       
   178 	*
       
   179 	*   @param -
       
   180 	*   @return -
       
   181 	*/
       
   182 	void SetupGrid();
       
   183 
       
   184 	/**	FindClipartsL
       
   185 	*
       
   186 	*	Find all cliparts in directories specified in the 
       
   187     *   resource file
       
   188 	*
       
   189 	*	@param -
       
   190 	*	@return -
       
   191 	*/
       
   192     void FindClipartsL();
       
   193 
       
   194     /** LoadBitmapsL
       
   195 	*
       
   196     *   Loads clipart bitmap and mask
       
   197     *
       
   198     *   @param - 
       
   199     *	@return -
       
   200 	*/
       
   201     void LoadBitmapsL();
       
   202 
       
   203     /** AddIconL
       
   204 	*
       
   205     *   Adds icon to grid
       
   206     *
       
   207     *   @param - 
       
   208     *	@return -
       
   209 	*/
       
   210     void AddIconL();
       
   211 
       
   212     /** ExternalizeIconArrayL
       
   213 	*
       
   214     *   Externalize icon array
       
   215     *
       
   216     *   @param - 
       
   217     *	@return -
       
   218 	*/
       
   219     void ExternalizeIconArrayL();
       
   220 
       
   221     /** InternalizeIconArrayL
       
   222 	*
       
   223     *   Internalize icon array
       
   224     *
       
   225     *   @param - 
       
   226     *	@return -
       
   227 	*/
       
   228     void InternalizeIconArrayL();
       
   229 
       
   230 private:
       
   231 
       
   232     /// Selection grid
       
   233     CClipartSelectionGrid*  iGrid;
       
   234     TFileName&				iClipartFileName;
       
   235     TInt&					iClipartFileNameIndex;
       
   236     
       
   237     CAknIconArray* 			iIconArray;
       
   238     CDesC16Array*			iTextArray;
       
   239     
       
   240     CAknProgressDialog*     iProgressDialog;
       
   241     CClipartScaler*         iClipartScaler;
       
   242     RClipartList            iClipartList; 
       
   243     CObCallback*            iCallback;
       
   244     CFbsBitmap*             iCurrentBitmap;
       
   245     CFbsBitmap*             iCurrentMask;
       
   246     TInt                    iClipartGridCellWidth;
       
   247     TInt                    iClipartGridCellHeight;
       
   248     TInt                    iCurrentIcon;
       
   249     TInt                    iState;
       
   250     TBool                   iBusy;    
       
   251     TBool                   iDoubleClick;
       
   252     TBool                   iClick; 
       
   253 	
       
   254     };
       
   255 
       
   256 
       
   257 #endif
       
   258 
       
   259 // End of File