45
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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: CalenTodayIndicatorLineDrawer implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
|
19 |
#include <QtGui>
|
|
20 |
#include <QPainter>
|
|
21 |
#include <QPen>
|
|
22 |
#include <hbcolorscheme.h>
|
|
23 |
#include <hbtheme.h>
|
|
24 |
|
|
25 |
// User includes
|
|
26 |
#include "CalenTodayIndicatorLineDrawer.h"
|
51
|
27 |
#include "OstTraceDefinitions.h"
|
|
28 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
29 |
#include "calentodayindicatorlinedrawerTraces.h"
|
|
30 |
#endif
|
|
31 |
|
45
|
32 |
|
|
33 |
/*!
|
|
34 |
\class CalenTodayIndicatorLineDrawer.
|
|
35 |
|
|
36 |
Class to draw the today indicator line.
|
|
37 |
*/
|
|
38 |
|
|
39 |
/*!
|
|
40 |
Constructor.
|
|
41 |
*/
|
|
42 |
CalenTodayIndicatorLineDrawer::CalenTodayIndicatorLineDrawer(
|
|
43 |
QGraphicsItem* parent): HbWidgetBase(parent)
|
|
44 |
{
|
51
|
45 |
OstTraceFunctionEntry0( CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_ENTRY );
|
|
46 |
|
45
|
47 |
connect(
|
|
48 |
HbTheme::instance(), SIGNAL(changed()),
|
|
49 |
this, SLOT(handleThemeChange()));
|
|
50 |
setFlag(QGraphicsItem::ItemHasNoContents, false);
|
51
|
51 |
|
|
52 |
OstTraceFunctionExit0( CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_EXIT );
|
45
|
53 |
}
|
|
54 |
|
|
55 |
/*!
|
|
56 |
Destructor.
|
|
57 |
*/
|
|
58 |
CalenTodayIndicatorLineDrawer::~CalenTodayIndicatorLineDrawer()
|
|
59 |
{
|
51
|
60 |
OstTraceFunctionEntry0( DUP1_CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_ENTRY );
|
45
|
61 |
|
51
|
62 |
OstTraceFunctionExit0( DUP1_CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_EXIT );
|
45
|
63 |
}
|
|
64 |
|
|
65 |
/*!
|
|
66 |
To paint the today indicator line.
|
|
67 |
*/
|
|
68 |
void CalenTodayIndicatorLineDrawer::paint(
|
|
69 |
QPainter* painter, const QStyleOptionGraphicsItem* option,
|
|
70 |
QWidget* widget)
|
|
71 |
{
|
51
|
72 |
OstTraceFunctionEntry0( CALENTODAYINDICATORLINEDRAWER_PAINT_ENTRY );
|
|
73 |
|
45
|
74 |
Q_UNUSED(option);
|
|
75 |
Q_UNUSED(widget);
|
|
76 |
QPen pen;
|
|
77 |
pen.setStyle(Qt::SolidLine);
|
|
78 |
pen.setBrush(HbColorScheme::color("qtc_cal_month_current_day"));
|
51
|
79 |
|
|
80 |
// Store the old pen
|
|
81 |
QPen oldPen = painter->pen();
|
|
82 |
|
45
|
83 |
painter->setPen(pen);
|
|
84 |
QRectF controlRect = this->boundingRect();
|
|
85 |
painter->fillRect(
|
|
86 |
controlRect, HbColorScheme::color("qtc_cal_month_current_day"));
|
51
|
87 |
|
|
88 |
// Set the old pen back
|
|
89 |
painter->setPen(oldPen);
|
|
90 |
|
|
91 |
OstTraceFunctionExit0( CALENTODAYINDICATORLINEDRAWER_PAINT_EXIT );
|
45
|
92 |
}
|
|
93 |
|
|
94 |
/*!
|
|
95 |
To handle the theme change for the today indicator line.
|
|
96 |
*/
|
|
97 |
void CalenTodayIndicatorLineDrawer::handleThemeChange()
|
|
98 |
{
|
51
|
99 |
OstTraceFunctionEntry0( CALENTODAYINDICATORLINEDRAWER_HANDLETHEMECHANGE_ENTRY );
|
|
100 |
|
45
|
101 |
update();
|
51
|
102 |
|
|
103 |
OstTraceFunctionExit0( CALENTODAYINDICATORLINEDRAWER_HANDLETHEMECHANGE_EXIT );
|
45
|
104 |
}
|
|
105 |
|
|
106 |
// End of file --Don't remove this.
|