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;
|
|
278 |
TInt XPos = aPoint.iX;
|
|
279 |
|
|
280 |
//Preferred is to display in upper area
|
|
281 |
TInt upperDisplayableHeight = upperYPos - iViewableRect.iTl.iY;
|
|
282 |
TInt rightDisplayableWidth = iViewableRect.iBr.iX - (XPos + KRightMargin
|
|
283 |
+ KWidthPadding);
|
|
284 |
|
|
285 |
//always draw above
|
|
286 |
if(rightDisplayableWidth < iMaxTextWidth)
|
|
287 |
{
|
|
288 |
XPos = aPoint.iX - iMaxTextWidth;
|
|
289 |
}
|
|
290 |
if(upperDisplayableHeight < KGridHeight)
|
|
291 |
{
|
|
292 |
iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos ));
|
|
293 |
}
|
|
294 |
else
|
|
295 |
{
|
|
296 |
iMainVisual->SetPos(TAlfRealPoint(XPos , upperYPos - KGridHeight));
|
|
297 |
}
|
|
298 |
|
|
299 |
if ( iTimer)
|
|
300 |
{
|
|
301 |
iTimer->Cancel(); //cancels any outstanding requests
|
|
302 |
iTimer->SetDelay(KTimerDelay);
|
|
303 |
}
|
|
304 |
}
|
|
305 |
|
|
306 |
// ---------------------------------------------------------------------------
|
|
307 |
// ShowItemMenuL()
|
|
308 |
// ---------------------------------------------------------------------------
|
|
309 |
//
|
|
310 |
void CGlxTagsContextMenuControl::ShowItemMenuL(TBool aShow)
|
|
311 |
{
|
|
312 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::ShowItemMenuL");
|
|
313 |
if(aShow)
|
|
314 |
{
|
|
315 |
iMainVisual->SetOpacity(KOpacityOpaque);
|
|
316 |
iItemMenuVisibility = ETrue;
|
|
317 |
}
|
|
318 |
else
|
|
319 |
{
|
|
320 |
iMainVisual->SetOpacity(KOpacityTransparent);
|
|
321 |
iRenameTextVisual->EnableBrushesL(EFalse);
|
|
322 |
iDeleteTextVisual->EnableBrushesL(EFalse);
|
|
323 |
iSlideshowTextVisual->EnableBrushesL(EFalse);
|
|
324 |
iItemMenuVisibility = EFalse;
|
|
325 |
iMainVisual->SetPos(TAlfRealPoint(KDummyPoint));
|
|
326 |
}
|
|
327 |
}
|
|
328 |
|
|
329 |
// ---------------------------------------------------------------------------
|
|
330 |
// ItemMenuVisibility()
|
|
331 |
// ---------------------------------------------------------------------------
|
|
332 |
//
|
|
333 |
TBool CGlxTagsContextMenuControl::ItemMenuVisibility()
|
|
334 |
{
|
|
335 |
return iItemMenuVisibility;
|
|
336 |
}
|
|
337 |
|
|
338 |
// ---------------------------------------------------------------------------
|
|
339 |
// OfferEventL()
|
|
340 |
// ---------------------------------------------------------------------------
|
|
341 |
//
|
|
342 |
TBool CGlxTagsContextMenuControl::OfferEventL(const TAlfEvent& aEvent)
|
|
343 |
{
|
|
344 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::OfferEventL");
|
|
345 |
TBool consumed = EFalse;
|
|
346 |
|
|
347 |
if (aEvent.IsPointerEvent() && iItemMenuVisibility )
|
|
348 |
{
|
|
349 |
MTouchFeedback* feedback = MTouchFeedback::Instance();
|
|
350 |
if (aEvent.PointerDown())
|
|
351 |
{
|
|
352 |
iCommandId = KErrNotFound;
|
|
353 |
Display()->Roster().SetPointerEventObservers(
|
|
354 |
EAlfPointerEventReportDrag
|
|
355 |
+ EAlfPointerEventReportLongTap
|
|
356 |
+ EAlfPointerEventReportUnhandled, *this);
|
|
357 |
if (iItemMenuVisibility)
|
|
358 |
{
|
|
359 |
CAlfVisual* onVisual = aEvent.Visual();
|
|
360 |
CAlfFrameBrush* brush = CAlfFrameBrush::NewLC(*iAlfEnv,
|
|
361 |
KAknsIIDQsnFrList);
|
|
362 |
TRect textVisualRect = TRect(TPoint(
|
|
363 |
iSlideshowTextVisual->Pos().IntValueNow()), TSize(
|
|
364 |
iSlideshowTextVisual->Size().ValueNow().AsSize()));
|
|
365 |
TRect innerRect(textVisualRect);
|
|
366 |
innerRect.Shrink(KShrinkXCoord, KShrinkYCoord);
|
|
367 |
brush->SetFrameRectsL(innerRect, textVisualRect);
|
|
368 |
iTimer->Cancel(); //cancels any outstanding requests
|
|
369 |
if (AlfUtil::TagMatches(onVisual->Tag(), KTagSlideshow))
|
|
370 |
{
|
|
371 |
iSlideshowTextVisual->EnableBrushesL(ETrue);
|
|
372 |
iSlideshowTextVisual->Brushes()->AppendL(brush,
|
|
373 |
EAlfHasOwnership);
|
|
374 |
|
|
375 |
iCommandId = EGlxCmdSlideshowPlay;
|
|
376 |
}
|
|
377 |
else if (AlfUtil::TagMatches(onVisual->Tag(), KTagDelete))
|
|
378 |
{
|
|
379 |
iDeleteTextVisual->EnableBrushesL(ETrue);
|
|
380 |
iDeleteTextVisual->Brushes()->AppendL(brush,
|
|
381 |
EAlfHasOwnership);
|
|
382 |
|
|
383 |
iCommandId = EGlxCmdDelete;
|
|
384 |
}
|
|
385 |
else if (AlfUtil::TagMatches(onVisual->Tag(), KTagRename))
|
|
386 |
{
|
|
387 |
iRenameTextVisual->EnableBrushesL(ETrue);
|
|
388 |
iRenameTextVisual->Brushes()->AppendL(brush,
|
|
389 |
EAlfHasOwnership);
|
|
390 |
|
|
391 |
iCommandId = EGlxCmdRename;
|
|
392 |
}
|
|
393 |
consumed = ETrue;
|
|
394 |
if (feedback)
|
|
395 |
{
|
|
396 |
feedback->InstantFeedback(ETouchFeedbackBasic);
|
|
397 |
}
|
|
398 |
CleanupStack::Pop(brush);
|
|
399 |
}//End of iItemMenuVisibility check
|
|
400 |
}//End of Pointer down event
|
|
401 |
else if (aEvent.PointerUp())
|
|
402 |
{
|
|
403 |
if (iCommandId >= 0)
|
|
404 |
{
|
|
405 |
TBool eventInsideControl = HitTest(
|
|
406 |
aEvent.PointerEvent().iParentPosition);
|
|
407 |
//If Up event is received only within Menu control, handle the command
|
|
408 |
if (eventInsideControl)
|
|
409 |
{
|
|
410 |
ShowItemMenuL(EFalse);
|
|
411 |
|
|
412 |
iItemMenuObserver.HandleGridMenuListL(iCommandId);
|
|
413 |
iCommandId = KErrNotFound;
|
|
414 |
}
|
|
415 |
else
|
|
416 |
{
|
|
417 |
HandleUpEventL();
|
|
418 |
}
|
|
419 |
}
|
|
420 |
consumed = ETrue;
|
|
421 |
}
|
|
422 |
else if (aEvent.PointerEvent().EDrag)
|
|
423 |
{
|
|
424 |
TBool eventInsideControl = HitTest(
|
|
425 |
aEvent.PointerEvent().iParentPosition);
|
|
426 |
if (!eventInsideControl)
|
|
427 |
{
|
|
428 |
HandleUpEventL();
|
|
429 |
}
|
|
430 |
else if (eventInsideControl && feedback)
|
|
431 |
{
|
|
432 |
feedback->InstantFeedback(ETouchFeedbackBasic);
|
|
433 |
}
|
|
434 |
consumed = ETrue;
|
|
435 |
}
|
|
436 |
consumed = ETrue;
|
|
437 |
}
|
|
438 |
return consumed;
|
|
439 |
}
|
|
440 |
|
|
441 |
// ---------------------------------------------------------------------------
|
|
442 |
// TimerCompleteL()
|
|
443 |
// ---------------------------------------------------------------------------
|
|
444 |
//
|
|
445 |
void CGlxTagsContextMenuControl::TimerCompleteL()
|
|
446 |
{
|
|
447 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::TimerCompleteL");
|
|
448 |
ShowItemMenuL(EFalse);
|
|
449 |
}
|
|
450 |
|
|
451 |
// ---------------------------------------------------------------------------
|
|
452 |
// SetViewableRect()
|
|
453 |
// ---------------------------------------------------------------------------
|
|
454 |
//
|
|
455 |
void CGlxTagsContextMenuControl::SetViewableRect(TRect aRect)
|
|
456 |
{
|
|
457 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::SetViewableRect");
|
|
458 |
iViewableRect.SetRect(aRect.iTl.iX, aRect.iTl.iY,
|
|
459 |
aRect.iBr.iX, aRect.iBr.iY);
|
|
460 |
}
|
|
461 |
// ---------------------------------------------------------------------------
|
|
462 |
// CalculateMaxWidth()
|
|
463 |
// ---------------------------------------------------------------------------
|
|
464 |
//
|
|
465 |
void CGlxTagsContextMenuControl::CalculateMaxWidth()
|
|
466 |
{
|
|
467 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::CalculateMaxWidth");
|
|
468 |
|
|
469 |
iMaxTextWidth
|
|
470 |
= (iSlideshowTextVisual->TextExtents().iWidth
|
|
471 |
> iRenameTextVisual->TextExtents().iWidth
|
|
472 |
? iSlideshowTextVisual->TextExtents().iWidth
|
|
473 |
: iRenameTextVisual->TextExtents().iWidth);
|
|
474 |
|
|
475 |
iMaxTextWidth
|
|
476 |
= (iMaxTextWidth > iDeleteTextVisual->TextExtents().iWidth
|
|
477 |
? iMaxTextWidth
|
|
478 |
: iDeleteTextVisual->TextExtents().iWidth);
|
|
479 |
|
|
480 |
}
|
|
481 |
// ---------------------------------------------------------------------------
|
|
482 |
// HandleUpEventL()
|
|
483 |
// ---------------------------------------------------------------------------
|
|
484 |
//
|
|
485 |
void CGlxTagsContextMenuControl::HandleUpEventL()
|
|
486 |
{
|
|
487 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::HandleUpEventL");
|
|
488 |
if(iCommandId >=0 && iItemMenuVisibility)
|
|
489 |
{
|
|
490 |
iCommandId = KErrNotFound;
|
|
491 |
|
|
492 |
iRenameTextVisual->EnableBrushesL(EFalse);
|
|
493 |
iDeleteTextVisual->EnableBrushesL(EFalse);
|
|
494 |
iSlideshowTextVisual->EnableBrushesL(EFalse);
|
|
495 |
|
|
496 |
iTimer->SetDelay(KTimerDelay);
|
|
497 |
}
|
|
498 |
}
|
|
499 |
// ---------------------------------------------------------------------------
|
|
500 |
// DrawLineSeparatorsL()
|
|
501 |
// ---------------------------------------------------------------------------
|
|
502 |
//
|
|
503 |
void CGlxTagsContextMenuControl::DrawLineSeparatorsL()
|
|
504 |
{
|
|
505 |
TRACER("GLX_CLOUD::CGlxTagsContextMenuControl::DrawLineSeparators");
|
|
506 |
TRgb color;
|
|
507 |
//Gets the color of the line specific to skin
|
|
508 |
AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color,
|
|
509 |
KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG11);
|
|
510 |
|
|
511 |
for (TInt i = 1; i < KNumofMenuItems; i++)
|
|
512 |
{
|
|
513 |
CAlfCurvePath* curvePath = CAlfCurvePath::NewLC(*iAlfEnv);
|
|
514 |
curvePath->AppendArcL(TPoint(KLinePadding, ((KReqHeightPerMenuItem
|
|
515 |
* i) + (KLinePadding * i + 2))), TSize(), 0, 0, 0);
|
|
516 |
curvePath->AppendLineL(TPoint(KLinePadding, ((KReqHeightPerMenuItem
|
|
517 |
* i) + (KLinePadding * i + 2))), TPoint(
|
|
518 |
iMainVisual->DisplayRect().Width() - KLinePadding,
|
|
519 |
((KReqHeightPerMenuItem * i) + (KLinePadding * i + 2))), 0);
|
|
520 |
|
|
521 |
CAlfLineVisual* line = CAlfLineVisual::AddNewL(*this, iMainVisual);
|
|
522 |
line->SetPath(curvePath, EAlfHasOwnership);
|
|
523 |
line->SetThickness(KSeparatorLineThickness);
|
|
524 |
line->SetColor(color);
|
|
525 |
line->SetFlag(EAlfVisualFlagIgnorePointer);
|
|
526 |
|
|
527 |
CleanupStack::Pop(curvePath);
|
|
528 |
}
|
|
529 |
}
|