author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:19:17 +0300 | |
branch | RCL_3 |
changeset 27 | 34937ec34dac |
parent 26 | 5b3385a43d68 |
permissions | -rw-r--r-- |
26 | 1 |
/* |
2 |
* Copyright (c) 2008-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: Cloud View Context menu control class |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// Alf Headers |
|
19 |
#include <alf/alflayout.h> |
|
20 |
#include <alf/alfgridlayout.h> // For CAlfGridLayout |
|
21 |
#include <alf/alfborderbrush.h> // For CAlfBorderBrush |
|
22 |
#include <alf/alfroster.h> // For CalfRoster |
|
23 |
#include <alf/alfanchorlayout.h> |
|
24 |
#include <alf/alftextvisual.h> |
|
25 |
#include <alf/alfimagevisual.h> |
|
26 |
#include <alf/alfbrusharray.h> |
|
27 |
#include <alf/alftextstyle.h> |
|
28 |
#include <alf/alfenv.h> |
|
29 |
#include <alf/alfeventhandler.h> |
|
30 |
#include <alf/alfutil.h> |
|
31 |
#include <alf/alftexture.h> |
|
32 |
#include <alf/alfcurvepath.h> |
|
33 |
#include <alf/alflinevisual.h> |
|
34 |
#include <alf/alfevent.h> |
|
35 |
#include <alf/alfdisplay.h> |
|
36 |
#include <alf/alfframebrush.h> |
|
37 |
||
38 |
#include <StringLoader.h> |
|
39 |
#include <touchfeedback.h> |
|
40 |
||
41 |
// Photos Headers |
|
42 |
#include "glxtagscontextmenucontrol.h" |
|
43 |
#include "glxcommandfactory.h" |
|
44 |
#include <mglxmedialist.h> //for medialist |
|
45 |
#include <glxuiutility.h> |
|
46 |
#include <glxtexturemanager.h> // Texturemanager |
|
47 |
#include <glxicons.mbg> // icons |
|
48 |
#include <glxuistd.h> // Attribute fetch priority |
|
49 |
#include <glxcommandhandlers.hrh> |
|
50 |
#include "glxbubbletimer.h" //for timer functionality |
|
51 |
#include <glxtagsbrowserview.rsg> // For resources |
|
52 |
#include <glxtracer.h> // For Logs |
|
53 |
||
54 |
//Left & Top padding of text within text box (In Pixels) |
|
55 |
const TInt KMinimalGap = 5; |
|
56 |
//Height of each menu item |
|
57 |
const TInt KReqHeightPerMenuItem = 47; |
|
58 |
//Number of menu items present in stylus menu |
|
59 |
const TInt KNumofMenuItems = 3; |
|
60 |
//Number of columns present in grid control showing menu |
|
61 |
const TInt KNoOfColumns = 1; |
|
62 |
//Highest possible value to make control opaque |
|
63 |
const TReal KOpacityOpaque = 1.0; |
|
64 |
//lowest possible value to make control completely transparent |
|
65 |
const TReal KOpacityTransparent = 0.0; |
|
66 |
const TPoint KDummyPoint(500, 500); |
|
67 |
//6 Seconds delay for menu control visibility on screen |
|
68 |
const TInt KTimerDelay = 6000000; |
|
69 |
//Control complete height |
|
70 |
const TInt KGridHeight = ((KReqHeightPerMenuItem * KNumofMenuItems) + (KMinimalGap * (KNumofMenuItems + 1))); |
|
71 |
//Text size for menu items |
|
72 |
const TInt KTextSizeInPixels = 20; |
|
73 |
//X shrink factor for stylus menu border to be drawn/visible |
|
74 |
const TInt KShrinkXCoord = 5; |
|
75 |
//Y shrink factor for stylus menu border to be drawn/visible |
|
76 |
const TInt KShrinkYCoord = 5; |
|
77 |
//Padding value for Minimum width for control |
|
78 |
const TInt KWidthPadding = 30; |
|
79 |
//Padding value for Minimum spacing for line separators |
|
80 |
const TInt KLinePadding = 5; |
|
81 |
//Padding value for right margin |
|
82 |
const TInt KRightMargin = 10; |
|
83 |
//Context menu separator line thickness value |
|
84 |
const TReal KSeparatorLineThickness = 0.2; |
|
85 |
//For Tagging the visuals |
|
86 |
_LIT8(KTagSlideshow, "SS"); |
|
87 |
_LIT8(KTagRename, "Ren"); |
|
88 |
_LIT8(KTagDelete, "Del"); |
|
89 |
||
90 |
// --------------------------------------------------------------------------- |
|
91 |
// NewL() |
|
92 |
// --------------------------------------------------------------------------- |
|
93 |
// |
|
94 |
CGlxTagsContextMenuControl* CGlxTagsContextMenuControl::NewL( |
|
95 |
MGlxItemMenuObserver& aItemMenuObserver) |
|
96 |
{ |
|
97 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::NewL"); |
|
98 |
CGlxTagsContextMenuControl* self = CGlxTagsContextMenuControl::NewLC( |
|
99 |
aItemMenuObserver); |
|
100 |
CleanupStack::Pop(self); |
|
101 |
return self; |
|
102 |
} |
|
103 |
// --------------------------------------------------------------------------- |
|
104 |
// NewLC() |
|
105 |
// --------------------------------------------------------------------------- |
|
106 |
// |
|
107 |
CGlxTagsContextMenuControl* CGlxTagsContextMenuControl::NewLC( |
|
108 |
MGlxItemMenuObserver& aItemMenuObserver ) |
|
109 |
{ |
|
110 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::NewLC"); |
|
111 |
CGlxTagsContextMenuControl* self = |
|
112 |
new (ELeave) CGlxTagsContextMenuControl(aItemMenuObserver); |
|
113 |
CleanupStack::PushL( self ); |
|
114 |
self->ConstructL(); |
|
115 |
return self; |
|
116 |
} |
|
117 |
// --------------------------------------------------------------------------- |
|
118 |
// CGlxTagsContextMenuControl() |
|
119 |
// --------------------------------------------------------------------------- |
|
120 |
// |
|
121 |
CGlxTagsContextMenuControl::CGlxTagsContextMenuControl( |
|
122 |
MGlxItemMenuObserver& aItemMenuObserver) : |
|
123 |
iItemMenuObserver(aItemMenuObserver), iCommandId(KErrNotFound) |
|
124 |
{ |
|
125 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::CGlxTagsContextMenuControl"); |
|
126 |
//Nothing more to do for now |
|
127 |
} |
|
128 |
// --------------------------------------------------------------------------- |
|
129 |
// ConstructL() |
|
130 |
// --------------------------------------------------------------------------- |
|
131 |
// |
|
132 |
void CGlxTagsContextMenuControl::ConstructL() |
|
133 |
{ |
|
134 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::ConstructL"); |
|
135 |
CGlxUiUtility* utility = CGlxUiUtility::UtilityL(); |
|
136 |
CleanupClosePushL( *utility ); |
|
137 |
iAlfEnv = utility->Env(); |
|
138 |
CleanupStack::PopAndDestroy( utility ); |
|
139 |
CAlfControl::ConstructL(*iAlfEnv); |
|
140 |
||
141 |
iTimer = CGlxBubbleTimer::NewL(this); |
|
142 |
||
143 |
iMainVisual = CAlfAnchorLayout::AddNewL(*this); |
|
144 |
iMainVisual->SetFlag(EAlfVisualFlagManualLayout); |
|
145 |
iMainVisual->SetPos(TAlfRealPoint(KDummyPoint)); |
|
146 |
// Create a new 3x1 grid layout visual. |
|
147 |
iGrid = CAlfGridLayout::AddNewL(*this, KNoOfColumns, KNumofMenuItems, |
|
148 |
iMainVisual);//columns, rows |
|
149 |
iGrid->SetFlag(EAlfVisualFlagManualLayout); |
|
150 |
//Finally create the menu list that will appear in screen |
|
151 |
CreateMenuListL(CreateFontL()); |
|
152 |
CalculateMaxWidth(); |
|
153 |
iMainVisual->SetSize(TSize(KWidthPadding + iMaxTextWidth, KGridHeight)); |
|
154 |
iGrid->SetInnerPadding(TPoint(KLinePadding,KLinePadding)); |
|
155 |
const TRect gridSize(TPoint(KLinePadding,KLinePadding),TSize(KTextSizeInPixels + iMaxTextWidth, KGridHeight - 10)); |
|
156 |
iGrid->SetRect(TAlfRealRect(gridSize)); |
|
157 |
||
158 |
iMainVisual->EnableBrushesL(ETrue); |
|
159 |
||
160 |
TRect outerRect(TRect(TPoint(KDummyPoint), |
|
161 |
TSize(KWidthPadding + iMaxTextWidth, KGridHeight))); |
|
162 |
TRect innerRect(outerRect); |
|
163 |
innerRect.Shrink(KShrinkXCoord, KShrinkYCoord); |
|
164 |
||
165 |
CAlfFrameBrush* frameBrush = CAlfFrameBrush::NewLC(*iAlfEnv, |
|
166 |
KAknsIIDQsnFrPopupSub); |
|
167 |
frameBrush->SetFrameRectsL(innerRect, outerRect); |
|
168 |
||
169 |
iMainVisual->Brushes()->AppendL(frameBrush, EAlfHasOwnership); |
|
170 |
CleanupStack::Pop(frameBrush); |
|
171 |
||
172 |
DrawLineSeparatorsL(); |
|
173 |
ShowItemMenuL(EFalse); |
|
174 |
} |
|
175 |
// --------------------------------------------------------------------------- |
|
176 |
// ~CGlxTagsContextMenuControl() |
|
177 |
// --------------------------------------------------------------------------- |
|
178 |
// |
|
179 |
CGlxTagsContextMenuControl::~CGlxTagsContextMenuControl() |
|
180 |
{ |
|
181 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::CGlxTagsContextMenuControl"); |
|
182 |
if (iMainVisual) |
|
183 |
{ |
|
184 |
iMainVisual->RemoveAndDestroyAllD(); |
|
185 |
iMainVisual = NULL; |
|
186 |
} |
|
187 |
if ( iTimer) |
|
188 |
{ |
|
189 |
iTimer->Cancel();//cancels any outstanding requests |
|
190 |
delete iTimer; |
|
191 |
iTimer = NULL; |
|
192 |
} |
|
193 |
} |
|
194 |
// --------------------------------------------------------------------------- |
|
195 |
// CreateFont() |
|
196 |
// --------------------------------------------------------------------------- |
|
197 |
// |
|
198 |
TInt CGlxTagsContextMenuControl::CreateFontL() |
|
199 |
{ |
|
200 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::CreateFont"); |
|
201 |
||
202 |
// Create a new style based on the required font |
|
203 |
CAlfTextStyleManager& styleMan = iAlfEnv->TextStyleManager(); |
|
204 |
||
205 |
// remember its id for return later |
|
206 |
TInt id = styleMan.CreatePlatformTextStyleL(EAlfTextStyleNormal); |
|
207 |
||
208 |
// Get style. It is not owned |
|
209 |
CAlfTextStyle* style = styleMan.TextStyle(id); |
|
210 |
||
211 |
// Set this style to have required size and to be normal weight |
|
212 |
style->SetTextSizeInPixels(KTextSizeInPixels); |
|
213 |
style->SetBold(ETrue); |
|
214 |
||
215 |
return id; |
|
216 |
} |
|
217 |
||
218 |
// --------------------------------------------------------------------------- |
|
219 |
// CreateMenuListL() |
|
220 |
// --------------------------------------------------------------------------- |
|
221 |
// |
|
222 |
void CGlxTagsContextMenuControl::CreateMenuListL(TInt aFontId) |
|
223 |
{ |
|
224 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::CreateMenuList"); |
|
225 |
||
226 |
TRgb color; |
|
227 |
//Gets the color of the text specific to skin |
|
228 |
AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color, |
|
229 |
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG20); |
|
230 |
||
231 |
//Loading the strings from rss |
|
232 |
HBufC* renameTitle = StringLoader::LoadLC( R_GLX_TAGS_RENAME_TITLE ); |
|
233 |
HBufC* slideshowTitle = StringLoader::LoadLC( R_GLX_TAGS_SLIDESHOW_TITLE ); |
|
234 |
HBufC* deleteTitle = StringLoader::LoadLC( R_GLX_TAGS_DELETE_TITLE ); |
|
235 |
||
236 |
iSlideshowTextVisual = CAlfTextVisual::AddNewL(*this, iGrid); |
|
237 |
iSlideshowTextVisual->SetTagL(KTagSlideshow); |
|
238 |
iSlideshowTextVisual->SetTextStyle(aFontId); |
|
239 |
iSlideshowTextVisual->SetColor(color); |
|
240 |
iSlideshowTextVisual->SetTextL(*slideshowTitle); |
|
241 |
iSlideshowTextVisual->SetOffset(TAlfTimedPoint(10,0)); |
|
242 |
iSlideshowTextVisual->SetAlign(EAlfAlignHLocale, EAlfAlignVCenter); |
|
243 |
||
244 |
iDeleteTextVisual = CAlfTextVisual::AddNewL(*this, iGrid); |
|
245 |
iDeleteTextVisual->SetTagL(KTagDelete); |
|
246 |
iDeleteTextVisual->SetTextStyle(aFontId); |
|
247 |
iDeleteTextVisual->SetColor(color); |
|
248 |
iDeleteTextVisual->SetTextL(*deleteTitle); |
|
249 |
iDeleteTextVisual->SetOffset(TAlfTimedPoint(10,0)); |
|
250 |
iDeleteTextVisual->SetAlign(EAlfAlignHLocale, EAlfAlignVCenter); |
|
251 |
||
252 |
iRenameTextVisual = CAlfTextVisual::AddNewL(*this, iGrid); |
|
253 |
iRenameTextVisual->SetTagL(KTagRename); |
|
254 |
iRenameTextVisual->SetTextStyle(aFontId); |
|
255 |
iRenameTextVisual->SetColor(color); |
|
256 |
iRenameTextVisual->SetTextL(*renameTitle); |
|
257 |
iRenameTextVisual->SetOffset(TAlfTimedPoint(10,0)); |
|
258 |
iRenameTextVisual->SetAlign(EAlfAlignHLocale, EAlfAlignVCenter); |
|
259 |
||
260 |
CleanupStack::PopAndDestroy(deleteTitle); // for deleteTitle |
|
261 |
CleanupStack::PopAndDestroy(slideshowTitle);// slideshowTitle |
|
262 |
CleanupStack::PopAndDestroy(renameTitle);// renameTitle |
|
263 |
} |
|
264 |
// --------------------------------------------------------------------------- |
|
265 |
// SetDisplayL() |
|
266 |
// --------------------------------------------------------------------------- |
|
267 |
// |
|
268 |
void CGlxTagsContextMenuControl::SetDisplay(const TPoint& aPoint) |
|
269 |
{ |
|
270 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::SetDisplayL"); |
|
271 |
//if already started , cancel it |
|
272 |
if(iTimer && iTimer->IsActive()) |
|
273 |
{ |
|
274 |
iTimer->Cancel();//cancels any outstanding requests |
|
275 |
} |
|
276 |
||
277 |
TInt upperYPos = aPoint.iY - KMinimalGap; |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
278 |
TInt xPos = aPoint.iX; |
26 | 279 |
|
280 |
//always draw above |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
281 |
if ((iViewableRect.iBr.iX - (xPos + KRightMargin + KWidthPadding)) |
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
282 |
< iMaxTextWidth) |
26 | 283 |
{ |
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
284 |
xPos = aPoint.iX - iMaxTextWidth; |
26 | 285 |
} |
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
286 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
287 |
if (upperYPos + KGridHeight > iViewableRect.iBr.iY) |
26 | 288 |
{ |
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
289 |
upperYPos = iViewableRect.iBr.iY - KGridHeight; |
26 | 290 |
} |
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
291 |
|
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
292 |
iMainVisual->SetPos(TAlfRealPoint(xPos, upperYPos)); |
26 | 293 |
|
294 |
if ( iTimer) |
|
295 |
{ |
|
296 |
iTimer->Cancel(); //cancels any outstanding requests |
|
297 |
iTimer->SetDelay(KTimerDelay); |
|
298 |
} |
|
299 |
} |
|
300 |
||
301 |
// --------------------------------------------------------------------------- |
|
302 |
// ShowItemMenuL() |
|
303 |
// --------------------------------------------------------------------------- |
|
304 |
// |
|
305 |
void CGlxTagsContextMenuControl::ShowItemMenuL(TBool aShow) |
|
306 |
{ |
|
307 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::ShowItemMenuL"); |
|
308 |
if(aShow) |
|
309 |
{ |
|
310 |
iMainVisual->SetOpacity(KOpacityOpaque); |
|
311 |
iItemMenuVisibility = ETrue; |
|
312 |
} |
|
313 |
else |
|
314 |
{ |
|
315 |
iMainVisual->SetOpacity(KOpacityTransparent); |
|
316 |
iRenameTextVisual->EnableBrushesL(EFalse); |
|
317 |
iDeleteTextVisual->EnableBrushesL(EFalse); |
|
318 |
iSlideshowTextVisual->EnableBrushesL(EFalse); |
|
319 |
iItemMenuVisibility = EFalse; |
|
320 |
iMainVisual->SetPos(TAlfRealPoint(KDummyPoint)); |
|
321 |
} |
|
322 |
} |
|
323 |
||
324 |
// --------------------------------------------------------------------------- |
|
325 |
// ItemMenuVisibility() |
|
326 |
// --------------------------------------------------------------------------- |
|
327 |
// |
|
328 |
TBool CGlxTagsContextMenuControl::ItemMenuVisibility() |
|
329 |
{ |
|
330 |
return iItemMenuVisibility; |
|
331 |
} |
|
332 |
||
333 |
// --------------------------------------------------------------------------- |
|
334 |
// OfferEventL() |
|
335 |
// --------------------------------------------------------------------------- |
|
336 |
// |
|
337 |
TBool CGlxTagsContextMenuControl::OfferEventL(const TAlfEvent& aEvent) |
|
338 |
{ |
|
339 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::OfferEventL"); |
|
340 |
TBool consumed = EFalse; |
|
341 |
||
342 |
if (aEvent.IsPointerEvent() && iItemMenuVisibility ) |
|
343 |
{ |
|
344 |
MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
345 |
if (aEvent.PointerDown()) |
|
346 |
{ |
|
347 |
iCommandId = KErrNotFound; |
|
348 |
Display()->Roster().SetPointerEventObservers( |
|
349 |
EAlfPointerEventReportDrag |
|
350 |
+ EAlfPointerEventReportLongTap |
|
351 |
+ EAlfPointerEventReportUnhandled, *this); |
|
352 |
if (iItemMenuVisibility) |
|
353 |
{ |
|
354 |
CAlfVisual* onVisual = aEvent.Visual(); |
|
355 |
CAlfFrameBrush* brush = CAlfFrameBrush::NewLC(*iAlfEnv, |
|
356 |
KAknsIIDQsnFrList); |
|
357 |
TRect textVisualRect = TRect(TPoint( |
|
358 |
iSlideshowTextVisual->Pos().IntValueNow()), TSize( |
|
359 |
iSlideshowTextVisual->Size().ValueNow().AsSize())); |
|
360 |
TRect innerRect(textVisualRect); |
|
361 |
innerRect.Shrink(KShrinkXCoord, KShrinkYCoord); |
|
362 |
brush->SetFrameRectsL(innerRect, textVisualRect); |
|
363 |
iTimer->Cancel(); //cancels any outstanding requests |
|
364 |
if (AlfUtil::TagMatches(onVisual->Tag(), KTagSlideshow)) |
|
365 |
{ |
|
366 |
iSlideshowTextVisual->EnableBrushesL(ETrue); |
|
367 |
iSlideshowTextVisual->Brushes()->AppendL(brush, |
|
368 |
EAlfHasOwnership); |
|
369 |
||
370 |
iCommandId = EGlxCmdSlideshowPlay; |
|
371 |
} |
|
372 |
else if (AlfUtil::TagMatches(onVisual->Tag(), KTagDelete)) |
|
373 |
{ |
|
374 |
iDeleteTextVisual->EnableBrushesL(ETrue); |
|
375 |
iDeleteTextVisual->Brushes()->AppendL(brush, |
|
376 |
EAlfHasOwnership); |
|
377 |
||
378 |
iCommandId = EGlxCmdDelete; |
|
379 |
} |
|
380 |
else if (AlfUtil::TagMatches(onVisual->Tag(), KTagRename)) |
|
381 |
{ |
|
382 |
iRenameTextVisual->EnableBrushesL(ETrue); |
|
383 |
iRenameTextVisual->Brushes()->AppendL(brush, |
|
384 |
EAlfHasOwnership); |
|
385 |
||
386 |
iCommandId = EGlxCmdRename; |
|
387 |
} |
|
388 |
consumed = ETrue; |
|
389 |
if (feedback) |
|
390 |
{ |
|
391 |
feedback->InstantFeedback(ETouchFeedbackBasic); |
|
392 |
} |
|
393 |
CleanupStack::Pop(brush); |
|
394 |
}//End of iItemMenuVisibility check |
|
395 |
}//End of Pointer down event |
|
396 |
else if (aEvent.PointerUp()) |
|
397 |
{ |
|
398 |
if (iCommandId >= 0) |
|
399 |
{ |
|
400 |
TBool eventInsideControl = HitTest( |
|
401 |
aEvent.PointerEvent().iParentPosition); |
|
402 |
//If Up event is received only within Menu control, handle the command |
|
403 |
if (eventInsideControl) |
|
404 |
{ |
|
405 |
ShowItemMenuL(EFalse); |
|
406 |
||
407 |
iItemMenuObserver.HandleGridMenuListL(iCommandId); |
|
408 |
iCommandId = KErrNotFound; |
|
409 |
} |
|
410 |
else |
|
411 |
{ |
|
412 |
HandleUpEventL(); |
|
413 |
} |
|
414 |
} |
|
415 |
consumed = ETrue; |
|
416 |
} |
|
417 |
else if (aEvent.PointerEvent().EDrag) |
|
418 |
{ |
|
419 |
TBool eventInsideControl = HitTest( |
|
420 |
aEvent.PointerEvent().iParentPosition); |
|
421 |
if (!eventInsideControl) |
|
422 |
{ |
|
423 |
HandleUpEventL(); |
|
424 |
} |
|
425 |
else if (eventInsideControl && feedback) |
|
426 |
{ |
|
427 |
feedback->InstantFeedback(ETouchFeedbackBasic); |
|
428 |
} |
|
429 |
consumed = ETrue; |
|
430 |
} |
|
431 |
consumed = ETrue; |
|
432 |
} |
|
433 |
return consumed; |
|
434 |
} |
|
435 |
||
436 |
// --------------------------------------------------------------------------- |
|
437 |
// TimerCompleteL() |
|
438 |
// --------------------------------------------------------------------------- |
|
439 |
// |
|
440 |
void CGlxTagsContextMenuControl::TimerCompleteL() |
|
441 |
{ |
|
442 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::TimerCompleteL"); |
|
443 |
ShowItemMenuL(EFalse); |
|
27
34937ec34dac
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
444 |
iItemMenuObserver.HandleGridMenuListL(); |
26 | 445 |
} |
446 |
||
447 |
// --------------------------------------------------------------------------- |
|
448 |
// SetViewableRect() |
|
449 |
// --------------------------------------------------------------------------- |
|
450 |
// |
|
451 |
void CGlxTagsContextMenuControl::SetViewableRect(TRect aRect) |
|
452 |
{ |
|
453 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::SetViewableRect"); |
|
454 |
iViewableRect.SetRect(aRect.iTl.iX, aRect.iTl.iY, |
|
455 |
aRect.iBr.iX, aRect.iBr.iY); |
|
456 |
} |
|
457 |
// --------------------------------------------------------------------------- |
|
458 |
// CalculateMaxWidth() |
|
459 |
// --------------------------------------------------------------------------- |
|
460 |
// |
|
461 |
void CGlxTagsContextMenuControl::CalculateMaxWidth() |
|
462 |
{ |
|
463 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::CalculateMaxWidth"); |
|
464 |
||
465 |
iMaxTextWidth |
|
466 |
= (iSlideshowTextVisual->TextExtents().iWidth |
|
467 |
> iRenameTextVisual->TextExtents().iWidth |
|
468 |
? iSlideshowTextVisual->TextExtents().iWidth |
|
469 |
: iRenameTextVisual->TextExtents().iWidth); |
|
470 |
||
471 |
iMaxTextWidth |
|
472 |
= (iMaxTextWidth > iDeleteTextVisual->TextExtents().iWidth |
|
473 |
? iMaxTextWidth |
|
474 |
: iDeleteTextVisual->TextExtents().iWidth); |
|
475 |
||
476 |
} |
|
477 |
// --------------------------------------------------------------------------- |
|
478 |
// HandleUpEventL() |
|
479 |
// --------------------------------------------------------------------------- |
|
480 |
// |
|
481 |
void CGlxTagsContextMenuControl::HandleUpEventL() |
|
482 |
{ |
|
483 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::HandleUpEventL"); |
|
484 |
if(iCommandId >=0 && iItemMenuVisibility) |
|
485 |
{ |
|
486 |
iCommandId = KErrNotFound; |
|
487 |
||
488 |
iRenameTextVisual->EnableBrushesL(EFalse); |
|
489 |
iDeleteTextVisual->EnableBrushesL(EFalse); |
|
490 |
iSlideshowTextVisual->EnableBrushesL(EFalse); |
|
491 |
||
492 |
iTimer->SetDelay(KTimerDelay); |
|
493 |
} |
|
494 |
} |
|
495 |
// --------------------------------------------------------------------------- |
|
496 |
// DrawLineSeparatorsL() |
|
497 |
// --------------------------------------------------------------------------- |
|
498 |
// |
|
499 |
void CGlxTagsContextMenuControl::DrawLineSeparatorsL() |
|
500 |
{ |
|
501 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::DrawLineSeparators"); |
|
502 |
TRgb color; |
|
503 |
//Gets the color of the line specific to skin |
|
504 |
AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color, |
|
505 |
KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG11); |
|
506 |
||
507 |
for (TInt i = 1; i < KNumofMenuItems; i++) |
|
508 |
{ |
|
509 |
CAlfCurvePath* curvePath = CAlfCurvePath::NewLC(*iAlfEnv); |
|
510 |
curvePath->AppendArcL(TPoint(KLinePadding, ((KReqHeightPerMenuItem |
|
511 |
* i) + (KLinePadding * i + 2))), TSize(), 0, 0, 0); |
|
512 |
curvePath->AppendLineL(TPoint(KLinePadding, ((KReqHeightPerMenuItem |
|
513 |
* i) + (KLinePadding * i + 2))), TPoint( |
|
514 |
iMainVisual->DisplayRect().Width() - KLinePadding, |
|
515 |
((KReqHeightPerMenuItem * i) + (KLinePadding * i + 2))), 0); |
|
516 |
||
517 |
CAlfLineVisual* line = CAlfLineVisual::AddNewL(*this, iMainVisual); |
|
518 |
line->SetPath(curvePath, EAlfHasOwnership); |
|
519 |
line->SetThickness(KSeparatorLineThickness); |
|
520 |
line->SetColor(color); |
|
521 |
line->SetFlag(EAlfVisualFlagIgnorePointer); |
|
522 |
||
523 |
CleanupStack::Pop(curvePath); |
|
524 |
} |
|
525 |
} |