williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* 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
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__EIKIMAGE_H__)
|
williamr@2
|
20 |
#define __EIKIMAGE_H__
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#if !defined(__EIKALIGN_H__)
|
williamr@2
|
23 |
#include <eikalign.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
|
williamr@2
|
26 |
class CFbsBitmap;
|
williamr@2
|
27 |
class CBitmapContext;
|
williamr@2
|
28 |
|
williamr@2
|
29 |
/**
|
williamr@2
|
30 |
* The package class @c CEikImage enables bitmaps to be packaged into an
|
williamr@2
|
31 |
* image. Two bitmaps can be packaged, one for the image itself and,
|
williamr@2
|
32 |
* optionally, another for the image’s mask.
|
williamr@2
|
33 |
*/
|
williamr@2
|
34 |
class CEikImage : public CEikAlignedControl
|
williamr@2
|
35 |
{
|
williamr@2
|
36 |
|
williamr@2
|
37 |
public:
|
williamr@2
|
38 |
|
williamr@2
|
39 |
/**
|
williamr@2
|
40 |
* C++ default constructor.
|
williamr@2
|
41 |
*/
|
williamr@2
|
42 |
IMPORT_C CEikImage();
|
williamr@2
|
43 |
|
williamr@2
|
44 |
/**
|
williamr@2
|
45 |
* Destructor.
|
williamr@2
|
46 |
*/
|
williamr@2
|
47 |
IMPORT_C ~CEikImage();
|
williamr@2
|
48 |
|
williamr@2
|
49 |
public: // framework
|
williamr@2
|
50 |
|
williamr@2
|
51 |
/**
|
williamr@2
|
52 |
* Gets the minimum size required to draw the image.
|
williamr@2
|
53 |
*
|
williamr@2
|
54 |
* @return The minimum size required to draw the image.
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
IMPORT_C TSize MinimumSize();
|
williamr@2
|
57 |
|
williamr@2
|
58 |
/**
|
williamr@2
|
59 |
* Constructs an image from resource using the specified resource reader.
|
williamr@2
|
60 |
*
|
williamr@2
|
61 |
* @param aReader The resource reader.
|
williamr@2
|
62 |
*/
|
williamr@2
|
63 |
IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
|
williamr@2
|
64 |
|
williamr@2
|
65 |
public: // new functions
|
williamr@2
|
66 |
|
williamr@2
|
67 |
/**
|
williamr@2
|
68 |
* Creates a bitmap and a mask for an icon. If @c aMaskId is not negative
|
williamr@2
|
69 |
* then function allocates bitmap and mask objects and sets member variables
|
williamr@2
|
70 |
* to point at them. These bitmaps are not ready for drawing until they are
|
williamr@2
|
71 |
* initialized with @c SetSize() method. Usually, UI controls do this. Note
|
williamr@2
|
72 |
* also that a single @c SetSize() call initializes both the bitmap and the
|
williamr@2
|
73 |
* mask.
|
williamr@2
|
74 |
*
|
williamr@2
|
75 |
* If @c aMaskId is not needed and not given then this function creates the
|
williamr@2
|
76 |
* bitmap for an icon. Returned object is saved to the member variable. The
|
williamr@2
|
77 |
* bitmap is not ready for drawing until it is initialized with @c
|
williamr@2
|
78 |
* SetSize() method. Usually, UI controls do this.
|
williamr@2
|
79 |
*
|
williamr@2
|
80 |
* @param aFilename File name. Can be either MBM or MIF file.
|
williamr@2
|
81 |
* Extension is changed based on the given bitmap ID.
|
williamr@2
|
82 |
* @param aMainId Bitmap id.
|
williamr@2
|
83 |
* @param aMaskId Mask id, by default -1.
|
williamr@2
|
84 |
*/
|
williamr@2
|
85 |
IMPORT_C void CreatePictureFromFileL(const TDesC& aFilename,
|
williamr@2
|
86 |
TInt aMainId,
|
williamr@2
|
87 |
TInt aMaskId=-1);
|
williamr@2
|
88 |
|
williamr@2
|
89 |
/**
|
williamr@2
|
90 |
* Sets picture parameters.
|
williamr@2
|
91 |
*
|
williamr@2
|
92 |
* @param aBitmap A bitmap.
|
williamr@2
|
93 |
* @param aMaskBitmap A bitmap mask.
|
williamr@2
|
94 |
*/
|
williamr@2
|
95 |
IMPORT_C void SetPicture(const CFbsBitmap* aBitmap,
|
williamr@2
|
96 |
const CFbsBitmap* aMaskBitmap=NULL);
|
williamr@2
|
97 |
|
williamr@2
|
98 |
/**
|
williamr@2
|
99 |
* Sets emphasis.
|
williamr@2
|
100 |
*
|
williamr@2
|
101 |
* @param aEmphasis Full emphasis if @c ETrue and if not then @c EFalse.
|
williamr@2
|
102 |
*/
|
williamr@2
|
103 |
IMPORT_C void SetEmphasis(TBool aEmphasis);
|
williamr@2
|
104 |
|
williamr@2
|
105 |
/**
|
williamr@2
|
106 |
* Sets the owner of the picture.
|
williamr@2
|
107 |
*
|
williamr@2
|
108 |
* @param aOwnership @c Etrue if owner is external and @c EFalse if not.
|
williamr@2
|
109 |
*/
|
williamr@2
|
110 |
IMPORT_C void SetPictureOwnedExternally(TBool aOwnership);
|
williamr@2
|
111 |
|
williamr@2
|
112 |
/**
|
williamr@2
|
113 |
* Gets a pointer of @c CFbsBitmap object.
|
williamr@2
|
114 |
*
|
williamr@2
|
115 |
* @return Pointer to handle to the bitmap or NULL.
|
williamr@2
|
116 |
*/
|
williamr@2
|
117 |
IMPORT_C const CFbsBitmap* Bitmap() const;
|
williamr@2
|
118 |
|
williamr@2
|
119 |
/**
|
williamr@2
|
120 |
* Gets pointer of @c CFbsBitmap object.
|
williamr@2
|
121 |
*
|
williamr@2
|
122 |
* @return Pointer to handle to the bitmap's mask or NULL.
|
williamr@2
|
123 |
*/
|
williamr@2
|
124 |
IMPORT_C const CFbsBitmap* Mask() const;
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/**
|
williamr@2
|
127 |
* Sets new bitmap.
|
williamr@2
|
128 |
*
|
williamr@2
|
129 |
* @param aBitmap Pointer to @c CFbsBitmap object containing the bitmap.
|
williamr@2
|
130 |
*/
|
williamr@2
|
131 |
IMPORT_C void SetBitmap(const CFbsBitmap* aBitmap);
|
williamr@2
|
132 |
|
williamr@2
|
133 |
/**
|
williamr@2
|
134 |
* Sets new bitmap mask.
|
williamr@2
|
135 |
*
|
williamr@2
|
136 |
* @param aMaskBitmap Pointer to @c CFbsBitmap object containing the bitmap
|
williamr@2
|
137 |
* mask.
|
williamr@2
|
138 |
*/
|
williamr@2
|
139 |
IMPORT_C void SetMask(const CFbsBitmap* aMaskBitmap);
|
williamr@2
|
140 |
|
williamr@2
|
141 |
/**
|
williamr@2
|
142 |
* Sets new bitmap and bitmap's mask.
|
williamr@2
|
143 |
*
|
williamr@2
|
144 |
* @param aNewBitmap A bitmap.
|
williamr@2
|
145 |
* @param aNewMask A bitmap mask.
|
williamr@2
|
146 |
*/
|
williamr@2
|
147 |
IMPORT_C void SetNewBitmaps(const CFbsBitmap* aNewBitmap,
|
williamr@2
|
148 |
const CFbsBitmap* aNewMask);
|
williamr@2
|
149 |
|
williamr@2
|
150 |
/**
|
williamr@2
|
151 |
* Checks whether picture is owned externally.
|
williamr@2
|
152 |
*
|
williamr@2
|
153 |
* @return @c ETrue if picture owned externally and @c EFalse if
|
williamr@2
|
154 |
* not.
|
williamr@2
|
155 |
*/
|
williamr@2
|
156 |
IMPORT_C TBool IsPictureOwnedExternally();
|
williamr@2
|
157 |
|
williamr@2
|
158 |
/**
|
williamr@2
|
159 |
* Sets the brush style.
|
williamr@2
|
160 |
*
|
williamr@2
|
161 |
* @param aBrushStyle A brush style.
|
williamr@2
|
162 |
*/
|
williamr@2
|
163 |
IMPORT_C void SetBrushStyle(CGraphicsContext::TBrushStyle aBrushStyle);
|
williamr@2
|
164 |
|
williamr@2
|
165 |
public: // from CCoeControl
|
williamr@2
|
166 |
|
williamr@2
|
167 |
/**
|
williamr@2
|
168 |
* From @c CCoeControl.
|
williamr@2
|
169 |
*
|
williamr@2
|
170 |
* Handles pointer events.
|
williamr@2
|
171 |
*
|
williamr@2
|
172 |
* This function gets called whenever a pointer event occurs in the
|
williamr@2
|
173 |
* control, i.e. when the pointer is within the control's extent, or when
|
williamr@2
|
174 |
* the control has grabbed the pointer. The control should implement this
|
williamr@2
|
175 |
* function to handle pointer events.
|
williamr@2
|
176 |
*
|
williamr@2
|
177 |
* Note: events of type @c EButton1Down are processed before
|
williamr@2
|
178 |
* @c HandlePointerEventL() is called in order to transfer keyboard focus
|
williamr@2
|
179 |
* to the control in which the @c EButton1Down event occurred.
|
williamr@2
|
180 |
*
|
williamr@2
|
181 |
* If overriding @c HandlePointerEventL(), the implementation must include
|
williamr@2
|
182 |
* a base call to @c CCoeControl's @c HandlePointerEventL().
|
williamr@2
|
183 |
*
|
williamr@2
|
184 |
* @param aPointerEvent The pointer event.
|
williamr@2
|
185 |
*/
|
williamr@2
|
186 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
187 |
|
williamr@2
|
188 |
protected: // from CCoeControl
|
williamr@2
|
189 |
|
williamr@2
|
190 |
/**
|
williamr@2
|
191 |
* From @c CCoeControl
|
williamr@2
|
192 |
*
|
williamr@2
|
193 |
* Writes the internal state of the control and its components to a stream.
|
williamr@2
|
194 |
* Does nothing in release mode. Designed to be overidden and base called
|
williamr@2
|
195 |
* by subclasses.
|
williamr@2
|
196 |
*
|
williamr@2
|
197 |
* @since App-Framework_6.1
|
williamr@2
|
198 |
* @param[in,out] aWriteStream The pointer writestream.
|
williamr@2
|
199 |
*/
|
williamr@2
|
200 |
IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
|
williamr@2
|
201 |
|
williamr@2
|
202 |
private: // from CCoeControl
|
williamr@2
|
203 |
|
williamr@2
|
204 |
IMPORT_C void Draw(const TRect& aRect) const;
|
williamr@2
|
205 |
IMPORT_C void Reserved_2();
|
williamr@2
|
206 |
|
williamr@2
|
207 |
private:
|
williamr@2
|
208 |
|
williamr@2
|
209 |
/**
|
williamr@2
|
210 |
* From CAknControl
|
williamr@2
|
211 |
*/
|
williamr@2
|
212 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
213 |
|
williamr@2
|
214 |
private:
|
williamr@2
|
215 |
|
williamr@2
|
216 |
const CFbsBitmap* iBitmap;
|
williamr@2
|
217 |
const CFbsBitmap* iMaskBitmap;
|
williamr@2
|
218 |
TInt iImFlags;
|
williamr@2
|
219 |
TInt iSpare;
|
williamr@2
|
220 |
CGraphicsContext::TBrushStyle iBrushStyle;
|
williamr@2
|
221 |
};
|
williamr@2
|
222 |
|
williamr@2
|
223 |
#endif // __EIKIMAGE_H__
|