|
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 QColor color() const; |
|
51 |
|
52 CalenDayStatusStrip::DrawingStyle drawingStyle() const; |
|
53 |
|
54 QPair<QTime,QTime> startEndTime() const; |
|
55 |
|
56 void setRange(qreal mRange); |
|
57 |
|
58 void setColor(QColor mStripColor); |
|
59 |
|
60 void setDrawingStyle(CalenDayStatusStrip::DrawingStyle mDrawingStyle); |
|
61 |
|
62 void setStartEndTime(const QTime &startTime, const QTime &endTime); |
|
63 |
|
64 |
|
65 protected: |
|
66 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
|
67 QWidget *widget = 0); |
|
68 |
|
69 QPolygonF diagonalLine(QPointF startPoint, qreal dx, qreal dy); |
|
70 |
|
71 |
|
72 QPair<QTime,QTime> calculateStartEndPostion( |
|
73 const QTime &startTime, |
|
74 const QTime &endTime |
|
75 ); |
|
76 |
|
77 qreal calculateMinuteHeight(const QTime &start, const QTime &end); |
|
78 |
|
79 private: |
|
80 qreal mRange; //!<Distanse beatween lines |
|
81 QColor mColor;//!<Color of status stripe |
|
82 CalenDayStatusStrip::DrawingStyle mDrawingStyle;//!<Specify style of drawing |
|
83 /*! |
|
84 Orginal start and end time of event |
|
85 */ |
|
86 QPair<QTime,QTime> mStartEndEventTime; |
|
87 |
|
88 static const qreal mMinute;//!<It keep info how much seconds are in minute |
|
89 static const qreal mMinimumTime;//!<It keep info about minimum timeline in minutes |
|
90 }; |
|
91 |
|
92 Q_DECLARE_METATYPE(CalenDayStatusStrip::DrawingStyle) |
|
93 |
|
94 #endif // CALENDAYSTATUSSTRIP_H |