30
|
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);
|
|
159 |
gc.SetPenColor(charFormat.iFontPresentation.iTextColor);
|
|
160 |
gc.DrawText(*(iCalendarName),TPoint(headingTextLayout.TextRect().iTl.iX,
|
|
161 |
headingTextLayout.TextRect().iBr.iY));
|
|
162 |
gc.DiscardFont();
|
|
163 |
TRACE_EXIT_POINT;
|
|
164 |
}
|
|
165 |
|
|
166 |
// ----------------------------------------------------------------------------
|
|
167 |
// CCustomNaviControl::Sizechanged
|
|
168 |
// Child control was resized.
|
|
169 |
// (other items were commented in a header)
|
|
170 |
// ----------------------------------------------------------------------------
|
|
171 |
//
|
|
172 |
void CCustomNaviControl::SizeChanged()
|
|
173 |
{
|
|
174 |
TRACE_ENTRY_POINT;
|
|
175 |
TRACE_EXIT_POINT;
|
|
176 |
}
|
|
177 |
|
|
178 |
// ----------------------------------------------------------------------------
|
|
179 |
// CCustomNaviControl::CountComponentControls
|
|
180 |
// Return child control count.
|
|
181 |
// (other items were commented in a header).
|
|
182 |
// ----------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
TInt CCustomNaviControl::CountComponentControls() const
|
|
185 |
{
|
|
186 |
TRACE_ENTRY_POINT;
|
|
187 |
TRACE_EXIT_POINT;
|
|
188 |
|
|
189 |
return 0;
|
|
190 |
}
|
|
191 |
|
|
192 |
// ----------------------------------------------------------------------------
|
|
193 |
// CCustomNaviControl::ComponentControl
|
|
194 |
// Return child control pointer.
|
|
195 |
// (other items were commented in a header).
|
|
196 |
// ----------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
CCoeControl* CCustomNaviControl::ComponentControl(TInt /*aIndex*/) const
|
|
199 |
{
|
|
200 |
TRACE_ENTRY_POINT;
|
|
201 |
TRACE_EXIT_POINT;
|
|
202 |
|
|
203 |
return NULL;
|
|
204 |
}
|
|
205 |
|
|
206 |
// end of file
|