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