author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:11:15 +0300 | |
branch | RCL_3 |
changeset 80 | 726fba06891a |
parent 64 | 3533d4323edc |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2007 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: Container class for compose view |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#ifndef CNCSATTACHMENTFIELD_H |
|
21 |
#define CNCSATTACHMENTFIELD_H |
|
22 |
||
23 |
||
24 |
#include "ncscontrol.h" |
|
25 |
||
26 |
||
27 |
class MNcsFieldSizeObserver; |
|
28 |
class CNcsHeaderContainer; |
|
29 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
30 |
/** |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
31 |
* Interface for the attachment field observer |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
32 |
*/ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
33 |
class MNcsAttachmentFieldObserver |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
34 |
{ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
35 |
public: |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
36 |
/** |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
37 |
* AttachmentOpenL |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
38 |
* Informs observer that focused attachment should be opened |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
39 |
*/ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
40 |
virtual void AttachmentOpenL() = 0; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
41 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
42 |
/** |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
43 |
* AttachmentRemoveL |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
44 |
* Informs observer that focused attachment should be removed |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
45 |
*/ |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
46 |
virtual void AttachmentRemoveL() = 0; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
47 |
}; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
48 |
|
64 | 49 |
|
50 |
/** |
|
51 |
* CNcsAttachmentField |
|
52 |
*/ |
|
53 |
class CNcsAttachmentField: |
|
54 |
public CCoeControl, |
|
55 |
public MNcsControl |
|
56 |
{ |
|
57 |
public: // construct & destruct |
|
58 |
||
59 |
static CNcsAttachmentField* NewL( |
|
60 |
TInt aLabelTextId, |
|
61 |
MNcsFieldSizeObserver* aSizeObserver, |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
62 |
MNcsAttachmentFieldObserver* aObserver, |
64 | 63 |
CNcsHeaderContainer* aParentControl ); |
64 |
||
65 |
virtual ~CNcsAttachmentField(); |
|
66 |
||
67 |
public: // methods |
|
68 |
||
69 |
TInt MinimumHeight() const; |
|
70 |
||
71 |
void SetMaxLabelLength( TInt aMaxLength ); |
|
72 |
||
73 |
TInt GetMinLabelLength() const; |
|
74 |
||
75 |
void SetTextsLD( CDesCArray* aAttachmentNames, |
|
76 |
CDesCArray* aAttachmentSizes ); |
|
77 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
78 |
TInt FocusedAttachmentLabelIndex() const; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
79 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
80 |
void SetFocusedAttachmentLabelIndex( TInt aIndex ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
81 |
|
64 | 82 |
public: // from MNcsControl |
83 |
||
84 |
TInt LineCount() const; |
|
85 |
||
86 |
TInt ScrollableLines() const; |
|
87 |
||
88 |
TInt GetNumChars() const; |
|
89 |
||
90 |
TInt CursorLineNumber() const; |
|
91 |
||
92 |
TInt CursorPosition() const; |
|
93 |
||
94 |
void Reposition( TPoint& aPt, TInt aWidth ); |
|
95 |
||
96 |
const TDesC& GetLabelText() const; |
|
97 |
||
98 |
TInt LayoutLineCount() const; |
|
99 |
||
100 |
public: // from CCoeControl |
|
101 |
||
102 |
void Draw( const TRect& aRect ) const; |
|
103 |
||
104 |
void SizeChanged(); |
|
105 |
||
106 |
void PositionChanged(); |
|
107 |
||
108 |
void SetContainerWindowL( const CCoeControl& aContainer ); |
|
109 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
110 |
void FocusChanged( TDrawNow aDrawNow ); |
64 | 111 |
|
112 |
void HandleResourceChange( TInt aType ); |
|
113 |
||
114 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
115 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
116 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
117 |
|
64 | 118 |
private: // methods |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
119 |
|
64 | 120 |
CNcsAttachmentField( TInt aLabelTextId, |
121 |
MNcsFieldSizeObserver* aSizeObserver, |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
122 |
MNcsAttachmentFieldObserver* aObserver, |
64 | 123 |
CNcsHeaderContainer* aParentControl ); |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
124 |
|
64 | 125 |
void ConstructL(); |
126 |
||
127 |
void UpdateColors(); |
|
128 |
void UpdateColors( CNcsLabel* aLabel ); |
|
129 |
||
130 |
void UpdateFontSize(); |
|
131 |
void UpdateFontSize( CNcsLabel* aLabel ); |
|
132 |
||
133 |
void LayoutControls(); |
|
134 |
||
135 |
void UpdateIconPositions( const TRect& aRect ); |
|
136 |
||
137 |
void UpdateAttachmentTextsL(); |
|
138 |
||
139 |
/** |
|
140 |
* Resizes icons |
|
141 |
*/ |
|
142 |
void ResizeIcons(); |
|
143 |
||
144 |
TInt CreateIcons(); |
|
145 |
void CreateIconsL(); |
|
146 |
||
147 |
void UpdateComponentArrayL(); |
|
148 |
||
149 |
void UpdateSingleAttachmentLabelTextL( CNcsLabel* aLabel, TInt aIndex ); |
|
150 |
||
151 |
private: // data |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
152 |
|
64 | 153 |
CNcsHeaderContainer* iParentControl; // not owned |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
154 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
155 |
// attachment field observer |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
156 |
MNcsAttachmentFieldObserver* iObserver; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
157 |
|
64 | 158 |
// attachment labels (within the array) owned |
159 |
RPointerArray<CNcsLabel> iAttachmentLabels; |
|
160 |
||
161 |
const CFont* iLabelFont; // not owned |
|
162 |
const CFont* iEditorFont; // not owned |
|
163 |
||
164 |
CDesCArray* iAttachmentNames; |
|
165 |
CDesCArray* iAttachmentSizes; |
|
166 |
||
167 |
TInt iMaximumLabelLength; |
|
168 |
||
169 |
TRgb iBgColor; |
|
170 |
||
171 |
TRgb iBorderColor; |
|
172 |
||
173 |
// Attachment icon |
|
174 |
CFbsBitmap* iAttachmentBitmap; |
|
175 |
CFbsBitmap* iAttachmentMask; |
|
176 |
TPoint iAttachmentIconPos; |
|
177 |
||
178 |
TInt iLabelTextId; |
|
179 |
TInt iAttachmentLabelCount; |
|
180 |
TInt iFocusedLabelIndex; |
|
181 |
}; |
|
182 |
||
183 |
#endif |