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 #start_since SINCE_3_1_SDK 00192 00195 IMPORT_C void HandleResourceChange(TInt aType); 00196 #end_since SINCE_3_1_SDK 00197 protected: 00201 IMPORT_C virtual ~CAknCheckBoxSettingPage(); 00202 00207 IMPORT_C virtual void UpdateSettingL(); 00208 00213 IMPORT_C void DynamicInitL(); 00214 00215 // From MEikCommandObserver 00216 IMPORT_C virtual void ProcessCommandL(TInt aCommandId); 00217 /* 00218 * This method is called upon Select command id. It should change the setting but not exit in 00219 * this case. 00220 */ 00221 IMPORT_C virtual void SelectCurrentItemL(); 00222 00223 // 00224 // CoeControl Framework and reserved methods 00225 // 00226 protected: 00227 00235 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const; 00236 private: 00240 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00241 00242 private: 00246 IMPORT_C virtual void Reserved_2(); 00247 00251 private: 00252 IMPORT_C virtual void CAknSettingPage_Reserved_1(); 00253 IMPORT_C virtual void CAknSettingPage_Reserved_2(); 00254 00255 private: 00260 IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1(); 00261 00262 private: 00263 void UpdateAllSelections(); 00264 void SetAllSelectionsL(); 00265 void ToggleSelectionL(); 00266 00271 void GenerateInternalArrayAndGiveToListBoxL(); 00272 00273 void CreateCheckBoxBitmapsL(); 00274 00275 CDesCArrayFlat* iInternalItemArray; 00276 00277 // the following are not owned 00278 CSelectionItemList* iItemArray; 00279 00280 // Spare data 00281 TInt iSpare_1; 00282 }; 00283 00284 #endif