diff -r edfc90759b9f -r 18b321db4884 imageeditor/plugins/DrawPlugin/inc/selectionpopup.h --- a/imageeditor/plugins/DrawPlugin/inc/selectionpopup.h Fri Jan 29 13:53:17 2010 +0200 +++ b/imageeditor/plugins/DrawPlugin/inc/selectionpopup.h Thu Jun 03 18:57:10 2010 +0800 @@ -1,22 +1,21 @@ /* -* 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: -* Selection popup dialog header file. -* -*/ - + * 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: + * Selection popup dialog header file. + * + */ #ifndef _SELECTIONPOPUP_H #define _SELECTIONPOPUP_H @@ -30,263 +29,263 @@ class CFbsBitmap; //class TAknLayoutText; - -NONSHARABLE_CLASS( CSelectionPopup ):public CPreviewControlBase -{ + +NONSHARABLE_CLASS( CSelectionPopup ) : public CPreviewControlBase + { public: - /** Default constructor, cannot leave. - * - * @since S60 5.0 - * @param - - * @return - - */ - CSelectionPopup(); + /** Default constructor, cannot leave. + * + * @since S60 5.0 + * @param - + * @return - + */ + CSelectionPopup(TRgb& aCurrentColor, const TRect& aImageRect); - /** Destructor - * - * @since S60 5.0 - * @param - - * @return - - */ - ~CSelectionPopup (); + /** Destructor + * + * @since S60 5.0 + * @param - + * @return - + */ + ~CSelectionPopup(); - /** Second phase constructor - * - * @since S60 5.0 - * @param aParent - Parent control - * @return - - */ - void ConstructL ( CCoeControl* aParent ); - + /** Second phase constructor + * + * @since S60 5.0 + * @param aParent - Parent control + * @return - + */ + void ConstructL(CCoeControl* aParent); + /** OfferKeyEventL - * - * @see CCoeControl - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** HandlePointerEventL - * - * @see CCoeControl - */ - void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + * + * @see CCoeControl + */ + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + + /** HandlePointerEventL + * + * @see CCoeControl + */ + void HandlePointerEventL(const TPointerEvent &aPointerEvent); + +public: + //new methods -public: //new methods - - /** GridRect - * - * Returns popup component's rectangle area - * - * @since S60 5.0 - * @param - - * @return TRect The area of the popup - */ - TRect GridRect() const; - - /** HighlightedItemPressed - * - * This function can be used to check whether user has pressed (by stylus) - * currently highlighted color item. - * - * @since S60 5.0 - * @param aPosition position value to be checked. - * @return ETrue if aPosition is in the rect area of currently highlighted - * plugin item, EFalse otherwise. - */ - TBool HighlightedItemPressed( TPoint aPosition ) const; - - /** SetSelectedValue - * - * Set currently highlighted item - * - * @param aSelected selected item index. - * @since S60 5.0 - */ - void SetSelectedValue( TInt aSelected ); - - /** GetSelectedValue - * - * Returns current highlighted item value - * - * @since S60 5.0 - * @return TInt Currently selected value - */ - TInt GetSelectedValue() const; - -private: - - /** CreateColorBitmapsL - * - * Creates a bitmap array - * - * @since S60 5.0 - * @param aSize Size that color bitmaps should be created to - * @return - - */ - void CreateColorBitmapsL( TSize aSize ); - + /** GridRect + * + * Returns popup component's rectangle area + * + * @since S60 5.0 + * @param - + * @return TRect The area of the popup + */ + TRect GridRect() const; + + /** HighlightedItemPressed + * + * This function can be used to check whether user has pressed (by stylus) + * currently highlighted color item. + * + * @since S60 5.0 + * @param aPosition position value to be checked. + * @return ETrue if aPosition is in the rect area of currently highlighted + * plugin item, EFalse otherwise. + */ + TBool HighlightedItemPressed(TPoint aPosition) const; + + /** SetSelectedValue + * + * Set currently highlighted item + * + * @param aSelected selected item index. + * @since S60 5.0 + */ + void SetSelectedValue(TInt aSelected); + + /** GetSelectedValue + * + * Returns current highlighted item value + * + * @since S60 5.0 + * @return TInt Currently selected value + */ + TInt GetSelectedValue() const; + +private: + + /** CreateColorBitmapsL + * + * Creates a bitmap array + * + * @since S60 5.0 + * @param aSize Size that color bitmaps should be created to + * @return - + */ + void CreateColorBitmapsL(TSize aSize); + protected: - /** SizeChanged - * - * @see CCoeControl - */ - virtual void SizeChanged(); + /** SizeChanged + * + * @see CCoeControl + */ + virtual void SizeChanged(); /** Draw - * - * @see CCoeControl - */ - virtual void Draw( const TRect& aRect ) const; - + * + * @see CCoeControl + */ + virtual void Draw(const TRect& aRect) const; private: - - // Popup graphic bitmaps - CFbsBitmap* iPopupCenter; - CFbsBitmap* iPopupCenterMask; - CFbsBitmap* iPopupCornerTL; - CFbsBitmap* iPopupCornerTLMask; - CFbsBitmap* iPopupCornerTR; - CFbsBitmap* iPopupCornerTRMask; - CFbsBitmap* iPopupCornerBL; - CFbsBitmap* iPopupCornerBLMask; - CFbsBitmap* iPopupCornerBR; - CFbsBitmap* iPopupCornerBRMask; - CFbsBitmap* iPopupSideL; - CFbsBitmap* iPopupSideLMask; - CFbsBitmap* iPopupSideR; - CFbsBitmap* iPopupSideRMask; - CFbsBitmap* iPopupSideT; - CFbsBitmap* iPopupSideTMask; - CFbsBitmap* iPopupSideB; - CFbsBitmap* iPopupSideBMask; - - // Popup rects - TRect iPopupCenterRect; - TRect iPopupCornerTLRect; - TRect iPopupCornerTRRect; - TRect iPopupCornerBLRect; - TRect iPopupCornerBRRect; - TRect iPopupSideLRect; - TRect iPopupSideRRect; - TRect iPopupSideTRect; - TRect iPopupSideBRect; - TRect iHeadingRect; - - // Format and layout information of the heading text - TAknLayoutText iLayoutTextHeading; - - // Contains rectangles of all grid highlight items - RArray< TRect > iHighlightRectsArray; - - // Contains rectangles of all grid color items - RArray< TRect > iGridRectsArray; - - // Color bitmaps - RPointerArray < CFbsBitmap > iColorBitmapsArray; - - // Used values - RArray< TInt > iItemArray; - - TInt iCurrentItem; + + // Popup graphic bitmaps + CFbsBitmap* iPopupCenter; + CFbsBitmap* iPopupCenterMask; + CFbsBitmap* iPopupCornerTL; + CFbsBitmap* iPopupCornerTLMask; + CFbsBitmap* iPopupCornerTR; + CFbsBitmap* iPopupCornerTRMask; + CFbsBitmap* iPopupCornerBL; + CFbsBitmap* iPopupCornerBLMask; + CFbsBitmap* iPopupCornerBR; + CFbsBitmap* iPopupCornerBRMask; + CFbsBitmap* iPopupSideL; + CFbsBitmap* iPopupSideLMask; + CFbsBitmap* iPopupSideR; + CFbsBitmap* iPopupSideRMask; + CFbsBitmap* iPopupSideT; + CFbsBitmap* iPopupSideTMask; + CFbsBitmap* iPopupSideB; + CFbsBitmap* iPopupSideBMask; - -}; + // Popup rects + TRect iPopupCenterRect; + TRect iPopupCornerTLRect; + TRect iPopupCornerTRRect; + TRect iPopupCornerBLRect; + TRect iPopupCornerBRRect; + TRect iPopupSideLRect; + TRect iPopupSideRRect; + TRect iPopupSideTRect; + TRect iPopupSideBRect; + TRect iHeadingRect; + + // Format and layout information of the heading text + TAknLayoutText iLayoutTextHeading; + + // Contains rectangles of all grid highlight items + RArray iHighlightRectsArray; + // Contains rectangles of all grid color items + RArray iGridRectsArray; -NONSHARABLE_CLASS( CSelectionDialog ): public CAknDialog - { + // Color bitmaps + RPointerArray iColorBitmapsArray; + + // Used values + RArray iItemArray; + + TInt iCurrentItem; + + TRgb iCurrentColor; + + TRect iImageRect; + }; + +NONSHARABLE_CLASS( CSelectionDialog ) : public CAknDialog + { public: - - /** RunDlgLD - * - * @param aBitmap - background bitmap - * @param aRect - Rect for the dialog - * @param aSelection - Selected value to be returned - * @return - ExecuteLD() return value - */ - static TInt RunDlgLD( const CFbsBitmap* aBitmap, - const TRect& aRect, - TInt& aSelection ); + /** RunDlgLD + * + * @param aBitmap - background bitmap + * @param aRect - Rect for the dialog + * @param aSelection - Selected value to be returned + * @return - ExecuteLD() return value + */ + static TInt RunDlgLD(const CFbsBitmap* aBitmap, const TRect& aRect, + TInt& aSelection, TRgb& aCurrentColor, const TRect& aImageRect); - virtual ~CSelectionDialog(); + virtual ~CSelectionDialog(); - /** 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 ); + /** 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); - /** Draw - * - * - * @see CAknDialog - * - */ - void Draw(const TRect& aRect) const; + /** Draw + * + * + * @see CAknDialog + * + */ + void Draw(const TRect& aRect) const; - /** SizeChanged - * - * - * @see CCoeControl - * - */ - virtual void SizeChanged(); + /** SizeChanged + * + * + * @see CCoeControl + * + */ + virtual void SizeChanged(); + + /** OfferKeyEventL + * + * @see CCoeControl + * + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType); - /** OfferKeyEventL - * - * @see CCoeControl - * - */ - virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); - - /** HandlePointerEventL - * - * @see CCoeControl - */ - virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); - - /** PreLayoutDynInitL - * - * @see CEikDialog - * - */ - virtual void PreLayoutDynInitL(); + /** HandlePointerEventL + * + * @see CCoeControl + */ + virtual void HandlePointerEventL(const TPointerEvent &aPointerEvent); + + /** PreLayoutDynInitL + * + * @see CEikDialog + * + */ + virtual void PreLayoutDynInitL(); - /** CountComponentControls - * - * @see CCoeControl - * - */ - TInt CountComponentControls() const; + /** CountComponentControls + * + * @see CCoeControl + * + */ + TInt CountComponentControls() const; - /** ComponentControl - * - * @see CCoeControl - * - */ - virtual CCoeControl* ComponentControl(TInt aIndex) const; - -private: // implementation - - CSelectionDialog( TInt& aSelectino ); - void ConstructL( const CFbsBitmap* aBitmap, const TRect& aRect); + /** ComponentControl + * + * @see CCoeControl + * + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; private: - - // Own: popup component - CSelectionPopup* iPopup; - - // Ref: Selected color - TInt& iCurrentValue; - - }; + // implementation + + CSelectionDialog(TInt& aSelectino); + void ConstructL(const CFbsBitmap* aBitmap, const TRect& aRect, + TRgb& aCurrentColor, const TRect& aImageRect); + +private: + + // Own: popup component + CSelectionPopup* iPopup; + + // Ref: Selected color + TInt& iCurrentValue; + }; #endif // _SELECTIONPOPUP_H