|
1 /* |
|
2 * Copyright (c) 2007-2008 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: FreestyleEmailUi editor control implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INTERNAL INCLUDES |
|
20 #include "emailtrace.h" |
|
21 #include "FreestyleEmailUiLauncherGrid.h" |
|
22 #include "FreestyleEmailUiLauncherGridVisualiser.h" |
|
23 #include "FreestyleEmailUiAppui.h" |
|
24 #include "FreestyleEmailUiLayoutHandler.h" |
|
25 |
|
26 #include <AknUtils.h> |
|
27 |
|
28 #include <alf/alfevent.h> |
|
29 #include <alf/alfdisplay.h> |
|
30 #include <alf/alfenv.h> |
|
31 #include <alf/alfmappingfunctions.h> |
|
32 #include <alf/alfroster.h> |
|
33 |
|
34 |
|
35 CFSEmailUiLauncherGrid* CFSEmailUiLauncherGrid::NewL( CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi ) |
|
36 { |
|
37 FUNC_LOG; |
|
38 CFSEmailUiLauncherGrid* self = CFSEmailUiLauncherGrid::NewLC( aEnv, aAppUi ); |
|
39 CleanupStack::Pop(self); |
|
40 return self; |
|
41 } |
|
42 |
|
43 |
|
44 CFSEmailUiLauncherGrid* CFSEmailUiLauncherGrid::NewLC( CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi ) |
|
45 { |
|
46 FUNC_LOG; |
|
47 CFSEmailUiLauncherGrid* self = new (ELeave) CFSEmailUiLauncherGrid( aAppUi ); |
|
48 CleanupStack::PushL(self); |
|
49 self->ConstructL(aEnv); |
|
50 return self; |
|
51 } |
|
52 // <cmail> |
|
53 CFSEmailUiLauncherGrid::CFSEmailUiLauncherGrid(CFreestyleEmailUiAppUi* aAppUi ) |
|
54 : CAlfControl(), |
|
55 iAppUi(aAppUi), |
|
56 iDraggingSet(EFalse) |
|
57 { |
|
58 FUNC_LOG; |
|
59 } |
|
60 |
|
61 CFSEmailUiLauncherGrid::~CFSEmailUiLauncherGrid() |
|
62 { |
|
63 FUNC_LOG; |
|
64 } |
|
65 |
|
66 TBool CFSEmailUiLauncherGrid::OfferEventL(const TAlfEvent& aEvent) |
|
67 { |
|
68 FUNC_LOG; |
|
69 TBool result(EFalse); |
|
70 if ( iVisualiser ) // Offer events to view |
|
71 { |
|
72 if( aEvent.IsPointerEvent() ) |
|
73 { |
|
74 result = iVisualiser->HandlePointerEventL( aEvent ); |
|
75 } |
|
76 else |
|
77 { |
|
78 result = iVisualiser->OfferEventL( aEvent ); |
|
79 } |
|
80 } |
|
81 else |
|
82 { |
|
83 result = KErrGeneral; |
|
84 } |
|
85 return result; |
|
86 } |
|
87 // </cmail> |
|
88 void CFSEmailUiLauncherGrid::ConstructL( CAlfEnv& aEnv ) |
|
89 { |
|
90 FUNC_LOG; |
|
91 CAlfControl::ConstructL(aEnv); |
|
92 } |
|
93 |
|
94 |
|
95 void CFSEmailUiLauncherGrid::SetVisualiserL( CFSEmailUiLauncherGridVisualiser* aVisualiser ) |
|
96 { |
|
97 FUNC_LOG; |
|
98 iVisualiser = aVisualiser; |
|
99 } |
|
100 |
|
101 void CFSEmailUiLauncherGrid::NotifyControlVisibility( TBool aIsVisible, CAlfDisplay& aDisplay ) |
|
102 { |
|
103 FUNC_LOG; |
|
104 |
|
105 //Add & remove extra touch events. |
|
106 if(aIsVisible && !iDraggingSet) |
|
107 { |
|
108 iDraggingSet = ETrue; |
|
109 aDisplay.Roster().AddPointerEventObserver(EAlfPointerEventReportDrag, *this); |
|
110 aDisplay.Roster().AddPointerEventObserver(EAlfPointerEventReportLongTap, *this); |
|
111 aDisplay.Roster().AddPointerEventObserver(EAlfPointerEventReportUnhandled, *this); |
|
112 } |
|
113 else if(!aIsVisible && iDraggingSet ) |
|
114 { |
|
115 aDisplay.Roster().RemovePointerEventObserver(EAlfPointerEventReportDrag, *this); |
|
116 aDisplay.Roster().RemovePointerEventObserver(EAlfPointerEventReportLongTap, *this); |
|
117 aDisplay.Roster().RemovePointerEventObserver(EAlfPointerEventReportUnhandled, *this); |
|
118 iDraggingSet = EFalse; |
|
119 } |
|
120 } |