|
1 /* |
|
2 * Copyright (c) 2002 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: Data storage for single lines of preview data. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CALENPREVIEWENTRY_H |
|
20 #define CALENPREVIEWENTRY_H |
|
21 |
|
22 #include "CalendarVariant.hrh" |
|
23 |
|
24 // INCLUDES |
|
25 #include <calentry.h> // For CCalEntry::TType |
|
26 #include <AknUtils.h> |
|
27 #include <eiklabel.h> |
|
28 #include <e32base.h> |
|
29 #include <caleninstanceid.h> // TCalenInstanceId |
|
30 |
|
31 #include "calenpreviewlabelobserver.h" |
|
32 #include "calenpreviewentryobserver.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class TCalenInstanceId; |
|
36 class CCalenPreviewLabel; |
|
37 class MCalenPreviewLabelObserver; |
|
38 class MCalenPreviewEntryObserver; |
|
39 class CCalenPreviewLayoutManager; |
|
40 class CCalenCommonUI; |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * CCalenPreviewEntry is a storage class for single line of popup. |
|
46 * @lib Calendar.exe |
|
47 * @since 5.0 |
|
48 */ |
|
49 NONSHARABLE_CLASS( CCalenPreviewEntry ) : |
|
50 public MCalenPreviewLabelObserver |
|
51 { |
|
52 public: |
|
53 enum TPreviewEntryType |
|
54 { |
|
55 ECalenPreviewEntryNormal, |
|
56 ECalenPreviewEntryPlugin, |
|
57 ECalenPreviewEntryEmpty |
|
58 }; |
|
59 /** |
|
60 * Copy constructor |
|
61 */ |
|
62 static CCalenPreviewEntry* NewL(CCalInstance* aInstance, |
|
63 CCalenPreviewLayoutManager* aLayoutManager, |
|
64 const TTime& aDay, |
|
65 TInt aMaxRows, |
|
66 TUint32 aColor); |
|
67 |
|
68 static CCalenPreviewEntry* NewL(CCalenPreviewLayoutManager* aLayoutManager, |
|
69 TPreviewEntryType aType, |
|
70 TUint32 aColor); |
|
71 |
|
72 /** |
|
73 * Destructor |
|
74 */ |
|
75 virtual ~CCalenPreviewEntry(); |
|
76 |
|
77 public: |
|
78 // From MCalenPreviewLabelObserver |
|
79 void HandleLabelPointerEventL(const TPointerEvent& aPointerEvent); |
|
80 |
|
81 // New functions |
|
82 CCalEntry::TType EventType() const; |
|
83 TPreviewEntryType EntryType() const; |
|
84 void SetEntryObserver(MCalenPreviewEntryObserver* aObserver); |
|
85 void FormatTextL(TBool aShortLine); |
|
86 void AddObservedLabelL(CCalenPreviewLabel *aLabel); |
|
87 TPtrC GetLine(TInt aIndex); |
|
88 TBool RemoveLine(); |
|
89 TBool Contains(TPoint aPoint); |
|
90 TInt LineCount(); |
|
91 |
|
92 private: |
|
93 CCalenPreviewEntry(); |
|
94 void ConstructL(CCalInstance* aInstance, |
|
95 CCalenPreviewLayoutManager* aLayoutManager, |
|
96 const TTime& aDay, |
|
97 TInt aMaxRows, |
|
98 TUint32 aColor); |
|
99 |
|
100 void ConstructL(CCalenPreviewLayoutManager* aLayoutManager, |
|
101 TPreviewEntryType aType, |
|
102 TUint32 aColor); |
|
103 |
|
104 TInt CalculateTextLengthL(); |
|
105 |
|
106 void DoLineUsageL(TInt aMaxRows); |
|
107 void SetLineCount(TInt aLineCount); |
|
108 void SetHyphenL(); |
|
109 |
|
110 HBufC* FullTextL(); |
|
111 |
|
112 void FormatTimeL(CCalInstance* aInstance, |
|
113 const TTime& aDay, |
|
114 TInt& aMaxLen); |
|
115 |
|
116 void FormatSummaryL(CCalInstance* aInstance, |
|
117 TInt& aMaxLen); |
|
118 void FormatLocationL(CCalInstance* aInstance, |
|
119 TInt& aMaxLen); |
|
120 void FormatDescriptionL(CCalInstance* aInstance, |
|
121 TInt& aMaxLen); |
|
122 |
|
123 void FormatEmptyTextL(); |
|
124 |
|
125 public: |
|
126 TUint32 iColor; |
|
127 |
|
128 private: |
|
129 |
|
130 HBufC* iStart; |
|
131 HBufC* iHyphen; |
|
132 HBufC* iEnd; |
|
133 HBufC* iSummary; |
|
134 HBufC* iLocation; |
|
135 HBufC* iDescription; |
|
136 |
|
137 // Data |
|
138 CCalenPreviewLayoutManager* iLayoutManager; |
|
139 RPointerArray<CCalenPreviewLabel> iLabels; |
|
140 MCalenPreviewEntryObserver* iObserver; |
|
141 HBufC* iText; |
|
142 CArrayFixFlat<TPtrC>* iTextLines; |
|
143 TInt iLines; |
|
144 TCalenInstanceId iInstanceId; |
|
145 CCalEntry::TType iEventType; |
|
146 TPreviewEntryType iEntryType; |
|
147 }; |
|
148 |
|
149 #endif // CALENPREVIEWENTRY_H |