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 |
#ifndef CALENDAYITEM_H
|
|
19 |
#define CALENDAYITEM_H
|
|
20 |
|
|
21 |
//System includes
|
55
|
22 |
#include <QDateTime>
|
45
|
23 |
#include <hbabstractviewitem.h>
|
|
24 |
#include <hbtextitem.h>
|
|
25 |
#include <hbframeitem.h>
|
|
26 |
|
|
27 |
//Forward declarations
|
|
28 |
class AgendaEntry;
|
|
29 |
class CalenDayStatusStrip;
|
55
|
30 |
class CalenDayContainer;
|
45
|
31 |
|
|
32 |
|
|
33 |
class CalenDayItem : public HbAbstractViewItem
|
|
34 |
{
|
|
35 |
Q_OBJECT
|
|
36 |
Q_PROPERTY( bool eventDescription READ hasEventDescription )
|
|
37 |
Q_PROPERTY( bool backgroundFrame READ hasBackgroundFrame )
|
83
|
38 |
Q_PROPERTY( BackgroundType backgroundType READ backgroundType )
|
|
39 |
Q_ENUMS( BackgroundType )
|
|
40 |
|
|
41 |
public:
|
|
42 |
//Due to HbFrameItem size limitation (2047px) in case when we have long lasting
|
|
43 |
//events, background item has the same height as screen and needs to be scrolled
|
|
44 |
//along with the view. By default background type is set as static but final decision
|
|
45 |
//is made when handling resize event i.e. when geomtry of event is already known.
|
|
46 |
enum BackgroundType{
|
|
47 |
EStaticBackground,
|
|
48 |
EFloatingBackground
|
|
49 |
};
|
|
50 |
|
45
|
51 |
public:
|
55
|
52 |
CalenDayItem(const CalenDayContainer *container);
|
45
|
53 |
virtual ~CalenDayItem();
|
|
54 |
HbAbstractViewItem * createItem();
|
|
55 |
void updateChildItems();
|
55
|
56 |
bool hasEventDescription() const { return mEventDesc->isVisible(); }
|
|
57 |
bool hasBackgroundFrame() const { return mBg->isVisible(); }
|
83
|
58 |
BackgroundType backgroundType() const { return mBackgroundType; }
|
55
|
59 |
const CalenDayContainer *container() const { return mContainer; }
|
83
|
60 |
|
|
61 |
public slots:
|
|
62 |
void scrollBackground(const QPointF &pos);
|
55
|
63 |
|
83
|
64 |
signals:
|
|
65 |
void backgroundTypeChanged(const CalenDayItem *item);
|
|
66 |
|
45
|
67 |
protected:
|
|
68 |
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
|
69 |
|
|
70 |
private:
|
|
71 |
CalenDayItem(const CalenDayItem &source);
|
|
72 |
void setDescription(const AgendaEntry &entry, bool allDayEvent);
|
|
73 |
void setStatusStrip(const AgendaEntry &entry, bool allDayEvent);
|
|
74 |
|
|
75 |
bool mUpdated;
|
57
|
76 |
qreal mEventDescMinWidth;
|
|
77 |
qreal mFrameMinWidth;
|
|
78 |
|
45
|
79 |
HbFrameItem *mBg;
|
|
80 |
HbTextItem *mEventDesc;
|
57
|
81 |
|
45
|
82 |
CalenDayStatusStrip *mColorStripe;
|
55
|
83 |
const CalenDayContainer *mContainer;
|
83
|
84 |
|
|
85 |
BackgroundType mBackgroundType;
|
45
|
86 |
};
|
|
87 |
|
|
88 |
#endif // CALENDAYITEM_H
|