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