|
1 /* |
|
2 * Copyright (c) 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: Focus strategy for editor implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cmrfocusstrategyviewer.h" |
|
19 |
|
20 #include "nmrglobalfeaturesettings.h" |
|
21 #include "mesmrfieldstorage.h" |
|
22 #include "cesmrfield.h" |
|
23 #include "emailtrace.h" |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // CMRFocusStrategyViewer::NewL |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 CMRFocusStrategyViewer* CMRFocusStrategyViewer::NewL( MESMRFieldStorage& aFactory ) |
|
30 { |
|
31 FUNC_LOG; |
|
32 |
|
33 CMRFocusStrategyViewer* self = |
|
34 new ( ELeave ) CMRFocusStrategyViewer( aFactory ); |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL(); |
|
37 CleanupStack::Pop( self ); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CMRFocusStrategyViewer::CMRFocusStrategyViewer |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 CMRFocusStrategyViewer::CMRFocusStrategyViewer( MESMRFieldStorage& aFactory ) |
|
46 : CMRFocusStrategyBase( aFactory ) |
|
47 { |
|
48 FUNC_LOG; |
|
49 |
|
50 // Do nothing |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CMRFocusStrategyViewer::~CMRFocusStrategyViewer |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 CMRFocusStrategyViewer::~CMRFocusStrategyViewer() |
|
58 { |
|
59 FUNC_LOG; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CMRFocusStrategyViewer::ConstructL |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CMRFocusStrategyViewer::ConstructL() |
|
67 { |
|
68 FUNC_LOG; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CMRFocusStrategyViewer::InitializeFocus |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void CMRFocusStrategyViewer::InitializeFocus() |
|
76 { |
|
77 FUNC_LOG; |
|
78 |
|
79 // Focus is not on by default |
|
80 const TInt count( iFactory.Count() ); |
|
81 for ( TInt i = 0; i < count; i++ ) |
|
82 { |
|
83 CESMRField* field = iFactory.Field( i ); |
|
84 |
|
85 // At the start there is no focus in hybrid or touch device. |
|
86 // The hw key provokest the focus again |
|
87 field->SetFocusType( EESMRNoFocus ); |
|
88 } |
|
89 iVisibleFocusOn = EFalse; |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CMRFocusStrategyViewer::EventOccured |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 void CMRFocusStrategyViewer::EventOccured( TFocusEventType aEventType ) |
|
97 { |
|
98 FUNC_LOG; |
|
99 |
|
100 if ( aEventType == MMRFocusStrategy::EFocusKeyEvent ) |
|
101 { |
|
102 // If device has the keyboard, we should show the focus |
|
103 if ( NMRGlobalFeatureSettings::KeyboardType() != |
|
104 NMRGlobalFeatureSettings::ENoKeyboard ) |
|
105 { |
|
106 CMRFocusStrategyBase::ShowFocus(); |
|
107 } |
|
108 } |
|
109 if ( aEventType == MMRFocusStrategy::EFocusPointerEvent ) |
|
110 { |
|
111 DoHideFocus(); |
|
112 } |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CMRFocusStrategyViewer::DoHideFocus |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CMRFocusStrategyViewer::DoHideFocus() |
|
120 { |
|
121 FUNC_LOG; |
|
122 |
|
123 if ( iVisibleFocusOn ) |
|
124 { |
|
125 const TInt count( iFactory.Count() ); |
|
126 for ( TInt i = 0; i < count; i++ ) |
|
127 { |
|
128 CESMRField* field = iFactory.Field( i ); |
|
129 |
|
130 // At the start there is no focus in hybrid or touch device. |
|
131 // The hw key provokest the focus again |
|
132 field->SetFocusType( EESMRNoFocus ); |
|
133 |
|
134 // Every field is redrawn due to draw problems after |
|
135 // focus removal |
|
136 field->DrawDeferred(); |
|
137 } |
|
138 |
|
139 iVisibleFocusOn = EFalse; |
|
140 } |
|
141 } |
|
142 // End of file |
|
143 |