1 /* |
1 /* |
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
35 { |
37 { |
36 _LIT( KCategory, "CMRBackground" ); |
38 _LIT( KCategory, "CMRBackground" ); |
37 User::Panic( KCategory(), aPanic ); |
39 User::Panic( KCategory(), aPanic ); |
38 } |
40 } |
39 #endif // _DEBUG |
41 #endif // _DEBUG |
|
42 |
|
43 TBool IsFocusUsed() |
|
44 { |
|
45 TBool retval( EFalse ); |
|
46 if ( NMRGlobalFeatureSettings::KeyboardType() != |
|
47 NMRGlobalFeatureSettings::ENoKeyboard ) |
|
48 { |
|
49 // If there is a keyboard then we can show the focus |
|
50 retval = ETrue; |
|
51 } |
|
52 |
|
53 return retval; |
|
54 } |
40 }//namespace |
55 }//namespace |
41 |
56 |
42 // ======== MEMBER FUNCTIONS ======== |
57 // ======== MEMBER FUNCTIONS ======== |
43 |
58 |
44 // --------------------------------------------------------------------------- |
59 // --------------------------------------------------------------------------- |
45 // CMRBackground::NewL |
60 // CMRBackground::NewL |
46 // --------------------------------------------------------------------------- |
61 // --------------------------------------------------------------------------- |
47 // |
62 // |
48 EXPORT_C |
63 EXPORT_C |
49 CMRBackground* CMRBackground::NewL( CESMRLayoutManager& aLayoutManager ) |
64 CMRBackground* CMRBackground::NewL() |
50 { |
65 { |
51 CMRBackground* self = new (ELeave) CMRBackground( aLayoutManager ); |
66 CMRBackground* self = new (ELeave) CMRBackground(); |
52 CleanupStack::PushL( self ); |
67 CleanupStack::PushL( self ); |
53 CleanupStack::Pop( self ); |
68 CleanupStack::Pop( self ); |
54 return self; |
69 return self; |
55 } |
70 } |
56 |
71 |
57 // --------------------------------------------------------------------------- |
72 // --------------------------------------------------------------------------- |
58 // CMRBackground::CMRBackground |
73 // CMRBackground::CMRBackground |
59 // --------------------------------------------------------------------------- |
74 // --------------------------------------------------------------------------- |
60 // |
75 // |
61 CMRBackground::CMRBackground( CESMRLayoutManager& aLayoutManager ) |
76 CMRBackground::CMRBackground() |
62 : iLayoutManager( aLayoutManager ) |
|
63 { |
77 { |
64 // Do nothing |
78 // Do nothing |
65 } |
79 } |
66 |
80 |
67 // --------------------------------------------------------------------------- |
81 // --------------------------------------------------------------------------- |
79 EXPORT_C void CMRBackground::Draw( |
93 EXPORT_C void CMRBackground::Draw( |
80 CWindowGc& aGc, |
94 CWindowGc& aGc, |
81 const CCoeControl& aControl, |
95 const CCoeControl& aControl, |
82 const TRect& /*aRect*/ ) const |
96 const TRect& /*aRect*/ ) const |
83 { |
97 { |
84 const CESMRField& ctrl = |
98 if ( IsFocusUsed() ) |
85 static_cast<const CESMRField&> ( aControl ); |
99 { |
86 TBool hasOutlineFocus = ctrl.HasOutlineFocus(); |
100 const CESMRField& ctrl = |
87 TESMRFieldFocusType focusType = ctrl.GetFocusType(); |
101 static_cast<const CESMRField&> ( aControl ); |
88 // highlight bitmap target rect: |
102 TBool hasOutlineFocus = ctrl.HasOutlineFocus(); |
89 TRect rect( ctrl.GetFocusRect() ); |
103 TESMRFieldFocusType focusType = ctrl.GetFocusType(); |
90 rect.Move( ctrl.Position() ); |
104 // highlight bitmap target rect: |
91 |
105 TRect rect( ctrl.GetFocusRect() ); |
92 if ( hasOutlineFocus ) |
106 rect.Move( ctrl.Position() ); |
93 { |
107 |
94 if( focusType == EESMRHighlightFocus ) |
108 if ( hasOutlineFocus ) |
95 { |
109 { |
96 if( ctrl.FieldMode() == EESMRFieldModeView ) |
110 if( focusType == EESMRHighlightFocus ) |
97 { |
111 { |
98 // Focused viewer field |
112 if( ctrl.FieldMode() == EESMRFieldModeView ) |
99 DrawFocus( aGc, rect, aControl, EViewerFieldWithFocus ); |
113 { |
100 } |
114 // Focused viewer field |
101 } |
115 DrawFocus( aGc, rect, aControl, EViewerFieldWithFocus ); |
|
116 } |
|
117 else |
|
118 { |
|
119 // Focused editor field |
|
120 DrawFocus( aGc, rect, aControl, EEditorFieldWithFocus ); |
|
121 } |
|
122 } |
|
123 } |
|
124 // TODO: Need to be removed after ui designer says that it can be removed. |
|
125 // else |
|
126 // { |
|
127 // if( ctrl.FieldMode() == EESMRFieldModeEdit ) |
|
128 // { |
|
129 // // Not focused editor field |
|
130 // DrawFocus( aGc, rect, aControl, EEditorFieldNoFocus ); |
|
131 // } |
|
132 // } |
102 } |
133 } |
103 } |
134 } |
104 |
135 |
105 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
106 // CMRBackground::IconSkinIdL |
137 // CMRBackground::IconSkinIdL |
122 array->AppendL( NMRBitmapManager::EMRBitmapListBottom ); |
153 array->AppendL( NMRBitmapManager::EMRBitmapListBottom ); |
123 array->AppendL( NMRBitmapManager::EMRBitmapListTopRight ); |
154 array->AppendL( NMRBitmapManager::EMRBitmapListTopRight ); |
124 array->AppendL( NMRBitmapManager::EMRBitmapListRight ); |
155 array->AppendL( NMRBitmapManager::EMRBitmapListRight ); |
125 array->AppendL( NMRBitmapManager::EMRBitmapListBottomRight ); |
156 array->AppendL( NMRBitmapManager::EMRBitmapListBottomRight ); |
126 } |
157 } |
|
158 else if ( aType == EEditorFieldWithFocus ) |
|
159 { |
|
160 array->AppendL( NMRBitmapManager::EMRBitmapInputTopLeft ); |
|
161 array->AppendL( NMRBitmapManager::EMRBitmapInputLeft ); |
|
162 array->AppendL( NMRBitmapManager::EMRBitmapInputBottomLeft ); |
|
163 array->AppendL( NMRBitmapManager::EMRBitmapInputTop ); |
|
164 array->AppendL( NMRBitmapManager::EMRBitmapInputCenter ); |
|
165 array->AppendL( NMRBitmapManager::EMRBitmapInputBottom ); |
|
166 array->AppendL( NMRBitmapManager::EMRBitmapInputTopRight ); |
|
167 array->AppendL( NMRBitmapManager::EMRBitmapInputRight ); |
|
168 array->AppendL( NMRBitmapManager::EMRBitmapInputBottomRight ); |
|
169 } |
127 else |
170 else |
128 { |
171 { |
129 array->AppendL( NMRBitmapManager::EMRBitmapSetOptTopLeft ); |
172 array->AppendL( NMRBitmapManager::EMRBitmapSetOptTopLeft ); |
130 array->AppendL( NMRBitmapManager::EMRBitmapSetOptLeft ); |
173 array->AppendL( NMRBitmapManager::EMRBitmapSetOptLeft ); |
131 array->AppendL( NMRBitmapManager::EMRBitmapSetOptBottomLeft ); |
174 array->AppendL( NMRBitmapManager::EMRBitmapSetOptBottomLeft ); |
132 array->AppendL( NMRBitmapManager::EMRBitmapSetOptTop ); |
175 array->AppendL( NMRBitmapManager::EMRBitmapSetOptTop ); |
133 array->AppendL( NMRBitmapManager::EMRBitmapSetOptCenter ); |
176 array->AppendL( NMRBitmapManager::EMRBitmapSetOptCenter ); |
134 array->AppendL( NMRBitmapManager::EMRBitmapSetOptBottom ); |
177 array->AppendL( NMRBitmapManager::EMRBitmapSetOptBottom ); |
135 array->AppendL( NMRBitmapManager::EMRBitmapSetOptTopRight ); |
178 array->AppendL( NMRBitmapManager::EMRBitmapSetOptTopRight ); |
136 array->AppendL( NMRBitmapManager::EMRBitmapSetOptRight ); |
179 array->AppendL( NMRBitmapManager::EMRBitmapSetOptRight ); |
137 array->AppendL( NMRBitmapManager::EMRBitmapSetOptBottomRight ); |
180 array->AppendL( NMRBitmapManager::EMRBitmapSetOptBottomRight ); |
138 } |
181 } |
139 |
182 |
140 CleanupStack::Pop( array ); |
183 CleanupStack::Pop( array ); |
141 return array; |
184 return array; |
142 } |
185 } |