26
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Implementation for presentation element - vertical.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
//Toolkit Includes
|
|
19 |
#include <avkon.mbg>
|
|
20 |
#include <mulsliderwidget.mbg>
|
|
21 |
|
|
22 |
// Alfred Client includes
|
|
23 |
#include <alf/alfenv.h>
|
|
24 |
#include <alf/alfroster.h>
|
|
25 |
#include <alf/alfdisplay.h>
|
|
26 |
#include <alf/alfbrusharray.h>
|
|
27 |
#include <alf/alftextvisual.h>
|
|
28 |
#include <alf/alfevent.h>
|
|
29 |
#include <alf/alftexture.h>
|
|
30 |
#include <alf/alfframebrush.h>
|
|
31 |
|
|
32 |
//Widget Model Includes
|
|
33 |
#include <alf/alfwidgetevents.h>
|
|
34 |
#include <alf/alfwidgetenvextension.h>
|
|
35 |
#include <alf/ialfmodel.h>
|
|
36 |
|
|
37 |
//Avkon Includes
|
|
38 |
#include <AknUtils.h>
|
|
39 |
#include <AknsConstants.h>
|
|
40 |
#include <utf.h>
|
|
41 |
#include <aknlayoutscalable_uiaccel.cdl.h>
|
|
42 |
#include <avkon.hrh>
|
|
43 |
//#include <math.h>
|
|
44 |
|
|
45 |
//slider widget includes
|
|
46 |
#include "mulslidervertical.h"
|
|
47 |
#include <mul/mulevent.h>
|
|
48 |
#include "mulsliderwidget.h"
|
|
49 |
#include "mulslidercontrol.h"
|
|
50 |
#include "mulslidermodel.h"
|
|
51 |
#include "mulsliderdefinitions.h"
|
|
52 |
#include "mulsliderutils.h"
|
|
53 |
|
|
54 |
//Timer function includes
|
|
55 |
#include "mulsliderlongtaptimer.h"
|
|
56 |
#include <alf/alfgradientbrush.h>
|
|
57 |
namespace Alf
|
|
58 |
{
|
|
59 |
// Structure to store data for the slider element class
|
|
60 |
struct MulVerticalSliderDataImpl
|
|
61 |
{
|
|
62 |
bool mOperation;// Drag state
|
|
63 |
bool mSliderHit;// button down has happened on slider visual
|
|
64 |
float mTickInPixels;// Tick size in Pixel
|
|
65 |
int mRangeInPixels;// Range in Pixel
|
|
66 |
int mCurrTickInPixels;// Current Tick posion in pixels
|
|
67 |
CAlfVisual * mVisual;// Stores the current visual hit
|
|
68 |
TPoint mDragPoint;// Point at which drag started
|
|
69 |
TPoint mLongTapPos;// Point at which button down happened
|
|
70 |
TSize mTrackTopImageSizePrt;
|
|
71 |
TSize mTrackTopImageSizeLsc;
|
|
72 |
TSize mTrackMiddleImageSizePrt;
|
|
73 |
TSize mTrackMiddleImageSizeLsc;
|
|
74 |
TSize mTrackBottomImageSizePrt;
|
|
75 |
TSize mTrackBottomImageSizeLsc;
|
|
76 |
TSize mSliderHandleSizePrt;
|
|
77 |
TSize mSliderHandleSizeLsc;
|
|
78 |
TSize mImagePlusSizePrt;
|
|
79 |
TSize mImagePlusSizeLsc;
|
|
80 |
TSize mImageMinusSizePrt;
|
|
81 |
TSize mImageMinusSizeLsc;
|
|
82 |
int mDragStartStep;// Tick positon of Drag Start
|
|
83 |
int mCurrTick;// Stores current tick
|
|
84 |
int mTick;// Stores Tick Size
|
|
85 |
int mTrackStartPoint;// Slider Track Start Point in pixel
|
|
86 |
int mHandleGhostHieghtDelta;
|
|
87 |
bool mOrientationLandScape;
|
|
88 |
bool mHasBackground; // for background only created once
|
|
89 |
int mdirection;// 0 - nomovement,1 up movement 2 down
|
|
90 |
bool mLayoutMirrored;// RTL if True else LTR
|
|
91 |
int mImageTextureId; // to differtiate between textures
|
|
92 |
int mTrackTopTexturePrtId ;// to store the auto generated texture id's
|
|
93 |
int mTrackTopTextureLscId;
|
|
94 |
int mTrackBottomTexturePrtId;
|
|
95 |
int mTrackBottomTextureLscId;
|
|
96 |
int mTrackMiddleTextureLscId;
|
|
97 |
int mTrackMiddleTexturePrtId;
|
|
98 |
int mMarkerTextureLscId;
|
|
99 |
int mMarkerTexturePrtId;
|
|
100 |
int mZoomInTexturePrtId;
|
|
101 |
int mZoomInTextureLscId;
|
|
102 |
int mZoomOutTexturePrtId;
|
|
103 |
int mZoomOutTextureLscId;
|
|
104 |
bool misSetModel;
|
|
105 |
|
|
106 |
|
|
107 |
CAlfLayout* mMainLayout;
|
|
108 |
CAlfLayout* mBaseSliderLayout;// Slider Background
|
|
109 |
CAlfTexture* mTexture;
|
|
110 |
CAlfLayout* mSliderCentre;// Track layout
|
|
111 |
CAlfLayout* mSliderCentreGhost;// Extended touch are for track
|
|
112 |
CAlfImageVisual* mTrackTopImage;
|
|
113 |
CAlfImageVisual* mTrackMiddleImage;
|
|
114 |
CAlfImageVisual* mTrackEndImage;
|
|
115 |
CAlfImageVisual* mSliderHandle;// Slider Handle
|
|
116 |
CAlfLayout* mSliderHandleGhost;//Extended touch are for handle
|
|
117 |
CAlfVisual* mSliderPercentAudio;//Visula showing percentage
|
|
118 |
CAlfImageVisual* mImagePlus;// Zoom in
|
|
119 |
CAlfImageVisual* mImageMinus;// Zoom out
|
|
120 |
|
|
121 |
|
|
122 |
MulVerticalSliderDataImpl()
|
|
123 |
{
|
|
124 |
mOperation = false;
|
|
125 |
mSliderHit = false;
|
|
126 |
misSetModel = false;
|
|
127 |
mTickInPixels = 0;
|
|
128 |
mRangeInPixels = 0;
|
|
129 |
mCurrTickInPixels = 0;
|
|
130 |
mVisual = NULL;
|
|
131 |
mDragPoint.SetXY(0,0);
|
|
132 |
mLongTapPos.SetXY(0,0);
|
|
133 |
mDragStartStep = 0;
|
|
134 |
mCurrTick = 0;
|
|
135 |
mTick = 0;
|
|
136 |
mTrackStartPoint = 0;
|
|
137 |
mImageTextureId = 0;
|
|
138 |
mTrackTopTexturePrtId = 0;
|
|
139 |
mTrackTopTextureLscId = 0;
|
|
140 |
mTrackBottomTexturePrtId = 0;
|
|
141 |
mTrackBottomTextureLscId = 0;
|
|
142 |
mTrackMiddleTexturePrtId = 0;
|
|
143 |
mTrackMiddleTextureLscId = 0;
|
|
144 |
mMarkerTexturePrtId = 0;
|
|
145 |
mMarkerTextureLscId = 0;
|
|
146 |
mZoomInTexturePrtId = 0;
|
|
147 |
mZoomInTextureLscId = 0;
|
|
148 |
mZoomOutTexturePrtId = 0;
|
|
149 |
mZoomOutTextureLscId = 0;
|
|
150 |
mMainLayout = NULL;
|
|
151 |
mBaseSliderLayout = NULL;
|
|
152 |
mSliderCentre = NULL;
|
|
153 |
mTrackTopImage = NULL;
|
|
154 |
mTrackMiddleImage = NULL;
|
|
155 |
mTrackEndImage = NULL;
|
|
156 |
mSliderCentreGhost = NULL;
|
|
157 |
mSliderHandleGhost = NULL;
|
|
158 |
mSliderHandle = NULL;
|
|
159 |
mSliderPercentAudio = NULL;
|
|
160 |
mImagePlus = NULL;
|
|
161 |
mImageMinus = NULL;
|
|
162 |
mHandleGhostHieghtDelta = 0;
|
|
163 |
mOrientationLandScape = false;
|
|
164 |
mdirection = 0;
|
|
165 |
mLayoutMirrored = false;
|
|
166 |
mHasBackground = false;
|
|
167 |
mTrackTopImageSizePrt.SetSize(0,0);
|
|
168 |
mTrackTopImageSizeLsc.SetSize(0,0);
|
|
169 |
mTrackBottomImageSizePrt.SetSize(0,0);
|
|
170 |
mTrackBottomImageSizeLsc.SetSize(0,0);
|
|
171 |
mTrackMiddleImageSizePrt.SetSize(0,0);
|
|
172 |
mTrackMiddleImageSizeLsc.SetSize(0,0);
|
|
173 |
mSliderHandleSizePrt.SetSize(0,0);
|
|
174 |
mSliderHandleSizeLsc.SetSize(0,0);
|
|
175 |
mImagePlusSizePrt.SetSize(0,0);
|
|
176 |
mImagePlusSizeLsc.SetSize(0,0);
|
|
177 |
mImageMinusSizePrt.SetSize(0,0);
|
|
178 |
mImageMinusSizeLsc.SetSize(0,0);
|
|
179 |
}
|
|
180 |
|
|
181 |
};
|
|
182 |
|
|
183 |
// bitmap file path
|
|
184 |
_LIT(KAvkonBitmapFile,"\\resource\\apps\\avkon2.mbm");
|
|
185 |
_LIT(KSliderBitmapFile,"\\resource\\apps\\mulsliderwidget.mif");
|
|
186 |
|
|
187 |
const TInt KAlfTrackTopTextureId = 1;
|
|
188 |
const TInt KAlfTrackBottomTextureId = 2;
|
|
189 |
const TInt KAlfTrackMiddleTextureId = 3;
|
|
190 |
const TInt KAlfMarkerTextureId = 4;
|
|
191 |
const TInt KAlfZoomInTextureId = 5;
|
|
192 |
const TInt KAlfZoomOutTextureId = 6;
|
|
193 |
|
|
194 |
// ---------------------------------------------------------------------------
|
|
195 |
// C++ default constructor.
|
|
196 |
// ---------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
MulSliderVertical::MulSliderVertical(
|
|
199 |
CAlfWidgetControl& aControl,
|
|
200 |
const char* aName,
|
|
201 |
AlfCustomInitDataBase* /*aCustomData*/)
|
|
202 |
: mData(NULL)
|
|
203 |
{
|
|
204 |
// Base class (AlfElement) construct
|
|
205 |
construct(aControl, aName);
|
|
206 |
mSliderModel = NULL;
|
|
207 |
mSliderWidget = NULL;
|
|
208 |
mData = new (EMM) MulVerticalSliderDataImpl;
|
|
209 |
mPosData.reset(new(EMM)MulSliderPos);
|
|
210 |
|
|
211 |
// Timer for generating tap and hold repeat events
|
|
212 |
mLongTapTimer.reset(new (EMM) MulSliderLongTapTimer(this));
|
|
213 |
initializeSliderData();
|
|
214 |
}
|
|
215 |
|
|
216 |
// ---------------------------------------------------------------------------
|
|
217 |
// Destructor
|
|
218 |
// ---------------------------------------------------------------------------
|
|
219 |
//
|
|
220 |
MulSliderVertical::~MulSliderVertical()
|
|
221 |
{
|
|
222 |
// Visualization Data
|
|
223 |
if(mData)
|
|
224 |
{
|
|
225 |
CAlfTextureManager& txtmanager = control().Env().TextureManager();
|
|
226 |
txtmanager.UnloadTexture(mData->mTrackTopTextureLscId);
|
|
227 |
txtmanager.UnloadTexture(mData->mTrackTopTexturePrtId);
|
|
228 |
txtmanager.UnloadTexture(mData->mTrackMiddleTextureLscId);
|
|
229 |
txtmanager.UnloadTexture(mData->mTrackMiddleTexturePrtId);
|
|
230 |
txtmanager.UnloadTexture(mData->mTrackBottomTextureLscId);
|
|
231 |
txtmanager.UnloadTexture(mData->mTrackBottomTexturePrtId);
|
|
232 |
txtmanager.UnloadTexture(mData->mMarkerTexturePrtId);
|
|
233 |
txtmanager.UnloadTexture(mData->mMarkerTextureLscId);
|
|
234 |
txtmanager.UnloadTexture(mData->mZoomInTexturePrtId);
|
|
235 |
txtmanager.UnloadTexture(mData->mZoomInTextureLscId);
|
|
236 |
txtmanager.UnloadTexture(mData->mZoomOutTexturePrtId);
|
|
237 |
txtmanager.UnloadTexture(mData->mZoomOutTextureLscId);
|
|
238 |
delete mData;
|
|
239 |
}
|
|
240 |
else
|
|
241 |
{
|
|
242 |
|
|
243 |
}
|
|
244 |
|
|
245 |
}//End of Destructor
|
|
246 |
|
|
247 |
// ---------------------------------------------------------------------------
|
|
248 |
// From class MAlfInterfaceBase.
|
|
249 |
// Getter for interfaces provided by the slider widget.
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
IAlfInterfaceBase* MulSliderVertical::makeInterface(
|
|
253 |
const IfId& aType)
|
|
254 |
{
|
|
255 |
IAlfInterfaceBase* interface = 0;
|
|
256 |
UString param (aType.mImplementationId);
|
|
257 |
if (param == IAlfWidgetEventHandler::type().mImplementationId)
|
|
258 |
{
|
|
259 |
return static_cast<IAlfWidgetEventHandler*>(this);
|
|
260 |
}
|
|
261 |
else if (param ==
|
|
262 |
IMulSliderBaseElementInternal::type().mImplementationId)
|
|
263 |
{
|
|
264 |
return static_cast<IMulSliderBaseElementInternal*>(this);
|
|
265 |
}
|
|
266 |
else
|
|
267 |
{
|
|
268 |
interface = AlfElement::makeInterface(aType);
|
|
269 |
}
|
|
270 |
return interface;
|
|
271 |
}
|
|
272 |
|
|
273 |
//--------------------------------------------------------------------------
|
|
274 |
// APIs from the IMulSliderBaseElement
|
|
275 |
//--------------------------------------------------------------------------
|
|
276 |
|
|
277 |
// ---------------------------------------------------------------------------
|
|
278 |
// Gets called when the parent layout is relayouted.
|
|
279 |
// resets all the anchor points and updates the visualization
|
|
280 |
// ---------------------------------------------------------------------------
|
|
281 |
//
|
|
282 |
void MulSliderVertical::baseLayoutSizeChanged()
|
|
283 |
{
|
|
284 |
mData->mMainLayout->ClearFlag(EAlfVisualFlagLayoutUpdateNotification);
|
|
285 |
if(mData->mMainLayout)
|
|
286 |
{
|
|
287 |
//mData->mOrientationLandScape = mSliderModel->IsLandscape();
|
|
288 |
// This is a hack to resolve screen refresh issue
|
|
289 |
control().Env().RefreshCallBack(&(control().Env()));
|
|
290 |
// Layout the visualization with correct LCT values
|
|
291 |
layoutVisuals(mSliderModel->GetTemplate());
|
|
292 |
// Convert all the user defined data to pixels
|
|
293 |
ConvertDataToPixels();
|
|
294 |
// Set the thumb position to the current tick
|
|
295 |
SetThumbPosition();
|
|
296 |
mData->mMainLayout->SetOpacity(mSliderWidget->GetOpacity());
|
|
297 |
}
|
|
298 |
mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification);
|
|
299 |
}
|
|
300 |
|
|
301 |
// ---------------------------------------------------------------------------
|
|
302 |
// From class IAlfWidgetEventHandler.
|
|
303 |
// ---------------------------------------------------------------------------
|
|
304 |
//
|
|
305 |
void MulSliderVertical::setActiveStates(
|
|
306 |
unsigned int /*aStates*/)
|
|
307 |
{
|
|
308 |
//do nothing
|
|
309 |
}
|
|
310 |
|
|
311 |
// ---------------------------------------------------------------------------
|
|
312 |
// initializes Model and Widget Pointer
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
void MulSliderVertical::initializeSliderData()
|
|
316 |
{
|
|
317 |
// initialize the Slider Widget Pointer;
|
|
318 |
IAlfWidgetFactory& widgetFactory =
|
|
319 |
AlfWidgetEnvExtension::widgetFactory(control().Env());
|
|
320 |
mSliderWidget = static_cast<MulSliderWidget *>(widgetFactory.findWidget(
|
|
321 |
control().widget()->widgetName()));
|
|
322 |
|
|
323 |
// initialize the Slider Model Pointer;
|
|
324 |
mSliderModel =static_cast<MulSliderModel*>(mSliderWidget->model());
|
|
325 |
}
|
|
326 |
|
|
327 |
// ---------------------------------------------------------------------------
|
|
328 |
// set the positions and images for the visual hierarchy
|
|
329 |
// ---------------------------------------------------------------------------
|
|
330 |
//
|
|
331 |
void MulSliderVertical::layoutVisuals( sliderTemplate /*aTemplateId*/)
|
|
332 |
{
|
|
333 |
|
|
334 |
bool relayout = mData->misSetModel;
|
|
335 |
|
|
336 |
if(mData->mLayoutMirrored != AknLayoutUtils::LayoutMirrored())
|
|
337 |
{
|
|
338 |
mData->mOrientationLandScape = !mSliderModel->IsLandscape();
|
|
339 |
mData->mLayoutMirrored = AknLayoutUtils::LayoutMirrored();
|
|
340 |
}
|
|
341 |
|
|
342 |
if( mSliderModel->IsLandscape() != mData->mOrientationLandScape )
|
|
343 |
{
|
|
344 |
relayout = true;
|
|
345 |
mData->mOrientationLandScape = mSliderModel->IsLandscape();
|
|
346 |
}
|
|
347 |
if(relayout)
|
|
348 |
{
|
|
349 |
mData->misSetModel = false;
|
|
350 |
CAlfControl* ctrl = (CAlfControl*)&control();
|
|
351 |
TAknLayoutRect layoutRect;
|
|
352 |
//get the lct rect for mBaseSliderLayout and set it
|
|
353 |
// aaslider_pane(3)
|
|
354 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
355 |
EVSliderPane,mData->mMainLayout,KVariety3);
|
|
356 |
mData->mBaseSliderLayout->SetRect(
|
|
357 |
TRect( TPoint(layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
|
|
358 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
359 |
layoutRect.Rect().Size().iHeight ))) ;
|
|
360 |
|
|
361 |
if(!mData->mHasBackground)
|
|
362 |
SetBackgroundBrush();
|
|
363 |
// Set Position and Size for Extended touch layout for track
|
|
364 |
mData->mSliderCentreGhost->SetRect(
|
|
365 |
TRect( TPoint(0,0 ),
|
|
366 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
367 |
layoutRect.Rect().Size().iHeight )));
|
|
368 |
|
|
369 |
|
|
370 |
//get the lct rect for mSliderCentre and set it
|
|
371 |
//aaslider_bg_pane_cp001(6)
|
|
372 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
373 |
EVSliderBgPane,
|
|
374 |
mData->mBaseSliderLayout,
|
|
375 |
KVariety6);
|
|
376 |
|
|
377 |
mData->mSliderCentre->SetRect(
|
|
378 |
TRect( TPoint( layoutRect.Rect().iTl.iX ,
|
|
379 |
layoutRect.Rect().iTl.iY),
|
|
380 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
381 |
layoutRect.Rect().Size().iHeight )));
|
|
382 |
|
|
383 |
//get the lct rect for mTrackTopImage and set it
|
|
384 |
//aaslider_bg_pane_cp001_g1(0)
|
|
385 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
386 |
EVSliderTop,
|
|
387 |
mData->mSliderCentre,
|
|
388 |
KVariety0);
|
|
389 |
|
|
390 |
mData->mTrackTopImage->SetRect(
|
|
391 |
TRect( TPoint(0,layoutRect.Rect().iTl.iY),
|
|
392 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
393 |
layoutRect.Rect().Size().iHeight )));
|
|
394 |
|
|
395 |
mSliderModel->IsLandscape() ? mData->mTrackTopImageSizeLsc = layoutRect.Rect().Size():
|
|
396 |
mData->mTrackTopImageSizePrt = layoutRect.Rect().Size();
|
|
397 |
|
|
398 |
//get the lct rect for mTrackMiddleImage and set it
|
|
399 |
//aaslider_bg_pane_cp001_g3(0)
|
|
400 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
401 |
EVSliderMiddle,
|
|
402 |
mData->mSliderCentre,
|
|
403 |
KVariety0);
|
|
404 |
mData->mTrackMiddleImage->SetRect(
|
|
405 |
TRect( TPoint( 0,layoutRect.Rect().iTl.iY),
|
|
406 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
407 |
layoutRect.Rect().Size().iHeight )));
|
|
408 |
|
|
409 |
mSliderModel->IsLandscape() ? mData->mTrackMiddleImageSizeLsc = layoutRect.Rect().Size():
|
|
410 |
mData->mTrackMiddleImageSizePrt = layoutRect.Rect().Size();
|
|
411 |
//get the lct rect for mTrackEndImage and set it
|
|
412 |
//aaslider_bg_pane_cp001_g2(0)
|
|
413 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
414 |
EVSliderEnd,
|
|
415 |
mData->mSliderCentre,
|
|
416 |
KVariety0);
|
|
417 |
mData->mTrackEndImage->SetRect(
|
|
418 |
TRect( TPoint(0,layoutRect.Rect().iTl.iY),
|
|
419 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
420 |
layoutRect.Rect().Size().iHeight )));
|
|
421 |
mSliderModel->IsLandscape() ? mData->mTrackBottomImageSizeLsc = layoutRect.Rect().Size():
|
|
422 |
mData->mTrackBottomImageSizePrt = layoutRect.Rect().Size();
|
|
423 |
|
|
424 |
if(mData->mTrackTopImage && mData->mTrackMiddleImage && mData->mTrackEndImage)
|
|
425 |
{
|
|
426 |
setTrackImage();
|
|
427 |
}
|
|
428 |
|
|
429 |
|
|
430 |
//get the lct rect for mSliderHandle and set it
|
|
431 |
//aid_touch_size_slider_marker(5)
|
|
432 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
433 |
EVSliderMarker,
|
|
434 |
mData->mBaseSliderLayout,
|
|
435 |
KVariety5);
|
|
436 |
mData->mSliderHandle->SetRect(
|
|
437 |
TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
|
|
438 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
439 |
layoutRect.Rect().Size().iHeight ))) ;
|
|
440 |
mSliderModel->IsLandscape() ? mData->mSliderHandleSizeLsc = layoutRect.Rect().Size():
|
|
441 |
mData->mSliderHandleSizePrt = layoutRect.Rect().Size();
|
|
442 |
|
|
443 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
444 |
EVSliderMarkerExtended,
|
|
445 |
mData->mBaseSliderLayout,
|
|
446 |
KVariety5);
|
|
447 |
mData->mHandleGhostHieghtDelta =
|
|
448 |
(layoutRect.Rect().Size().iHeight - mData->mSliderHandle->Size().iY.ValueNow() );
|
|
449 |
|
|
450 |
// Set Position and Size for Extended touch layout for handle
|
|
451 |
mData->mSliderHandleGhost->SetRect(
|
|
452 |
TRect( TPoint( mData->mBaseSliderLayout->Pos().iX.ValueNow(),
|
|
453 |
mData->mSliderHandle->Pos().iY.ValueNow()-
|
|
454 |
mData->mHandleGhostHieghtDelta/2),
|
|
455 |
TSize( mData->mBaseSliderLayout->Size().iX.ValueNow(),
|
|
456 |
layoutRect.Rect().Size().iHeight)));
|
|
457 |
|
|
458 |
if(mData->mSliderHandle)
|
|
459 |
{
|
|
460 |
mData->mImageTextureId = KAlfMarkerTextureId;
|
|
461 |
// Create the texture from bitmap provider
|
|
462 |
mData->mSliderHandle->SetImage( skinTexture(mData->mSliderHandleSizePrt ,mData->mSliderHandleSizeLsc , mData->mMarkerTexturePrtId, mData->mMarkerTextureLscId ) );
|
|
463 |
}
|
|
464 |
|
|
465 |
//get the lct rect for mImagePlus and set it
|
|
466 |
// aid_touch_size_slider_max(1)
|
|
467 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
468 |
EVSliderPlus,
|
|
469 |
mData->mBaseSliderLayout,
|
|
470 |
KVariety1);
|
|
471 |
mData->mImagePlus->SetRect(
|
|
472 |
TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
|
|
473 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
474 |
layoutRect.Rect().Size().iHeight ))) ;
|
|
475 |
|
|
476 |
mSliderModel->IsLandscape() ? mData->mImagePlusSizeLsc = layoutRect.Rect().Size():
|
|
477 |
mData->mImagePlusSizePrt = layoutRect.Rect().Size();
|
|
478 |
if(mData->mImagePlus)
|
|
479 |
{
|
|
480 |
mData->mImageTextureId = KAlfZoomInTextureId;
|
|
481 |
// Create the texture from bitmap provider
|
|
482 |
mData->mImagePlus->SetImage(skinTexture(mData->mImagePlusSizePrt ,mData->mImagePlusSizeLsc , mData->mZoomInTexturePrtId, mData->mZoomInTextureLscId ));
|
|
483 |
}
|
|
484 |
|
|
485 |
//get the lct rect for mImageMinus and set it
|
|
486 |
// aid_touch_size_slider_min(2)
|
|
487 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
488 |
EVSliderMinus,mData->mBaseSliderLayout,KVariety2);
|
|
489 |
|
|
490 |
mData->mImageMinus->SetRect(
|
|
491 |
TRect( TPoint( layoutRect.Rect().iTl.iX,layoutRect.Rect().iTl.iY ),
|
|
492 |
TSize( layoutRect.Rect().Size().iWidth,
|
|
493 |
layoutRect.Rect().Size().iHeight ))) ;
|
|
494 |
|
|
495 |
mSliderModel->IsLandscape() ? mData->mImageMinusSizeLsc = layoutRect.Rect().Size():
|
|
496 |
mData->mImageMinusSizePrt = layoutRect.Rect().Size();
|
|
497 |
if(mData->mImageMinus)
|
|
498 |
{
|
|
499 |
mData->mImageTextureId = KAlfZoomOutTextureId;
|
|
500 |
// Create the texture from bitmap provider
|
|
501 |
mData->mImageMinus->SetImage(skinTexture(mData->mImageMinusSizePrt ,mData->mImageMinusSizeLsc , mData->mZoomOutTexturePrtId, mData->mZoomOutTextureLscId ));
|
|
502 |
|
|
503 |
}
|
|
504 |
}
|
|
505 |
}
|
|
506 |
// ---------------------------------------------------------------------------
|
|
507 |
// Used for setting images for the track
|
|
508 |
// ---------------------------------------------------------------------------
|
|
509 |
//
|
|
510 |
|
|
511 |
void MulSliderVertical::setTrackImage()
|
|
512 |
{
|
|
513 |
|
|
514 |
CAlfControl* ctrl = (CAlfControl*)&control();
|
|
515 |
//creating texture for topimage
|
|
516 |
mData->mImageTextureId = KAlfTrackTopTextureId;
|
|
517 |
mData->mTrackTopImage->SetImage( skinTexture(mData->mTrackTopImageSizePrt ,mData->mTrackTopImageSizeLsc , mData->mTrackTopTexturePrtId, mData->mTrackTopTextureLscId ) ) ;
|
|
518 |
|
|
519 |
//creating texture for middleimage
|
|
520 |
mData->mImageTextureId = KAlfTrackMiddleTextureId;
|
|
521 |
mData->mTrackMiddleImage->SetImage(skinTexture(mData->mTrackMiddleImageSizePrt ,mData->mTrackMiddleImageSizeLsc , mData->mTrackMiddleTexturePrtId, mData->mTrackMiddleTextureLscId ));
|
|
522 |
|
|
523 |
//creating texture for bottom image
|
|
524 |
mData->mImageTextureId = KAlfTrackBottomTextureId;
|
|
525 |
mData->mTrackEndImage->SetImage( skinTexture(mData->mTrackBottomImageSizePrt ,mData->mTrackBottomImageSizeLsc , mData->mTrackBottomTexturePrtId, mData->mTrackBottomTextureLscId ) );
|
|
526 |
|
|
527 |
}//End of setImage
|
|
528 |
|
|
529 |
// ---------------------------------------------------------------------------
|
|
530 |
// ProvideBitmapL()
|
|
531 |
// ---------------------------------------------------------------------------
|
|
532 |
//
|
|
533 |
void MulSliderVertical::ProvideBitmapL (TInt aId, CFbsBitmap *& aBitmap, CFbsBitmap *& aMaskBitmap)
|
|
534 |
{
|
|
535 |
TAknLayoutRect layoutRect;
|
|
536 |
switch(mData->mImageTextureId)
|
|
537 |
{
|
|
538 |
case KAlfTrackTopTextureId:
|
|
539 |
{
|
|
540 |
AknIconUtils::CreateIconL(
|
|
541 |
aBitmap,
|
|
542 |
aMaskBitmap,
|
|
543 |
KAvkonBitmapFile,
|
|
544 |
EMbmAvkonQgn_graf_nslider_vertical_top,
|
|
545 |
EMbmAvkonQgn_graf_nslider_vertical_top_mask );
|
|
546 |
|
|
547 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
548 |
EVSliderTop,
|
|
549 |
mData->mSliderCentre,
|
|
550 |
KVariety0);
|
|
551 |
|
|
552 |
AknIconUtils::SetSize( aBitmap,
|
|
553 |
TSize(layoutRect.Rect().Size().iWidth,
|
|
554 |
layoutRect.Rect().Size().iHeight),
|
|
555 |
EAspectRatioNotPreserved);
|
|
556 |
mData->mImageTextureId = 0;
|
|
557 |
mSliderModel->IsLandscape() ? mData->mTrackTopTextureLscId = aId :
|
|
558 |
mData->mTrackTopTexturePrtId = aId ;
|
|
559 |
}
|
|
560 |
break;
|
|
561 |
case KAlfTrackBottomTextureId:
|
|
562 |
{
|
|
563 |
AknIconUtils::CreateIconL(
|
|
564 |
aBitmap,
|
|
565 |
aMaskBitmap,
|
|
566 |
KAvkonBitmapFile,
|
|
567 |
EMbmAvkonQgn_graf_nslider_vertical_bottom,
|
|
568 |
EMbmAvkonQgn_graf_nslider_vertical_bottom_mask );
|
|
569 |
|
|
570 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
571 |
EVSliderEnd,
|
|
572 |
mData->mSliderCentre,
|
|
573 |
KVariety0);
|
|
574 |
AknIconUtils::SetSize( aBitmap,
|
|
575 |
TSize(layoutRect.Rect().Size().iWidth,
|
|
576 |
layoutRect.Rect().Size().iHeight),
|
|
577 |
EAspectRatioNotPreserved);
|
|
578 |
mData->mImageTextureId = 0;
|
|
579 |
mSliderModel->IsLandscape() ? mData->mTrackBottomTextureLscId = aId :
|
|
580 |
mData->mTrackBottomTexturePrtId = aId ;
|
|
581 |
}
|
|
582 |
break;
|
|
583 |
case KAlfTrackMiddleTextureId:
|
|
584 |
{
|
|
585 |
AknIconUtils::CreateIconL(
|
|
586 |
aBitmap,
|
|
587 |
aMaskBitmap,
|
|
588 |
KAvkonBitmapFile,
|
|
589 |
EMbmAvkonQgn_graf_nslider_vertical_middle,
|
|
590 |
EMbmAvkonQgn_graf_nslider_vertical_middle_mask );
|
|
591 |
|
|
592 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
593 |
EVSliderMiddle,
|
|
594 |
mData->mSliderCentre,
|
|
595 |
KVariety0);
|
|
596 |
|
|
597 |
AknIconUtils::SetSize( aBitmap,
|
|
598 |
TSize(layoutRect.Rect().Size().iWidth,
|
|
599 |
layoutRect.Rect().Size().iHeight),
|
|
600 |
EAspectRatioNotPreserved);
|
|
601 |
|
|
602 |
mData->mImageTextureId = 0;
|
|
603 |
mSliderModel->IsLandscape() ? mData->mTrackMiddleTextureLscId = aId :
|
|
604 |
mData->mTrackMiddleTexturePrtId = aId ;
|
|
605 |
}
|
|
606 |
break;
|
|
607 |
|
|
608 |
case KAlfMarkerTextureId:
|
|
609 |
{
|
|
610 |
AknIconUtils::CreateIconL(
|
|
611 |
aBitmap,
|
|
612 |
aMaskBitmap,
|
|
613 |
KAvkonBitmapFile,
|
|
614 |
EMbmAvkonQgn_graf_nslider_vertical_marker,
|
|
615 |
EMbmAvkonQgn_graf_nslider_vertical_marker_mask );
|
|
616 |
|
|
617 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
618 |
EVSliderMarker,
|
|
619 |
mData->mBaseSliderLayout,
|
|
620 |
KVariety5);
|
|
621 |
|
|
622 |
AknIconUtils::SetSize( aBitmap,
|
|
623 |
TSize(layoutRect.Rect().Size().iWidth,
|
|
624 |
layoutRect.Rect().Size().iHeight),
|
|
625 |
EAspectRatioNotPreserved);
|
|
626 |
|
|
627 |
mData->mImageTextureId = 0;
|
|
628 |
mSliderModel->IsLandscape() ? mData->mMarkerTextureLscId = aId :
|
|
629 |
mData->mMarkerTexturePrtId = aId ;
|
|
630 |
}
|
|
631 |
break;
|
|
632 |
case KAlfZoomInTextureId:
|
|
633 |
{
|
|
634 |
AknIconUtils::CreateIconL(
|
|
635 |
aBitmap,
|
|
636 |
aMaskBitmap,
|
|
637 |
KSliderBitmapFile,
|
|
638 |
EMbmMulsliderwidgetQgn_indi_nslider_zoom_in,
|
|
639 |
EMbmMulsliderwidgetQgn_indi_nslider_zoom_in_mask );
|
|
640 |
|
|
641 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
642 |
EVSliderPlus,mData->mBaseSliderLayout,KVariety1);
|
|
643 |
|
|
644 |
AknIconUtils::SetSize( aBitmap,
|
|
645 |
TSize(layoutRect.Rect().Size().iWidth,
|
|
646 |
layoutRect.Rect().Size().iHeight),
|
|
647 |
EAspectRatioNotPreserved);
|
|
648 |
mData->mImageTextureId = 0;
|
|
649 |
mSliderModel->IsLandscape() ? mData->mZoomInTextureLscId = aId :
|
|
650 |
mData->mZoomInTexturePrtId = aId;
|
|
651 |
}
|
|
652 |
break;
|
|
653 |
case KAlfZoomOutTextureId:
|
|
654 |
{
|
|
655 |
AknIconUtils::CreateIconL(
|
|
656 |
aBitmap,
|
|
657 |
aMaskBitmap,
|
|
658 |
KSliderBitmapFile,
|
|
659 |
EMbmMulsliderwidgetQgn_indi_nslider_zoom_out,
|
|
660 |
EMbmMulsliderwidgetQgn_indi_nslider_zoom_out_mask );
|
|
661 |
|
|
662 |
layoutRect = MulSliderUtils::GetComponentRect(
|
|
663 |
EVSliderMinus,mData->mBaseSliderLayout,KVariety2);
|
|
664 |
|
|
665 |
AknIconUtils::SetSize( aBitmap,
|
|
666 |
TSize(layoutRect.Rect().Size().iWidth,
|
|
667 |
layoutRect.Rect().Size().iHeight),
|
|
668 |
EAspectRatioNotPreserved);
|
|
669 |
|
|
670 |
mData->mImageTextureId = 0;
|
|
671 |
mSliderModel->IsLandscape() ? mData->mZoomOutTextureLscId = aId :
|
|
672 |
mData->mZoomOutTexturePrtId = aId ;
|
|
673 |
|
|
674 |
}
|
|
675 |
break;
|
|
676 |
default:
|
|
677 |
break;
|
|
678 |
|
|
679 |
}
|
|
680 |
|
|
681 |
}
|
|
682 |
|
|
683 |
// ---------------------------------------------------------------------------
|
|
684 |
// setBackgroundBrush()
|
|
685 |
// ---------------------------------------------------------------------------
|
|
686 |
//
|
|
687 |
void MulSliderVertical::SetBackgroundBrush()
|
|
688 |
{
|
|
689 |
|
|
690 |
CAlfControl* ctrl = (CAlfControl*)&control();
|
|
691 |
// Get Slider Pane Rect (aaslider_pane(2)) and apply on mBaseSliderLayout
|
|
692 |
TAknLayoutRect layoutRect = MulSliderUtils::GetComponentRect(
|
|
693 |
EVSliderPane,mData->mMainLayout,2);
|
|
694 |
|
|
695 |
|
|
696 |
TAknWindowLineLayout LayoutHandle =
|
|
697 |
AknLayoutScalable_UiAccel::
|
|
698 |
aid_touch_size_slider_max(0).LayoutLine();
|
|
699 |
|
|
700 |
|
|
701 |
int x = LayoutHandle.il;
|
|
702 |
TAknsItemID itemid;
|
|
703 |
|
|
704 |
itemid.Set(EAknsMajorSkin, EAknsMinorQgnGrafPopupTrans);
|
|
705 |
CAlfFrameBrush* brush = CAlfFrameBrush::NewLC((*ctrl).Env(),itemid, 0, 0);
|
|
706 |
|
|
707 |
if(brush!=NULL)
|
|
708 |
{
|
|
709 |
TRect dispRect(layoutRect.Rect().iTl.iX,
|
|
710 |
layoutRect.Rect().iTl.iY,
|
|
711 |
layoutRect.Rect().Size().iWidth,
|
|
712 |
layoutRect.Rect().Size().iHeight );
|
|
713 |
TRect innerRect(layoutRect.Rect().iTl.iX + x,
|
|
714 |
layoutRect.Rect().iTl.iY + x,
|
|
715 |
layoutRect.Rect().Size().iWidth - x ,
|
|
716 |
layoutRect.Rect().Size().iHeight - x);
|
|
717 |
|
|
718 |
brush->SetFrameRectsL(innerRect,dispRect);
|
|
719 |
brush->SetOpacity(KMinopacity);
|
|
720 |
mData->mBaseSliderLayout->EnableBrushesL();
|
|
721 |
mData->mBaseSliderLayout->Brushes()->AppendL(brush, EAlfHasOwnership);
|
|
722 |
CleanupStack::Pop(brush);
|
|
723 |
}
|
|
724 |
mData->mHasBackground = true;
|
|
725 |
}
|
|
726 |
|
|
727 |
// ----------------------------------------------------------------------------
|
|
728 |
// skinTexture()
|
|
729 |
// ----------------------------------------------------------------------------
|
|
730 |
//
|
|
731 |
TAlfImage MulSliderVertical::skinTexture(TSize aPrtImageSize, TSize aLscImageSize, TInt aPrtSkinId, TInt aLscSkinId )
|
|
732 |
{
|
|
733 |
const CAlfControl* ctrl = (CAlfControl*)(&control());
|
|
734 |
|
|
735 |
if ( aPrtImageSize != aLscImageSize )
|
|
736 |
{
|
|
737 |
if ( aPrtSkinId == 0 || aLscSkinId == 0 )
|
|
738 |
{
|
|
739 |
mData->mTexture = &((ctrl->Env()).TextureManager().CreateTextureL(
|
|
740 |
KAlfAutoGeneratedTextureId,
|
|
741 |
(MAlfBitmapProvider *)this,
|
|
742 |
(TAlfTextureFlags)(EAlfTextureFlagRetainResolution|EAlfTextureFlagSkinContent)));
|
|
743 |
TAlfImage dummyImage(*mData->mTexture);
|
|
744 |
return dummyImage;
|
|
745 |
}
|
|
746 |
}
|
|
747 |
else if ( aPrtSkinId == 0 || aLscSkinId == 0 )
|
|
748 |
{
|
|
749 |
TInt id = aPrtSkinId > aLscSkinId ? aPrtSkinId : aLscSkinId;
|
|
750 |
mData->mTexture = ((ctrl->Env()).TextureManager().TextureL(id));
|
|
751 |
TAlfImage dummyImage(*mData->mTexture);
|
|
752 |
return dummyImage;
|
|
753 |
}
|
|
754 |
|
|
755 |
TInt textureId = mSliderModel->IsLandscape() ? aLscSkinId : aPrtSkinId;
|
|
756 |
mData->mTexture = ((ctrl->Env()).TextureManager().TextureL( textureId ));
|
|
757 |
TAlfImage dummyImage(*mData->mTexture);
|
|
758 |
return dummyImage;
|
|
759 |
}
|
|
760 |
|
|
761 |
|
|
762 |
// ---------------------------------------------------------------------------
|
|
763 |
// MakeTransparent()
|
|
764 |
// ---------------------------------------------------------------------------
|
|
765 |
//
|
|
766 |
void MulSliderVertical::MakeTransparent(bool aVal)
|
|
767 |
{
|
|
768 |
CAlfBrushArray * brushArray = mData->mBaseSliderLayout->Brushes();
|
|
769 |
if(aVal)
|
|
770 |
{
|
|
771 |
TAlfTimedValue opacity(KMinopacity);
|
|
772 |
brushArray->At(0).SetOpacity(opacity);
|
|
773 |
}
|
|
774 |
else
|
|
775 |
{
|
|
776 |
TAlfTimedValue opacity(KMaxopacity);
|
|
777 |
brushArray->At(0).SetOpacity(opacity);
|
|
778 |
}
|
|
779 |
}
|
|
780 |
// ---------------------------------------------------------------------------
|
|
781 |
// ConvertDataToPixels
|
|
782 |
// ---------------------------------------------------------------------------
|
|
783 |
//
|
|
784 |
void MulSliderVertical::ConvertDataToPixels()
|
|
785 |
{
|
|
786 |
float sliderCentreSize = mData->mSliderCentre->Size().iY.ValueNow();
|
|
787 |
float sliderHandleSize = mData->mSliderHandle->Size().iY.ValueNow();
|
|
788 |
float sliderCentrePos = mData->mSliderCentre->Pos().iY.ValueNow();
|
|
789 |
|
|
790 |
// Calculate the range in pixel values
|
|
791 |
mData->mRangeInPixels = sliderCentreSize - sliderHandleSize;
|
|
792 |
|
|
793 |
if(mSliderModel->MaxRange() - mSliderModel->MinRange() != 0)
|
|
794 |
{
|
|
795 |
// Calculate Tick Size in Pixels
|
|
796 |
mData->mTickInPixels =
|
|
797 |
(sliderCentreSize - sliderHandleSize) /
|
|
798 |
(mSliderModel->MaxRange() - mSliderModel->MinRange()) ;
|
|
799 |
}
|
|
800 |
// Get the track start pixel value
|
|
801 |
mData->mTrackStartPoint = sliderCentrePos + sliderCentreSize - sliderHandleSize ;
|
|
802 |
// Store current tick
|
|
803 |
mData->mCurrTick = mSliderModel->PrimaryValue() ;
|
|
804 |
if(mSliderModel->MaxRange()== mSliderModel->MinRange())
|
|
805 |
{
|
|
806 |
mData->mTrackStartPoint= sliderCentrePos;
|
|
807 |
}
|
|
808 |
mData->mTick = mSliderModel->Tick();
|
|
809 |
}
|
|
810 |
|
|
811 |
//----------------------------------------------------------------------------
|
|
812 |
// FeedbackIntensity
|
|
813 |
//----------------------------------------------------------------------------
|
|
814 |
//
|
|
815 |
TInt MulSliderVertical::feedbackIntensity()
|
|
816 |
{
|
|
817 |
/* We need to find the position of the thumb w.r.t the slider track.
|
|
818 |
* mData->mTickInPixels will give the no. of pixels each tick will
|
|
819 |
*
|
|
820 |
*/
|
|
821 |
|
|
822 |
int deltaY = (mSliderModel->PrimaryValue() - mSliderModel->MinRange()) *
|
|
823 |
mData->mTickInPixels;
|
|
824 |
TInt intensity = ( deltaY * 100 )/ mData->mRangeInPixels ;
|
|
825 |
return intensity ;
|
|
826 |
}
|
|
827 |
|
|
828 |
// ---------------------------------------------------------------------------
|
|
829 |
// createVisualization
|
|
830 |
// ---------------------------------------------------------------------------
|
|
831 |
//
|
|
832 |
void MulSliderVertical::createVisualization(sliderTemplate /*aTemplateId*/)
|
|
833 |
{
|
|
834 |
mData->mHasBackground = false;
|
|
835 |
if(AknLayoutUtils::LayoutMirrored())
|
|
836 |
mData->mLayoutMirrored = true;
|
|
837 |
else
|
|
838 |
mData->mLayoutMirrored = false;
|
|
839 |
// Create the visualization
|
|
840 |
CAlfControl* ctrl = (CAlfControl*)&control();
|
|
841 |
mData->mOrientationLandScape = mSliderModel->IsLandscape();
|
|
842 |
mData->misSetModel = true;
|
|
843 |
|
|
844 |
// Visual Hierarchy creation
|
|
845 |
// create the mMainLayout
|
|
846 |
mData->mMainLayout = CAlfLayout::AddNewL(*ctrl,NULL);
|
|
847 |
// set the flag for Notifications
|
|
848 |
mData->mMainLayout->SetFlag(EAlfVisualFlagLayoutUpdateNotification);
|
|
849 |
//create the mBaseSliderLayout
|
|
850 |
mData->mBaseSliderLayout =
|
|
851 |
CAlfLayout::AddNewL(*ctrl,mData->mMainLayout);
|
|
852 |
// create the dummy layout for slider track
|
|
853 |
mData->mSliderCentreGhost =
|
|
854 |
CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout);
|
|
855 |
// create the dummy layout for slider handle
|
|
856 |
mData->mSliderHandleGhost =
|
|
857 |
CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout);
|
|
858 |
|
|
859 |
// create the imagevisual for slider track
|
|
860 |
mData->mSliderCentre =
|
|
861 |
CAlfLayout::AddNewL(*ctrl,mData->mBaseSliderLayout);
|
|
862 |
// create the imagevisual for slider handle
|
|
863 |
mData->mSliderHandle =
|
|
864 |
CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout);
|
|
865 |
// create the imagevisual for plus icon
|
|
866 |
mData->mImagePlus=
|
|
867 |
CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout);
|
|
868 |
// create the imagevisual for minus icon
|
|
869 |
mData->mImageMinus =
|
|
870 |
CAlfImageVisual::AddNewL(*ctrl,mData->mBaseSliderLayout);
|
|
871 |
if(mData->mSliderCentre)
|
|
872 |
{
|
|
873 |
mData->mTrackTopImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre);
|
|
874 |
mData->mTrackMiddleImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre);
|
|
875 |
mData->mTrackEndImage = CAlfImageVisual::AddNewL(*ctrl,mData->mSliderCentre);
|
|
876 |
}
|
|
877 |
|
|
878 |
// Get the widget opacity and apply on root visual
|
|
879 |
mSliderWidget->ShowWidget(mSliderWidget->GetOpacity(),0);
|
|
880 |
}
|
|
881 |
|
|
882 |
|
|
883 |
// ---------------------------------------------------------------------------
|
|
884 |
// eventHandlerType
|
|
885 |
// ---------------------------------------------------------------------------
|
|
886 |
//
|
|
887 |
IAlfWidgetEventHandler::AlfEventHandlerType MulSliderVertical::eventHandlerType()
|
|
888 |
{
|
|
889 |
return IAlfWidgetEventHandler::EPresentationEventHandler;
|
|
890 |
}
|
|
891 |
|
|
892 |
|
|
893 |
// ---------------------------------------------------------------------------
|
|
894 |
// eventExecutionPhase
|
|
895 |
// ---------------------------------------------------------------------------
|
|
896 |
//
|
|
897 |
IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase MulSliderVertical::
|
|
898 |
eventExecutionPhase()
|
|
899 |
{
|
|
900 |
return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler;
|
|
901 |
}
|
|
902 |
|
|
903 |
|
|
904 |
// ---------------------------------------------------------------------------
|
|
905 |
// offerEvent
|
|
906 |
// ---------------------------------------------------------------------------
|
|
907 |
//
|
|
908 |
AlfEventStatus MulSliderVertical::offerEvent( CAlfWidgetControl& /*aControl*/,
|
|
909 |
const TAlfEvent& aEvent )
|
|
910 |
{
|
|
911 |
AlfEventStatus ret=EEventNotHandled;
|
|
912 |
if(!mSliderWidget->IsHidden())
|
|
913 |
{
|
|
914 |
if(aEvent.IsCustomEvent())
|
|
915 |
{
|
|
916 |
if(aEvent.CustomParameter() == EEventMissedPointerUp)
|
|
917 |
{
|
|
918 |
ret=EEventHandled;
|
|
919 |
mData->mSliderHit = false;
|
|
920 |
handlePointerUpEvent();
|
|
921 |
}
|
|
922 |
}
|
|
923 |
|
|
924 |
// handle key events
|
|
925 |
else if(aEvent.IsKeyEvent() && mSliderWidget->IsKeyEnabled() )
|
|
926 |
{
|
|
927 |
ret = HandleKeyEvents(aEvent);
|
|
928 |
}
|
|
929 |
|
|
930 |
// Pointer drag events and single tap events
|
|
931 |
else if(aEvent.IsPointerEvent())
|
|
932 |
{
|
|
933 |
if(mSliderWidget->GetOpacity())
|
|
934 |
{
|
|
935 |
ret = HandlePointerEvents((TAlfEvent *)&aEvent);
|
|
936 |
}
|
|
937 |
}
|
|
938 |
|
|
939 |
}
|
|
940 |
|
|
941 |
return ret;
|
|
942 |
}
|
|
943 |
|
|
944 |
|
|
945 |
// ---------------------------------------------------------------------------
|
|
946 |
// HandleKeyEvents
|
|
947 |
// ---------------------------------------------------------------------------
|
|
948 |
//
|
|
949 |
AlfEventStatus MulSliderVertical::HandleKeyEvents(const TAlfEvent& aEvent)
|
|
950 |
{
|
|
951 |
AlfEventStatus ret = EEventNotHandled;
|
|
952 |
|
|
953 |
|
|
954 |
if(aEvent.KeyEvent().iScanCode == EStdKeyUpArrow)
|
|
955 |
{
|
|
956 |
if(aEvent.Code() == EEventKey)
|
|
957 |
{
|
|
958 |
ret = EEventHandled;
|
|
959 |
int newPos = mSliderModel->PrimaryValue() + mData->mTick;
|
|
960 |
updateModelPrimaryValue(newPos);
|
|
961 |
}
|
|
962 |
}
|
|
963 |
else if(aEvent.KeyEvent().iScanCode == EStdKeyDownArrow)
|
|
964 |
{
|
|
965 |
if(aEvent.Code() == EEventKey)
|
|
966 |
{
|
|
967 |
ret = EEventHandled;
|
|
968 |
int newPos = mSliderModel->PrimaryValue() - mData->mTick;
|
|
969 |
updateModelPrimaryValue(newPos);
|
|
970 |
}
|
|
971 |
}
|
|
972 |
return ret;
|
|
973 |
}
|
|
974 |
// ---------------------------------------------------------------------------
|
|
975 |
// Sends drag Up or Down event, according to the hit position
|
|
976 |
// on track
|
|
977 |
// ---------------------------------------------------------------------------
|
|
978 |
//
|
|
979 |
AlfEventStatus MulSliderVertical::trackVisualHit(CAlfVisual * /*aHitVisual*/)
|
|
980 |
{
|
|
981 |
//Find the thumb Anchor Layout.
|
|
982 |
// Zoom Plus icon rectangle
|
|
983 |
TAlfRealRect zoomPlus = mData->mBaseSliderLayout->DisplayRect();
|
|
984 |
// Slider Handle position
|
|
985 |
TAlfTimedPoint thumbVisPos = mData->mSliderHandle->Pos();
|
|
986 |
TAlfTimedPoint thumbVisSize = mData->mSliderHandle->Size();
|
|
987 |
// Slider track display rect
|
|
988 |
TAlfRealRect rct = mData->mSliderCentre->DisplayRect() ;
|
|
989 |
int diff = rct.iTl.iY - zoomPlus.iTl.iY;
|
|
990 |
//Check if click was above/to left or below/to right of thumb
|
|
991 |
if (mData->mLongTapPos.iY - rct.iTl.iY < thumbVisPos.iY.ValueNow() + (thumbVisSize.iY.ValueNow()/2) - diff)
|
|
992 |
{
|
|
993 |
// Pointer down happened above Handle
|
|
994 |
int newPos = mSliderModel->PrimaryValue() + (((thumbVisPos.iY.ValueNow() +(thumbVisSize.iY.ValueNow()/2) - diff) -(mData->mLongTapPos.iY - rct.iTl.iY))/mData->mTickInPixels);
|
|
995 |
|
|
996 |
if( rct.iTl.iY > mData->mLongTapPos.iY )
|
|
997 |
{
|
|
998 |
mData->mLongTapPos.iY = rct.iTl.iY + (thumbVisSize.iY.ValueNow()/2);
|
|
999 |
}
|
|
1000 |
// Move Handle
|
|
1001 |
if(mData->mdirection !=2)
|
|
1002 |
{
|
|
1003 |
// checks if the thumb was moving up
|
|
1004 |
updateModelPrimaryValue(newPos);
|
|
1005 |
mData->mdirection = 1;
|
|
1006 |
}
|
|
1007 |
|
|
1008 |
if(!mData->mOperation)
|
|
1009 |
{
|
|
1010 |
mData->mVisual = mData->mSliderHandle;
|
|
1011 |
initializeThumbDragData(
|
|
1012 |
mData->mLongTapPos);
|
|
1013 |
|
|
1014 |
}
|
|
1015 |
}
|
|
1016 |
else if (mData->mLongTapPos.iY - rct.iTl.iY > (thumbVisPos.iY.ValueNow() +
|
|
1017 |
(thumbVisSize.iY.ValueNow()/2)- diff) )
|
|
1018 |
{
|
|
1019 |
if( (rct.iTl.iY + rct.Size().iHeight < mData->mLongTapPos.iY))
|
|
1020 |
{
|
|
1021 |
mData->mLongTapPos.iY = rct.iTl.iY+ rct.Size().iHeight - (thumbVisSize.iY.ValueNow()/2);
|
|
1022 |
}
|
|
1023 |
// Pointer down happened below Handle
|
|
1024 |
int newPos = mSliderModel->PrimaryValue() - (((mData->mLongTapPos.iY - rct.iTl.iY) -(thumbVisPos.iY.ValueNow() + (thumbVisSize.iY.ValueNow()/2)-diff))/mData->mTickInPixels);
|
|
1025 |
// Move Handle
|
|
1026 |
if(mData->mdirection !=1)
|
|
1027 |
{
|
|
1028 |
// checks if the thumb was moving down
|
|
1029 |
updateModelPrimaryValue(newPos);
|
|
1030 |
mData->mdirection = 2;
|
|
1031 |
}
|
|
1032 |
|
|
1033 |
//mData->mLongTapStarted = false;
|
|
1034 |
if(!mData->mOperation)
|
|
1035 |
{
|
|
1036 |
mData->mVisual = mData->mSliderHandle;
|
|
1037 |
initializeThumbDragData( mData->mLongTapPos);
|
|
1038 |
|
|
1039 |
}
|
|
1040 |
}
|
|
1041 |
else
|
|
1042 |
{
|
|
1043 |
|
|
1044 |
}
|
|
1045 |
return EEventHandled;
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
// ---------------------------------------------------------------------------
|
|
1049 |
// handles the pointerDown event
|
|
1050 |
//
|
|
1051 |
// ---------------------------------------------------------------------------
|
|
1052 |
//
|
|
1053 |
AlfEventStatus MulSliderVertical::handlePointerDownEvent(TAlfEvent * aPntrEvent)
|
|
1054 |
{
|
|
1055 |
|
|
1056 |
CAlfVisual * focusvisual = aPntrEvent->Visual();
|
|
1057 |
AlfEventStatus result = EEventNotHandled;
|
|
1058 |
if (focusvisual)
|
|
1059 |
{
|
|
1060 |
mData->mVisual = focusvisual;
|
|
1061 |
if (IsSliderVisual(focusvisual))
|
|
1062 |
{
|
|
1063 |
control().processEvent(TAlfEvent(ECustomEventIconClick));
|
|
1064 |
mData->mSliderHit = true;
|
|
1065 |
MakeTransparent(false);
|
|
1066 |
|
|
1067 |
// Register with the Roster to receive Long Tap Event
|
|
1068 |
control().Display()->Roster().SetPointerEventObservers(
|
|
1069 |
EAlfPointerEventReportDrag,control());
|
|
1070 |
|
|
1071 |
if(!mData->mOperation)
|
|
1072 |
{
|
|
1073 |
mData->mLongTapPos = aPntrEvent->PointerEvent().iParentPosition;
|
|
1074 |
//mData->mLongTapStarted = true;
|
|
1075 |
}
|
|
1076 |
|
|
1077 |
//Page Movement
|
|
1078 |
if (focusvisual == mData->mSliderCentre ||
|
|
1079 |
focusvisual == mData->mSliderCentreGhost)
|
|
1080 |
{
|
|
1081 |
result = trackVisualHit(focusvisual);
|
|
1082 |
}
|
|
1083 |
|
|
1084 |
// Drag
|
|
1085 |
else if (focusvisual == mData->mSliderHandle
|
|
1086 |
|| focusvisual == mData->mSliderHandleGhost )
|
|
1087 |
{
|
|
1088 |
if(focusvisual)
|
|
1089 |
{
|
|
1090 |
// Initialize the drag variables
|
|
1091 |
initializeThumbDragData(aPntrEvent->PointerEvent().iParentPosition);
|
|
1092 |
//Tactile Feedback For Thumb touch
|
|
1093 |
MulSliderControl& sldrcntrl = static_cast<MulSliderControl&>(control());
|
|
1094 |
sldrcntrl.TactileEffectOnTouchandHold();
|
|
1095 |
}
|
|
1096 |
result = EEventHandled;
|
|
1097 |
}
|
|
1098 |
// Zoom Icon Plus Clicked
|
|
1099 |
else if (focusvisual == mData->mImagePlus || focusvisual == mData->mImageMinus )
|
|
1100 |
{
|
|
1101 |
// Update the newTick
|
|
1102 |
int newPos =0;
|
|
1103 |
if( mData->mVisual == mData->mImagePlus)
|
|
1104 |
{
|
|
1105 |
newPos = mSliderModel->MaxRange();
|
|
1106 |
}
|
|
1107 |
else
|
|
1108 |
{
|
|
1109 |
newPos = mSliderModel->MinRange();
|
|
1110 |
//newPos = mSliderModel->PrimaryValue() - mData->mTick;
|
|
1111 |
}
|
|
1112 |
updateModelPrimaryValue(newPos);
|
|
1113 |
//return ETrue;
|
|
1114 |
result = EEventHandled;
|
|
1115 |
}
|
|
1116 |
|
|
1117 |
}//END OF if (isSliderVisual())
|
|
1118 |
}
|
|
1119 |
return result;
|
|
1120 |
}// End Of handlePointerDownEvent
|
|
1121 |
|
|
1122 |
|
|
1123 |
// ---------------------------------------------------------------------------
|
|
1124 |
// HandlePointerEvents
|
|
1125 |
// ---------------------------------------------------------------------------
|
|
1126 |
//
|
|
1127 |
AlfEventStatus MulSliderVertical::HandlePointerEvents(TAlfEvent* aEvent)
|
|
1128 |
{
|
|
1129 |
AlfEventStatus ret = EEventNotHandled;
|
|
1130 |
if (aEvent->PointerEvent().iType == TPointerEvent::EButton1Down)
|
|
1131 |
{
|
|
1132 |
mData->mdirection = 0;
|
|
1133 |
return handlePointerDownEvent(aEvent);
|
|
1134 |
}
|
|
1135 |
// Drag Events
|
|
1136 |
else if (aEvent->PointerEvent().iType == TPointerEvent::EDrag)
|
|
1137 |
{
|
|
1138 |
// Drag on Handle
|
|
1139 |
TAlfRealRect rct = mData->mSliderCentre->DisplayRect() ;
|
|
1140 |
TAlfTimedPoint thumbVisSize = mData->mSliderHandle->Size();
|
|
1141 |
// Drag on Handle
|
|
1142 |
if(mData->mVisual &&
|
|
1143 |
mData->mSliderHandle && mData->mSliderHandleGhost)
|
|
1144 |
{
|
|
1145 |
// Store the new pointer position
|
|
1146 |
mData->mLongTapPos= aEvent->PointerEvent().iParentPosition ;
|
|
1147 |
}
|
|
1148 |
|
|
1149 |
// Calculate the distance moved from the drag start point
|
|
1150 |
int dist = mData->mDragPoint.iY - aEvent->PointerEvent().iParentPosition.iY;
|
|
1151 |
int precision = KRoundupvalue;
|
|
1152 |
if(dist<0)
|
|
1153 |
{
|
|
1154 |
precision = -KRoundupvalue;
|
|
1155 |
}
|
|
1156 |
// Calculate the new tick position
|
|
1157 |
int newPos = (int)(((float)dist / mData->mTickInPixels ) + precision) +
|
|
1158 |
mData->mDragStartStep;
|
|
1159 |
// Update the model hence update visualization
|
|
1160 |
updateModelPrimaryValue(newPos);
|
|
1161 |
//Tactile Feedback For Thumb Drag
|
|
1162 |
MulSliderControl& sldrcntrl = static_cast<MulSliderControl&>(control());
|
|
1163 |
int fdbintensity = feedbackIntensity();
|
|
1164 |
sldrcntrl.TactileEffectOnDrag(*aEvent , fdbintensity );
|
|
1165 |
ret = EEventHandled;
|
|
1166 |
}
|
|
1167 |
|
|
1168 |
else if(aEvent->PointerUp() )
|
|
1169 |
{
|
|
1170 |
|
|
1171 |
// Long tap Timer not running
|
|
1172 |
//mData->mLongTapStarted = false;
|
|
1173 |
// Handle events for pointer up
|
|
1174 |
if(mData->mSliderHit)
|
|
1175 |
{
|
|
1176 |
// checing if any of slider visual got a button down event
|
|
1177 |
// Otherwise its a stray pointerup event , so dont handle it
|
|
1178 |
mData->mSliderHit = false;
|
|
1179 |
ret = EEventHandled;
|
|
1180 |
handlePointerUpEvent();
|
|
1181 |
}
|
|
1182 |
|
|
1183 |
}
|
|
1184 |
|
|
1185 |
return ret;
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
|
|
1189 |
// ---------------------------------------------------------------------------
|
|
1190 |
// updateModelPrimaryValue
|
|
1191 |
// ---------------------------------------------------------------------------
|
|
1192 |
//
|
|
1193 |
void MulSliderVertical::updateModelPrimaryValue(int aNewPosValue)
|
|
1194 |
{
|
|
1195 |
// Validate the new tick value
|
|
1196 |
if(aNewPosValue < mSliderModel->MinRange())
|
|
1197 |
{
|
|
1198 |
aNewPosValue = mSliderModel->MinRange();
|
|
1199 |
}
|
|
1200 |
else if(aNewPosValue > mSliderModel->MaxRange())
|
|
1201 |
{
|
|
1202 |
aNewPosValue = mSliderModel->MaxRange();
|
|
1203 |
}
|
|
1204 |
if(mSliderModel->PrimaryValue() != aNewPosValue && mData->mTick != 0)
|
|
1205 |
{
|
|
1206 |
// Update visualization and model only if data is changed
|
|
1207 |
mSliderModel->SetPrimaryValue(aNewPosValue);
|
|
1208 |
mPosData.reset(new(EMM)MulSliderPos);
|
|
1209 |
mPosData->mPreviousValue = mData->mCurrTick ;
|
|
1210 |
mPosData->mCurrentValue= aNewPosValue;
|
|
1211 |
mData->mCurrTick = aNewPosValue;
|
|
1212 |
// Send event to the scrollable widget
|
|
1213 |
TAlfEvent customevent(ETypePrimaryValueChange,
|
|
1214 |
(uint)mPosData.get());
|
|
1215 |
control().processEvent(customevent);
|
|
1216 |
}
|
|
1217 |
}
|
|
1218 |
|
|
1219 |
// ---------------------------------------------------------------------------
|
|
1220 |
// snapPrimaryValueToTicks
|
|
1221 |
// ---------------------------------------------------------------------------
|
|
1222 |
//
|
|
1223 |
void MulSliderVertical::snapPrimaryValueToTicks()
|
|
1224 |
{
|
|
1225 |
// If the position is not a multiple of ticks then
|
|
1226 |
//snap to the nearest tick multiple
|
|
1227 |
int currHandlePos = mSliderModel->PrimaryValue() - mSliderModel->MinRange();
|
|
1228 |
int tick = mSliderModel->Tick();
|
|
1229 |
int newPos = currHandlePos + mSliderModel->MinRange();
|
|
1230 |
if(mSliderModel->PrimaryValue() < mSliderModel->MaxRange())
|
|
1231 |
{
|
|
1232 |
|
|
1233 |
int diff = 0;
|
|
1234 |
if(tick > 0) //model
|
|
1235 |
{
|
|
1236 |
diff = currHandlePos - ((currHandlePos /tick) * tick);
|
|
1237 |
}
|
|
1238 |
if(diff !=0)
|
|
1239 |
{
|
|
1240 |
newPos = currHandlePos + tick - diff + mSliderModel->MinRange();
|
|
1241 |
}
|
|
1242 |
}
|
|
1243 |
|
|
1244 |
|
|
1245 |
// Update model
|
|
1246 |
updateModelPrimaryValue(newPos);
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
|
|
1250 |
// ---------------------------------------------------------------------------
|
|
1251 |
// handles the pointerUp event
|
|
1252 |
//
|
|
1253 |
// ---------------------------------------------------------------------------
|
|
1254 |
//
|
|
1255 |
void MulSliderVertical::handlePointerUpEvent()
|
|
1256 |
{
|
|
1257 |
// if thumb or track is clicked, change the graphics
|
|
1258 |
// Send event if single click has hapened
|
|
1259 |
|
|
1260 |
snapPrimaryValueToTicks();
|
|
1261 |
MakeTransparent(true);
|
|
1262 |
if(mData->mOperation)
|
|
1263 |
{
|
|
1264 |
//Somehow missed the Up event?
|
|
1265 |
stopDrag();
|
|
1266 |
//Tactile Feedback For Thumb Release
|
|
1267 |
MulSliderControl& sldrcntrl = static_cast<MulSliderControl&>(control());
|
|
1268 |
sldrcntrl.TactileEffectOnRelease();
|
|
1269 |
}
|
|
1270 |
|
|
1271 |
|
|
1272 |
// Un-register with the roster for long tap events
|
|
1273 |
control().Display()->Roster().SetPointerEventObservers(0,
|
|
1274 |
control());
|
|
1275 |
|
|
1276 |
// send the event for release/poiter up
|
|
1277 |
control().processEvent(TAlfEvent(ECustomEventIconRelease));
|
|
1278 |
}
|
|
1279 |
|
|
1280 |
// ---------------------------------------------------------------------------
|
|
1281 |
// Stops event handling
|
|
1282 |
//
|
|
1283 |
// ---------------------------------------------------------------------------
|
|
1284 |
//
|
|
1285 |
void MulSliderVertical::stopEvents()
|
|
1286 |
{
|
|
1287 |
if(mData->mSliderHit)
|
|
1288 |
{
|
|
1289 |
// checking if any of slider visual got a button down event
|
|
1290 |
mData->mSliderHit = false;
|
|
1291 |
handlePointerUpEvent();
|
|
1292 |
}
|
|
1293 |
}
|
|
1294 |
|
|
1295 |
// ---------------------------------------------------------------------------
|
|
1296 |
|
|
1297 |
// UpdateVisualization
|
|
1298 |
// ---------------------------------------------------------------------------
|
|
1299 |
//
|
|
1300 |
|
|
1301 |
void MulSliderVertical::updateVisualization()
|
|
1302 |
{
|
|
1303 |
ConvertDataToPixels();
|
|
1304 |
SetThumbPosition();
|
|
1305 |
}
|
|
1306 |
// ---------------------------------------------------------------------------
|
|
1307 |
// SetThumbPosition
|
|
1308 |
// ---------------------------------------------------------------------------
|
|
1309 |
//
|
|
1310 |
void MulSliderVertical::SetThumbPosition()
|
|
1311 |
{
|
|
1312 |
// Current primary value in pixels
|
|
1313 |
int deltaY = (mSliderModel->PrimaryValue() - mSliderModel->MinRange()) *
|
|
1314 |
mData->mTickInPixels;
|
|
1315 |
// Handle
|
|
1316 |
int handleX = mData->mSliderHandle->Pos().iX.ValueNow();
|
|
1317 |
int ghostHandleX = mData->mSliderHandleGhost->Pos().iX.ValueNow();
|
|
1318 |
// Handle new pos
|
|
1319 |
TAlfRealPoint pnt(handleX,mData->mTrackStartPoint - deltaY);
|
|
1320 |
// Ghost Handle ( Extended) new pos
|
|
1321 |
TAlfRealPoint pnt1(ghostHandleX,mData->mTrackStartPoint - deltaY -
|
|
1322 |
mData->mHandleGhostHieghtDelta/2);
|
|
1323 |
// Set the position
|
|
1324 |
mData->mSliderHandle->SetPos(pnt,0);
|
|
1325 |
mData->mSliderHandleGhost->SetPos(pnt1,0);
|
|
1326 |
// Update visualization variables
|
|
1327 |
mData->mCurrTick = mSliderModel->PrimaryValue();
|
|
1328 |
//mData->mMainLayout->UpdateChildrenLayout(0);
|
|
1329 |
|
|
1330 |
}
|
|
1331 |
// ---------------------------------------------------------------------------
|
|
1332 |
// SetTextLabels
|
|
1333 |
// ---------------------------------------------------------------------------
|
|
1334 |
//
|
|
1335 |
void MulSliderVertical::SetTextLabels(const char* /*aStr*/)
|
|
1336 |
{
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
// ---------------------------------------------------------------------------
|
|
1340 |
// accept
|
|
1341 |
// ---------------------------------------------------------------------------
|
|
1342 |
//
|
|
1343 |
bool MulSliderVertical::accept( CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent ) const
|
|
1344 |
{
|
|
1345 |
// Accept only key or pointer events.
|
|
1346 |
if(aEvent.IsKeyEvent()||aEvent.IsPointerEvent())
|
|
1347 |
{
|
|
1348 |
return true;
|
|
1349 |
}
|
|
1350 |
else
|
|
1351 |
{
|
|
1352 |
return false;
|
|
1353 |
}
|
|
1354 |
}
|
|
1355 |
|
|
1356 |
|
|
1357 |
// ---------------------------------------------------------------------------
|
|
1358 |
// initializeThumbDragData
|
|
1359 |
// ---------------------------------------------------------------------------
|
|
1360 |
//
|
|
1361 |
bool MulSliderVertical::initializeThumbDragData(const TPoint& aPointerPos)
|
|
1362 |
{
|
|
1363 |
TRAPD(err,control().Display()->Roster().SetPointerDragThreshold(control(),
|
|
1364 |
TAlfXYMetric(TAlfMetric(KXToleranceInPixel,EAlfUnitPixel),
|
|
1365 |
TAlfMetric(KYToleranceInPixel,EAlfUnitPixel))) );
|
|
1366 |
if(mData->mVisual && err == KErrNone)
|
|
1367 |
{
|
|
1368 |
mData->mOperation = EMoveItem;
|
|
1369 |
mData->mDragPoint = aPointerPos;
|
|
1370 |
mData->mDragStartStep = mSliderModel->PrimaryValue();
|
|
1371 |
}
|
|
1372 |
else
|
|
1373 |
{
|
|
1374 |
|
|
1375 |
}
|
|
1376 |
return ETrue;
|
|
1377 |
}
|
|
1378 |
|
|
1379 |
// ---------------------------------------------------------------------------
|
|
1380 |
// stopDrag
|
|
1381 |
// Stop Dragging
|
|
1382 |
// ---------------------------------------------------------------------------
|
|
1383 |
//
|
|
1384 |
bool MulSliderVertical::stopDrag()
|
|
1385 |
{
|
|
1386 |
|
|
1387 |
TRAPD(err,
|
|
1388 |
control().Display()->Roster().SetPointerEventObservers(
|
|
1389 |
0,
|
|
1390 |
control()));
|
|
1391 |
if(err == KErrNone)
|
|
1392 |
{
|
|
1393 |
mData->mVisual = NULL;
|
|
1394 |
mData->mOperation = ENop;
|
|
1395 |
return ETrue;
|
|
1396 |
}
|
|
1397 |
return EFalse;
|
|
1398 |
}
|
|
1399 |
|
|
1400 |
|
|
1401 |
// ---------------------------------------------------------------------------
|
|
1402 |
// IsSliderVisual
|
|
1403 |
// ---------------------------------------------------------------------------
|
|
1404 |
//
|
|
1405 |
bool MulSliderVertical::IsSliderVisual(CAlfVisual *aVisual)
|
|
1406 |
{
|
|
1407 |
if(aVisual == mData->mSliderCentre||
|
|
1408 |
aVisual == mData->mSliderCentreGhost||
|
|
1409 |
aVisual == mData->mSliderHandle||
|
|
1410 |
aVisual == mData->mSliderHandleGhost||
|
|
1411 |
aVisual == mData->mImagePlus||
|
|
1412 |
aVisual == mData->mImageMinus)
|
|
1413 |
{
|
|
1414 |
return true;
|
|
1415 |
}
|
|
1416 |
return false;
|
|
1417 |
}
|
|
1418 |
|
|
1419 |
// ---------------------------------------------------------------------------
|
|
1420 |
// updateTextVisualization
|
|
1421 |
// ---------------------------------------------------------------------------
|
|
1422 |
//
|
|
1423 |
void MulSliderVertical::updateTextVisualization()
|
|
1424 |
{/*
|
|
1425 |
MulSliderModel* sliderModel = mSliderModel;
|
|
1426 |
const char* perctext = sliderModel->GetPercentText();
|
|
1427 |
SetTextLabels(perctext);*/
|
|
1428 |
}
|
|
1429 |
}//namespace Alf
|
|
1430 |
|
|
1431 |
//End Of File
|