|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Include |
|
20 #include "peninputlistonerowwithouticonwithbubble.h" |
|
21 #include "peninputcandidate.h" |
|
22 |
|
23 #include <peninputdropdownlistcontext.h> |
|
24 #include <peninputdropdownlist.h> |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // Implementation of Class CListOneRowWithoutIconWithBubble |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CListOneRowWithoutIconWithBubble::CListOneRowWithoutIconWithBubble |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave |
|
34 // (other items were commented in a header). |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CListOneRowWithoutIconWithBubble::CListOneRowWithoutIconWithBubble(CListManager* aManager, |
|
38 MFepCtrlDropdownListContext* aOwner) |
|
39 :CListOneRowWithoutIcon(aManager, aOwner) |
|
40 { |
|
41 iIsMultiRows = EFalse; |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CListOneRowWithoutIconWithBubble::NewL |
|
46 // factory function |
|
47 // (other items were commented in a header). |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CListOneRowWithoutIconWithBubble* CListOneRowWithoutIconWithBubble::NewL(CListManager* aManager, |
|
51 MFepCtrlDropdownListContext* aOwner) |
|
52 { |
|
53 CListOneRowWithoutIconWithBubble* self = new (ELeave) CListOneRowWithoutIconWithBubble(aManager, aOwner); |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop(); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CListOneRowWithoutIconWithBubble::~CListOneRowWithoutIconWithBubble |
|
62 // desstrutor function |
|
63 // (other items were commented in a header). |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CListOneRowWithoutIconWithBubble::~CListOneRowWithoutIconWithBubble() |
|
67 { |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CListOneRowWithoutIconWithBubble::HandlePointerDownL |
|
72 // handle pointer down |
|
73 // (other items were commented in a header). |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void CListOneRowWithoutIconWithBubble::HandlePointerDownL(const TPoint& aPoint) |
|
77 { |
|
78 // Pass the event first to the base |
|
79 CList::HandlePointerDownL(aPoint); |
|
80 |
|
81 TInt index = -1; |
|
82 CCandidate* candidate = FindCandidate(aPoint, index); |
|
83 if(candidate) |
|
84 iOwner->DrawBubble(iClickedRect, candidate->GetCandidate()); |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CListOneRowWithoutIconWithBubble::HandlePointerDragL |
|
89 // handle pointer drag function |
|
90 // (other items were commented in a header). |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void CListOneRowWithoutIconWithBubble::HandlePointerDragL(const TPoint& aPoint) |
|
94 { |
|
95 // Pass the event first to the base |
|
96 CList::HandlePointerDragL(aPoint); |
|
97 |
|
98 // If the mouse have click in the area of DDL |
|
99 if ( iIndicateButtonClicked ) |
|
100 { |
|
101 CCandidate* candidate = FindCandidate(aPoint, iClickedCandidateIndex); |
|
102 |
|
103 if ( candidate ) |
|
104 { |
|
105 if(iClickedRect != candidate->GetRect()) |
|
106 { |
|
107 iMoveLatestRect = iClickedRect; |
|
108 iClickedRect.SetRect(candidate->GetRect().iTl, candidate->GetRect().Size()); |
|
109 iOwner->ClearBubble(); |
|
110 iOwner->DrawBubble(iClickedRect, candidate->GetCandidate()); |
|
111 } |
|
112 } |
|
113 else |
|
114 { |
|
115 iOwner->ClearBubble(); |
|
116 |
|
117 iMoveLatestRect = iClickedRect; |
|
118 iClickedRect = KEmptyRect; |
|
119 } |
|
120 |
|
121 // Compare the two rect, then decide draw it or not |
|
122 CompareRect(iMoveLatestRect, iClickedRect); |
|
123 } |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CListOneRowWithoutIconWithBubble::HandlePointerUpL |
|
128 // handle pointer up function |
|
129 // (other items were commented in a header). |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 void CListOneRowWithoutIconWithBubble::HandlePointerUpL(const TPoint& aPoint) |
|
133 { |
|
134 if ( !iClickedRect.IsEmpty() ) |
|
135 { |
|
136 iOwner->ClearBubble(); |
|
137 // Find out which rectangle was clicked and save it for |
|
138 // later usage (HandlePointerUpL) |
|
139 if ( iContentRect.Contains( aPoint ) ) |
|
140 { |
|
141 if ( iClickedRect.Contains( aPoint ) ) |
|
142 { |
|
143 if ( iClickedCandidateIndex != KErrNotFound ) |
|
144 { |
|
145 // Redraw the selection rect |
|
146 DrawSelection( iClickedRect, EFalse ); |
|
147 |
|
148 // We have selected a candidate |
|
149 // Send message to plugin |
|
150 CCandidate* candidate = iOwner->GetCandidate(iClickedCandidateIndex); |
|
151 if ( candidate ) |
|
152 { |
|
153 iOwner->ReportCandidateSelectEventL(candidate->GetCandidate(), |
|
154 iClickedCandidateIndex); |
|
155 } |
|
156 |
|
157 } |
|
158 } |
|
159 |
|
160 iIndicateButtonClicked = EFalse; |
|
161 } |
|
162 |
|
163 iClickedRect = KEmptyRect; |
|
164 } |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CListOneRowWithoutIconWithBubble::HandlePointerLeave |
|
169 // handle pointer leave function |
|
170 // (other items were commented in a header). |
|
171 // ----------------------------------------------------------------------------- |
|
172 // |
|
173 void CListOneRowWithoutIconWithBubble::HandlePointerLeave(const TPoint& /*aPoint*/) |
|
174 { |
|
175 iMoveLatestRect = iClickedRect; |
|
176 iClickedRect = KEmptyRect; |
|
177 DrawSelection( iMoveLatestRect, EFalse ); |
|
178 DrawHighightCell(iMoveLatestRect, ETrue); |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CListOneRowWithoutIconWithBubble::CompareRect |
|
183 // Compare src and des rect |
|
184 // (other items were commented in a header). |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 TBool CListOneRowWithoutIconWithBubble::CompareRect(const TRect& aSrcRect, const TRect& aDesRect) |
|
188 { |
|
189 if(aSrcRect != aDesRect) |
|
190 { |
|
191 DrawSelection(aDesRect, ETrue); |
|
192 DrawSelection(aSrcRect, EFalse); |
|
193 DrawHighightCell(aSrcRect, ETrue); |
|
194 } |
|
195 |
|
196 return EFalse; |
|
197 } |
|
198 |
|
199 // End Of File |