1 /* |
|
2 * Copyright (c) 2002-2004 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: Predictive candidate list |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 // INCLUDE FILES |
|
30 #include <eikdef.h> |
|
31 #include <aknViewAppUi.h> |
|
32 #include <avkon.hrh> |
|
33 #include <aknPopup.h> |
|
34 #include <aknlists.h> |
|
35 #include <AknsDrawUtils.h> |
|
36 #include <AknLayout.lag> |
|
37 #include <aknlayoutscalable_avkon.cdl.h> |
|
38 |
|
39 #include "AknFepUiInterfacePanic.h" |
|
40 #include "AknFepUIAvkonCtrlJapanesePredictiveCellListBoxData.h" |
|
41 |
|
42 #include <skinlayout.cdl.h> |
|
43 using namespace SkinLayout; |
|
44 |
|
45 // CONSTANTS |
|
46 |
|
47 // ============================ MEMBER FUNCTIONS =============================== |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CAknFepUICtrlJapanesePredictiveCellListBoxData::NewL |
|
51 // Two-phased constructor. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CAknFepUICtrlJapanesePredictiveCellListBoxData* |
|
55 CAknFepUICtrlJapanesePredictiveCellListBoxData::NewL() |
|
56 { |
|
57 CAknFepUICtrlJapanesePredictiveCellListBoxData* self = |
|
58 new(ELeave) CAknFepUICtrlJapanesePredictiveCellListBoxData; |
|
59 self->ConstructLD(); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CAknFepUICtrlJapanesePredictiveCellListBoxData::SetHighlightArea |
|
65 // Setting rang of x-point to highlight |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CAknFepUICtrlJapanesePredictiveCellListBoxData::SetHighlightArea( |
|
69 TInt aHighlightStartXPos, TInt aHighlightEndXPos) |
|
70 { |
|
71 iHighlightStartXPos = aHighlightStartXPos; |
|
72 iHighlightEndXPos = aHighlightEndXPos; |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CAknFepUICtrlJapanesePredictiveCellListBoxData::Draw |
|
77 // Drawing a item in listbox |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void CAknFepUICtrlJapanesePredictiveCellListBoxData::Draw( |
|
81 TListItemProperties aProperties, |
|
82 CWindowGc& aGc, |
|
83 const TDesC* aText, |
|
84 const TRect& aRect, |
|
85 TBool aHighlight, |
|
86 const TColors& aColors) const |
|
87 { |
|
88 const TRect& aItemRect = aRect; |
|
89 |
|
90 aHighlight = (iHighlightStartXPos != 0 || iHighlightEndXPos != 0); |
|
91 TRect highlightItemRect = aRect; |
|
92 |
|
93 TAknTextLineLayout textLineLayout = |
|
94 AKN_LAYOUT_TEXT_Predictive_candidate_selection_list_texts_Line_1(0,0); |
|
95 TAknTextLineLayout highlighttextLineLayout = |
|
96 AKN_LAYOUT_TEXT_Predictive_candidate_selection_list_texts_Line_1(1,0); |
|
97 TAknWindowLineLayout laf = |
|
98 AKN_LAYOUT_WINDOW_Predictive_candidate_selection_popup_window_graphics_Line_4(aItemRect); |
|
99 TAknLayoutText textlay; |
|
100 textlay.LayoutText(aItemRect, textLineLayout); |
|
101 TAknTextComponentLayout scal = AknLayoutScalable_Avkon::popup_fep_japan_predictive_window_t1(0); |
|
102 |
|
103 highlightItemRect.iBr.iX = highlightItemRect.iTl.iX + iHighlightEndXPos; |
|
104 highlightItemRect.iTl.iX = highlightItemRect.iTl.iX + iHighlightStartXPos; |
|
105 DrawDefaultHighlight(aGc, highlightItemRect, aHighlight); |
|
106 |
|
107 // Draw the actual items. |
|
108 DrawFormatted(aProperties, aGc, aText, aItemRect, EFalse, aColors); |
|
109 |
|
110 aGc.Reset(); |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CAknFepUICtrlJapanesePredictiveCellListBoxData::DrawDefaultHighlight |
|
115 // Highlighting a item |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CAknFepUICtrlJapanesePredictiveCellListBoxData::DrawDefaultHighlight( |
|
119 CWindowGc& aGc, |
|
120 const TRect& aItemRect, |
|
121 TBool aHighlight) const |
|
122 { |
|
123 if (aHighlight) |
|
124 { |
|
125 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
126 TBool highlightDrawn = EFalse; |
|
127 MAknsControlContext* cc = AknsDrawUtils::ControlContext(Control()); |
|
128 if (!cc) |
|
129 { |
|
130 cc = SkinBackgroundContext(); |
|
131 } |
|
132 |
|
133 if (cc) |
|
134 { |
|
135 TAknWindowLineLayout layCorner = List_highlight_skin_placing__general__Line_2(); |
|
136 TAknLayoutRect topLeft; |
|
137 topLeft.LayoutRect( |
|
138 aItemRect, |
|
139 ELayoutEmpty, |
|
140 0, 0, ELayoutEmpty, ELayoutEmpty, layCorner.iW, layCorner.iH); |
|
141 |
|
142 TAknLayoutRect bottomRight; |
|
143 bottomRight.LayoutRect( |
|
144 aItemRect, |
|
145 ELayoutEmpty, |
|
146 ELayoutEmpty, ELayoutEmpty, -layCorner.iW, 0, layCorner.iW, layCorner.iH); |
|
147 |
|
148 TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
|
149 TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
|
150 aGc.SetPenStyle(CGraphicsContext::ENullPen); |
|
151 |
|
152 const TAknsItemID* skinHighlightFrameId = &KAknsIIDQsnFrList; |
|
153 const TAknsItemID* skinHighlightFrameCenterId = &KAknsIIDQsnFrListCenter; |
|
154 highlightDrawn = |
|
155 AknsDrawUtils::DrawFrame( |
|
156 skin, aGc, outerRect, innerRect, |
|
157 *skinHighlightFrameId, *skinHighlightFrameCenterId); |
|
158 } |
|
159 |
|
160 if (!highlightDrawn) |
|
161 { |
|
162 TAknWindowLineLayout hl = AKN_LAYOUT_WINDOW_Predictive_candidate_selection_highlight_Line_1; |
|
163 hl.iW = ELayoutEmpty; |
|
164 hl.il += 1; |
|
165 hl.it += 1; |
|
166 hl.ir = -1; |
|
167 TAknLayoutRect highlight; |
|
168 highlight.LayoutRect(aItemRect, hl); |
|
169 highlight.DrawRect(aGc); |
|
170 } |
|
171 } |
|
172 } |
|
173 |
|
174 // End of File |
|