epoc32/include/mw/eikccpu.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) 2002-2006 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:  Provides support for cut, copy, paste and
williamr@2
    15
*                undo functionality in editors.
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
#ifndef EIKCCPU_H
williamr@2
    21
#define EIKCCPU_H
williamr@2
    22
williamr@2
    23
#include <coecntrl.h>
williamr@2
    24
#include <eikdef.h>
williamr@2
    25
#include <eikmobs.h>
williamr@2
    26
#include <babitflags.h>
williamr@2
    27
#include <AknControl.h>
williamr@2
    28
williamr@2
    29
class CEikButtonGroupContainer;
williamr@2
    30
class CEikMenuBar;
williamr@2
    31
williamr@2
    32
williamr@2
    33
/**
williamr@2
    34
 * Interface for cut, copy, paste and undo functionality.
williamr@2
    35
 */
williamr@2
    36
class MEikCcpuEditor
williamr@2
    37
	{
williamr@2
    38
public:
williamr@2
    39
    /**
williamr@2
    40
     * Derived classes must provide the implementation for
williamr@2
    41
     * following:
williamr@2
    42
     *
williamr@2
    43
     * Tests whether the editor is focused.
williamr@2
    44
     * 
williamr@2
    45
     * @return If editor is focused, @c ETrue is returned.
williamr@2
    46
     */
williamr@2
    47
	virtual TBool CcpuIsFocused() const = 0;
williamr@2
    48
	
williamr@2
    49
    /**
williamr@2
    50
     * Derived classes must provide the implementation for
williamr@2
    51
     * following:
williamr@2
    52
     *
williamr@2
    53
     * Tests whether the selected text can be cut.
williamr@2
    54
     * 
williamr@2
    55
     * @return @c ETrue if it is possible to cut the selected text.
williamr@2
    56
     */
williamr@2
    57
	virtual TBool CcpuCanCut() const = 0;
williamr@2
    58
	
williamr@2
    59
    /**
williamr@2
    60
     * Derived classes must provide the implementation for
williamr@2
    61
     * following:
williamr@2
    62
     *
williamr@2
    63
     * Cuts selected text.
williamr@2
    64
     */
williamr@2
    65
	virtual void CcpuCutL() = 0;
williamr@2
    66
	
williamr@2
    67
    /**
williamr@2
    68
     * Derived classes must provide the implementation for
williamr@2
    69
     * following:
williamr@2
    70
     *
williamr@2
    71
     * Tests whether the selected text can be copied.
williamr@2
    72
     * 
williamr@2
    73
     * @return @c ETrue if it is possible to copy the selected text.
williamr@2
    74
     */	
williamr@2
    75
	virtual TBool CcpuCanCopy() const = 0;
williamr@2
    76
williamr@2
    77
    /**
williamr@2
    78
     * Derived classes must provide the implementation for
williamr@2
    79
     * following:
williamr@2
    80
     *
williamr@2
    81
     * Copies selected text.
williamr@2
    82
     */	
williamr@2
    83
	virtual void CcpuCopyL() = 0;
williamr@2
    84
	
williamr@2
    85
    /**
williamr@2
    86
     * Derived classes must provide the implementation for
williamr@2
    87
     * following:
williamr@2
    88
     *
williamr@2
    89
     * Tests whether text can be pasted from the clipboard.
williamr@2
    90
     * 
williamr@2
    91
     * @return @c ETrue if it is possible to paste the clipboard text.
williamr@2
    92
     */	
williamr@2
    93
	virtual TBool CcpuCanPaste() const = 0;
williamr@2
    94
williamr@2
    95
    /**
williamr@2
    96
     * Derived classes must provide the implementation for
williamr@2
    97
     * following:
williamr@2
    98
     *
williamr@2
    99
     * Pastes text from the clipboard to the editor.
williamr@2
   100
     */	
williamr@2
   101
	virtual void CcpuPasteL() = 0;
williamr@2
   102
	
williamr@2
   103
	/**
williamr@2
   104
     * Derived classes must provide the implementation for
williamr@2
   105
     * following:
williamr@2
   106
     *
williamr@2
   107
     * Tests is it possible to undo previous operation.
williamr@2
   108
     * 
williamr@2
   109
     * @return @c ETrue if it is possible to undo previous operation.
williamr@2
   110
     */	
williamr@2
   111
	virtual TBool CcpuCanUndo() const = 0;
williamr@2
   112
	
williamr@2
   113
    /**
williamr@2
   114
     * Derived classes must provide the implementation for
williamr@2
   115
     * following:
williamr@2
   116
     *
williamr@2
   117
     * Undoes the most recent text operation when the editor supports this
williamr@2
   118
     * feature and when the undo store is not empty
williamr@2
   119
     */	
williamr@2
   120
	virtual void CcpuUndoL() = 0;
williamr@2
   121
	};
williamr@2
   122
williamr@2
   123
/**
williamr@2
   124
 * Cut, copy, paste and undo support class. Takes care
williamr@2
   125
 * of CBA handling and menu command processing when FEP
williamr@2
   126
 * instructs this control to activate the commands
williamr@2
   127
 * for ccpu operations.
williamr@2
   128
 */
williamr@2
   129
class CAknCcpuSupport : public CAknControl, public MEikMenuObserver
williamr@2
   130
	{
williamr@2
   131
public:
williamr@2
   132
    /**
williamr@2
   133
     * Constructor. ConstructL() must be called after a call
williamr@2
   134
     * to this function.
williamr@2
   135
     *
williamr@2
   136
     * @param aEditor A pointer to the editor implementing the
williamr@2
   137
     * MEikCcpuEditor interface.
williamr@2
   138
     */
williamr@2
   139
	IMPORT_C CAknCcpuSupport(MEikCcpuEditor* aEditor);
williamr@2
   140
	
williamr@2
   141
	/**
williamr@2
   142
	 * Destructor.
williamr@2
   143
	 */
williamr@2
   144
	IMPORT_C ~CAknCcpuSupport();
williamr@2
   145
	
williamr@2
   146
	/**
williamr@2
   147
	 * 2nd phase constructor.
williamr@2
   148
	 *
williamr@2
   149
	 * Adds this control to the control stack.
williamr@2
   150
	 */
williamr@2
   151
	IMPORT_C void ConstructL();
williamr@2
   152
williamr@2
   153
    /**
williamr@2
   154
     * Updates the CBA labels according to selection and
williamr@2
   155
     * clipboard contents.
williamr@2
   156
     */
williamr@2
   157
	IMPORT_C void HandleSelectionChangeL();
williamr@2
   158
	
williamr@2
   159
	/**
williamr@2
   160
	 * Updates the CBA labels according to editor focus
williamr@2
   161
	 * state.
williamr@2
   162
	 */
williamr@2
   163
	IMPORT_C void HandleFocusChangeL();
williamr@2
   164
williamr@2
   165
	// from CCoeControl
williamr@2
   166
    
williamr@2
   167
    /**
williamr@2
   168
     * Responds to key presses.
williamr@2
   169
     * 
williamr@2
   170
     * Overrides CCoeControl::OfferKeyEventL().
williamr@2
   171
     * 
williamr@2
   172
     * @param aKeyEvent The key event.
williamr@2
   173
     * @param aType Not used.
williamr@2
   174
     * @return Indicates whether or not the key event was consumed.
williamr@2
   175
     */	
williamr@2
   176
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
williamr@2
   177
williamr@2
   178
    /**
williamr@2
   179
     * From @c CCoeControl.
williamr@2
   180
     * 
williamr@2
   181
     * Handles pointer events.
williamr@2
   182
     *
williamr@2
   183
     * @param aPointerEvent The pointer event.
williamr@2
   184
     */
williamr@2
   185
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   186
williamr@2
   187
	// from MEikMenuObserver
williamr@2
   188
	
williamr@2
   189
	/**
williamr@2
   190
	 * From MEikMenuObserver.
williamr@2
   191
	 * 
williamr@2
   192
	 * Dynamically initialises a menu pane.
williamr@2
   193
	 *
williamr@2
   194
	 * @param aResourceId Resource ID of the menu.
williamr@2
   195
	 * @param aMenuPane The in-memory representation of the menu pane.
williamr@2
   196
	 */
williamr@2
   197
	IMPORT_C void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
williamr@2
   198
williamr@2
   199
    /**
williamr@2
   200
     * From MEikCommandObserver.
williamr@2
   201
     *
williamr@2
   202
     * Processes user commands.
williamr@2
   203
     *
williamr@2
   204
     * @param aCommandId ID of the command to respond to.
williamr@2
   205
     */
williamr@2
   206
	IMPORT_C void ProcessCommandL(TInt aCommandId);
williamr@2
   207
williamr@2
   208
private:
williamr@4
   209
    void UpdateCBALabelsL();
williamr@4
   210
    TBool UpdateCBALabelL(TInt aPosition, TInt aCommandId, TInt aTextResId);
williamr@4
   211
    void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis);
williamr@4
   212
    void DeleteCBAL();
williamr@2
   213
williamr@2
   214
private:
williamr@2
   215
    /**
williamr@2
   216
    * From CAknControl
williamr@2
   217
    */
williamr@2
   218
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   219
private:
williamr@4
   220
    TBitFlags iFlags;
williamr@4
   221
    TBool isCbaEmded;
williamr@4
   222
    // Owned
williamr@4
   223
    CEikButtonGroupContainer* iCba;
williamr@4
   224
    
williamr@2
   225
williamr@2
   226
	// Not owned
williamr@2
   227
	CEikMenuBar* iMenu;
williamr@2
   228
	MEikCcpuEditor* iEditor;
williamr@4
   229
	CEikButtonGroupContainer* iDialogCba;
williamr@2
   230
	};
williamr@2
   231
williamr@2
   232
#endif // EIKCCPU_H