williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* 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
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
* Support for Form component. Also has CAknDialog which specialized
|
williamr@2
|
16 |
* CEikDialog (adds menu capability) Note that most support for Avkon
|
williamr@2
|
17 |
* Forms is contained within CEikDialog.
|
williamr@2
|
18 |
*
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
#ifndef __AKNFORM_H__
|
williamr@2
|
24 |
#define __AKNFORM_H__
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// INCLUDES
|
williamr@2
|
27 |
#include <aknDialog.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
// CLASS DECLARATION
|
williamr@2
|
30 |
class CEikMenuBar ;
|
williamr@2
|
31 |
|
williamr@2
|
32 |
/**
|
williamr@2
|
33 |
* Forms are special types of dialogs. The item layout and functionality can
|
williamr@2
|
34 |
* differ between the two states. In the view state, the fields are not
|
williamr@2
|
35 |
* editable. It looks and acts like a listbox. The listbox focus can be moved
|
williamr@2
|
36 |
* and items can be selected.
|
williamr@2
|
37 |
*
|
williamr@2
|
38 |
* @since Series 60 0.9
|
williamr@2
|
39 |
*/
|
williamr@2
|
40 |
class CAknForm : public CAknDialog
|
williamr@2
|
41 |
{
|
williamr@2
|
42 |
public:
|
williamr@2
|
43 |
|
williamr@2
|
44 |
/**
|
williamr@2
|
45 |
* Base class default constructor.
|
williamr@2
|
46 |
*/
|
williamr@2
|
47 |
IMPORT_C CAknForm();
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
* Perform the second phase construction of a object. If a leave occurs
|
williamr@2
|
51 |
* the framework generates a Symbian Leave code.
|
williamr@2
|
52 |
* @param aMenuResource The menu resource to be used for the form.
|
williamr@2
|
53 |
*/
|
williamr@2
|
54 |
IMPORT_C void ConstructL( TInt aMenuBarId=0 );
|
williamr@2
|
55 |
|
williamr@2
|
56 |
/**
|
williamr@2
|
57 |
* Destructor.
|
williamr@2
|
58 |
*/
|
williamr@2
|
59 |
IMPORT_C ~CAknForm();
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
* Function from @c MEikMenuObserver. The framework
|
williamr@2
|
63 |
* calls this function. It removes the unused default form options. If a
|
williamr@2
|
64 |
* leave occurs the framework generates a Symbian Leave code.
|
williamr@2
|
65 |
* @param aResourceId The ID of the menu pane.
|
williamr@2
|
66 |
* @param aMenuPane The menu pane itself.
|
williamr@2
|
67 |
*/
|
williamr@2
|
68 |
IMPORT_C virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
|
williamr@2
|
69 |
|
williamr@2
|
70 |
/**
|
williamr@2
|
71 |
* Function from @c MEikCommandObserver. Handle user menu commands. If a
|
williamr@2
|
72 |
* leave occurs the framework generates a Symbian Leave code.
|
williamr@2
|
73 |
* @param aCommandId The command identifier to process.
|
williamr@2
|
74 |
*/
|
williamr@2
|
75 |
IMPORT_C virtual void ProcessCommandL( TInt aCommandId );
|
williamr@2
|
76 |
|
williamr@2
|
77 |
protected:
|
williamr@2
|
78 |
/**
|
williamr@2
|
79 |
* Function from @c CEikDialog. Called by framework when the softkey is
|
williamr@2
|
80 |
* pressed. Use this to pop up the options menu or close the dialog. Will
|
williamr@2
|
81 |
* call c@ SaveFormDataL() before closing if data has been edited. Will
|
williamr@2
|
82 |
* NOT permit exit if attempt to save data fails. If a leave occurs the
|
williamr@2
|
83 |
* framework generates a Symbian Leave code.
|
williamr@2
|
84 |
* @param aButtonId Translates the button presses into commands ID.
|
williamr@2
|
85 |
* @return @c ETrue if the dialog should exit, and @c EFalse if it should
|
williamr@2
|
86 |
* not.
|
williamr@2
|
87 |
*/
|
williamr@2
|
88 |
IMPORT_C virtual TBool OkToExitL( TInt aButtonId );
|
williamr@2
|
89 |
|
williamr@2
|
90 |
/**
|
williamr@2
|
91 |
* Function from @c CEikDialog and thence from c@ MEikDialogPageObserver.
|
williamr@2
|
92 |
* This funtion should be implemented to prepare for focus transition from
|
williamr@2
|
93 |
* the current line. If deleting then this routine must not do anything (the
|
williamr@2
|
94 |
* default tries to access the control which has just been deleted). If a
|
williamr@2
|
95 |
* leave occurs the framework generates a Symbian Leave code.
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
IMPORT_C virtual void PrepareForFocusTransitionL();
|
williamr@2
|
98 |
|
williamr@2
|
99 |
public:
|
williamr@2
|
100 |
|
williamr@2
|
101 |
/**
|
williamr@2
|
102 |
* Function from @c CCoeControl handles a change to the control's resources
|
williamr@2
|
103 |
* of type aType which are shared across the environment, e.g. colors or
|
williamr@2
|
104 |
* fonts.
|
williamr@2
|
105 |
* @param aType. A message UID value.
|
williamr@2
|
106 |
* @since Series 60 2.0
|
williamr@2
|
107 |
*/
|
williamr@2
|
108 |
IMPORT_C void HandleResourceChange(TInt aType);
|
williamr@2
|
109 |
|
williamr@2
|
110 |
/**
|
williamr@2
|
111 |
* From CCoeControl.
|
williamr@2
|
112 |
* Handles pointer events
|
williamr@2
|
113 |
* @param aPointerEvent The pointer event.
|
williamr@2
|
114 |
*/
|
williamr@2
|
115 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
116 |
|
williamr@2
|
117 |
protected:
|
williamr@2
|
118 |
|
williamr@2
|
119 |
/**
|
williamr@2
|
120 |
* This routine should be re-implemented by the client to save the contents
|
williamr@2
|
121 |
* of the form. The re-implementation can call this function to display the
|
williamr@2
|
122 |
* 'Saved' dialog @c CAknForm::SaveFormDataL().
|
williamr@2
|
123 |
* @return @c ETrue if the editable state can be left. The return value should
|
williamr@2
|
124 |
* reflect whether or not the form is to leave the editable state. A real
|
williamr@2
|
125 |
* system problem saving should generate a Symbian Leave code.
|
williamr@2
|
126 |
*/
|
williamr@2
|
127 |
IMPORT_C virtual TBool SaveFormDataL();
|
williamr@2
|
128 |
|
williamr@2
|
129 |
/**
|
williamr@2
|
130 |
* This routine should be implemented by the client for dealing with the
|
williamr@2
|
131 |
* occasion of a change from edit->view mode but the user does not wish to
|
williamr@2
|
132 |
* save the changes. A typical implementation would set the controls back
|
williamr@2
|
133 |
* to their old values. If a leave occurs the framework generates a
|
williamr@2
|
134 |
* Symbian Leave code.
|
williamr@2
|
135 |
*/
|
williamr@2
|
136 |
IMPORT_C virtual void DoNotSaveFormDataL();
|
williamr@2
|
137 |
|
williamr@2
|
138 |
/**
|
williamr@2
|
139 |
* This routine may be overridden. Default displays 'Save Changes Dialog
|
williamr@2
|
140 |
* Yes/No'. Data validation may occur here as an alternative to overriding
|
williamr@2
|
141 |
* @c OkToExit(). Re-implementation may put data validation here (as an
|
williamr@2
|
142 |
* alternative to over-riding @c OkToExit() - which is a more complicated
|
williamr@2
|
143 |
* method). Note that this routine does not perform the changes itself. If
|
williamr@2
|
144 |
* the leave occurs the framework generates a Symbian Leave code.
|
williamr@2
|
145 |
* @return @c ETrue if changes are requested to be saved and then are
|
williamr@2
|
146 |
* successfully saved. Save of data is not performed here but in
|
williamr@2
|
147 |
* @c SaveFormDataL().
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
IMPORT_C virtual TBool QuerySaveChangesL();
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
* This routine may be overridden. Default displays old label as caption and
|
williamr@2
|
153 |
* editor for new one. Uses customised dialog.If a leave occurs the
|
williamr@2
|
154 |
* framework generates a Symbian Leave code.
|
williamr@2
|
155 |
*/
|
williamr@2
|
156 |
IMPORT_C virtual void EditCurrentLabelL();
|
williamr@2
|
157 |
|
williamr@2
|
158 |
/**
|
williamr@2
|
159 |
* This routine may be overridden. Default displays "Delete item? Yes/No"
|
williamr@2
|
160 |
* Deletes item on return from the dialog before returning. If a leave occurs
|
williamr@2
|
161 |
* the framework generates a Symbian Leave code.
|
williamr@2
|
162 |
*/
|
williamr@2
|
163 |
IMPORT_C virtual void DeleteCurrentItemL();
|
williamr@2
|
164 |
|
williamr@2
|
165 |
/**
|
williamr@2
|
166 |
* This routine may be overridden. Implementation is missing in this class.
|
williamr@2
|
167 |
*/
|
williamr@2
|
168 |
IMPORT_C virtual void AddItemL();
|
williamr@2
|
169 |
|
williamr@2
|
170 |
/**
|
williamr@2
|
171 |
* Sets changes pending.
|
williamr@2
|
172 |
* @param aChangesPending @c ETrue if changes are pending. Else @cEFalse.
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
IMPORT_C void SetChangesPending(TBool aChangesPending);
|
williamr@2
|
175 |
|
williamr@2
|
176 |
/**
|
williamr@2
|
177 |
* Function from @c CEikdialog. This function is called by the EIKON
|
williamr@2
|
178 |
* dialog framework just before the dialog is activated, after it has
|
williamr@2
|
179 |
* called @c PreLayoutDynInitL() and the dialog has been sized. If a
|
williamr@2
|
180 |
* leave occurs the framework generates a Symbian Leave code.
|
williamr@2
|
181 |
*/
|
williamr@2
|
182 |
IMPORT_C void PostLayoutDynInitL();
|
williamr@2
|
183 |
|
williamr@2
|
184 |
/**
|
williamr@2
|
185 |
* Overridden, so that the form can tell if a line's state has changed.
|
williamr@2
|
186 |
* This is used to decide when to save changes. If a leave occurs the
|
williamr@2
|
187 |
* framework generates a Symbian Leave code.
|
williamr@2
|
188 |
* @param aControlId. Control id.
|
williamr@2
|
189 |
*/
|
williamr@2
|
190 |
IMPORT_C void HandleControlStateChangeL(TInt aControlId);
|
williamr@2
|
191 |
|
williamr@2
|
192 |
/**
|
williamr@2
|
193 |
* This is added, so that anyone adding lines either in @c PreLayoutDynInit()
|
williamr@2
|
194 |
* or @c SetInitialCurrentLine() should have the lines in a consistent state.
|
williamr@2
|
195 |
*/
|
williamr@2
|
196 |
IMPORT_C void SetInitialCurrentLine();
|
williamr@2
|
197 |
|
williamr@2
|
198 |
/**
|
williamr@2
|
199 |
* Required by @c OkToExit().
|
williamr@2
|
200 |
* @return @c ETrue if unsave editing, and @c EFalse if it
|
williamr@2
|
201 |
* should not.
|
williamr@2
|
202 |
*/
|
williamr@2
|
203 |
IMPORT_C TBool UnsavedEdit() const;
|
williamr@2
|
204 |
|
williamr@2
|
205 |
/**
|
williamr@2
|
206 |
* Required by @c PrepareForFocusTransitionL().
|
williamr@2
|
207 |
* @return @c ETrue if deleting, and @c EFalse if it
|
williamr@2
|
208 |
* should not.
|
williamr@2
|
209 |
*/
|
williamr@2
|
210 |
IMPORT_C TBool Deleting() const;
|
williamr@2
|
211 |
|
williamr@2
|
212 |
enum TFlags
|
williamr@2
|
213 |
{
|
williamr@2
|
214 |
/** Flag for deleting item. */
|
williamr@2
|
215 |
EDeleting = 0x1, // Form flag enum
|
williamr@2
|
216 |
|
williamr@2
|
217 |
/** Flag for unsave editing item. */
|
williamr@2
|
218 |
EUnsavedEdit = 0x2 // Form flag enum
|
williamr@2
|
219 |
};
|
williamr@2
|
220 |
|
williamr@2
|
221 |
/**
|
williamr@2
|
222 |
* Set the form flag indicated.
|
williamr@2
|
223 |
* @param aFlagPattern Pattern of bits to set or clear.
|
williamr@2
|
224 |
* @param aSetTheFlag If @c ETrue, sets the pattern; if @c EFalse, clear the
|
williamr@2
|
225 |
* pattern.
|
williamr@2
|
226 |
*/
|
williamr@2
|
227 |
IMPORT_C void SetFormFlag( TFlags aFlagPattern, TBool aSetTheFlag );
|
williamr@2
|
228 |
|
williamr@2
|
229 |
private:
|
williamr@2
|
230 |
/**
|
williamr@2
|
231 |
* From CAknControl
|
williamr@2
|
232 |
*/
|
williamr@2
|
233 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
234 |
|
williamr@2
|
235 |
private:
|
williamr@2
|
236 |
IMPORT_C virtual void CEikDialog_Reserved_1();
|
williamr@2
|
237 |
IMPORT_C virtual void CEikDialog_Reserved_2();
|
williamr@2
|
238 |
private:
|
williamr@2
|
239 |
IMPORT_C virtual void CAknDialog_Reserved();
|
williamr@2
|
240 |
private:// new function
|
williamr@2
|
241 |
IMPORT_C virtual void CAknForm_Reserved();
|
williamr@2
|
242 |
private: // helpers
|
williamr@2
|
243 |
void DoLayout();
|
williamr@2
|
244 |
private :
|
williamr@2
|
245 |
TInt iMenuBarId ; // resource ID
|
williamr@2
|
246 |
TInt iFlags ;
|
williamr@2
|
247 |
TInt iWsBufferRequestID;
|
williamr@2
|
248 |
} ;
|
williamr@2
|
249 |
|
williamr@2
|
250 |
#endif // __AKNFORM_H__
|