author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:11:35 +0300 | |
branch | RCL_3 |
changeset 78 | 356f28cd5ca0 |
parent 66 | bd7edf625bdd |
child 86 | ed599363c2d7 |
permissions | -rw-r--r-- |
66 | 1 |
/* |
2 |
* Copyright (c) 2002, 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 "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: Navi decorated control for eventview |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "calencustomnavilabel.h" |
|
19 |
#include "calendarui_debug.h" |
|
20 |
||
21 |
#include <aknlayoutscalable_apps.cdl.h> |
|
22 |
#include <eikapp.h> |
|
23 |
#include <eikappui.h> |
|
24 |
#include <AknUtils.h> |
|
25 |
#include <calendar.mbg> |
|
26 |
#include <AknIconUtils.h> |
|
27 |
#include <debug.h> |
|
28 |
#include <AknsUtils.h> |
|
29 |
||
30 |
||
31 |
// ---------------------------------------------------------------------------- |
|
32 |
// CCustomNaviControl::NewL |
|
33 |
// First stage construction |
|
34 |
// ---------------------------------------------------------------------------- |
|
35 |
CCustomNaviControl* CCustomNaviControl::NewL(const TDesC& aName, const TRgb aColor) |
|
36 |
{ |
|
37 |
TRACE_ENTRY_POINT; |
|
38 |
CCustomNaviControl* self = new(ELeave)CCustomNaviControl(); |
|
39 |
CleanupStack::PushL(self); |
|
40 |
self->ConstructL( aName, aColor ); |
|
41 |
CleanupStack::Pop(self); |
|
42 |
TRACE_EXIT_POINT; |
|
43 |
return self; |
|
44 |
} |
|
45 |
||
46 |
// ---------------------------------------------------------------------------- |
|
47 |
// CCustomNaviControl::~CCustomNaviControl |
|
48 |
// Destructor |
|
49 |
// ---------------------------------------------------------------------------- |
|
50 |
CCustomNaviControl::~CCustomNaviControl() |
|
51 |
{ |
|
52 |
TRACE_ENTRY_POINT; |
|
53 |
if(iBitmap) |
|
54 |
{ |
|
55 |
delete iBitmap; |
|
56 |
iBitmap = NULL; |
|
57 |
} |
|
58 |
if(iMask) |
|
59 |
{ |
|
60 |
delete iMask; |
|
61 |
iMask = NULL; |
|
62 |
} |
|
63 |
||
64 |
if(iCalendarName) |
|
65 |
{ |
|
66 |
delete iCalendarName; |
|
67 |
} |
|
68 |
TRACE_EXIT_POINT; |
|
69 |
} |
|
70 |
||
71 |
// ---------------------------------------------------------------------------- |
|
72 |
// CCustomNaviControl::SetCalendarNameAndColor |
|
73 |
// Sets the Calendar name and Color. |
|
74 |
// ---------------------------------------------------------------------------- |
|
75 |
void CCustomNaviControl::SetCalendarNameAndColorL(const TDesC& aName, const TRgb aColor) |
|
76 |
{ |
|
77 |
TRACE_ENTRY_POINT; |
|
78 |
delete iCalendarName; |
|
79 |
iCalendarColor = aColor; |
|
80 |
iCalendarName = aName.AllocL(); |
|
81 |
TRACE_EXIT_POINT; |
|
82 |
} |
|
83 |
||
84 |
// ---------------------------------------------------------------------------- |
|
85 |
// CCustomNaviControl::CCustomNaviControl |
|
86 |
// Constructor |
|
87 |
// ---------------------------------------------------------------------------- |
|
88 |
CCustomNaviControl::CCustomNaviControl() |
|
89 |
{ |
|
90 |
TRACE_ENTRY_POINT; |
|
91 |
TRACE_EXIT_POINT; |
|
92 |
} |
|
93 |
||
94 |
// ---------------------------------------------------------------------------- |
|
95 |
// CCustomNaviControl::ConstructL |
|
96 |
// Second stage construction |
|
97 |
// ---------------------------------------------------------------------------- |
|
98 |
void CCustomNaviControl::ConstructL(const TDesC& aName, const TRgb aColor) |
|
99 |
{ |
|
100 |
TRACE_ENTRY_POINT; |
|
101 |
iCalendarColor = aColor; |
|
102 |
iCalendarName = aName.AllocL(); |
|
103 |
CreateWindowL(); |
|
104 |
// Create an icon |
|
105 |
TFileName IconFile; |
|
106 |
IconFile = ((CEikAppUi*)CCoeEnv::Static()->AppUi())->Application()->BitmapStoreName(); |
|
107 |
AknIconUtils::CreateIconL(iBitmap, iMask,IconFile, |
|
108 |
EMbmCalendarQgn_indi_navi_color, |
|
109 |
EMbmCalendarQgn_indi_navi_color_mask); |
|
110 |
TRect naviPane; |
|
111 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ENaviPane, naviPane ); |
|
112 |
SetRect(naviPane); |
|
113 |
ActivateL(); |
|
114 |
TRACE_EXIT_POINT; |
|
115 |
} |
|
116 |
||
117 |
// ---------------------------------------------------------------------------- |
|
118 |
// CCustomNaviControl::Draw |
|
119 |
// (other items were commented in a header). |
|
120 |
// ---------------------------------------------------------------------------- |
|
121 |
// |
|
122 |
void CCustomNaviControl::Draw(const TRect& /*aRect*/) const |
|
123 |
{ |
|
124 |
TRACE_ENTRY_POINT; |
|
125 |
||
126 |
TSize navi_pane_size; |
|
127 |
AknLayoutUtils::LayoutMetricsSize (AknLayoutUtils::ENaviPane, navi_pane_size); |
|
128 |
TRect navi_pane(navi_pane_size); |
|
129 |
TAknLayoutRect navi_cale_icon_pane; |
|
130 |
navi_cale_icon_pane.LayoutRect(navi_pane, |
|
131 |
AknLayoutScalable_Apps::navi_pane_bcale_mc_g1().LayoutLine() ); |
|
132 |
TRect navi_cale_icon_ev2_pane = navi_cale_icon_pane.Rect(); |
|
133 |
||
134 |
CWindowGc& gc = SystemGc(); |
|
135 |
AknIconUtils::SetSize(iBitmap, navi_cale_icon_ev2_pane.Size()); |
|
136 |
AknIconUtils::SetIconColor(iBitmap,iCalendarColor); |
|
137 |
gc.BitBlt(navi_cale_icon_ev2_pane.iTl,iBitmap); |
|
138 |
TAknTextLineLayout navi_cale_text_pane_t1 = |
|
139 |
AknLayoutScalable_Apps::navi_pane_bcale_mc_t1(0).LayoutLine(); |
|
140 |
||
141 |
// Get heading layout properties |
|
142 |
// from field_cale_ev2_pane_t1 with list_cale_ev2_pane as parent |
|
143 |
TAknLayoutText headingTextLayout; |
|
144 |
headingTextLayout.LayoutText(navi_pane, navi_cale_text_pane_t1); |
|
145 |
||
146 |
const CFont* font = CCoeEnv::Static()->NormalFont(); |
|
147 |
gc.UseFont(font); |
|
148 |
// If you see bright red text, the skins api is broken! |
|
149 |
TRgb textColourFromSkin(255,0,0); |
|
150 |
// Does not transfer ownership. |
|
151 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
152 |
AknsUtils::GetCachedColor(skin, |
|
153 |
textColourFromSkin, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG2); |
|
154 |
TCharFormat charFormat; |
|
155 |
TCharFormatMask charFormatMask; |
|
156 |
// Set the text colour we found. |
|
157 |
charFormat.iFontPresentation.iTextColor = TLogicalRgb(textColourFromSkin); |
|
158 |
charFormatMask.SetAttrib(EAttColor); |
|
78
356f28cd5ca0
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
159 |
|
356f28cd5ca0
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
160 |
headingTextLayout.DrawText( gc, *iCalendarName, ETrue, charFormat.iFontPresentation.iTextColor ); |
66 | 161 |
gc.DiscardFont(); |
162 |
TRACE_EXIT_POINT; |
|
163 |
} |
|
164 |
||
165 |
// ---------------------------------------------------------------------------- |
|
166 |
// CCustomNaviControl::Sizechanged |
|
167 |
// Child control was resized. |
|
168 |
// (other items were commented in a header) |
|
169 |
// ---------------------------------------------------------------------------- |
|
170 |
// |
|
171 |
void CCustomNaviControl::SizeChanged() |
|
172 |
{ |
|
173 |
TRACE_ENTRY_POINT; |
|
174 |
TRACE_EXIT_POINT; |
|
175 |
} |
|
176 |
||
177 |
// ---------------------------------------------------------------------------- |
|
178 |
// CCustomNaviControl::CountComponentControls |
|
179 |
// Return child control count. |
|
180 |
// (other items were commented in a header). |
|
181 |
// ---------------------------------------------------------------------------- |
|
182 |
// |
|
183 |
TInt CCustomNaviControl::CountComponentControls() const |
|
184 |
{ |
|
185 |
TRACE_ENTRY_POINT; |
|
186 |
TRACE_EXIT_POINT; |
|
187 |
||
188 |
return 0; |
|
189 |
} |
|
190 |
||
191 |
// ---------------------------------------------------------------------------- |
|
192 |
// CCustomNaviControl::ComponentControl |
|
193 |
// Return child control pointer. |
|
194 |
// (other items were commented in a header). |
|
195 |
// ---------------------------------------------------------------------------- |
|
196 |
// |
|
197 |
CCoeControl* CCustomNaviControl::ComponentControl(TInt /*aIndex*/) const |
|
198 |
{ |
|
199 |
TRACE_ENTRY_POINT; |
|
200 |
TRACE_EXIT_POINT; |
|
201 |
||
202 |
return NULL; |
|
203 |
} |
|
204 |
||
205 |
// end of file |