calendarui/views/src/calentodayindicatorlinedrawer.cpp
author hgs
Mon, 20 Sep 2010 12:44:39 +0530
changeset 75 7ac58b2aae6f
parent 51 0b38fc5b94c6
permissions -rw-r--r--
201037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  CalenTodayIndicatorLineDrawer implementation.
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// System includes
hgs
parents:
diff changeset
    19
#include <QtGui>
hgs
parents:
diff changeset
    20
#include <QPainter>
hgs
parents:
diff changeset
    21
#include <QPen>
hgs
parents:
diff changeset
    22
#include <hbcolorscheme.h>
hgs
parents:
diff changeset
    23
#include <hbtheme.h>
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
// User includes
hgs
parents:
diff changeset
    26
#include "CalenTodayIndicatorLineDrawer.h"
51
hgs
parents: 45
diff changeset
    27
#include "OstTraceDefinitions.h"
hgs
parents: 45
diff changeset
    28
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents: 45
diff changeset
    29
#include "calentodayindicatorlinedrawerTraces.h"
hgs
parents: 45
diff changeset
    30
#endif
hgs
parents: 45
diff changeset
    31
45
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
/*!
hgs
parents:
diff changeset
    34
 \class CalenTodayIndicatorLineDrawer.
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
 Class to draw the today indicator line.
hgs
parents:
diff changeset
    37
 */
hgs
parents:
diff changeset
    38
hgs
parents:
diff changeset
    39
/*!
hgs
parents:
diff changeset
    40
 Constructor.
hgs
parents:
diff changeset
    41
 */
hgs
parents:
diff changeset
    42
CalenTodayIndicatorLineDrawer::CalenTodayIndicatorLineDrawer(
hgs
parents:
diff changeset
    43
		QGraphicsItem* parent): HbWidgetBase(parent)
hgs
parents:
diff changeset
    44
{
51
hgs
parents: 45
diff changeset
    45
    OstTraceFunctionEntry0( CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_ENTRY );
hgs
parents: 45
diff changeset
    46
    
45
hgs
parents:
diff changeset
    47
	connect(
hgs
parents:
diff changeset
    48
			HbTheme::instance(), SIGNAL(changed()),
hgs
parents:
diff changeset
    49
			this, SLOT(handleThemeChange()));
hgs
parents:
diff changeset
    50
	setFlag(QGraphicsItem::ItemHasNoContents, false);
51
hgs
parents: 45
diff changeset
    51
	
hgs
parents: 45
diff changeset
    52
	OstTraceFunctionExit0( CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_EXIT );
45
hgs
parents:
diff changeset
    53
}
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
/*!
hgs
parents:
diff changeset
    56
 Destructor.
hgs
parents:
diff changeset
    57
 */
hgs
parents:
diff changeset
    58
CalenTodayIndicatorLineDrawer::~CalenTodayIndicatorLineDrawer()
hgs
parents:
diff changeset
    59
{
51
hgs
parents: 45
diff changeset
    60
    OstTraceFunctionEntry0( DUP1_CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_ENTRY );
45
hgs
parents:
diff changeset
    61
51
hgs
parents: 45
diff changeset
    62
    OstTraceFunctionExit0( DUP1_CALENTODAYINDICATORLINEDRAWER_CALENTODAYINDICATORLINEDRAWER_EXIT );
45
hgs
parents:
diff changeset
    63
}
hgs
parents:
diff changeset
    64
hgs
parents:
diff changeset
    65
/*!
hgs
parents:
diff changeset
    66
 To paint the today indicator line.
hgs
parents:
diff changeset
    67
 */
hgs
parents:
diff changeset
    68
void CalenTodayIndicatorLineDrawer::paint(
hgs
parents:
diff changeset
    69
		QPainter* painter, const QStyleOptionGraphicsItem* option,
hgs
parents:
diff changeset
    70
		QWidget* widget)
hgs
parents:
diff changeset
    71
{
51
hgs
parents: 45
diff changeset
    72
    OstTraceFunctionEntry0( CALENTODAYINDICATORLINEDRAWER_PAINT_ENTRY );
hgs
parents: 45
diff changeset
    73
    
45
hgs
parents:
diff changeset
    74
	Q_UNUSED(option);
hgs
parents:
diff changeset
    75
	Q_UNUSED(widget);
hgs
parents:
diff changeset
    76
	QPen pen;
hgs
parents:
diff changeset
    77
	pen.setStyle(Qt::SolidLine);
hgs
parents:
diff changeset
    78
	pen.setBrush(HbColorScheme::color("qtc_cal_month_current_day"));
51
hgs
parents: 45
diff changeset
    79
	
hgs
parents: 45
diff changeset
    80
	// Store the old pen
hgs
parents: 45
diff changeset
    81
    QPen oldPen = painter->pen();
hgs
parents: 45
diff changeset
    82
	    
45
hgs
parents:
diff changeset
    83
	painter->setPen(pen);
hgs
parents:
diff changeset
    84
	QRectF controlRect = this->boundingRect();
hgs
parents:
diff changeset
    85
	painter->fillRect(
hgs
parents:
diff changeset
    86
			controlRect, HbColorScheme::color("qtc_cal_month_current_day"));
51
hgs
parents: 45
diff changeset
    87
	
hgs
parents: 45
diff changeset
    88
	// Set the old pen back
hgs
parents: 45
diff changeset
    89
    painter->setPen(oldPen);
hgs
parents: 45
diff changeset
    90
    
hgs
parents: 45
diff changeset
    91
    OstTraceFunctionExit0( CALENTODAYINDICATORLINEDRAWER_PAINT_EXIT );
45
hgs
parents:
diff changeset
    92
}
hgs
parents:
diff changeset
    93
hgs
parents:
diff changeset
    94
/*!
hgs
parents:
diff changeset
    95
 To handle the theme change for the today indicator line.
hgs
parents:
diff changeset
    96
 */
hgs
parents:
diff changeset
    97
void CalenTodayIndicatorLineDrawer::handleThemeChange()
hgs
parents:
diff changeset
    98
{
51
hgs
parents: 45
diff changeset
    99
    OstTraceFunctionEntry0( CALENTODAYINDICATORLINEDRAWER_HANDLETHEMECHANGE_ENTRY );
hgs
parents: 45
diff changeset
   100
    
45
hgs
parents:
diff changeset
   101
	update();
51
hgs
parents: 45
diff changeset
   102
	
hgs
parents: 45
diff changeset
   103
	OstTraceFunctionExit0( CALENTODAYINDICATORLINEDRAWER_HANDLETHEMECHANGE_EXIT );
45
hgs
parents:
diff changeset
   104
}
hgs
parents:
diff changeset
   105
hgs
parents:
diff changeset
   106
// End of file  --Don't remove this.