45
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: Day view control of calendar
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CALENDAYSTATUSSTRIP_H
|
|
20 |
#define CALENDAYSTATUSSTRIP_H
|
|
21 |
|
|
22 |
#include <QTime>
|
|
23 |
#include <HbWidget>
|
|
24 |
|
|
25 |
class CalenDayStatusStrip : public HbWidget
|
|
26 |
{
|
|
27 |
Q_OBJECT
|
|
28 |
Q_ENUMS(DrawingStyle)
|
|
29 |
public:
|
|
30 |
/*!
|
|
31 |
\brief It specifiy how status Strip should be drawed.
|
|
32 |
|
|
33 |
OnlyFrame -- draw not filled rectangle
|
|
34 |
StripWithLines -- draw filled rectangle with transparent diagonal lines
|
|
35 |
Filled -- draw filled rectangle
|
|
36 |
*/
|
|
37 |
enum DrawingStyle
|
|
38 |
{
|
|
39 |
OnlyFrame,
|
|
40 |
StripWithLines,
|
|
41 |
Filled
|
|
42 |
};
|
|
43 |
|
|
44 |
|
|
45 |
CalenDayStatusStrip(HbWidget *parent = 0);
|
|
46 |
~CalenDayStatusStrip();
|
|
47 |
|
|
48 |
qreal range() const;
|
|
49 |
|
|
50 |
CalenDayStatusStrip::DrawingStyle drawingStyle() const;
|
|
51 |
|
|
52 |
QPair<QTime,QTime> startEndTime() const;
|
|
53 |
|
63
|
54 |
void setRange(qreal range);
|
45
|
55 |
|
|
56 |
void setDrawingStyle(CalenDayStatusStrip::DrawingStyle mDrawingStyle);
|
|
57 |
|
|
58 |
void setStartEndTime(const QTime &startTime, const QTime &endTime);
|
|
59 |
|
|
60 |
|
|
61 |
protected:
|
|
62 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
63 |
QWidget *widget = 0);
|
|
64 |
|
|
65 |
QPolygonF diagonalLine(QPointF startPoint, qreal dx, qreal dy);
|
|
66 |
|
|
67 |
|
|
68 |
QPair<QTime,QTime> calculateStartEndPostion(
|
|
69 |
const QTime &startTime,
|
|
70 |
const QTime &endTime
|
|
71 |
);
|
|
72 |
|
|
73 |
qreal calculateMinuteHeight(const QTime &start, const QTime &end);
|
|
74 |
|
|
75 |
private:
|
57
|
76 |
qreal mRange; //!<Distance between lines
|
45
|
77 |
CalenDayStatusStrip::DrawingStyle mDrawingStyle;//!<Specify style of drawing
|
|
78 |
/*!
|
57
|
79 |
Original start and end time of event
|
45
|
80 |
*/
|
|
81 |
QPair<QTime,QTime> mStartEndEventTime;
|
|
82 |
|
57
|
83 |
static const qreal mMinute;//!<It keeps info how much seconds are in minute
|
|
84 |
static const qreal mMinimumTime;//!<It keeps info about minimum timeline in minutes
|
45
|
85 |
};
|
|
86 |
|
|
87 |
Q_DECLARE_METATYPE(CalenDayStatusStrip::DrawingStyle)
|
|
88 |
|
|
89 |
#endif // CALENDAYSTATUSSTRIP_H
|