diff -r f5050f1da672 -r 04becd199f91 javauis/lcdui_akn/lcdui/inc/CMIDCanvasGraphicsItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/lcdui_akn/lcdui/inc/CMIDCanvasGraphicsItem.h Tue Apr 27 16:30:29 2010 +0300 @@ -0,0 +1,291 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "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: +* +* Description: CMIDCanvasGraphicsItem - Implements the native part Canvas Graphics Item class. +* +*/ + + +#ifndef CMIDCANVASGRAPHICSITEM_H +#define CMIDCANVASGRAPHICSITEM_H + +// EXTERNAL INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CMIDCanvasGraphicsItemPainter; +class CCoeControl; +class MMIDCustomComponentContainer; +class CMIDUtils; + +// CLASS DESCRIPTION +/** + * Defines the Canvas Graphics Item native side component. + */ +NONSHARABLE_CLASS(CMIDCanvasGraphicsItem) : + public CBase, + public MMIDCanvasGraphicsItem, + public MMIDCustomComponent +{ +public: // Type definitions + + class TCtorParams + { + public: + // The CanvasGraphicsItemPainter native side peer handle. Not owned. + CMIDCanvasGraphicsItemPainter* iPainterHandle; + // The shared CMIDUtils instance. Not owned. + CMIDUtils* iUtils; + + TCtorParams::TCtorParams() : + iPainterHandle(NULL), + iUtils(NULL) {} + }; + +public: // Constructors and destructor + + /** + * Two-phased constructor. Creates an instance from this class + * The caller takes the ownership of the returned instance + * + * @param aParams The construction parameters of this class. + * @return New instance from this class + */ + static CMIDCanvasGraphicsItem* NewL(const TCtorParams& aParams); + + /** + * Destructor. + */ + virtual ~CMIDCanvasGraphicsItem(); + + +public: // From MMIDCustomComponent + + /** + * Returns the count of controls in this custom component. + * + * Note that the count must not change during the lifetime + * of the object. The count of all components is updated + * when it is added to the custom component container. + * + * This is done in order to improve the performance when counting + * countrols. + * + * @return The count of controls in this custom component. + * @since S60 5.0 + */ + TInt CustomComponentControlCount() const; + + /** + * Returns an UI control of this custom component. + * + * The index specifies which component is requested. The method + * works similar to CCoeControl::ComponentControl() method. The + * ownership of the control is NOT transferred to the caller. + * + * @param aIndex The index of the control to be retrieved. + * @return The UI control of this custom component. + * @since S60 5.0 + */ + CCoeControl* CustomComponentControl(TInt aIndex); + + /** + * Indicates that the container is about to be disposed. + * + * The custom component does not have to remove itself + * from the container since the container removes all components + * when disposing. + * + * @since S60 5.0 + */ + void CustomComponentContainerDisposing(); + + /** + * Indicates if traversal is needed and does the traverse. + * + * Not used on CanvasGraphicsItem. + * + * @param aEvent Key Event. + * @since S60 5.0 + */ + void TraverseL(const TKeyEvent& /* aEvent */) {} + + /** + * Processes the received pointer event. + * + * @param aPointerEvent The pointer event. iPosition will be reset to the + * parent window position. iParentPosition will be invalid for the + * container. + * @since S60 5.0 + */ + void ProcessPointerEventL(const TPointerEvent& /*aPointerEvent*/) {} + + /** + * Gets the current touch-enabled state + * + * @return false, this component is not touch-enabled + * @since S60 5.0 + */ + TBool IsTouchEnabled() + { + return EFalse; + } + + /** + * Handles fullscreen state of parent Canvas. + * + * @since S60 5.0 + */ + void HandleFullscreenModeChange(); + + /** + * Handles changes of screen orientation. + * + * @since S60 5.0 + */ + void HandleResolutionChange(); + +public: // From MMIDCanvasGraphicsItem + + /** + * Sets the parent of this canvas graphics item component. The parent must + * implement the custom component container interface in order to + * provide necessary services for registering custom UI components. + * + * The ownership of the parent is not transffered to this object. + * + * @param aComponentContainer The parent MIDP custom component + * container. + * @since S60 5.0 + */ + void SetParentL(MMIDCustomComponentContainer* aComponentContainer); + + /** + * Sets the direct container of this canvas graphics item component. + * + * Note that the canvas graphics item does not necessary need to have direct + * container. If the parent component is responsible for somekind of + * custom drawing using direct screena access, this method can be used + * to register the direct container. + * + * The canvas graphics item adds itself to the direct container so that it + * is not able to draw on top of the canvas graphics item when direct content + * is added to the screen. + * + * @param aDirectContainer The direct container of this compoennt if + * any. NULL removes the current container. + * @since S60 5.0 + */ + void SetDirectContainerL(MDirectContainer* aDirectContainer); + + /** + * Sets the elevation of this canvas graphics item component. + * + * If the specified elevation exeeds to amount of items in the + * custom component container, the item becomes the topmost item + * in the custom component stack. + * + * Note that the elevation requsted may not be the actual elevation + * of the item (if, for example, the elevation is higher than the + * amount of all items, the elevation is set to the top). + * + * @param aElevation The new elevation (Z-position) of this item. + * @since S60 5.0 + */ + void SetElevationL(TInt aElevation); + + /** + * Returns the elevation of this canvas graphics item component. + * + * @return The elevation of this canvas graphics item component. + * @since S60 5.0 + */ + TInt Elevation(); + + /** + * Sets this canvas graphics item component visible if it is hidden. + * + * Depending on the current status of the canvas graphics item, this operation + * is no-op if there is nothing to be done. (i.e. the canvas graphics item is set + * hidden when it is already hidden). + * + * @param aVisible Indicates the visibility status of the canvas graphics item. + * @since S60 5.0 + */ + void SetVisibleL(TBool aVisible); + + /** + * Sets the size of this canvas graphics item component. + * + * @param aWidth The width of the item. + * @param aHeight The height of the item. + * @since S60 5.0 + */ + void SetSizeL(const TInt aWidth, const TInt aHeight); + + /** + * Sets the position of this canvas graphics item component. + * + * Note: Calling this function results in a call to + * CMIDCanvasGraphicsItemEdwin::PositionChanged(). + * + * @param aX The x coordinate of the anchor point. + * @param aY The y coordinate of the anchor point. + * @since S60 5.0 + */ + void SetPosition(const TInt aX, const TInt aY); + +public: // From MMIDComponent + + /** + * Invoked by the framework to clean up any resources used by the + * implementation. + * + * Typically, the implementation will do "delete this" but is clearly + * not restricted to + * + * @since S60 5.0 + */ + void Dispose(); + +private: // Construtors + + /** + * C++ constructor. + */ + CMIDCanvasGraphicsItem(); + + /** + * Second phase constructor + * + * @param aParams The construction parameters of this class. + */ + void ConstructL(const TCtorParams& aParams); + +private: // Data + + // canvas graphics item control. Not owned. + CMIDCanvasGraphicsItemPainter* iItemPainter; + + // Container for this object. Not owned. + MMIDCustomComponentContainer* iComponentContainer; + + // The shared CMIDUtils instance. Not owned. + CMIDUtils* iUtils; +}; + +#endif // CMIDCANVASGRAPHICSITEM_H + +// End of file