1.1 --- a/epoc32/include/mw/eiklbed.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eiklbed.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,269 @@
1.4 -eiklbed.h
1.5 +/*
1.6 +* Copyright (c) 1997-1999 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 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#if !defined(__EIKLBED_H__)
1.24 +#define __EIKLBED_H__
1.25 +
1.26 +#if !defined(__E32BASE_H__)
1.27 +#include <e32base.h>
1.28 +#endif
1.29 +
1.30 +#if !defined(__EIKLBM_H__)
1.31 +#include <eiklbm.h>
1.32 +#endif
1.33 +
1.34 +#if !defined(__W32STD_H__)
1.35 +#include <w32std.h>
1.36 +#endif
1.37 +
1.38 +#if !defined(__COEDEF_H__)
1.39 +#include <coedef.h>
1.40 +#endif
1.41 +
1.42 +#if !defined(__COECNTRL_H__)
1.43 +#include <coecntrl.h>
1.44 +#endif
1.45 +
1.46 +#include <akncontrol.h>
1.47 +
1.48 +class CEikEdwin;
1.49 +class CParaFormatLayer;
1.50 +class CCharFormatLayer;
1.51 +
1.52 +/**
1.53 + * The MEikListBoxEditor class specifies an interface to a text editor which can be used inside
1.54 + * a list box.
1.55 + *
1.56 + * @since ER5U
1.57 + */
1.58 +class MEikListBoxEditor
1.59 + {
1.60 +public:
1.61 + /**
1.62 + * Returns a pointer to the current editable item text.
1.63 + */
1.64 + virtual TPtrC ItemText() = 0;
1.65 +
1.66 + /**
1.67 + * Creates the editor inside the list box aContainer. The editor occupies the rectangle aRect
1.68 + * and is used to editor the contents of the item at index aItemIndex up to a maximum length of
1.69 + * aMaxLength characters..
1.70 + */
1.71 + virtual void StartEditingL(const CCoeControl& aContainer,const TRect& aRect,TInt aItemIndex,TInt aMaxLength) = 0;
1.72 +
1.73 + /**
1.74 + * Stops editing and deletes the item editor.
1.75 + */
1.76 + virtual void StopEditingL() = 0;
1.77 +
1.78 + /**
1.79 + * Updates the list box model with the new item contents.
1.80 + */
1.81 + virtual TBool UpdateModelL() = 0;
1.82 +
1.83 + /**
1.84 + * Deletes the editor.
1.85 + */
1.86 + virtual void Release() = 0;
1.87 +private:
1.88 + IMPORT_C virtual void MEikListBoxEditor_Reserved_1();
1.89 + };
1.90 +
1.91 +class MListBoxEditorObserver
1.92 + {
1.93 +public:
1.94 + virtual TKeyResponse HandleListBoxEditorEventL(MEikListBoxEditor* aListBoxEditor, const TKeyEvent& aKeyEvent)=0;
1.95 + };
1.96 +
1.97 +/**
1.98 +* The @c CEikListBoxTextEditor implements a text list box item editor. This
1.99 +* editor is used inside of listbox items for editing the list box item text.
1.100 +*
1.101 +* @since ER5U
1.102 +*/
1.103 +class CEikListBoxTextEditor : public CAknControl, public MEikListBoxEditor
1.104 + {
1.105 +public:
1.106 +
1.107 + /**
1.108 + * C++ default constructor.
1.109 + *
1.110 + * @param aModel Model class of the list box.
1.111 + */
1.112 + IMPORT_C CEikListBoxTextEditor(MListBoxModel* aModel);
1.113 +
1.114 + /**
1.115 + * Destructor
1.116 + */
1.117 + IMPORT_C ~CEikListBoxTextEditor();
1.118 +
1.119 + /**
1.120 + * Sets font to the text editor
1.121 + *
1.122 + * @param aFont New font for the text editor.
1.123 + */
1.124 + IMPORT_C void SetFont(const CFont* aFont);
1.125 +
1.126 + /**
1.127 + * Gets text editor instance as @c CEikEdwin.
1.128 + *
1.129 + * @return CEikEdwin* Pointer to the text editor base class instance.
1.130 + */
1.131 + IMPORT_C CEikEdwin* Editor();
1.132 +
1.133 + /**
1.134 + * Sets observer to the text editor.
1.135 + *
1.136 + * @param aObserver The list box editor observer interface.
1.137 + */
1.138 + IMPORT_C void SetListBoxEditorObserver(MListBoxEditorObserver* aObserver);
1.139 +
1.140 +public: // from MEikListBoxEditor
1.141 +
1.142 + /**
1.143 + * From @c MEikListBoxEditor.
1.144 + * This function returns the text of the list box item.
1.145 + *
1.146 + * @return TPtrC Pointer descriptor to the list box item text.
1.147 + */
1.148 + IMPORT_C TPtrC ItemText();
1.149 +
1.150 + /**
1.151 + * From @c MEikListBoxEditor.
1.152 + * This function creates text editor inside the
1.153 + * list box item and starts editing of the item text. The list box item can
1.154 + * contain partly editable text. This text is between '\\n' chars and this
1.155 + * control does not modify it.
1.156 + *
1.157 + * @param aContainer Container class of the list box.
1.158 + * @param aRect Retangle of the list box item.
1.159 + * @param aItemIndex Index of the list box item where text editor will be
1.160 + * created.
1.161 + * @param aMaxLength Maximum length of editor in characters.
1.162 + */
1.163 + IMPORT_C void StartEditingL(const CCoeControl& aContainer,
1.164 + const TRect& aRect,
1.165 + TInt aItemIndex,
1.166 + TInt aMaxLength);
1.167 +
1.168 + /**
1.169 + * From @c MEikListBoxEditor.
1.170 + * Stops editing the current item and deletes the text editor.
1.171 + */
1.172 + IMPORT_C void StopEditingL();
1.173 +
1.174 + /**
1.175 + * From @c MEikListBoxEditor.
1.176 + * Updates the list box model with new text from text editor. If text is
1.177 + * partly editable, string between '\n' chars is not updated.
1.178 + *
1.179 + * @return TBool @c EFalse if editing is not currently on otherwise @c ETrue
1.180 + */
1.181 + IMPORT_C TBool UpdateModelL();
1.182 +
1.183 + /**
1.184 + * From @c CCoeControl.
1.185 + * Handles key press events. Called by the control framework.
1.186 + *
1.187 + * @param aKeyEvent The key event
1.188 + * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or
1.189 + * @c EEventKeyDown.
1.190 + * @return TKeyResponse Indicates whether or not the key event was used by
1.191 + * this control.
1.192 + */
1.193 + IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
1.194 + TEventCode aType);
1.195 +
1.196 +public: // From CCoeControl
1.197 +
1.198 + /**
1.199 + * From @c CCoeControl.
1.200 + * Handles pointer events.
1.201 + *
1.202 + * @param aPointerEvent The pointer event.
1.203 + */
1.204 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.205 +
1.206 +protected: // from MEikListBoxEditor
1.207 +
1.208 + /**
1.209 + * From @c MEikListBoxEditor.
1.210 + * Deletes the editor.
1.211 + */
1.212 + IMPORT_C void Release();
1.213 +
1.214 +protected:
1.215 +
1.216 + /**
1.217 + * Gets the list box model.
1.218 + *
1.219 + * @return MListBoxModel* Pointer to the list box model instance.
1.220 + */
1.221 + IMPORT_C MListBoxModel* ListBoxModel();
1.222 +
1.223 + /**
1.224 + * Function for getting the list box item index that holds the text editor.
1.225 + *
1.226 + * @return TInt Index of the list box item that holds the text editor.
1.227 + */
1.228 + IMPORT_C TInt ItemIndex() const;
1.229 +
1.230 +private: // from MEikListBoxEditor
1.231 +
1.232 + IMPORT_C void MEikListBoxEditor_Reserved_1();
1.233 +
1.234 +protected:
1.235 +
1.236 + /**
1.237 + * This function writes the internal state of the control and its components
1.238 + * to @c aStream in debug mode. Does nothing in release mode.
1.239 + *
1.240 + * @param aWriteStream Stream where control and its components internal
1.241 + * state will be written.
1.242 + */
1.243 + IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
1.244 +
1.245 +private:
1.246 +
1.247 + void UseFontL(CEikEdwin& editor, const CFont& aFont);
1.248 +
1.249 + TPtrC EditableItemText(TRect* aRect=NULL);
1.250 +
1.251 +private:
1.252 + /**
1.253 + * From CAknControl
1.254 + */
1.255 + IMPORT_C void* ExtensionInterface(TUid aInterface);
1.256 +
1.257 +private:
1.258 + MListBoxEditorObserver* iEditorObserver;
1.259 + MListBoxModel* iModel;
1.260 + CEikEdwin* iEditor;
1.261 + TInt iItemIndex;
1.262 + CFont* iFont;
1.263 + TInt iItemPos;
1.264 + TInt iItemLen;
1.265 + CParaFormatLayer* iParaFormatLayer;
1.266 + CCharFormatLayer* iCharFormatLayer;
1.267 + TInt iSpare[2];
1.268 + };
1.269 +
1.270 +#endif
1.271 +
1.272 +
1.273 +// End of File
1.274 \ No newline at end of file