|
1 /* |
|
2 * Copyright (c) 2005 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: Layout calculations for week view listbox. |
|
15 * Week view implementation differs from LAF specification model |
|
16 * and some calculations are needed. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CALENWEEKLISTBOXLAYOUT_H |
|
23 #define CALENWEEKLISTBOXLAYOUT_H |
|
24 |
|
25 #include <AknUtils.h> |
|
26 #include <e32std.h> |
|
27 |
|
28 #include "CalendarVariant.hrh" |
|
29 |
|
30 /** |
|
31 * TWeekListBoxLayout provides helper functions to calculate correct layout values |
|
32 * for week view listbox. |
|
33 * |
|
34 * Long description below is divided to two sections: |
|
35 * 1) Rationale: Why listbox layout calculations are needed? |
|
36 * 2) (Naming) conventions explained |
|
37 * |
|
38 * |
|
39 * 1) Rationale: Why listbox layout calculations are needed |
|
40 * ----------------------------------------------------- |
|
41 * |
|
42 * Week view implementation differs from LAF specification. |
|
43 * LAF specification defines week view grid and time pane in the left side of grid. |
|
44 * But implementation uses listbox which combines both grid and time pane. |
|
45 * |
|
46 * Implementation implements week view as specially customized Uikon listbox. Uikon listboxes have |
|
47 * list items (= list rows), which have several subcells (rectangle inside row). |
|
48 * For week view listbox, first column is for hour labels, and it can't be focused. |
|
49 * Next 7 columns are for day columns of scrollable grid. Each row is one list item. |
|
50 * |
|
51 * Following images might help you to imagine the idea: |
|
52 * |
|
53 * Week view: |
|
54 * |
|
55 * Mo Tu We Th Fr Sa Su |
|
56 * ----------------------------------- |
|
57 * 8:00 |___|___|___|___|___|___|___| |
|
58 * 9:00 |___|___|_#_|___|___|___|___| |
|
59 * 10:00 |___|___|_#_|___|_#_|___|___| |
|
60 * 11:00 |___|___|___|___|_#_|___|___| |
|
61 * ... |
|
62 * |
|
63 * Listbox: used in implementation, not defined in LAF |
|
64 * |
|
65 * 8:00 |___|___|___|___|___|___|___| |
|
66 * 9:00 |___|___|_#_|___|___|___|___| |
|
67 * 10:00 |___|___|_#_|___|_#_|___|___| |
|
68 * 11:00 |___|___|___|___|_#_|___|___| |
|
69 * ... |
|
70 * |
|
71 * Time pane: defined in LAF |
|
72 * 8:00 |
|
73 * 9:00 |
|
74 * 10:00 |
|
75 * 11:00 |
|
76 * ... |
|
77 * |
|
78 * Week view grid: defined in LAF |
|
79 * |
|
80 * |___|___|___|___|___|___|___| |
|
81 * |___|___|_#_|___|___|___|___| |
|
82 * |___|___|_#_|___|_#_|___|___| |
|
83 * |___|___|___|___|_#_|___|___| |
|
84 * ... |
|
85 * |
|
86 * |
|
87 * 2) (Naming) conventions explained |
|
88 * ------------------------------ |
|
89 * |
|
90 * Following conventions are used: |
|
91 * - TAknLayoutRect/TAknLayoutText are written similar way as Avkon Layout system functions: |
|
92 * lower case, with underscore _ separating words. |
|
93 * e.g. TAknLayotRect cale_week_time_pane |
|
94 * |
|
95 * - TRect types has _Rect ending |
|
96 * e.g. TRect main_pane_Rect |
|
97 * |
|
98 * - cached (member variables) have i_ in the beginning |
|
99 * e.g TAknLayoutRect i_grid_cale_week_pane |
|
100 * |
|
101 * - Layout values that can't be read from layout data but has to be calculated are always TRects. |
|
102 * They have Rect ending. They are written in CamelCase, e.g. ListBoxRect |
|
103 * |
|
104 * - all layout rects are main pane relative unless otherwise noted. Especially data that is read through layout APIs |
|
105 * is always main pane relative because parents are passed to LayoutRect functions |
|
106 * |
|
107 * - if layout rect is not main_pane relative, it is indicated by writing layout rect that it is relative to in the end |
|
108 * of name: e.g. hourCellRect_in_ListItemRect |
|
109 * We only need ListItemRect relative stuff, because listbox subcell rects are given as list item relative. |
|
110 * |
|
111 * @lib Calendar.exe |
|
112 * @since S60 v3.0 |
|
113 */ |
|
114 |
|
115 NONSHARABLE_CLASS( TWeekListBoxLayout ) |
|
116 { |
|
117 public: |
|
118 /** |
|
119 * Constructor |
|
120 */ |
|
121 TWeekListBoxLayout( TBool aUseExtraRowLayout, TBool aUseToolbarLayout |
|
122 , TBool aUsePreview, TRect aMainPane ); |
|
123 |
|
124 /** |
|
125 * List box rect relative to main pane. |
|
126 * This is used directly to set list box size in CCalenWeekCont. |
|
127 * |
|
128 * Layout data defines both week view grid and time pane relative to listscroll_cale_week_pane |
|
129 * We calculate listbox size by combaining these two. |
|
130 */ |
|
131 TRect ListBoxRect(); |
|
132 |
|
133 /** |
|
134 * Return height of single line of list. |
|
135 */ |
|
136 TInt ListItemHeight(); |
|
137 |
|
138 /** |
|
139 * ListItemRect returns rect for list item line relative to main pane. |
|
140 * This is used to make coordinate system conversions between main pane and list item, |
|
141 * because list's subcell rects are given relative to list item. |
|
142 */ |
|
143 TRect ListItemRect(); |
|
144 |
|
145 |
|
146 /** |
|
147 * WeekGridRect returns rect for list item line relative to main pane (with out time). |
|
148 * This is used to make coordinate system conversions between main pane and list item, |
|
149 * because list's subcell rects are given relative to list item. |
|
150 */ |
|
151 TRect WeekGridRect(); |
|
152 |
|
153 |
|
154 /** |
|
155 * Equivalent to cale_week_time_pane_t1 |
|
156 */ |
|
157 TAknLayoutText HourTextLayout(); |
|
158 |
|
159 /** |
|
160 * Layout rect of hour text subcell rect. Relative to list item rect |
|
161 * Used for SetSubCellSizeL. Margins are calculated based on this and actual text rect layout. |
|
162 */ |
|
163 TRect HourSubCellRect_in_ListItemRect(); |
|
164 |
|
165 /** |
|
166 * Layout rect for week grid cell relative to list item rect |
|
167 * Used directly for SetSubcellSize. Used also for icon layout for memo, todo and anniversary icons. |
|
168 * |
|
169 */ |
|
170 TRect GridSubCellRect_in_ListItemRect(TInt aSubCellIndex); |
|
171 |
|
172 |
|
173 /** |
|
174 * @returns ETrue, if extra row layout has to be used |
|
175 * Extra row layout is used for regional calendar variants. |
|
176 */ |
|
177 TBool UseExtraRowLayout() const; |
|
178 |
|
179 TBool UseToolbarLayout() const; |
|
180 |
|
181 enum TWeekLayoutVariant |
|
182 { |
|
183 EListScrollCaleWeekPane, |
|
184 EPopupToolbarWindowCp01, |
|
185 EScrollPaneCp08, |
|
186 EBgCalePaneCp01, |
|
187 EGridCaleWeekPane, |
|
188 ECaleWeekDayHeadingPane, |
|
189 ECaleWeekTimePane, |
|
190 ECaleWeekTimePaneT1, |
|
191 EBgCaleSidePane, |
|
192 ECaleWeekScrollPaneG1, |
|
193 EBgCaleHeadingPane, |
|
194 EListScrollCaleWeekPaneT1, |
|
195 ECellCaleWeekPane, |
|
196 ECaleWeekDayHeadingPaneT1, |
|
197 ECellCaleWeekPaneG2 |
|
198 }; |
|
199 |
|
200 /** |
|
201 * Return currently used variant index to LAF |
|
202 */ |
|
203 TInt LayoutVariantIndex(TWeekLayoutVariant) const; |
|
204 |
|
205 private: |
|
206 TAknLayoutRect i_grid_cale_week_pane; |
|
207 TAknLayoutRect i_listscroll_cale_week_pane; |
|
208 TBool iUseExtraRowLayout; |
|
209 TBool iUseToolbarLayout; |
|
210 }; |
|
211 |
|
212 #endif // CALENWEEKLISTBOXLAYOUT_H |