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