eikctgrp.h

Go to the documentation of this file.
00001 // EIKCTGRP.H
00002 //
00003 // Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
00004 //
00005 
00006 #if !defined(__EIKCTGRP_H__)
00007 #define __EIKCTGRP_H__
00008 
00009 #if !defined(__EIKBCTRL_H__)
00010 #include <eikbctrl.h>
00011 #endif
00012 
00013 #include <lafpublc.h>
00014 
00015 class TEikGroupControl
00016         {
00017 public:
00020         inline TEikGroupControl();
00023         inline TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags);
00024 public:
00025         CCoeControl* iControl;
00026         TInt iId;
00027         TInt iLongId;
00028 public:
00031         inline TBool IsLengthSet() const;
00034         inline TInt Length() const;
00037         inline TBool IsStretchable() const;
00040         inline void SetLength(TInt aLength);
00043         inline void SetStretchable();
00044 public:
00045         enum TControlFlags
00046                 {
00047                 ESetLength              =0x01,
00048                 EAllowStretch   =0x02
00049                 };
00050 private:
00051         TInt iLength;
00052         TInt iFlags;
00053         };
00054 
00055 class CEikControlGroup : public CEikBorderedControl
00056         {
00057 friend class CTestControlGroup; // test code
00058 
00059 // CEikCba made a friend to get at Orientation() private method
00060 friend class CEikCba;
00061 // -> 
00062 public:
00063         enum TStartCorner
00064                 {
00065                 EFromTopLeft=SLafControlGroup::EFromTopLeft,
00066                 EFromTopRight=SLafControlGroup::EFromTopRight,
00067                 EFromBottomLeft=SLafControlGroup::EFromBottomLeft,
00068                 EFromBottomRight=SLafControlGroup::EFromBottomRight
00069                 };
00070         enum TOrientation
00071                 {
00072                 ELayHorizontally=SLafControlGroup::ELayHorizontally,
00073                 ELayVertically  =SLafControlGroup::ELayVertically       
00074                 };
00075 public: // new functions
00078         IMPORT_C CEikControlGroup();
00081         IMPORT_C ~CEikControlGroup();
00086         IMPORT_C void ConstructL(TStartCorner aStart,TOrientation aOrientation);
00091         IMPORT_C virtual void AddControlL(CCoeControl* aControl,TInt aId);
00095         IMPORT_C virtual void AddControlL(TEikGroupControl& aGroupControl);
00100         IMPORT_C void InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex);
00105         IMPORT_C void DeleteControl(TInt aIndex,TInt aCount);
00109         IMPORT_C void SetLengthInPixels(TInt aLength);
00113         IMPORT_C void SetBreadthInPixels(TInt aBreadth);
00118         IMPORT_C void SetControlSpacing(TInt aHSpacing,TInt aVSpacing);
00123         IMPORT_C void SetControlLayout(TStartCorner aStart,TOrientation aOrientation);
00128         IMPORT_C void SetNumberOfLines(TInt aNumLines,TBool aDistributeEvenly);
00131         IMPORT_C void SetControlsAllSameSize();
00134         IMPORT_C void LayoutControls();
00138         IMPORT_C CCoeControl* ControlById(TInt aId) const;
00143         IMPORT_C TInt IndexById(TInt aId) const;
00146         IMPORT_C void Reset();
00151         IMPORT_C TInt ControlId(CCoeControl* aControl) const;
00156         IMPORT_C CCoeControl* Control(TInt aIndex) const; // as requested by Bill
00160         IMPORT_C CArrayFix<TEikGroupControl>* ControlArray() const;
00164         IMPORT_C TOrientation Orientation() const;
00169         IMPORT_C void ControlSpacing(TInt& aHSpacing,TInt& aVSpacing) const;
00170 public: // from CCoeControl
00173         IMPORT_C TSize MinimumSize();
00176     IMPORT_C TInt CountComponentControls() const;
00179         IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
00182         IMPORT_C virtual void HandleResourceChange(TInt aType);                 // not available before Release 005u
00185     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00186 protected:
00187         enum
00188                 {
00189                 EDistributeEvenly       =0x40,
00190                 EAllSameSize            =0x80,
00191                 EDisableMSKDrawing  =0x100
00192                 };
00193 protected: // from CCoeControl
00194     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
00195         IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00196         // only used from CEikCba
00197         void SetMSKVisibility(TBool aEnable);
00198 private: // from CCoeControl
00199         IMPORT_C void Reserved_2();
00200 private:
00204     IMPORT_C void* ExtensionInterface( TUid aInterface );
00205 private: // new functions
00206         IMPORT_C TInt Adjacent(TInt aRow,TInt aColumn,TInt aCtrlIndex,TInt aTotalRows,TInt aTotalColumns) const;
00207         IMPORT_C TStartCorner StartCorner() const;
00208         IMPORT_C void DeleteAllComponents();
00209         IMPORT_C TSize ControlMinimumSize(TInt aIndex) const;
00210         IMPORT_C TInt ControlMinimumLength(TInt aIndex);
00211         IMPORT_C TSize LargestControlSize() const;
00212         IMPORT_C TBool DistributeEvenly() const;
00213         IMPORT_C TBool AllSameSize();
00214 private: // from CCoeControl
00215     IMPORT_C void SizeChanged();
00216         IMPORT_C void Draw(const TRect& aRect) const;
00217 protected:
00218         CArrayFix<TEikGroupControl>* iControlArray;
00219 private:
00220         TInt iLayout;
00221         TInt iLines;
00222         TInt iHSpacing;
00223         TInt iVSpacing;
00224         TInt iBreadth;
00225         TInt iLength;
00226         TSize iLargestControl;
00227         };
00228 
00229 
00230 inline TEikGroupControl::TEikGroupControl()
00231         { iControl=NULL; iId=iFlags=iLength=0; }
00232 inline TEikGroupControl::TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags)
00233         : iControl(aControl),iId(aId),iLength(aLength),iFlags(aFlags)
00234         {}
00235 inline TBool TEikGroupControl::IsLengthSet() const
00236         { return iFlags&ESetLength; }
00237 inline TInt TEikGroupControl::Length() const
00238         { return iLength; }
00239 inline TBool TEikGroupControl::IsStretchable() const
00240         { return iFlags&EAllowStretch; }
00241 inline void TEikGroupControl::SetLength(TInt aLength)
00242         { iLength=aLength; iFlags|=ESetLength; }
00243 inline void TEikGroupControl::SetStretchable()
00244         { iFlags|=EAllowStretch; }
00245 
00246 #endif

Copyright © Nokia Corporation 2001-2008
Back to top