williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__EIKCTGRP_H__)
|
williamr@2
|
20 |
#define __EIKCTGRP_H__
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#if !defined(__EIKBCTRL_H__)
|
williamr@2
|
23 |
#include <eikbctrl.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#include <lafpublc.h>
|
williamr@2
|
27 |
|
williamr@2
|
28 |
class TEikGroupControl
|
williamr@2
|
29 |
{
|
williamr@2
|
30 |
public:
|
williamr@2
|
31 |
/** Constructor
|
williamr@2
|
32 |
*/
|
williamr@2
|
33 |
inline TEikGroupControl();
|
williamr@2
|
34 |
/** Constructor
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
inline TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags);
|
williamr@2
|
37 |
public:
|
williamr@2
|
38 |
CCoeControl* iControl;
|
williamr@2
|
39 |
TInt iId;
|
williamr@2
|
40 |
TInt iLongId;
|
williamr@2
|
41 |
public:
|
williamr@2
|
42 |
/** IsLengthSet() whether length has been set
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
inline TBool IsLengthSet() const;
|
williamr@2
|
45 |
/** Length() returns value of the length
|
williamr@2
|
46 |
*/
|
williamr@2
|
47 |
inline TInt Length() const;
|
williamr@2
|
48 |
/** IsStretchable() whether controlgroup is stretchable
|
williamr@2
|
49 |
*/
|
williamr@2
|
50 |
inline TBool IsStretchable() const;
|
williamr@2
|
51 |
/** SetLength() sets the length
|
williamr@2
|
52 |
*/
|
williamr@2
|
53 |
inline void SetLength(TInt aLength);
|
williamr@2
|
54 |
/** SetStretchable() sets to be stretchable
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
inline void SetStretchable();
|
williamr@2
|
57 |
public:
|
williamr@2
|
58 |
enum TControlFlags
|
williamr@2
|
59 |
{
|
williamr@2
|
60 |
ESetLength =0x01,
|
williamr@2
|
61 |
EAllowStretch =0x02
|
williamr@2
|
62 |
};
|
williamr@2
|
63 |
private:
|
williamr@2
|
64 |
TInt iLength;
|
williamr@2
|
65 |
TInt iFlags;
|
williamr@2
|
66 |
};
|
williamr@2
|
67 |
|
williamr@2
|
68 |
class CEikControlGroup : public CEikBorderedControl
|
williamr@2
|
69 |
{
|
williamr@2
|
70 |
friend class CTestControlGroup; // test code
|
williamr@2
|
71 |
|
williamr@2
|
72 |
// CEikCba made a friend to get at Orientation() private method
|
williamr@2
|
73 |
friend class CEikCba;
|
williamr@2
|
74 |
// ->
|
williamr@2
|
75 |
public:
|
williamr@2
|
76 |
enum TStartCorner
|
williamr@2
|
77 |
{
|
williamr@2
|
78 |
EFromTopLeft=SLafControlGroup::EFromTopLeft,
|
williamr@2
|
79 |
EFromTopRight=SLafControlGroup::EFromTopRight,
|
williamr@2
|
80 |
EFromBottomLeft=SLafControlGroup::EFromBottomLeft,
|
williamr@2
|
81 |
EFromBottomRight=SLafControlGroup::EFromBottomRight
|
williamr@2
|
82 |
};
|
williamr@2
|
83 |
enum TOrientation
|
williamr@2
|
84 |
{
|
williamr@2
|
85 |
ELayHorizontally=SLafControlGroup::ELayHorizontally,
|
williamr@2
|
86 |
ELayVertically =SLafControlGroup::ELayVertically
|
williamr@2
|
87 |
};
|
williamr@2
|
88 |
public: // new functions
|
williamr@2
|
89 |
/** Constructor
|
williamr@2
|
90 |
*/
|
williamr@2
|
91 |
IMPORT_C CEikControlGroup();
|
williamr@2
|
92 |
/** Destructor
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
IMPORT_C ~CEikControlGroup();
|
williamr@2
|
95 |
/** ConstructL() constructs the CEikControlGroup
|
williamr@2
|
96 |
* @param aStart corner to start
|
williamr@2
|
97 |
* @param aOrientation whether controlgroup is vertical or horizontal
|
williamr@2
|
98 |
*/
|
williamr@2
|
99 |
IMPORT_C void ConstructL(TStartCorner aStart,TOrientation aOrientation);
|
williamr@2
|
100 |
/** AddControlL() adds a new control to the controlgroup
|
williamr@2
|
101 |
* @param aControl control to be added
|
williamr@2
|
102 |
* @param aId id of the control
|
williamr@2
|
103 |
*/
|
williamr@2
|
104 |
IMPORT_C virtual void AddControlL(CCoeControl* aControl,TInt aId);
|
williamr@2
|
105 |
/** AddControlL() adds new control to the controlgroup
|
williamr@2
|
106 |
* @param aControlGroup a control and it's id packed into TEikGroupControl struct
|
williamr@2
|
107 |
*/
|
williamr@2
|
108 |
IMPORT_C virtual void AddControlL(TEikGroupControl& aGroupControl);
|
williamr@2
|
109 |
/** InsertControlL() inserts a control to specific position
|
williamr@2
|
110 |
* @param aGroupControl control and its id packed to a struct
|
williamr@2
|
111 |
* @param aIndex index of the array where new control is to be inserted
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
IMPORT_C void InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex);
|
williamr@2
|
114 |
/** DeleteControl() removes control from the group
|
williamr@2
|
115 |
* @param aIndex at which position of the array to delete
|
williamr@2
|
116 |
* @param aCount how many controls to delete
|
williamr@2
|
117 |
*/
|
williamr@2
|
118 |
IMPORT_C void DeleteControl(TInt aIndex,TInt aCount);
|
williamr@2
|
119 |
/** SetLengthInPixels() sets length of the control group in pixels
|
williamr@2
|
120 |
* @param aLength length of the whole control group in pixels
|
williamr@2
|
121 |
*/
|
williamr@2
|
122 |
IMPORT_C void SetLengthInPixels(TInt aLength);
|
williamr@2
|
123 |
/** SetBreadthInPixels() sets width of the control group
|
williamr@2
|
124 |
* @param aBreadth width of the control group
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
IMPORT_C void SetBreadthInPixels(TInt aBreadth);
|
williamr@2
|
127 |
/** SetControlSpacing sets horizontal and vertical spacing
|
williamr@2
|
128 |
* @param aHSpacing horizontal spacing between controls
|
williamr@2
|
129 |
* @param aVSpacing vertical spacing between controls
|
williamr@2
|
130 |
*/
|
williamr@2
|
131 |
IMPORT_C void SetControlSpacing(TInt aHSpacing,TInt aVSpacing);
|
williamr@2
|
132 |
/** SetControlLayout sets control layout parameters
|
williamr@2
|
133 |
* @param aStart start corner
|
williamr@2
|
134 |
* @param aOrientation vertical or horizontal orientation
|
williamr@2
|
135 |
*/
|
williamr@2
|
136 |
IMPORT_C void SetControlLayout(TStartCorner aStart,TOrientation aOrientation);
|
williamr@2
|
137 |
/** SetNumberOfLines() sets number of lines of the control group
|
williamr@2
|
138 |
* @param aNumLines number of lines
|
williamr@2
|
139 |
* @param aDistributeEvenly whether controls distribute evenly to the group
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
IMPORT_C void SetNumberOfLines(TInt aNumLines,TBool aDistributeEvenly);
|
williamr@2
|
142 |
/** SetControlsAllSameSize() sets all controls to be the same size
|
williamr@2
|
143 |
*/
|
williamr@2
|
144 |
IMPORT_C void SetControlsAllSameSize();
|
williamr@2
|
145 |
/** LayoutControls layouts the controls
|
williamr@2
|
146 |
*/
|
williamr@2
|
147 |
IMPORT_C void LayoutControls();
|
williamr@2
|
148 |
/** ControlById() fetches individual controls by id
|
williamr@2
|
149 |
* @param aId id of the control
|
williamr@2
|
150 |
*/
|
williamr@2
|
151 |
IMPORT_C CCoeControl* ControlById(TInt aId) const;
|
williamr@2
|
152 |
/** IndexById() gets array index from id
|
williamr@2
|
153 |
* @param aId id number of the control
|
williamr@2
|
154 |
* @return index number to the array
|
williamr@2
|
155 |
*/
|
williamr@2
|
156 |
IMPORT_C TInt IndexById(TInt aId) const;
|
williamr@2
|
157 |
/** Reset() clears the control array
|
williamr@2
|
158 |
*/
|
williamr@2
|
159 |
IMPORT_C void Reset();
|
williamr@2
|
160 |
/** ControlId() finds id of the control based on CCoeCOntrol pointer
|
williamr@2
|
161 |
* @param aControl control stored in a control group
|
williamr@2
|
162 |
* @return id of the control
|
williamr@2
|
163 |
*/
|
williamr@2
|
164 |
IMPORT_C TInt ControlId(CCoeControl* aControl) const;
|
williamr@2
|
165 |
/** Control() returns CCoeControl pointer based on array index
|
williamr@2
|
166 |
* @param aIndex index to the internal array
|
williamr@2
|
167 |
* @return control in that position of the array
|
williamr@2
|
168 |
*/
|
williamr@2
|
169 |
IMPORT_C CCoeControl* Control(TInt aIndex) const; // as requested by Bill
|
williamr@2
|
170 |
/** ControlArray() access to the actual array representation
|
williamr@2
|
171 |
* @return array
|
williamr@2
|
172 |
*/
|
williamr@2
|
173 |
IMPORT_C CArrayFix<TEikGroupControl>* ControlArray() const;
|
williamr@2
|
174 |
/** Orientation orientation of the control group
|
williamr@2
|
175 |
* @return either horizontal or vertical orientation
|
williamr@2
|
176 |
*/
|
williamr@2
|
177 |
IMPORT_C TOrientation Orientation() const;
|
williamr@2
|
178 |
/** ControlSpacing() gets control's spacing
|
williamr@2
|
179 |
* @aHSpacing modifies variable to get horizontal spacing
|
williamr@2
|
180 |
* @aVSpacing modifies variable to get vertical spacing
|
williamr@2
|
181 |
*/
|
williamr@2
|
182 |
IMPORT_C void ControlSpacing(TInt& aHSpacing,TInt& aVSpacing) const;
|
williamr@2
|
183 |
public: // from CCoeControl
|
williamr@2
|
184 |
/** MinimumSize() gets minimumsize
|
williamr@2
|
185 |
*/
|
williamr@2
|
186 |
IMPORT_C TSize MinimumSize();
|
williamr@2
|
187 |
/** CountComponentControls returns component controls count
|
williamr@2
|
188 |
*/
|
williamr@2
|
189 |
IMPORT_C TInt CountComponentControls() const;
|
williamr@2
|
190 |
/** GetColorUseListL() sets the color use list of the control group
|
williamr@2
|
191 |
*/
|
williamr@2
|
192 |
IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
|
williamr@2
|
193 |
/** HandleResourceChange() handles resource change event
|
williamr@2
|
194 |
*/
|
williamr@2
|
195 |
IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u
|
williamr@2
|
196 |
/** HandlePointerEventL() handles touch pointer events
|
williamr@2
|
197 |
*/
|
williamr@2
|
198 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
199 |
protected:
|
williamr@2
|
200 |
enum
|
williamr@2
|
201 |
{
|
williamr@2
|
202 |
EDistributeEvenly =0x40,
|
williamr@2
|
203 |
EAllSameSize =0x80,
|
williamr@2
|
204 |
EDisableMSKDrawing =0x100
|
williamr@2
|
205 |
};
|
williamr@2
|
206 |
protected: // from CCoeControl
|
williamr@2
|
207 |
IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
|
williamr@2
|
208 |
IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
|
williamr@2
|
209 |
// only used from CEikCba
|
williamr@2
|
210 |
void SetMSKVisibility(TBool aEnable);
|
williamr@2
|
211 |
private: // from CCoeControl
|
williamr@2
|
212 |
IMPORT_C void Reserved_2();
|
williamr@2
|
213 |
private:
|
williamr@2
|
214 |
/**
|
williamr@2
|
215 |
* From CAknControl
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
218 |
private: // new functions
|
williamr@2
|
219 |
IMPORT_C TInt Adjacent(TInt aRow,TInt aColumn,TInt aCtrlIndex,TInt aTotalRows,TInt aTotalColumns) const;
|
williamr@2
|
220 |
IMPORT_C TStartCorner StartCorner() const;
|
williamr@2
|
221 |
IMPORT_C void DeleteAllComponents();
|
williamr@2
|
222 |
IMPORT_C TSize ControlMinimumSize(TInt aIndex) const;
|
williamr@2
|
223 |
IMPORT_C TInt ControlMinimumLength(TInt aIndex);
|
williamr@2
|
224 |
IMPORT_C TSize LargestControlSize() const;
|
williamr@2
|
225 |
IMPORT_C TBool DistributeEvenly() const;
|
williamr@2
|
226 |
IMPORT_C TBool AllSameSize();
|
williamr@2
|
227 |
private: // from CCoeControl
|
williamr@2
|
228 |
IMPORT_C void SizeChanged();
|
williamr@2
|
229 |
IMPORT_C void Draw(const TRect& aRect) const;
|
williamr@2
|
230 |
protected:
|
williamr@2
|
231 |
CArrayFix<TEikGroupControl>* iControlArray;
|
williamr@2
|
232 |
private:
|
williamr@2
|
233 |
TInt iLayout;
|
williamr@2
|
234 |
TInt iLines;
|
williamr@2
|
235 |
TInt iHSpacing;
|
williamr@2
|
236 |
TInt iVSpacing;
|
williamr@2
|
237 |
TInt iBreadth;
|
williamr@2
|
238 |
TInt iLength;
|
williamr@2
|
239 |
TSize iLargestControl;
|
williamr@2
|
240 |
};
|
williamr@2
|
241 |
|
williamr@2
|
242 |
|
williamr@2
|
243 |
inline TEikGroupControl::TEikGroupControl()
|
williamr@2
|
244 |
{ iControl=NULL; iId=iFlags=iLength=0; }
|
williamr@2
|
245 |
inline TEikGroupControl::TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags)
|
williamr@2
|
246 |
: iControl(aControl),iId(aId),iLength(aLength),iFlags(aFlags)
|
williamr@2
|
247 |
{}
|
williamr@2
|
248 |
inline TBool TEikGroupControl::IsLengthSet() const
|
williamr@2
|
249 |
{ return iFlags&ESetLength; }
|
williamr@2
|
250 |
inline TInt TEikGroupControl::Length() const
|
williamr@2
|
251 |
{ return iLength; }
|
williamr@2
|
252 |
inline TBool TEikGroupControl::IsStretchable() const
|
williamr@2
|
253 |
{ return iFlags&EAllowStretch; }
|
williamr@2
|
254 |
inline void TEikGroupControl::SetLength(TInt aLength)
|
williamr@2
|
255 |
{ iLength=aLength; iFlags|=ESetLength; }
|
williamr@2
|
256 |
inline void TEikGroupControl::SetStretchable()
|
williamr@2
|
257 |
{ iFlags|=EAllowStretch; }
|
williamr@2
|
258 |
|
williamr@2
|
259 |
#endif
|