epoc32/include/mw/eiklbed.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1997-1999 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@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.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
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
   
williamr@2
    19
#if !defined(__EIKLBED_H__)
williamr@2
    20
#define __EIKLBED_H__
williamr@2
    21
williamr@2
    22
#if !defined(__E32BASE_H__)
williamr@2
    23
#include <e32base.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
#if !defined(__EIKLBM_H__)
williamr@2
    27
#include <eiklbm.h>
williamr@2
    28
#endif
williamr@2
    29
williamr@2
    30
#if !defined(__W32STD_H__)
williamr@2
    31
#include <w32std.h>
williamr@2
    32
#endif
williamr@2
    33
williamr@2
    34
#if !defined(__COEDEF_H__)
williamr@2
    35
#include <coedef.h>
williamr@2
    36
#endif
williamr@2
    37
williamr@2
    38
#if !defined(__COECNTRL_H__)
williamr@2
    39
#include <coecntrl.h>
williamr@2
    40
#endif
williamr@2
    41
williamr@4
    42
#include <AknControl.h>
williamr@2
    43
williamr@2
    44
class CEikEdwin;
williamr@2
    45
class CParaFormatLayer;
williamr@2
    46
class CCharFormatLayer;
williamr@2
    47
williamr@2
    48
/**
williamr@2
    49
 * The MEikListBoxEditor class specifies an interface to a text editor which can be used inside
williamr@2
    50
 * a list box.
williamr@2
    51
 *
williamr@2
    52
 * @since ER5U
williamr@2
    53
 */
williamr@2
    54
class MEikListBoxEditor
williamr@2
    55
	{
williamr@2
    56
public:
williamr@2
    57
    /**
williamr@2
    58
     * Returns a pointer to the current editable item text.
williamr@2
    59
     */
williamr@2
    60
	virtual TPtrC ItemText() = 0;
williamr@2
    61
williamr@2
    62
    /**
williamr@2
    63
     * Creates the editor inside the list box aContainer. The editor occupies the rectangle aRect
williamr@2
    64
     * and is used to editor the contents of the item at index aItemIndex up to a maximum length of
williamr@2
    65
     * aMaxLength characters..
williamr@2
    66
     */
williamr@2
    67
	virtual void StartEditingL(const CCoeControl& aContainer,const TRect& aRect,TInt aItemIndex,TInt aMaxLength) = 0;
williamr@2
    68
williamr@2
    69
    /**
williamr@2
    70
     * Stops editing and deletes the item editor. 
williamr@2
    71
     */
williamr@2
    72
	virtual void StopEditingL() = 0;
williamr@2
    73
williamr@2
    74
    /**
williamr@2
    75
	 * Updates the list box model with the new item contents.
williamr@2
    76
	 */
williamr@2
    77
	virtual TBool UpdateModelL() = 0;
williamr@2
    78
williamr@2
    79
	/**
williamr@2
    80
	 * Deletes the editor.
williamr@2
    81
	 */
williamr@2
    82
	virtual void Release() = 0;
williamr@2
    83
private:
williamr@2
    84
	IMPORT_C virtual void MEikListBoxEditor_Reserved_1();
williamr@2
    85
	};
williamr@2
    86
williamr@2
    87
class MListBoxEditorObserver
williamr@2
    88
	{
williamr@2
    89
public:
williamr@2
    90
	virtual TKeyResponse HandleListBoxEditorEventL(MEikListBoxEditor* aListBoxEditor, const TKeyEvent& aKeyEvent)=0;
williamr@2
    91
	};
williamr@2
    92
williamr@2
    93
/**
williamr@2
    94
* The @c CEikListBoxTextEditor implements a text list box item editor. This 
williamr@2
    95
* editor is used inside of listbox items for editing the list box item text.  
williamr@2
    96
*
williamr@2
    97
* @since ER5U
williamr@2
    98
*/
williamr@2
    99
class CEikListBoxTextEditor : public CAknControl, public MEikListBoxEditor
williamr@2
   100
	{
williamr@2
   101
public:
williamr@2
   102
williamr@2
   103
    /**
williamr@2
   104
     * C++ default constructor.
williamr@2
   105
     *
williamr@2
   106
     * @param aModel Model class of the list box.
williamr@2
   107
     */
williamr@2
   108
	IMPORT_C CEikListBoxTextEditor(MListBoxModel* aModel);
williamr@2
   109
	
williamr@2
   110
    /**
williamr@2
   111
     * Destructor
williamr@2
   112
     */
williamr@2
   113
	IMPORT_C ~CEikListBoxTextEditor();
williamr@2
   114
williamr@2
   115
    /**
williamr@2
   116
     * Sets font to the text editor
williamr@2
   117
     *
williamr@2
   118
     * @param aFont New font for the text editor.
williamr@2
   119
     */
williamr@2
   120
	IMPORT_C void SetFont(const CFont* aFont);
williamr@2
   121
williamr@2
   122
    /**
williamr@2
   123
     * Gets text editor instance as @c CEikEdwin.
williamr@2
   124
     *
williamr@2
   125
     * @return CEikEdwin* Pointer to the text editor base class instance. 
williamr@2
   126
     */
williamr@2
   127
	IMPORT_C CEikEdwin* Editor();
williamr@2
   128
williamr@2
   129
    /**
williamr@2
   130
     * Sets observer to the text editor. 
williamr@2
   131
     *
williamr@2
   132
     * @param aObserver The list box editor observer interface.
williamr@2
   133
     */
williamr@2
   134
	IMPORT_C void SetListBoxEditorObserver(MListBoxEditorObserver* aObserver);
williamr@2
   135
williamr@2
   136
public: // from MEikListBoxEditor
williamr@2
   137
williamr@2
   138
    /**
williamr@2
   139
     * From @c MEikListBoxEditor. 
williamr@2
   140
     * This function returns the text of the list box item.
williamr@2
   141
     *
williamr@2
   142
     * @return TPtrC Pointer descriptor to the list box item text.
williamr@2
   143
     */
williamr@2
   144
	IMPORT_C TPtrC ItemText();
williamr@2
   145
williamr@2
   146
	/**
williamr@2
   147
     * From @c MEikListBoxEditor. 
williamr@2
   148
     * This function creates text editor inside the 
williamr@2
   149
     * list box item and starts editing of the item text. The list box item can 
williamr@2
   150
     * contain partly editable text. This text is between '\\n' chars and this
williamr@2
   151
     * control does not modify it. 
williamr@2
   152
     *
williamr@2
   153
     * @param aContainer Container class of the list box.
williamr@2
   154
     * @param aRect Retangle of the list box item.
williamr@2
   155
     * @param aItemIndex Index of the list box item where text editor will be
williamr@2
   156
     *					created.
williamr@2
   157
     * @param aMaxLength Maximum length of editor in characters.
williamr@2
   158
     */
williamr@2
   159
	IMPORT_C void StartEditingL(const CCoeControl& aContainer, 
williamr@2
   160
								const TRect& aRect, 
williamr@2
   161
								TInt aItemIndex, 
williamr@2
   162
								TInt aMaxLength);
williamr@2
   163
	
williamr@2
   164
    /**
williamr@2
   165
     * From @c MEikListBoxEditor. 
williamr@2
   166
     * Stops editing the current item and deletes the text editor. 
williamr@2
   167
     */
williamr@2
   168
	IMPORT_C void StopEditingL();
williamr@2
   169
williamr@2
   170
    /**
williamr@2
   171
     * From @c MEikListBoxEditor. 
williamr@2
   172
     * Updates the list box model with new text from text editor. If text is 
williamr@2
   173
     * partly editable, string between '\n' chars is not updated.
williamr@2
   174
     *
williamr@2
   175
     * @return TBool @c EFalse if editing is not currently on otherwise @c ETrue
williamr@2
   176
     */
williamr@2
   177
	IMPORT_C TBool UpdateModelL();
williamr@2
   178
williamr@2
   179
	/**
williamr@2
   180
     * From @c CCoeControl. 
williamr@2
   181
     * Handles key press events. Called by the control framework.
williamr@2
   182
     *
williamr@2
   183
     * @param aKeyEvent The key event 
williamr@2
   184
     * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or 
williamr@2
   185
     *              @c EEventKeyDown.
williamr@2
   186
     * @return TKeyResponse Indicates whether or not the key event was used by 
williamr@2
   187
     *                      this control.
williamr@2
   188
     */
williamr@2
   189
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 
williamr@2
   190
										 TEventCode aType);
williamr@2
   191
williamr@2
   192
public: // From CCoeControl
williamr@2
   193
williamr@2
   194
    /**
williamr@2
   195
     * From @c CCoeControl. 
williamr@2
   196
     * Handles pointer events.
williamr@2
   197
     *
williamr@2
   198
     * @param aPointerEvent The pointer event.
williamr@2
   199
     */	
williamr@2
   200
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   201
    	
williamr@2
   202
protected: // from MEikListBoxEditor
williamr@2
   203
williamr@2
   204
    /**
williamr@2
   205
     * From @c MEikListBoxEditor. 
williamr@2
   206
     * Deletes the editor. 
williamr@2
   207
     */
williamr@2
   208
	IMPORT_C void Release();
williamr@2
   209
williamr@2
   210
protected:
williamr@2
   211
williamr@2
   212
    /**
williamr@2
   213
     * Gets the list box model.
williamr@2
   214
     *
williamr@2
   215
     * @return MListBoxModel* Pointer to the list box model instance.
williamr@2
   216
     */
williamr@2
   217
	IMPORT_C MListBoxModel* ListBoxModel();
williamr@2
   218
williamr@2
   219
    /**
williamr@2
   220
     * Function for getting the list box item index that holds the text editor.
williamr@2
   221
     *
williamr@2
   222
     * @return TInt Index of the list box item that holds the text editor.
williamr@2
   223
     */
williamr@2
   224
	IMPORT_C TInt ItemIndex() const;
williamr@2
   225
williamr@2
   226
private: // from MEikListBoxEditor
williamr@2
   227
williamr@2
   228
	IMPORT_C void MEikListBoxEditor_Reserved_1();
williamr@2
   229
williamr@2
   230
protected:
williamr@2
   231
williamr@2
   232
    /**
williamr@2
   233
     * This function writes the internal state of the control and its components
williamr@2
   234
     * to @c aStream in debug mode. Does nothing in release mode. 
williamr@2
   235
     *
williamr@2
   236
     * @param aWriteStream Stream where control and its components internal 
williamr@2
   237
     *                     state will be written.
williamr@2
   238
     */
williamr@2
   239
	IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   240
williamr@2
   241
private:
williamr@2
   242
williamr@2
   243
	void UseFontL(CEikEdwin& editor, const CFont& aFont);
williamr@2
   244
williamr@2
   245
	TPtrC EditableItemText(TRect* aRect=NULL);
williamr@2
   246
williamr@2
   247
private:
williamr@2
   248
    /**
williamr@2
   249
    * From CAknControl
williamr@2
   250
    */
williamr@2
   251
    IMPORT_C void* ExtensionInterface(TUid aInterface);
williamr@2
   252
williamr@2
   253
private:
williamr@2
   254
	MListBoxEditorObserver* iEditorObserver;
williamr@2
   255
	MListBoxModel*  iModel;
williamr@2
   256
	CEikEdwin*		iEditor;
williamr@2
   257
	TInt            iItemIndex;
williamr@2
   258
	CFont*          iFont;
williamr@2
   259
	TInt			iItemPos;
williamr@2
   260
	TInt			iItemLen;
williamr@2
   261
	CParaFormatLayer* iParaFormatLayer;
williamr@2
   262
	CCharFormatLayer* iCharFormatLayer;
williamr@2
   263
    TInt iSpare[2];
williamr@2
   264
	};
williamr@2
   265
williamr@2
   266
#endif
williamr@2
   267
williamr@2
   268
williamr@2
   269
//  End of File