1.1 --- a/epoc32/include/mw/akncheckboxsettingpage.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/akncheckboxsettingpage.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,281 @@
1.4 -akncheckboxsettingpage.h
1.5 +/*
1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +* Check box list support for setting page in editable state
1.20 +*
1.21 +*
1.22 +*/
1.23 +
1.24 +
1.25 +#ifndef __AKNCHECKBOXSETTINGPAGE_H__
1.26 +#define __AKNCHECKBOXSETTINGPAGE_H__
1.27 +
1.28 +
1.29 +#include <aknlistboxsettingpage.h>
1.30 +
1.31 +// forward declare
1.32 +class CAknCheckBoxSettingPageExtension;
1.33 +
1.34 +/**
1.35 +* Class to encapsulate text and Boolean status; An array of these provides the interface to the CheckBoxSettingPage
1.36 +* The boolean status can be changed after construction, but the text cannot be changed.
1.37 +*
1.38 +*
1.39 +*/
1.40 +class CSelectableItem : public CBase
1.41 +{
1.42 +public :
1.43 + /**
1.44 + * C++ constructor
1.45 + * @param aItemText text to go into the compound type
1.46 + * @param aSelected Pass ETrue to select the item; EFalse to deselect it.
1.47 + */
1.48 + IMPORT_C CSelectableItem( TDesC& aItemText, TBool aSelected );
1.49 + /**
1.50 + * C++ Destructor
1.51 + */
1.52 + virtual ~CSelectableItem();
1.53 +
1.54 + /**
1.55 + * 2nd stage construction
1.56 + *
1.57 + */
1.58 + IMPORT_C void ConstructL();
1.59 +
1.60 + /**
1.61 + * Set the selection status to ETrue or EFalse
1.62 + *
1.63 + * @param aSelected status that the selection status is to be set to.
1.64 + */
1.65 + IMPORT_C void SetSelectionStatus( TBool aSelected );
1.66 +
1.67 + /**
1.68 + * Access the selection status
1.69 + * @return EFalse if not selected; otherwise not EFalse
1.70 + */
1.71 + IMPORT_C TBool SelectionStatus();
1.72 +
1.73 + /**
1.74 + * Access to the item text as TPtr
1.75 + * @return TPtrC that points to items's text.
1.76 + */
1.77 + IMPORT_C TPtrC ItemText();
1.78 +
1.79 +private:
1.80 + TDesC& iDesC; // Holds the reference to the descriptor prior to construction
1.81 + HBufC* iItem; // This is on the heap and is used post constuction
1.82 + TBool iSelected;
1.83 +};
1.84 +
1.85 +
1.86 +/**
1.87 +* Array type for holding selection items
1.88 +*
1.89 +*/
1.90 +class CSelectionItemList : public CArrayPtrFlat<CSelectableItem>, public MDesCArray
1.91 + {
1.92 +public:
1.93 + /**
1.94 + * Constructor
1.95 + */
1.96 + IMPORT_C CSelectionItemList( TInt Granularity );
1.97 +// from MDesCArray
1.98 +
1.99 + /**
1.100 + * From MDesCArray:
1.101 + *
1.102 + * @return number of items in the array
1.103 + */
1.104 + IMPORT_C TInt MdcaCount() const;
1.105 +
1.106 + /**
1.107 + * Access to item text of the elements in the array
1.108 + * @return item text of aIndex'th element
1.109 + */
1.110 + IMPORT_C TPtrC MdcaPoint(TInt aIndex) const;
1.111 + };
1.112 +
1.113 +
1.114 +
1.115 +/**
1.116 +* Setting Page class supporting multiple selection.
1.117 +*
1.118 +* Interface is via a CSelectionItemList array
1.119 +*
1.120 +*/
1.121 +class CAknCheckBoxSettingPage : public CAknListBoxSettingPage
1.122 +{
1.123 +public:
1.124 + IMPORT_C CAknCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray );
1.125 + /**
1.126 + * Constructor that allows separate setting page and editor resources
1.127 + *
1.128 + * In all cases the number (if supplied i.e. <> 0 ) is used.
1.129 + *
1.130 + * Editor Resource Setting Page Resource
1.131 + * present present Both are used (but text & number overridden)
1.132 + * = 0 present Editor resource is used via SP resource
1.133 + * present = 0 Default Avkon SP resource if used (to no effect?)
1.134 + * = 0 = 0 Not permitted
1.135 + *
1.136 + * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
1.137 + * cannot initialize such a member without allocation or having an internal dummy buffer.
1.138 + *
1.139 + * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
1.140 + * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
1.141 + * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
1.142 + * specific API for setting them, WILL override the resource.
1.143 + * It is assumed that number from resource is very rare. Special text is somewhat more likely.
1.144 + *
1.145 + * @param aSettingTitleText Text at top of setting pane
1.146 + * @param aSettingNumber Number at top left (if present)
1.147 + * @param aControlType Determines the type constructed and how its resource is read
1.148 + * @param aEditorResourceId Editor resource to use in the setting page (if present)
1.149 + * @param aSettingPageResourceId Setting Page to use (if present)
1.150 + * @param aItemArray List of option texts and their selection states
1.151 + */
1.152 + IMPORT_C CAknCheckBoxSettingPage( const TDesC* aSettingTitleText,
1.153 + TInt aSettingNumber,
1.154 + TInt aControlType,
1.155 + TInt aEditorResourceId,
1.156 + TInt aSettingPageResourceId,
1.157 + CSelectionItemList* aItemArray );
1.158 +
1.159 +
1.160 + /**
1.161 + * 2nd phase constructor
1.162 + *
1.163 + */
1.164 + IMPORT_C virtual void ConstructL();
1.165 +
1.166 + /**
1.167 + *
1.168 + * Access to ListBoxControl
1.169 + *
1.170 + * @return pointer to listbox used by the setting page; No transfer of ownership
1.171 + */
1.172 + IMPORT_C CAknSetStyleListBox* ListBoxControl() const;
1.173 +
1.174 + /**
1.175 + * Method to update the item array after a change in content
1.176 + *
1.177 + * @param CSelectionItemList* aItemArray The new array of selectable items
1.178 + */
1.179 + IMPORT_C void SetSelectionItemArrayL( CSelectionItemList* aItemArray );
1.180 +
1.181 +// From MEikListBoxObserver
1.182 + /**
1.183 + * Observer callback from the listbox
1.184 + *
1.185 + * @param aListBox ptr to listbox that is calling the method
1.186 + * @param aEventType type of event; defined by MEikListBoxObserver
1.187 + */
1.188 + IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox,
1.189 + MEikListBoxObserver::TListBoxEvent aEventType);
1.190 +
1.191 + /**
1.192 + * From CCoeControl
1.193 + * Handles pointer events
1.194 + */
1.195 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.196 +
1.197 + IMPORT_C void HandleResourceChange(TInt aType);
1.198 +
1.199 +protected:
1.200 + /**
1.201 + * Destructor
1.202 + */
1.203 + IMPORT_C virtual ~CAknCheckBoxSettingPage();
1.204 +
1.205 + /**
1.206 + * Called when the setting is updated
1.207 + *
1.208 + */
1.209 + IMPORT_C virtual void UpdateSettingL();
1.210 +
1.211 + /**
1.212 + * Called when the setting page is about to be displayed
1.213 + *
1.214 + */
1.215 + IMPORT_C void DynamicInitL();
1.216 +
1.217 + // From MEikCommandObserver
1.218 + IMPORT_C virtual void ProcessCommandL(TInt aCommandId);
1.219 + /*
1.220 + * This method is called upon Select command id. It should change the setting but not exit in
1.221 + * this case.
1.222 + */
1.223 + IMPORT_C virtual void SelectCurrentItemL();
1.224 +
1.225 +//
1.226 +// CoeControl Framework and reserved methods
1.227 +//
1.228 +protected:
1.229 +
1.230 +/**
1.231 + * Writes the internal state of the control and its components to aStream.
1.232 + * Does nothing in release mode.
1.233 + * Designed to be overidden and base called by subclasses.
1.234 + *
1.235 + * @param aWriteSteam A connected write stream
1.236 + */
1.237 + IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
1.238 +private:
1.239 + /**
1.240 + * From CAknControl
1.241 + */
1.242 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.243 +
1.244 +private:
1.245 +/**
1.246 + * Reserved method derived from CCoeControl
1.247 + */
1.248 + IMPORT_C virtual void Reserved_2();
1.249 +
1.250 +/**
1.251 + * New reserved methods for CAknSettingPage hierarchy
1.252 + */
1.253 +private:
1.254 + IMPORT_C virtual void CAknSettingPage_Reserved_1();
1.255 + IMPORT_C virtual void CAknSettingPage_Reserved_2();
1.256 +
1.257 +private:
1.258 +/**
1.259 + * New reserved method from CAknListBoxSettingPage
1.260 + *
1.261 + */
1.262 + IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1();
1.263 +
1.264 +private:
1.265 + void UpdateAllSelections();
1.266 + void SetAllSelectionsL();
1.267 + void ToggleSelectionL();
1.268 +
1.269 + /**
1.270 + * Internal method to re-generate the internal, "decorated" text array used in the
1.271 + * real listbox.
1.272 + */
1.273 + void GenerateInternalArrayAndGiveToListBoxL();
1.274 +
1.275 + void CreateCheckBoxBitmapsL();
1.276 +
1.277 + CDesCArrayFlat* iInternalItemArray;
1.278 +
1.279 + // the following are not owned
1.280 + CSelectionItemList* iItemArray;
1.281 +
1.282 + CAknCheckBoxSettingPageExtension* iExtension; // owned
1.283 +};
1.284 +
1.285 +#endif