1.1 --- a/epoc32/include/mw/eikimage.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eikimage.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,223 @@
1.4 -eikimage.h
1.5 +/*
1.6 +* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#if !defined(__EIKIMAGE_H__)
1.24 +#define __EIKIMAGE_H__
1.25 +
1.26 +#if !defined(__EIKALIGN_H__)
1.27 +#include <eikalign.h>
1.28 +#endif
1.29 +
1.30 +class CFbsBitmap;
1.31 +class CBitmapContext;
1.32 +
1.33 +/**
1.34 + * The package class @c CEikImage enables bitmaps to be packaged into an
1.35 + * image. Two bitmaps can be packaged, one for the image itself and,
1.36 + * optionally, another for the image’s mask.
1.37 + */
1.38 +class CEikImage : public CEikAlignedControl
1.39 + {
1.40 +
1.41 +public:
1.42 +
1.43 + /**
1.44 + * C++ default constructor.
1.45 + */
1.46 + IMPORT_C CEikImage();
1.47 +
1.48 + /**
1.49 + * Destructor.
1.50 + */
1.51 + IMPORT_C ~CEikImage();
1.52 +
1.53 +public: // framework
1.54 +
1.55 + /**
1.56 + * Gets the minimum size required to draw the image.
1.57 + *
1.58 + * @return The minimum size required to draw the image.
1.59 + */
1.60 + IMPORT_C TSize MinimumSize();
1.61 +
1.62 + /**
1.63 + * Constructs an image from resource using the specified resource reader.
1.64 + *
1.65 + * @param aReader The resource reader.
1.66 + */
1.67 + IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
1.68 +
1.69 +public: // new functions
1.70 +
1.71 + /**
1.72 + * Creates a bitmap and a mask for an icon. If @c aMaskId is not negative
1.73 + * then function allocates bitmap and mask objects and sets member variables
1.74 + * to point at them. These bitmaps are not ready for drawing until they are
1.75 + * initialized with @c SetSize() method. Usually, UI controls do this. Note
1.76 + * also that a single @c SetSize() call initializes both the bitmap and the
1.77 + * mask.
1.78 + *
1.79 + * If @c aMaskId is not needed and not given then this function creates the
1.80 + * bitmap for an icon. Returned object is saved to the member variable. The
1.81 + * bitmap is not ready for drawing until it is initialized with @c
1.82 + * SetSize() method. Usually, UI controls do this.
1.83 + *
1.84 + * @param aFilename File name. Can be either MBM or MIF file.
1.85 + * Extension is changed based on the given bitmap ID.
1.86 + * @param aMainId Bitmap id.
1.87 + * @param aMaskId Mask id, by default -1.
1.88 + */
1.89 + IMPORT_C void CreatePictureFromFileL(const TDesC& aFilename,
1.90 + TInt aMainId,
1.91 + TInt aMaskId=-1);
1.92 +
1.93 + /**
1.94 + * Sets picture parameters.
1.95 + *
1.96 + * @param aBitmap A bitmap.
1.97 + * @param aMaskBitmap A bitmap mask.
1.98 + */
1.99 + IMPORT_C void SetPicture(const CFbsBitmap* aBitmap,
1.100 + const CFbsBitmap* aMaskBitmap=NULL);
1.101 +
1.102 + /**
1.103 + * Sets emphasis.
1.104 + *
1.105 + * @param aEmphasis Full emphasis if @c ETrue and if not then @c EFalse.
1.106 + */
1.107 + IMPORT_C void SetEmphasis(TBool aEmphasis);
1.108 +
1.109 + /**
1.110 + * Sets the owner of the picture.
1.111 + *
1.112 + * @param aOwnership @c Etrue if owner is external and @c EFalse if not.
1.113 + */
1.114 + IMPORT_C void SetPictureOwnedExternally(TBool aOwnership);
1.115 +
1.116 + /**
1.117 + * Gets a pointer of @c CFbsBitmap object.
1.118 + *
1.119 + * @return Pointer to handle to the bitmap or NULL.
1.120 + */
1.121 + IMPORT_C const CFbsBitmap* Bitmap() const;
1.122 +
1.123 + /**
1.124 + * Gets pointer of @c CFbsBitmap object.
1.125 + *
1.126 + * @return Pointer to handle to the bitmap's mask or NULL.
1.127 + */
1.128 + IMPORT_C const CFbsBitmap* Mask() const;
1.129 +
1.130 + /**
1.131 + * Sets new bitmap.
1.132 + *
1.133 + * @param aBitmap Pointer to @c CFbsBitmap object containing the bitmap.
1.134 + */
1.135 + IMPORT_C void SetBitmap(const CFbsBitmap* aBitmap);
1.136 +
1.137 + /**
1.138 + * Sets new bitmap mask.
1.139 + *
1.140 + * @param aMaskBitmap Pointer to @c CFbsBitmap object containing the bitmap
1.141 + * mask.
1.142 + */
1.143 + IMPORT_C void SetMask(const CFbsBitmap* aMaskBitmap);
1.144 +
1.145 + /**
1.146 + * Sets new bitmap and bitmap's mask.
1.147 + *
1.148 + * @param aNewBitmap A bitmap.
1.149 + * @param aNewMask A bitmap mask.
1.150 + */
1.151 + IMPORT_C void SetNewBitmaps(const CFbsBitmap* aNewBitmap,
1.152 + const CFbsBitmap* aNewMask);
1.153 +
1.154 + /**
1.155 + * Checks whether picture is owned externally.
1.156 + *
1.157 + * @return @c ETrue if picture owned externally and @c EFalse if
1.158 + * not.
1.159 + */
1.160 + IMPORT_C TBool IsPictureOwnedExternally();
1.161 +
1.162 + /**
1.163 + * Sets the brush style.
1.164 + *
1.165 + * @param aBrushStyle A brush style.
1.166 + */
1.167 + IMPORT_C void SetBrushStyle(CGraphicsContext::TBrushStyle aBrushStyle);
1.168 +
1.169 +public: // from CCoeControl
1.170 +
1.171 + /**
1.172 + * From @c CCoeControl.
1.173 + *
1.174 + * Handles pointer events.
1.175 + *
1.176 + * This function gets called whenever a pointer event occurs in the
1.177 + * control, i.e. when the pointer is within the control's extent, or when
1.178 + * the control has grabbed the pointer. The control should implement this
1.179 + * function to handle pointer events.
1.180 + *
1.181 + * Note: events of type @c EButton1Down are processed before
1.182 + * @c HandlePointerEventL() is called in order to transfer keyboard focus
1.183 + * to the control in which the @c EButton1Down event occurred.
1.184 + *
1.185 + * If overriding @c HandlePointerEventL(), the implementation must include
1.186 + * a base call to @c CCoeControl's @c HandlePointerEventL().
1.187 + *
1.188 + * @param aPointerEvent The pointer event.
1.189 + */
1.190 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.191 +
1.192 +protected: // from CCoeControl
1.193 +
1.194 + /**
1.195 + * From @c CCoeControl
1.196 + *
1.197 + * Writes the internal state of the control and its components to a stream.
1.198 + * Does nothing in release mode. Designed to be overidden and base called
1.199 + * by subclasses.
1.200 + *
1.201 + * @since App-Framework_6.1
1.202 + * @param[in,out] aWriteStream The pointer writestream.
1.203 + */
1.204 + IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
1.205 +
1.206 +private: // from CCoeControl
1.207 +
1.208 + IMPORT_C void Draw(const TRect& aRect) const;
1.209 + IMPORT_C void Reserved_2();
1.210 +
1.211 +private:
1.212 +
1.213 + /**
1.214 + * From CAknControl
1.215 + */
1.216 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.217 +
1.218 +private:
1.219 +
1.220 + const CFbsBitmap* iBitmap;
1.221 + const CFbsBitmap* iMaskBitmap;
1.222 + TInt iImFlags;
1.223 + TInt iSpare;
1.224 + CGraphicsContext::TBrushStyle iBrushStyle;
1.225 + };
1.226 +
1.227 +#endif // __EIKIMAGE_H__