00001 /* 00002 * ============================================================================ 00003 * Name : AknCheckBoxSettingPage.h 00004 * Part of : Avkon 00005 * 00006 * Description: 00007 * Check box list support for setting page in editable state 00008 * 00009 * Version: 00010 * 00011 * Copyright © 2002 Nokia Corporation. 00012 * This material, including documentation and any related 00013 * computer programs, is protected by copyright controlled by 00014 * Nokia Corporation. All rights are reserved. Copying, 00015 * including reproducing, storing, adapting or translating, any 00016 * or all of this material requires the prior written consent of 00017 * Nokia Corporation. This material also contains confidential 00018 * information which may not be disclosed to others without the 00019 * prior written consent of Nokia Corporation. 00020 */ 00021 00022 #ifndef __AKNCHECKBOXSETTINGPAGE_H__ 00023 #define __AKNCHECKBOXSETTINGPAGE_H__ 00024 00025 00026 #include <aknlistboxsettingpage.h> 00027 00034 class CSelectableItem : public CBase 00035 { 00036 public : 00042 IMPORT_C CSelectableItem( TDesC& aItemText, TBool aSelected ); 00046 virtual ~CSelectableItem(); 00047 00052 IMPORT_C void ConstructL(); 00053 00059 IMPORT_C void SetSelectionStatus( TBool aSelected ); 00060 00065 IMPORT_C TBool SelectionStatus(); 00066 00071 IMPORT_C TPtrC ItemText(); 00072 00073 private: 00074 TDesC& iDesC; // Holds the reference to the descriptor prior to construction 00075 HBufC* iItem; // This is on the heap and is used post constuction 00076 TBool iSelected; 00077 }; 00078 00079 00084 class CSelectionItemList : public CArrayPtrFlat<CSelectableItem>, public MDesCArray 00085 { 00086 public: 00090 IMPORT_C CSelectionItemList( TInt Granularity ); 00091 // from MDesCArray 00092 00098 IMPORT_C TInt MdcaCount() const; 00099 00104 IMPORT_C TPtrC MdcaPoint(TInt aIndex) const; 00105 }; 00106 00107 00108 00115 class CAknCheckBoxSettingPage : public CAknListBoxSettingPage 00116 { 00117 public: 00118 IMPORT_C CAknCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray ); 00146 IMPORT_C CAknCheckBoxSettingPage( const TDesC* aSettingTitleText, 00147 TInt aSettingNumber, 00148 TInt aControlType, 00149 TInt aEditorResourceId, 00150 TInt aSettingPageResourceId, 00151 CSelectionItemList* aItemArray ); 00152 00153 00158 IMPORT_C virtual void ConstructL(); 00159 00166 IMPORT_C CAknSetStyleListBox* ListBoxControl() const; 00167 00173 IMPORT_C void SetSelectionItemArrayL( CSelectionItemList* aItemArray ); 00174 00175 // From MEikListBoxObserver 00182 IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox, 00183 MEikListBoxObserver::TListBoxEvent aEventType); 00184 00189 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00190 00191 IMPORT_C void HandleResourceChange(TInt aType); 00192 00193 protected: 00197 IMPORT_C virtual ~CAknCheckBoxSettingPage(); 00198 00203 IMPORT_C virtual void UpdateSettingL(); 00204 00209 IMPORT_C void DynamicInitL(); 00210 00211 // From MEikCommandObserver 00212 IMPORT_C virtual void ProcessCommandL(TInt aCommandId); 00213 /* 00214 * This method is called upon Select command id. It should change the setting but not exit in 00215 * this case. 00216 */ 00217 IMPORT_C virtual void SelectCurrentItemL(); 00218 00219 // 00220 // CoeControl Framework and reserved methods 00221 // 00222 protected: 00223 00231 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const; 00232 private: 00236 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00237 00238 private: 00242 IMPORT_C virtual void Reserved_2(); 00243 00247 private: 00248 IMPORT_C virtual void CAknSettingPage_Reserved_1(); 00249 IMPORT_C virtual void CAknSettingPage_Reserved_2(); 00250 00251 private: 00256 IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1(); 00257 00258 private: 00259 void UpdateAllSelections(); 00260 void SetAllSelectionsL(); 00261 void ToggleSelectionL(); 00262 00267 void GenerateInternalArrayAndGiveToListBoxL(); 00268 00269 void CreateCheckBoxBitmapsL(); 00270 00271 CDesCArrayFlat* iInternalItemArray; 00272 00273 // the following are not owned 00274 CSelectionItemList* iItemArray; 00275 00276 // Spare data 00277 TInt iSpare_1; 00278 }; 00279 00280 #endif