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: 00018 inline TEikGroupControl(); 00019 inline TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags); 00020 public: 00021 CCoeControl* iControl; 00022 TInt iId; 00023 TInt iLongId; 00024 public: 00025 inline TBool IsLengthSet() const; 00026 inline TInt Length() const; 00027 inline TBool IsStretchable() const; 00028 inline void SetLength(TInt aLength); 00029 inline void SetStretchable(); 00030 public: 00031 enum TControlFlags 00032 { 00033 ESetLength =0x01, 00034 EAllowStretch =0x02 00035 }; 00036 private: 00037 TInt iLength; 00038 TInt iFlags; 00039 }; 00040 00041 class CEikControlGroup : public CEikBorderedControl 00042 { 00043 friend class CTestControlGroup; // test code 00044 00045 // CEikCba made a friend to get at Orientation() private method 00046 friend class CEikCba; 00047 // -> 00048 public: 00049 enum TStartCorner 00050 { 00051 EFromTopLeft=SLafControlGroup::EFromTopLeft, 00052 EFromTopRight=SLafControlGroup::EFromTopRight, 00053 EFromBottomLeft=SLafControlGroup::EFromBottomLeft, 00054 EFromBottomRight=SLafControlGroup::EFromBottomRight 00055 }; 00056 enum TOrientation 00057 { 00058 ELayHorizontally=SLafControlGroup::ELayHorizontally, 00059 ELayVertically =SLafControlGroup::ELayVertically 00060 }; 00061 public: // new functions 00062 IMPORT_C CEikControlGroup(); 00063 IMPORT_C ~CEikControlGroup(); 00064 IMPORT_C void ConstructL(TStartCorner aStart,TOrientation aOrientation); 00065 IMPORT_C virtual void AddControlL(CCoeControl* aControl,TInt aId); 00066 IMPORT_C virtual void AddControlL(TEikGroupControl& aGroupControl); 00067 IMPORT_C void InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex); 00068 IMPORT_C void DeleteControl(TInt aIndex,TInt aCount); 00069 IMPORT_C void SetLengthInPixels(TInt aLength); 00070 IMPORT_C void SetBreadthInPixels(TInt aBreadth); 00071 IMPORT_C void SetControlSpacing(TInt aHSpacing,TInt aVSpacing); 00072 IMPORT_C void SetControlLayout(TStartCorner aStart,TOrientation aOrientation); 00073 IMPORT_C void SetNumberOfLines(TInt aNumLines,TBool aDistributeEvenly); 00074 IMPORT_C void SetControlsAllSameSize(); 00075 IMPORT_C void LayoutControls(); 00076 IMPORT_C CCoeControl* ControlById(TInt aId) const; 00077 IMPORT_C TInt IndexById(TInt aId) const; 00078 IMPORT_C void Reset(); 00079 IMPORT_C TInt ControlId(CCoeControl* aControl) const; 00080 IMPORT_C CCoeControl* Control(TInt aIndex) const; // as requested by Bill 00081 IMPORT_C CArrayFix<TEikGroupControl>* ControlArray() const; 00082 IMPORT_C TOrientation Orientation() const; 00083 IMPORT_C void ControlSpacing(TInt& aHSpacing,TInt& aVSpacing) const; 00084 public: // from CCoeControl 00085 IMPORT_C TSize MinimumSize(); 00086 IMPORT_C TInt CountComponentControls() const; 00087 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u 00088 IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u 00089 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00090 protected: 00091 enum 00092 { 00093 EDistributeEvenly =0x40, 00094 EAllSameSize =0x80 00095 #start_since SINCE_3_1_SDK 00096 ,EDisableMSKDrawing =0x100 00097 #end_since SINCE_3_1_SDK 00098 }; 00099 protected: // from CCoeControl 00100 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; 00101 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; 00102 #start_since SINCE_3_1_SDK 00103 00107 void SetMSKVisibility(TBool aEnable); 00108 #end_since SINCE_3_1_SDK 00109 private: // from CCoeControl 00110 IMPORT_C void Reserved_2(); 00111 private: 00115 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00116 private: // new functions 00117 IMPORT_C TInt Adjacent(TInt aRow,TInt aColumn,TInt aCtrlIndex,TInt aTotalRows,TInt aTotalColumns) const; 00118 IMPORT_C TStartCorner StartCorner() const; 00119 IMPORT_C void DeleteAllComponents(); 00120 IMPORT_C TSize ControlMinimumSize(TInt aIndex) const; 00121 IMPORT_C TInt ControlMinimumLength(TInt aIndex); 00122 IMPORT_C TSize LargestControlSize() const; 00123 IMPORT_C TBool DistributeEvenly() const; 00124 IMPORT_C TBool AllSameSize(); 00125 private: // from CCoeControl 00126 IMPORT_C void SizeChanged(); 00127 IMPORT_C void Draw(const TRect& aRect) const; 00128 protected: 00129 CArrayFix<TEikGroupControl>* iControlArray; 00130 private: 00131 TInt iLayout; 00132 TInt iLines; 00133 TInt iHSpacing; 00134 TInt iVSpacing; 00135 TInt iBreadth; 00136 TInt iLength; 00137 TSize iLargestControl; 00138 }; 00139 00140 00141 inline TEikGroupControl::TEikGroupControl() 00142 { iControl=NULL; iId=iFlags=iLength=0; } 00143 inline TEikGroupControl::TEikGroupControl(CCoeControl* aControl,TInt aId,TInt aLength,TInt aFlags) 00144 : iControl(aControl),iId(aId),iLength(aLength),iFlags(aFlags) 00145 {} 00146 inline TBool TEikGroupControl::IsLengthSet() const 00147 { return iFlags&ESetLength; } 00148 inline TInt TEikGroupControl::Length() const 00149 { return iLength; } 00150 inline TBool TEikGroupControl::IsStretchable() const 00151 { return iFlags&EAllowStretch; } 00152 inline void TEikGroupControl::SetLength(TInt aLength) 00153 { iLength=aLength; iFlags|=ESetLength; } 00154 inline void TEikGroupControl::SetStretchable() 00155 { iFlags|=EAllowStretch; } 00156 00157 #endif