epoc32/include/mw/eikctgrp.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/eikctgrp.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/eikctgrp.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,259 @@
     1.4 -eikctgrp.h
     1.5 +/*
     1.6 +* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* 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
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#if !defined(__EIKCTGRP_H__)
    1.24 +#define __EIKCTGRP_H__
    1.25 +
    1.26 +#if !defined(__EIKBCTRL_H__)
    1.27 +#include <eikbctrl.h>
    1.28 +#endif
    1.29 +
    1.30 +#include <lafpublc.h>
    1.31 +
    1.32 +class TEikGroupControl
    1.33 +	{
    1.34 +public:
    1.35 +	/** Constructor
    1.36 +	 */
    1.37 +	inline TEikGroupControl();
    1.38 +    /** Constructor
    1.39 +     */
    1.40 +	inline TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags);
    1.41 +public:
    1.42 +	CCoeControl* iControl;
    1.43 +	TInt iId;
    1.44 +	TInt iLongId;
    1.45 +public:
    1.46 +	/** IsLengthSet() whether length has been set
    1.47 +	 */
    1.48 +	inline TBool IsLengthSet() const;
    1.49 +    /** Length() returns value of the length
    1.50 +     */
    1.51 +	inline TInt Length() const;
    1.52 +    /** IsStretchable() whether controlgroup is stretchable
    1.53 +     */
    1.54 +	inline TBool IsStretchable() const;
    1.55 +    /** SetLength() sets the length
    1.56 +     */
    1.57 +	inline void SetLength(TInt aLength);
    1.58 +    /** SetStretchable() sets to be stretchable
    1.59 +     */
    1.60 +	inline void SetStretchable();
    1.61 +public:
    1.62 +	enum TControlFlags
    1.63 +		{
    1.64 +		ESetLength		=0x01,
    1.65 +		EAllowStretch	=0x02
    1.66 +		};
    1.67 +private:
    1.68 +	TInt iLength;
    1.69 +	TInt iFlags;
    1.70 +	};
    1.71 +
    1.72 +class CEikControlGroup : public CEikBorderedControl
    1.73 +	{
    1.74 +friend class CTestControlGroup; // test code
    1.75 +
    1.76 +// CEikCba made a friend to get at Orientation() private method
    1.77 +friend class CEikCba;
    1.78 +// -> 
    1.79 +public:
    1.80 +	enum TStartCorner
    1.81 +		{
    1.82 +		EFromTopLeft=SLafControlGroup::EFromTopLeft,
    1.83 +		EFromTopRight=SLafControlGroup::EFromTopRight,
    1.84 +		EFromBottomLeft=SLafControlGroup::EFromBottomLeft,
    1.85 +		EFromBottomRight=SLafControlGroup::EFromBottomRight
    1.86 +		};
    1.87 +	enum TOrientation
    1.88 +		{
    1.89 +		ELayHorizontally=SLafControlGroup::ELayHorizontally,
    1.90 +		ELayVertically	=SLafControlGroup::ELayVertically	
    1.91 +		};
    1.92 +public: // new functions
    1.93 +	/** Constructor
    1.94 +	 */
    1.95 +	IMPORT_C CEikControlGroup();
    1.96 +    /** Destructor
    1.97 +     */
    1.98 +	IMPORT_C ~CEikControlGroup();
    1.99 +    /** ConstructL() constructs the CEikControlGroup
   1.100 +     * @param aStart corner to start
   1.101 +     * @param aOrientation whether controlgroup is vertical or horizontal
   1.102 +     */
   1.103 +	IMPORT_C void ConstructL(TStartCorner aStart,TOrientation aOrientation);
   1.104 +	/** AddControlL() adds a new control to the controlgroup
   1.105 +	 * @param aControl control to be added
   1.106 +	 * @param aId id of the control
   1.107 +	 */
   1.108 +	IMPORT_C virtual void AddControlL(CCoeControl* aControl,TInt aId);
   1.109 +	/** AddControlL() adds new control to the controlgroup
   1.110 +     * @param aControlGroup a control and it's id packed into TEikGroupControl struct
   1.111 +	 */
   1.112 +	IMPORT_C virtual void AddControlL(TEikGroupControl& aGroupControl);
   1.113 +    /** InsertControlL() inserts a control to specific position
   1.114 +     * @param aGroupControl control and its id packed to a struct
   1.115 +     * @param aIndex index of the array where new control is to be inserted
   1.116 +     */
   1.117 +	IMPORT_C void InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex);
   1.118 +    /** DeleteControl() removes control from the group
   1.119 +     * @param aIndex at which position of the array to delete
   1.120 +     * @param aCount how many controls to delete
   1.121 +     */
   1.122 +	IMPORT_C void DeleteControl(TInt aIndex,TInt aCount);
   1.123 +    /** SetLengthInPixels() sets length of the control group in pixels
   1.124 +     * @param aLength length of the whole control group in pixels
   1.125 +     */
   1.126 +	IMPORT_C void SetLengthInPixels(TInt aLength);
   1.127 +    /** SetBreadthInPixels() sets width of the control group
   1.128 +     * @param aBreadth width of the control group
   1.129 +     */
   1.130 +	IMPORT_C void SetBreadthInPixels(TInt aBreadth);
   1.131 +    /** SetControlSpacing sets horizontal and vertical spacing
   1.132 +     * @param aHSpacing horizontal spacing between controls
   1.133 +     * @param aVSpacing vertical spacing between controls
   1.134 +     */
   1.135 +	IMPORT_C void SetControlSpacing(TInt aHSpacing,TInt aVSpacing);
   1.136 +    /** SetControlLayout sets control layout parameters
   1.137 +     * @param aStart start corner
   1.138 +     * @param aOrientation vertical or horizontal orientation
   1.139 +     */
   1.140 +	IMPORT_C void SetControlLayout(TStartCorner aStart,TOrientation aOrientation);
   1.141 +    /** SetNumberOfLines() sets number of lines of the control group
   1.142 +     * @param aNumLines number of lines
   1.143 +     * @param aDistributeEvenly whether controls distribute evenly to the group
   1.144 +     */
   1.145 +	IMPORT_C void SetNumberOfLines(TInt aNumLines,TBool aDistributeEvenly);
   1.146 +    /** SetControlsAllSameSize() sets all controls to be the same size
   1.147 +     */
   1.148 +	IMPORT_C void SetControlsAllSameSize();
   1.149 +    /** LayoutControls layouts the controls
   1.150 +     */
   1.151 +	IMPORT_C void LayoutControls();
   1.152 +    /** ControlById() fetches individual controls by id
   1.153 +     * @param aId id of the control
   1.154 +     */
   1.155 +	IMPORT_C CCoeControl* ControlById(TInt aId) const;
   1.156 +    /** IndexById() gets array index from id
   1.157 +     * @param aId id number of the control
   1.158 +     * @return index number to the array
   1.159 +     */
   1.160 +	IMPORT_C TInt IndexById(TInt aId) const;
   1.161 +    /** Reset() clears the control array
   1.162 +     */
   1.163 +	IMPORT_C void Reset();
   1.164 +    /** ControlId() finds id of the control based on CCoeCOntrol pointer
   1.165 +     * @param aControl control stored in a control group
   1.166 +     * @return id of the control
   1.167 +     */
   1.168 +	IMPORT_C TInt ControlId(CCoeControl* aControl) const;
   1.169 +    /** Control() returns CCoeControl pointer based on array index
   1.170 +     * @param aIndex index to the internal array
   1.171 +     * @return control in that position of the array
   1.172 +     */
   1.173 +	IMPORT_C CCoeControl* Control(TInt aIndex) const; // as requested by Bill
   1.174 +    /** ControlArray() access to the actual array representation
   1.175 +     * @return array
   1.176 +     */
   1.177 +	IMPORT_C CArrayFix<TEikGroupControl>* ControlArray() const;
   1.178 +    /** Orientation orientation of the control group
   1.179 +     * @return either horizontal or vertical orientation
   1.180 +     */
   1.181 +	IMPORT_C TOrientation Orientation() const;
   1.182 +	/** ControlSpacing() gets control's spacing
   1.183 +	 * @aHSpacing modifies variable to get horizontal spacing
   1.184 +	 * @aVSpacing modifies variable to get vertical spacing
   1.185 +     */
   1.186 + 	IMPORT_C void ControlSpacing(TInt& aHSpacing,TInt& aVSpacing) const;
   1.187 +public: // from CCoeControl
   1.188 +	/** MinimumSize() gets minimumsize
   1.189 +	 */
   1.190 +	IMPORT_C TSize MinimumSize();
   1.191 +    /** CountComponentControls returns component controls count
   1.192 +     */
   1.193 +    IMPORT_C TInt CountComponentControls() const;
   1.194 +    /** GetColorUseListL() sets the color use list of the control group
   1.195 +     */
   1.196 +	IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
   1.197 +    /** HandleResourceChange() handles resource change event
   1.198 +     */
   1.199 +	IMPORT_C virtual void HandleResourceChange(TInt aType);			// not available before Release 005u
   1.200 +    /** HandlePointerEventL() handles touch pointer events
   1.201 +     */
   1.202 +    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   1.203 +protected:
   1.204 +	enum
   1.205 +		{
   1.206 +		EDistributeEvenly	=0x40,
   1.207 +		EAllSameSize		=0x80,
   1.208 +		EDisableMSKDrawing  =0x100
   1.209 +		};
   1.210 +protected: // from CCoeControl
   1.211 +    IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
   1.212 +	IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
   1.213 +	// only used from CEikCba
   1.214 +	void SetMSKVisibility(TBool aEnable);
   1.215 +private: // from CCoeControl
   1.216 +	IMPORT_C void Reserved_2();
   1.217 +private:
   1.218 +    /**
   1.219 +    * From CAknControl
   1.220 +    */
   1.221 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.222 +private: // new functions
   1.223 +	IMPORT_C TInt Adjacent(TInt aRow,TInt aColumn,TInt aCtrlIndex,TInt aTotalRows,TInt aTotalColumns) const;
   1.224 +	IMPORT_C TStartCorner StartCorner() const;
   1.225 +	IMPORT_C void DeleteAllComponents();
   1.226 +	IMPORT_C TSize ControlMinimumSize(TInt aIndex) const;
   1.227 +	IMPORT_C TInt ControlMinimumLength(TInt aIndex);
   1.228 +	IMPORT_C TSize LargestControlSize() const;
   1.229 +	IMPORT_C TBool DistributeEvenly() const;
   1.230 +	IMPORT_C TBool AllSameSize();
   1.231 +private: // from CCoeControl
   1.232 +    IMPORT_C void SizeChanged();
   1.233 +	IMPORT_C void Draw(const TRect& aRect) const;
   1.234 +protected:
   1.235 +	CArrayFix<TEikGroupControl>* iControlArray;
   1.236 +private:
   1.237 +	TInt iLayout;
   1.238 +	TInt iLines;
   1.239 +	TInt iHSpacing;
   1.240 +	TInt iVSpacing;
   1.241 +	TInt iBreadth;
   1.242 +	TInt iLength;
   1.243 +	TSize iLargestControl;
   1.244 +	};
   1.245 +
   1.246 +
   1.247 +inline TEikGroupControl::TEikGroupControl()
   1.248 +	{ iControl=NULL; iId=iFlags=iLength=0; }
   1.249 +inline TEikGroupControl::TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags)
   1.250 +	: iControl(aControl),iId(aId),iLength(aLength),iFlags(aFlags)
   1.251 +	{}
   1.252 +inline TBool TEikGroupControl::IsLengthSet() const
   1.253 +	{ return iFlags&ESetLength; }
   1.254 +inline TInt TEikGroupControl::Length() const
   1.255 +	{ return iLength; }
   1.256 +inline TBool TEikGroupControl::IsStretchable() const
   1.257 +	{ return iFlags&EAllowStretch; }
   1.258 +inline void TEikGroupControl::SetLength(TInt aLength)
   1.259 +	{ iLength=aLength; iFlags|=ESetLength; }
   1.260 +inline void TEikGroupControl::SetStretchable()
   1.261 +	{ iFlags|=EAllowStretch; }
   1.262 +
   1.263 +#endif