calendarui/views/src/calentodayindicatorlinedrawer.cpp
changeset 49 5de72ea7a065
child 51 0b38fc5b94c6
equal deleted inserted replaced
37:360d55486d7f 49:5de72ea7a065
       
     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"
       
    27 
       
    28 /*!
       
    29  \class CalenTodayIndicatorLineDrawer.
       
    30 
       
    31  Class to draw the today indicator line.
       
    32  */
       
    33 
       
    34 /*!
       
    35  Constructor.
       
    36  */
       
    37 CalenTodayIndicatorLineDrawer::CalenTodayIndicatorLineDrawer(
       
    38 		QGraphicsItem* parent): HbWidgetBase(parent)
       
    39 {
       
    40 	connect(
       
    41 			HbTheme::instance(), SIGNAL(changed()),
       
    42 			this, SLOT(handleThemeChange()));
       
    43 	setFlag(QGraphicsItem::ItemHasNoContents, false);
       
    44 }
       
    45 
       
    46 /*!
       
    47  Destructor.
       
    48  */
       
    49 CalenTodayIndicatorLineDrawer::~CalenTodayIndicatorLineDrawer()
       
    50 {
       
    51 
       
    52 }
       
    53 
       
    54 /*!
       
    55  To paint the today indicator line.
       
    56  */
       
    57 void CalenTodayIndicatorLineDrawer::paint(
       
    58 		QPainter* painter, const QStyleOptionGraphicsItem* option,
       
    59 		QWidget* widget)
       
    60 {
       
    61 	Q_UNUSED(option);
       
    62 	Q_UNUSED(widget);
       
    63 	QPen pen;
       
    64 	pen.setStyle(Qt::SolidLine);
       
    65 	pen.setBrush(HbColorScheme::color("qtc_cal_month_current_day"));
       
    66 	painter->setPen(pen);
       
    67 	QRectF controlRect = this->boundingRect();
       
    68 	painter->fillRect(
       
    69 			controlRect, HbColorScheme::color("qtc_cal_month_current_day"));
       
    70 }
       
    71 
       
    72 /*!
       
    73  To handle the theme change for the today indicator line.
       
    74  */
       
    75 void CalenTodayIndicatorLineDrawer::handleThemeChange()
       
    76 {
       
    77 	update();
       
    78 }
       
    79 
       
    80 // End of file  --Don't remove this.