|
1 /* |
|
2 * Copyright (c) 2003 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 the License "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: Object for containing scrolling specific methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MVCSCROLL_H |
|
20 #define __MVCSCROLL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "MVCView.h" |
|
25 #include "nw_evt_controlkeyevent.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // FUNCTION PROTOTYPES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 |
|
37 // CLASS DECLARATION |
|
38 NONSHARABLE_CLASS(CMVCScroll) : public CBase |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 * @param view A pointer to the view object associated with this scroll object |
|
44 * @return CMVCScroll* |
|
45 */ |
|
46 static CMVCScroll* NewL(CView* view); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 ~CMVCScroll(); |
|
52 |
|
53 /** |
|
54 * Navigates downward through the page |
|
55 * @since 2.X |
|
56 * @param isNewPage A flag passed to SetCurrentBox |
|
57 * @param noBoxVisible A flag used for deciding whether or not to call ForceCurrentBox |
|
58 * @return TBool |
|
59 */ |
|
60 TBool TabForward(TBool isNewPage, |
|
61 TBool* noBoxVisible); |
|
62 |
|
63 /** |
|
64 * Navigates upward through the page |
|
65 * @since 2.X |
|
66 * @param noBoxVisible A flag used for deciding whether or not to call ForceCurrentBox |
|
67 * @return TBool |
|
68 */ |
|
69 TBool TabBackward(TBool* noBoxVisible); |
|
70 |
|
71 /** |
|
72 * Navigates left horizontally through the page |
|
73 * @since 2.X |
|
74 * @param noBoxVisible A flag used for deciding whether or not to call ForceCurrentBox |
|
75 * @return TBool |
|
76 */ |
|
77 TBool TabLeft(TBool* noBoxVisible); |
|
78 |
|
79 /** |
|
80 * Navigates right horizontally through the page |
|
81 * @since 2.X |
|
82 * @param noBoxVisible A flag used for deciding whether or not to call ForceCurrentBox |
|
83 * @return TBool |
|
84 */ |
|
85 TBool TabRight(TBool* noBoxVisible); |
|
86 |
|
87 /** |
|
88 * Returns a NW_LMgr_Box_t pointer to the the previous box in the index |
|
89 * @since 2.X |
|
90 * @param oldBox A pointer to the (current)box used to calculate the previous box |
|
91 * @return NW_LMgr_Box_t* |
|
92 */ |
|
93 NW_LMgr_Box_t* GetPreviousTabIndex(const NW_LMgr_Box_t* oldBox, |
|
94 NW_Int32* currentTabIndex); |
|
95 |
|
96 /** |
|
97 * Returns a NW_LMgr_Box_t pointer to the the next box in the index |
|
98 * @since 2.X |
|
99 * @param oldBox A pointer to the (current)box used to calculate the previous box |
|
100 * @return NW_LMgr_Box_t* |
|
101 */ |
|
102 NW_LMgr_Box_t* GetNextTabIndex(const NW_LMgr_Box_t* oldBox, |
|
103 NW_Int32* currentTabIndex); |
|
104 |
|
105 /** |
|
106 * Processes the control key for normal layout |
|
107 * @since 2.X |
|
108 * @param key The control key that was pressed, up, down, left, right |
|
109 * @return TBool |
|
110 */ |
|
111 TBool ProcessControlKey(NW_Evt_ControlKeyType_t key); |
|
112 |
|
113 /** |
|
114 * Processes the control key for vertical layout |
|
115 * @since 2.X |
|
116 * @param key The control key that was pressed, up, down, left, right |
|
117 * @return TBool |
|
118 */ |
|
119 TBool ProcessControlKeyVL(NW_Evt_ControlKeyType_t key); |
|
120 |
|
121 /** |
|
122 * Method used to calculate the amount to scroll the page up or down |
|
123 * @since 2.X |
|
124 * @param void |
|
125 * @return NW_Uint16 |
|
126 */ |
|
127 NW_Uint16 GetScrollAmount(void); |
|
128 |
|
129 /** |
|
130 * Method used in vertical layout to page up or down by one full |
|
131 * page size minus 2 lines |
|
132 */ |
|
133 TBool ScrollPage(NW_Evt_ControlKeyType_t key); |
|
134 |
|
135 /** |
|
136 * Method returns the first sibling box whose width and height are not zero |
|
137 */ |
|
138 NW_LMgr_Box_t* CMVCScroll::GetFirstSiblingBox (NW_LMgr_Box_t* box); |
|
139 |
|
140 private: // Private methods and member variables |
|
141 /** |
|
142 * C++ default constructor. |
|
143 */ |
|
144 CMVCScroll(CView* view); |
|
145 |
|
146 /** |
|
147 * By default Symbian 2nd phase constructor is private. |
|
148 */ |
|
149 void ConstructL(); |
|
150 |
|
151 /** |
|
152 * Method used in vertical layout to tab to the appropriate link |
|
153 */ |
|
154 TBool ScrollLink(NW_Evt_ControlKeyType_t key, |
|
155 TBool* noBoxVisible); |
|
156 |
|
157 /** |
|
158 * Method used to calculate the next box to tab to |
|
159 */ |
|
160 void GetBoxRange(NW_LMgr_Box_t* box, |
|
161 NW_GDI_Metric_t* referenceY, NW_GDI_Metric_t* refY2, |
|
162 NW_GDI_Metric_t* referenceX, NW_GDI_Metric_t* refX2); |
|
163 |
|
164 /** |
|
165 * Method to set focus to the current box |
|
166 */ |
|
167 TBrowserStatusCode SetCurrentBox(NW_LMgr_Box_t* box, |
|
168 NW_Evt_TabEvent_t* tabEvent, |
|
169 TBool isNewPage, |
|
170 TBool* noBoxVisible); |
|
171 /** |
|
172 * Method returns true if the box is visible in both rectangles |
|
173 */ |
|
174 TBool IsBoxVisibleInEither(const NW_LMgr_Box_t* box, |
|
175 NW_GDI_Rectangle_t* bounds1, |
|
176 NW_GDI_Rectangle_t* bounds2); |
|
177 /** |
|
178 * Method used to get range of the box, not considering sibling or master box's range |
|
179 */ |
|
180 void GetBoxRangeRestrict (NW_LMgr_Box_t* box, |
|
181 NW_GDI_Metric_t* referenceY, NW_GDI_Metric_t* refY2, |
|
182 NW_GDI_Metric_t* referenceX, NW_GDI_Metric_t* refX2 ); |
|
183 /** |
|
184 * Method used to get master range of the box |
|
185 */ |
|
186 void GetMasterBoxRange (NW_LMgr_Box_t* box, |
|
187 NW_GDI_Metric_t* referenceY, NW_GDI_Metric_t* refY2, |
|
188 NW_GDI_Metric_t* referenceX, NW_GDI_Metric_t* refX2 ); |
|
189 |
|
190 /** |
|
191 * Method used to get the first sibling box range |
|
192 */ |
|
193 void GetFirstSiblingBoxRange (NW_LMgr_Box_t* box, |
|
194 NW_GDI_Metric_t* referenceY, NW_GDI_Metric_t* refY2, |
|
195 NW_GDI_Metric_t* referenceX, NW_GDI_Metric_t* refX2 ); |
|
196 /** |
|
197 * Method used to get the size of the visible box |
|
198 */ |
|
199 NW_Bool HowBigIsBoxVisible ( const NW_LMgr_Box_t* box, |
|
200 NW_GDI_Rectangle_t* bounds, |
|
201 NW_GDI_Rectangle_t* overlap ); |
|
202 /** |
|
203 * Method used to get the scroll down bounds |
|
204 */ |
|
205 NW_Bool GetScrollDownBounds ( CView* view, |
|
206 NW_GDI_Rectangle_t* scrolledBounds ); |
|
207 /** |
|
208 * Method used to get the scroll up bounds |
|
209 */ |
|
210 NW_Bool GetScrollUpBounds ( CView* view, |
|
211 NW_GDI_Rectangle_t* scrolledBounds ); |
|
212 /** |
|
213 * Method used to get the tab index |
|
214 */ |
|
215 NW_LMgr_Box_t* GetTabIndex( const NW_LMgr_Box_t* oldBox, |
|
216 NW_Bool nextIndex, |
|
217 NW_Int32* currentTabIndex ); |
|
218 /** |
|
219 * Method used to get the next event listener |
|
220 */ |
|
221 NW_LMgr_Box_t* GetNextEventListener (NW_LMgr_BoxVisitor_t* boxVisitor); |
|
222 |
|
223 /** |
|
224 * Method used to find the first visible box on a page |
|
225 */ |
|
226 void GetFirstVisible(NW_LMgr_Box_t* box, |
|
227 NW_LMgr_Box_t** firstVisible); |
|
228 /** |
|
229 * Method used to calculate the amount to page up or down |
|
230 */ |
|
231 NW_Uint16 GetPagingAmount(void); |
|
232 |
|
233 // Pointer to the scroll objects associated view object |
|
234 CView* iView; |
|
235 }; |
|
236 |
|
237 #endif //__MVCSCROLL_H |