1.1 --- a/epoc32/include/mw/aknform.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/aknform.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,250 @@
1.4 -aknform.h
1.5 +/*
1.6 +* Copyright (c) 2002-2004 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 +* Support for Form component. Also has CAknDialog which specialized
1.20 +* CEikDialog (adds menu capability) Note that most support for Avkon
1.21 +* Forms is contained within CEikDialog.
1.22 +*
1.23 +*
1.24 +*/
1.25 +
1.26 +
1.27 +#ifndef __AKNFORM_H__
1.28 +#define __AKNFORM_H__
1.29 +
1.30 +// INCLUDES
1.31 +#include <aknDialog.h>
1.32 +
1.33 +// CLASS DECLARATION
1.34 +class CEikMenuBar ;
1.35 +
1.36 +/**
1.37 +* Forms are special types of dialogs. The item layout and functionality can
1.38 +* differ between the two states. In the view state, the fields are not
1.39 +* editable. It looks and acts like a listbox. The listbox focus can be moved
1.40 +* and items can be selected.
1.41 +*
1.42 +* @since Series 60 0.9
1.43 +*/
1.44 +class CAknForm : public CAknDialog
1.45 + {
1.46 +public:
1.47 +
1.48 + /**
1.49 + * Base class default constructor.
1.50 + */
1.51 + IMPORT_C CAknForm();
1.52 +
1.53 + /**
1.54 + * Perform the second phase construction of a object. If a leave occurs
1.55 + * the framework generates a Symbian Leave code.
1.56 + * @param aMenuResource The menu resource to be used for the form.
1.57 + */
1.58 + IMPORT_C void ConstructL( TInt aMenuBarId=0 );
1.59 +
1.60 + /**
1.61 + * Destructor.
1.62 + */
1.63 + IMPORT_C ~CAknForm();
1.64 +
1.65 + /**
1.66 + * Function from @c MEikMenuObserver. The framework
1.67 + * calls this function. It removes the unused default form options. If a
1.68 + * leave occurs the framework generates a Symbian Leave code.
1.69 + * @param aResourceId The ID of the menu pane.
1.70 + * @param aMenuPane The menu pane itself.
1.71 + */
1.72 + IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
1.73 +
1.74 + /**
1.75 + * Function from @c MEikCommandObserver. Handle user menu commands. If a
1.76 + * leave occurs the framework generates a Symbian Leave code.
1.77 + * @param aCommandId The command identifier to process.
1.78 + */
1.79 + IMPORT_C virtual void ProcessCommandL( TInt aCommandId );
1.80 +
1.81 +protected:
1.82 + /**
1.83 + * Function from @c CEikDialog. Called by framework when the softkey is
1.84 + * pressed. Use this to pop up the options menu or close the dialog. Will
1.85 + * call c@ SaveFormDataL() before closing if data has been edited. Will
1.86 + * NOT permit exit if attempt to save data fails. If a leave occurs the
1.87 + * framework generates a Symbian Leave code.
1.88 + * @param aButtonId Translates the button presses into commands ID.
1.89 + * @return @c ETrue if the dialog should exit, and @c EFalse if it should
1.90 + * not.
1.91 + */
1.92 + IMPORT_C virtual TBool OkToExitL( TInt aButtonId );
1.93 +
1.94 + /**
1.95 + * Function from @c CEikDialog and thence from c@ MEikDialogPageObserver.
1.96 + * This funtion should be implemented to prepare for focus transition from
1.97 + * the current line. If deleting then this routine must not do anything (the
1.98 + * default tries to access the control which has just been deleted). If a
1.99 + * leave occurs the framework generates a Symbian Leave code.
1.100 + */
1.101 + IMPORT_C virtual void PrepareForFocusTransitionL();
1.102 +
1.103 +public:
1.104 +
1.105 + /**
1.106 + * Function from @c CCoeControl handles a change to the control's resources
1.107 + * of type aType which are shared across the environment, e.g. colors or
1.108 + * fonts.
1.109 + * @param aType. A message UID value.
1.110 + * @since Series 60 2.0
1.111 + */
1.112 + IMPORT_C void HandleResourceChange(TInt aType);
1.113 +
1.114 + /**
1.115 + * From CCoeControl.
1.116 + * Handles pointer events
1.117 + * @param aPointerEvent The pointer event.
1.118 + */
1.119 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.120 +
1.121 +protected:
1.122 +
1.123 + /**
1.124 + * This routine should be re-implemented by the client to save the contents
1.125 + * of the form. The re-implementation can call this function to display the
1.126 + * 'Saved' dialog @c CAknForm::SaveFormDataL().
1.127 + * @return @c ETrue if the editable state can be left. The return value should
1.128 + * reflect whether or not the form is to leave the editable state. A real
1.129 + * system problem saving should generate a Symbian Leave code.
1.130 + */
1.131 + IMPORT_C virtual TBool SaveFormDataL();
1.132 +
1.133 + /**
1.134 + * This routine should be implemented by the client for dealing with the
1.135 + * occasion of a change from edit->view mode but the user does not wish to
1.136 + * save the changes. A typical implementation would set the controls back
1.137 + * to their old values. If a leave occurs the framework generates a
1.138 + * Symbian Leave code.
1.139 + */
1.140 + IMPORT_C virtual void DoNotSaveFormDataL();
1.141 +
1.142 + /**
1.143 + * This routine may be overridden. Default displays 'Save Changes Dialog
1.144 + * Yes/No'. Data validation may occur here as an alternative to overriding
1.145 + * @c OkToExit(). Re-implementation may put data validation here (as an
1.146 + * alternative to over-riding @c OkToExit() - which is a more complicated
1.147 + * method). Note that this routine does not perform the changes itself. If
1.148 + * the leave occurs the framework generates a Symbian Leave code.
1.149 + * @return @c ETrue if changes are requested to be saved and then are
1.150 + * successfully saved. Save of data is not performed here but in
1.151 + * @c SaveFormDataL().
1.152 + */
1.153 + IMPORT_C virtual TBool QuerySaveChangesL();
1.154 +
1.155 + /**
1.156 + * This routine may be overridden. Default displays old label as caption and
1.157 + * editor for new one. Uses customised dialog.If a leave occurs the
1.158 + * framework generates a Symbian Leave code.
1.159 + */
1.160 + IMPORT_C virtual void EditCurrentLabelL();
1.161 +
1.162 + /**
1.163 + * This routine may be overridden. Default displays "Delete item? Yes/No"
1.164 + * Deletes item on return from the dialog before returning. If a leave occurs
1.165 + * the framework generates a Symbian Leave code.
1.166 + */
1.167 + IMPORT_C virtual void DeleteCurrentItemL();
1.168 +
1.169 + /**
1.170 + * This routine may be overridden. Implementation is missing in this class.
1.171 + */
1.172 + IMPORT_C virtual void AddItemL();
1.173 +
1.174 + /**
1.175 + * Sets changes pending.
1.176 + * @param aChangesPending @c ETrue if changes are pending. Else @cEFalse.
1.177 + */
1.178 + IMPORT_C void SetChangesPending(TBool aChangesPending);
1.179 +
1.180 + /**
1.181 + * Function from @c CEikdialog. This function is called by the EIKON
1.182 + * dialog framework just before the dialog is activated, after it has
1.183 + * called @c PreLayoutDynInitL() and the dialog has been sized. If a
1.184 + * leave occurs the framework generates a Symbian Leave code.
1.185 + */
1.186 + IMPORT_C void PostLayoutDynInitL();
1.187 +
1.188 + /**
1.189 + * Overridden, so that the form can tell if a line's state has changed.
1.190 + * This is used to decide when to save changes. If a leave occurs the
1.191 + * framework generates a Symbian Leave code.
1.192 + * @param aControlId. Control id.
1.193 + */
1.194 + IMPORT_C void HandleControlStateChangeL(TInt aControlId);
1.195 +
1.196 + /**
1.197 + * This is added, so that anyone adding lines either in @c PreLayoutDynInit()
1.198 + * or @c SetInitialCurrentLine() should have the lines in a consistent state.
1.199 + */
1.200 + IMPORT_C void SetInitialCurrentLine();
1.201 +
1.202 + /**
1.203 + * Required by @c OkToExit().
1.204 + * @return @c ETrue if unsave editing, and @c EFalse if it
1.205 + * should not.
1.206 + */
1.207 + IMPORT_C TBool UnsavedEdit() const;
1.208 +
1.209 + /**
1.210 + * Required by @c PrepareForFocusTransitionL().
1.211 + * @return @c ETrue if deleting, and @c EFalse if it
1.212 + * should not.
1.213 + */
1.214 + IMPORT_C TBool Deleting() const;
1.215 +
1.216 +enum TFlags
1.217 + {
1.218 + /** Flag for deleting item. */
1.219 + EDeleting = 0x1, // Form flag enum
1.220 +
1.221 + /** Flag for unsave editing item. */
1.222 + EUnsavedEdit = 0x2 // Form flag enum
1.223 + };
1.224 +
1.225 + /**
1.226 + * Set the form flag indicated.
1.227 + * @param aFlagPattern Pattern of bits to set or clear.
1.228 + * @param aSetTheFlag If @c ETrue, sets the pattern; if @c EFalse, clear the
1.229 + * pattern.
1.230 + */
1.231 + IMPORT_C void SetFormFlag( TFlags aFlagPattern, TBool aSetTheFlag );
1.232 +
1.233 +private:
1.234 + /**
1.235 + * From CAknControl
1.236 + */
1.237 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.238 +
1.239 +private:
1.240 + IMPORT_C virtual void CEikDialog_Reserved_1();
1.241 + IMPORT_C virtual void CEikDialog_Reserved_2();
1.242 +private:
1.243 + IMPORT_C virtual void CAknDialog_Reserved();
1.244 +private:// new function
1.245 + IMPORT_C virtual void CAknForm_Reserved();
1.246 +private: // helpers
1.247 + void DoLayout();
1.248 +private :
1.249 + TInt iMenuBarId ; // resource ID
1.250 + TInt iFlags ;
1.251 + TInt iWsBufferRequestID;
1.252 + } ;
1.253 +
1.254 +#endif // __AKNFORM_H__