diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/ClipartSelectionDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/ClipartSelectionDialog.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2010 Ixonos Plc. +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - Initial contribution +* +* Contributors: +* Ixonos Plc +* +* Description: +* Dialog for clipart plugin. +* +*/ + + +#ifndef CLIPARTSELECTIONDIALOG_H +#define CLIPARTSELECTIONDIALOG_H + +#include +#include + +#include "clipartscaler.h" +#include "CallbackMethod.h" + +// FORWARD DECLARATION +class CClipartSelectionGrid; +class CGulIcon; +class CDir; +class CAknIconArray; +class CClipartScaler; +class CObCallback; + + +class CClipartSelectionDialog : public CEikDialog, + public MClipartScalerNotifier, + public MProgressDialogCallback, + public MEikListBoxObserver, + public MObCallbackMethod + { + + class TClipartListItem + { + public: + TFileName iFilename; + TInt iIndex; + }; + + typedef RArray RClipartList; + + enum TState + { + EIdle, + EScalingBitmap, + EScalingMask + }; + +public: + + /** Constructor + * + * @param aClipartFileName - Clipart filename + * @param aClipartFileNameIndex - Clipart filename index + * @return - + */ + CClipartSelectionDialog(TFileName& aClipartFileName, TInt& aClipartFileNameIndex); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CClipartSelectionDialog(); + + /** ConstructL + * + * Second phase constructor + * + * @param aParent - Parent control + * + */ + void ConstructL(MCoeControlObserver* aParent); + + /** OkToExitL + * + * From CAknDialog update member variables . + * @param aButtonId The ID of the button that was activated. + * @return Should return ETrue if the dialog should exit, + * and EFalse if it should not + */ + TBool OkToExitL( TInt aButtonId ); + + /** SetBusy + * + * @param aBusy - Set control busy + * + */ + void SetBusy(TBool aBusy); + + /** SetSizeAndPosition + * + * @see CEikDialog + * + */ + void SetSizeAndPosition( const TSize& /*aSize*/ ); + + /** ClipartFilenameL + * + * Get select clipart filename and index + * + * @param aFilename - Clipart filename with full path + * @param aIndex - Clipart index in the MBM file + * @return - + */ + void ClipartFilenameL(TDes& aFilename, TInt& aIndex); + + /** ClipartScalerOperationReadyL + * + * Called by the Clipart scaler when operation is ready + * + * @see MClipartScalerNotifier + * + */ + void ClipartScalerOperationReadyL(TInt aError) ; + + /** DialogDismissedL + * + * @see MProgressDialogCallback + * + */ + void DialogDismissedL( TInt aButtonId ); + + /** + * + * @see MObCallbackMethod + * + */ + TBool CallbackMethodL( TInt aParam ); + + /** PreLayoutDynInitL + * + * @see CEikDialog + * + */ + void PreLayoutDynInitL(); + + /** CreateCustomControlL + * + * @see CEikDialog + * + */ + SEikControlInfo CreateCustomControlL(TInt aControlType); + + /** OfferKeyEventL + * + * @see CEikDialog + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + virtual void HandleDialogPageEventL(TInt /*aEventId*/); + + virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + void HandleResourceChange(TInt aType); +private: + + /* SetupGrid + * + * Sets up grid every time the grid size changes. + * + * @param - + * @return - + */ + void SetupGrid(); + + /** FindClipartsL + * + * Find all cliparts in directories specified in the + * resource file + * + * @param - + * @return - + */ + void FindClipartsL(); + + /** LoadBitmapsL + * + * Loads clipart bitmap and mask + * + * @param - + * @return - + */ + void LoadBitmapsL(); + + /** AddIconL + * + * Adds icon to grid + * + * @param - + * @return - + */ + void AddIconL(); + + /** ExternalizeIconArrayL + * + * Externalize icon array + * + * @param - + * @return - + */ + void ExternalizeIconArrayL(); + + /** InternalizeIconArrayL + * + * Internalize icon array + * + * @param - + * @return - + */ + void InternalizeIconArrayL(); + +private: + + /// Selection grid + CClipartSelectionGrid* iGrid; + TFileName& iClipartFileName; + TInt& iClipartFileNameIndex; + + CAknIconArray* iIconArray; + CDesC16Array* iTextArray; + + CAknProgressDialog* iProgressDialog; + CClipartScaler* iClipartScaler; + RClipartList iClipartList; + CObCallback* iCallback; + CFbsBitmap* iCurrentBitmap; + CFbsBitmap* iCurrentMask; + TInt iClipartGridCellWidth; + TInt iClipartGridCellHeight; + TInt iCurrentIcon; + TInt iState; + TBool iBusy; + TBool iDoubleClick; + TBool iClick; + + }; + + +#endif + +// End of File