66
|
1 |
/*
|
|
2 |
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CMIDCUSTOMITEM_H
|
|
20 |
#define CMIDCUSTOMITEM_H
|
|
21 |
|
|
22 |
#include <gdi.h>
|
|
23 |
#include <lcdui.h>
|
|
24 |
#include <reflcdui.h>
|
|
25 |
//
|
|
26 |
#include "CMIDForm.h"
|
|
27 |
// CMIDControlItem inheritance in class declaration
|
|
28 |
#include "CMIDControlItem.h"
|
|
29 |
// interface class for receiving media key events
|
|
30 |
#include "MMIDMediaKeysListener.h"
|
|
31 |
// PointerEventSuppressor
|
|
32 |
#include <aknpointereventsuppressor.h>
|
|
33 |
|
|
34 |
#ifdef RD_TACTILE_FEEDBACK
|
|
35 |
#include "CMIDTactileFeedbackExtension.h"
|
|
36 |
#endif //RD_TACTILE_FEEDBACK
|
|
37 |
|
|
38 |
|
|
39 |
// FORWARD DECLARATIONS
|
|
40 |
class CMIDRemConObserver;
|
|
41 |
class CMIDKeyDecoder;
|
|
42 |
class CEikLabel;
|
|
43 |
|
|
44 |
NONSHARABLE_CLASS(CMIDCustomItem) : public CMIDControlItem, public MMIDCustomItem,
|
|
45 |
#ifndef RD_JAVA_NGA_ENABLED
|
|
46 |
public MDirectScreenAccess,
|
|
47 |
#endif
|
|
48 |
public MMIDBufferProcessor, public MDirectContainer, public MMIDMediaKeysListener
|
|
49 |
#ifdef RD_TACTILE_FEEDBACK
|
|
50 |
, public MMIDTactileFeedbackComponent
|
|
51 |
#endif // RD_TACTILE_FEEDBACK
|
|
52 |
, public MMIDLcduiEventConsumer
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
static CMIDCustomItem* NewL(MMIDEnv& aEnv, const TDesC& aLabel, CMIDUIManager* aUIManager);
|
|
56 |
|
|
57 |
TBool SupportsInternalTraversal() const;
|
|
58 |
|
|
59 |
//
|
|
60 |
// From MMIDCustomItem
|
|
61 |
//
|
|
62 |
TInt InteractionModes() const;
|
|
63 |
void SetFocusAndScroll(TBool aFocus,const TRect* aScroll,TInt aDirection);
|
|
64 |
|
|
65 |
void SetContainerWindowL(const CCoeControl& aWindow);
|
|
66 |
void Invalidate(const TSize& aMinSize, const TSize& aPrefSize);
|
|
67 |
const TSize& PreferredContentSize() const;
|
|
68 |
const TSize& MinimumContentSize() const;
|
|
69 |
|
|
70 |
CFbsBitmap* FrameBuffer() const;
|
|
71 |
MDirectContainer& DirectContainer();
|
|
72 |
//
|
|
73 |
// From MMIDItem
|
|
74 |
//
|
|
75 |
void SetLabelL(const TDesC& aLabel);
|
|
76 |
void SetLayoutL(TLayout aLayout);
|
|
77 |
|
|
78 |
void SetPreferredSizeL(const TSize& aSize);
|
|
79 |
TSize PreferredSize() const;
|
|
80 |
|
|
81 |
TSize MinimumSize() const;
|
|
82 |
|
|
83 |
void AddCommandL(MMIDCommand* aCommand);
|
|
84 |
void RemoveCommand(MMIDCommand* aCommand);
|
|
85 |
void SetDefaultCommand(MMIDCommand* aCommand);
|
|
86 |
|
|
87 |
//
|
|
88 |
// From MMIDComponent
|
|
89 |
//
|
|
90 |
void Dispose();
|
|
91 |
MMIDBufferProcessor* Processor();
|
|
92 |
|
|
93 |
//
|
|
94 |
// From MMIDBufferProcessor
|
|
95 |
//
|
|
96 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
97 |
virtual TBool ProcessL(
|
|
98 |
const TMIDBufferOp*& aRead, const TMIDBufferOp* aEnd,
|
|
99 |
TInt& aCycles, java::util::Monitor* aMonitor);
|
|
100 |
#else
|
|
101 |
virtual TBool ProcessL(
|
|
102 |
const TMIDBufferOp*& aRead, const TMIDBufferOp* aEnd,
|
|
103 |
TInt& aCycles, TRequestStatus* aStatus = NULL);
|
|
104 |
#endif
|
|
105 |
void AbortAsync();
|
|
106 |
|
|
107 |
//
|
|
108 |
// From CCoeControl
|
|
109 |
//
|
|
110 |
TSize MinimumSize();
|
|
111 |
TInt CountComponentControls() const;
|
|
112 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
|
113 |
void Draw(const TRect& aRect) const;
|
|
114 |
void SizeChanged();
|
|
115 |
void PositionChanged();
|
|
116 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aEvent, TEventCode aType);
|
|
117 |
#ifdef RD_SCALABLE_UI_V2
|
|
118 |
void HandlePointerEventL(const TPointerEvent &aPointerEvent);
|
|
119 |
#endif //RD_SCALABLE_UI_V2
|
|
120 |
void HandleCurrentL(TBool aCurrent);
|
|
121 |
|
|
122 |
public:
|
|
123 |
TSize ResetPreferredSize() const;
|
|
124 |
TSize CheckRequestedSize(const TSize& aRequestedSize) const;
|
|
125 |
void FocusChanged(TDrawNow aDrawNow);
|
|
126 |
void HandleVisibilityChange();
|
|
127 |
// overrides CMIDItem::SetForm(CMIDForm* aForm)
|
|
128 |
void SetForm(CMIDForm* aForm);
|
|
129 |
|
|
130 |
TInt ItemPreferredHeightWithoutLabel();
|
|
131 |
|
|
132 |
public:
|
|
133 |
// from CMIDItem
|
|
134 |
void ItemAddedToFormL();
|
|
135 |
void ItemRemovedFromForm();
|
|
136 |
|
|
137 |
// from CMIDControlItem
|
|
138 |
void PostFocusTransferEvent(TBool aFocus,CMIDForm::TDirection aDirection);
|
|
139 |
|
|
140 |
void AdjustToSizeL(const TSize& aSize);
|
|
141 |
|
|
142 |
void ResolutionChange(TInt aType);
|
|
143 |
|
|
144 |
void HandleWindowFade(TBool aFaded);
|
|
145 |
|
|
146 |
private:
|
|
147 |
/**
|
|
148 |
* PointerEventSuppressor.
|
|
149 |
* Own.
|
|
150 |
*/
|
|
151 |
CAknPointerEventSuppressor* iPointerEventSuppressor;
|
|
152 |
TPoint iPointerPressedCoordinates;
|
|
153 |
TBool iPointerEventSuppressionOngoing;
|
|
154 |
TInt iPESPointerMovementInTwips;
|
|
155 |
TInt iPESTimeInMilliseconds;
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Ctor
|
|
159 |
* @param aEnv Environment instance
|
|
160 |
* @param aUIManager UI Manager
|
|
161 |
*/
|
|
162 |
CMIDCustomItem(MMIDEnv& aEnv, CMIDUIManager* aUIManager);
|
|
163 |
~CMIDCustomItem();
|
|
164 |
void ConstructL(const TDesC& aLabel);
|
|
165 |
|
|
166 |
CMIDForm::TDirection TranslateKey(const TKeyEvent& aEvent);
|
|
167 |
|
|
168 |
void ResetBuffers();
|
|
169 |
void CreateBuffersL();
|
|
170 |
|
|
171 |
void UpdateMargins();
|
|
172 |
|
|
173 |
#ifndef RD_JAVA_NGA_ENABLED
|
|
174 |
/**
|
|
175 |
* Pauses the direct screen access.
|
|
176 |
* Sets iDirectPaused flag to true.
|
|
177 |
*/
|
|
178 |
void PauseDirectAccess();
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Sets iDirectPaused flag to true.
|
|
182 |
* Resumes the direct screen access using StartDirectAccess().
|
|
183 |
*/
|
|
184 |
void ResumeDirectAccess();
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Stops direct screen access.
|
|
188 |
*/
|
|
189 |
void StopDirectAccess();
|
|
190 |
|
|
191 |
void StartDirectAccess();
|
|
192 |
#endif
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Checks if there are hw keyboards available in the device and returns the
|
|
196 |
* interaction modes based on keyboard availability.
|
|
197 |
*
|
|
198 |
* @return TInt containing the supported keyboard interaction modes.
|
|
199 |
* @since S60 5.0
|
|
200 |
*/
|
|
201 |
TInt KeyboardInteractionModesL() const;
|
|
202 |
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Notifies the current displayable
|
|
206 |
* about the direct content position update
|
|
207 |
*
|
|
208 |
* @since S60 5.0
|
|
209 |
* @return ETrue if the update was done
|
|
210 |
EFalse if the update could be done
|
|
211 |
*/
|
|
212 |
TBool UpdateDirectContentBounds();
|
|
213 |
|
|
214 |
#ifndef RD_JAVA_NGA_ENABLED
|
|
215 |
public:
|
|
216 |
// From MDirectScreenAccess
|
|
217 |
virtual void AbortNow(RDirectScreenAccess::TTerminationReasons aReasons);
|
|
218 |
virtual void Restart(RDirectScreenAccess::TTerminationReasons aReasons);
|
|
219 |
#endif
|
|
220 |
|
|
221 |
// From MDirectContainer
|
|
222 |
public:
|
|
223 |
void MdcAddContent(MDirectContent* aContent);
|
|
224 |
void MdcRemoveContent(MDirectContent* aContent);
|
|
225 |
TRect MdcContainerWindowRect() const;
|
|
226 |
TBool MdcContainerVisibility() const;
|
|
227 |
TRect MdcContentBounds() const;
|
|
228 |
void MdcItemContentRect(TRect& aContentRect, TRect& aScreenRect) const;
|
|
229 |
void MdcHandlePointerEventL(TPointerEvent& aPointerEvent);
|
|
230 |
void MdcFlushContainer(const TRect& aRect);
|
|
231 |
void MdcAddContentBounds(const TRect& aRect);
|
|
232 |
void MdcRemoveContentBounds(const TRect& aRect);
|
|
233 |
void MdcGetDSAResources(MUiEventConsumer& aConsumer);
|
|
234 |
void MdcGetUICallback(MUiEventConsumer& aConsumer, TInt aCallbackId);
|
|
235 |
|
|
236 |
/**
|
|
237 |
* From MDirectContainer.
|
|
238 |
*
|
|
239 |
* @since S60 v9.2
|
|
240 |
* @param TBool aEnableFix
|
|
241 |
*/
|
|
242 |
void MdcFixUIOrientation(TBool aEnableFix);
|
|
243 |
|
|
244 |
// From MMIDLcduiEventConsumer
|
|
245 |
public:
|
|
246 |
void HandleLcduiEvent(int aType);
|
|
247 |
|
|
248 |
// From MMIDMediaKeysListener
|
|
249 |
public:
|
|
250 |
/**
|
|
251 |
* This method is called when a media key has been pressed.
|
|
252 |
* Posts the key event to Java layer.
|
|
253 |
*
|
|
254 |
* @param TMIDKeyEvent Media key event that has occured.
|
|
255 |
* @since S60 3.2
|
|
256 |
*/
|
|
257 |
void HandleMediaKeyEvent(TMIDKeyEvent& aKeyEvent);
|
|
258 |
|
|
259 |
void ChangeDirectContainerVisibility(TBool aVisible);
|
|
260 |
|
|
261 |
#ifdef RD_TACTILE_FEEDBACK
|
|
262 |
|
|
263 |
CMIDTactileFeedbackExtension* iTactileFeedback;
|
|
264 |
|
|
265 |
public:
|
|
266 |
MMIDTactileFeedbackComponent* TactileFeedbackComponent();
|
|
267 |
|
|
268 |
void UpdateTactileFeedback();
|
|
269 |
|
|
270 |
void RegisterFeedbackArea(TInt aId, TRect aRect, TInt aStyle);
|
|
271 |
void UnregisterFeedbackArea(TInt aId);
|
|
272 |
void UnregisterFeedbackForControl();
|
|
273 |
void MoveAreaToFirstPriority(TInt aId);
|
|
274 |
#endif
|
|
275 |
|
|
276 |
|
|
277 |
private:
|
|
278 |
/** The content buffer, used by the
|
|
279 |
Graphics object associated to this custom item */
|
|
280 |
CFbsBitmap* iFrameBuffer;
|
|
281 |
CFbsBitGc* iFrameContext;
|
|
282 |
CFbsBitmapDevice* iFrameDevice;
|
|
283 |
|
|
284 |
/** The offscreen buffer, implements double buffering
|
|
285 |
to assure content is kept between drawn. This allows
|
|
286 |
having skin underneath the content if nothing is drawn on it.
|
|
287 |
*/
|
|
288 |
CFbsBitmap* iOffScreenBuffer;
|
|
289 |
CFbsBitGc* iOffScreenContext;
|
|
290 |
CFbsBitmapDevice* iOffScreenDevice;
|
|
291 |
|
|
292 |
TSize iMinimumContentSize; // This doesn't include margin
|
|
293 |
TSize iPreferredContentSize; // This doesn't include margin
|
|
294 |
TRect iContentRect;
|
|
295 |
TBool iEntered;
|
|
296 |
TBool iSupportsInternalTraversal;
|
|
297 |
MMIDEnv& iEnv;
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Indicates that the iFrameBuffer may be reset (with background skin).
|
|
301 |
* It prevents the situation where iFrameBuffer is reset
|
|
302 |
* before it has been copied to iOffScreenBuffer.
|
|
303 |
*/
|
|
304 |
TBool iResetFrameBuffer;
|
|
305 |
|
|
306 |
/**
|
|
307 |
* Item can only have one DirectContent.
|
|
308 |
* Content is null if content is not added
|
|
309 |
* with MdcAddContent method.
|
|
310 |
*/
|
|
311 |
MDirectContent* iDirectContent;
|
|
312 |
TBool iDirectAreaAddedToDisplayable;
|
|
313 |
TRect iDirectArea;
|
|
314 |
|
|
315 |
TMargins iContentMargins; // Margins for the content in relation to controlItem area
|
|
316 |
CMIDRemConObserver* iRemConObserver;
|
|
317 |
CMIDKeyDecoder* iKeyDecoder;
|
|
318 |
// Nokia-MIDlet-S60-Selection-Key-Compatibility
|
|
319 |
TBool iS60SelectionKeyCompatibility;
|
|
320 |
|
|
321 |
#ifndef RD_JAVA_NGA_ENABLED
|
|
322 |
CDirectScreenAccess* iDirectAccess;
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Indicates that direct screen access is paused
|
|
326 |
* using PauseDirectAccess().
|
|
327 |
*/
|
|
328 |
TBool iDirectPaused;
|
|
329 |
#endif
|
|
330 |
|
|
331 |
TBool iRestoreDirectContentWhenUnfaded;
|
|
332 |
|
|
333 |
// Stores information if CustomItem changed it visibility
|
|
334 |
// from invisible (e.g. outside Form, to background) to visible and vice versa
|
|
335 |
TBool iPreviousVisibility;
|
|
336 |
|
|
337 |
/**
|
|
338 |
* A consumer which is waiting for the callback.
|
|
339 |
* Set in case that Container Window have not been set
|
|
340 |
* before MdcGetDSAResources call.
|
|
341 |
* Not owned.
|
|
342 |
*/
|
|
343 |
MUiEventConsumer* iConsumerWaitingForDSAResourcesCallback;
|
|
344 |
|
|
345 |
/**
|
|
346 |
* Stores the last window position as returned
|
|
347 |
* from DrawableWindow()->Position() to be useful
|
|
348 |
* from another than MMAPI ES thread.
|
|
349 |
*/
|
|
350 |
TPoint iLastWindowPosition;
|
|
351 |
|
|
352 |
/**
|
|
353 |
* using for Items on Form
|
|
354 |
* checking if Form was created
|
|
355 |
*/
|
|
356 |
TBool iUiFixed;
|
|
357 |
TBool iUiToBeFixedLater;
|
|
358 |
|
|
359 |
};
|
|
360 |
|
|
361 |
#endif // CMIDCUSTOMITEM_H
|
|
362 |
|
|
363 |
|
|
364 |
|