equal
deleted
inserted
replaced
28 #include <aknlayoutscalable_avkon.cdl.h> |
28 #include <aknlayoutscalable_avkon.cdl.h> |
29 #include <aknlayoutscalable_apps.cdl.h> |
29 #include <aknlayoutscalable_apps.cdl.h> |
30 |
30 |
31 |
31 |
32 THgPopupDrawer::THgPopupDrawer() |
32 THgPopupDrawer::THgPopupDrawer() |
|
33 : iRect(), |
|
34 iFont (NULL), |
|
35 iLongestMonth(0) |
33 { |
36 { |
34 } |
37 } |
35 |
38 |
36 void THgPopupDrawer::Init( TRect aRect, const CFont* aFont ) |
39 void THgPopupDrawer::Init( TRect aRect, const CFont* aFont ) |
37 { |
40 { |
40 iLongestMonth = 0; |
43 iLongestMonth = 0; |
41 } |
44 } |
42 |
45 |
43 void THgPopupDrawer::InitLongestMonth() |
46 void THgPopupDrawer::InitLongestMonth() |
44 { |
47 { |
|
48 // font needs to be set |
|
49 if(!iFont) return; |
|
50 |
45 TTime time; |
51 TTime time; |
46 time.HomeTime(); |
52 time.HomeTime(); |
47 TDateTime date = time.DateTime(); |
53 TDateTime date = time.DateTime(); |
48 date.SetMonth(EJanuary); |
54 date.SetMonth(EJanuary); |
49 time = date; |
55 time = date; |
63 } |
69 } |
64 } |
70 } |
65 |
71 |
66 void THgPopupDrawer::Draw( CWindowGc& aGc, const TDesC& aDesc ) |
72 void THgPopupDrawer::Draw( CWindowGc& aGc, const TDesC& aDesc ) |
67 { |
73 { |
|
74 // font needs to be set |
|
75 if(!iFont) return; |
|
76 |
68 // Resolve rect for the popup "window" |
77 // Resolve rect for the popup "window" |
69 const TInt textLength = iFont->TextWidthInPixels( aDesc ); |
78 const TInt textLength = iFont->TextWidthInPixels( aDesc ); |
70 TInt width = iRect.Width()/KPopupWidthDiv > textLength + KPopupTextExtraPadding ? |
79 TInt width = iRect.Width()/KPopupWidthDiv > textLength + KPopupTextExtraPadding ? |
71 iRect.Width()/KPopupWidthDiv : textLength + KPopupTextExtraPadding; |
80 iRect.Width()/KPopupWidthDiv : textLength + KPopupTextExtraPadding; |
72 TInt height = (iFont->FontMaxHeight() * 2); |
81 TInt height = (iFont->FontMaxHeight() * 2); |
123 void THgPopupDrawer::Draw( CWindowGc& aGc, |
132 void THgPopupDrawer::Draw( CWindowGc& aGc, |
124 const TDesC& aDesc1, |
133 const TDesC& aDesc1, |
125 const TDesC& aDesc2 |
134 const TDesC& aDesc2 |
126 ) |
135 ) |
127 { |
136 { |
|
137 // font needs to be set |
|
138 if(!iFont) return; |
|
139 |
128 // init longest month value. |
140 // init longest month value. |
129 if(!iLongestMonth) |
141 if(!iLongestMonth) |
130 InitLongestMonth(); |
142 InitLongestMonth(); |
131 |
143 |
132 // Resolve rect for the popup "window" |
144 // Resolve rect for the popup "window" |
199 } |
211 } |
200 } |
212 } |
201 |
213 |
202 void THgPopupDrawer::InitFont(CWindowGc& aGc) |
214 void THgPopupDrawer::InitFont(CWindowGc& aGc) |
203 { |
215 { |
|
216 // font needs to be set |
|
217 if(!iFont) return; |
|
218 |
204 // Get color for the text from the skin. |
219 // Get color for the text from the skin. |
205 TRgb normal; |
220 TRgb normal; |
206 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
221 AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), |
207 normal, |
222 normal, |
208 KAknsIIDQsnTextColors, |
223 KAknsIIDQsnTextColors, |