1.1 --- a/epoc32/include/mw/eikccpu.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eikccpu.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,229 @@
1.4 -eikccpu.h
1.5 +/*
1.6 +* Copyright (c) 2002-2006 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: Provides support for cut, copy, paste and
1.19 +* undo functionality in editors.
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +#ifndef EIKCCPU_H
1.25 +#define EIKCCPU_H
1.26 +
1.27 +#include <coecntrl.h>
1.28 +#include <eikdef.h>
1.29 +#include <eikmobs.h>
1.30 +#include <babitflags.h>
1.31 +#include <AknControl.h>
1.32 +
1.33 +class CEikButtonGroupContainer;
1.34 +class CEikMenuBar;
1.35 +
1.36 +
1.37 +/**
1.38 + * Interface for cut, copy, paste and undo functionality.
1.39 + */
1.40 +class MEikCcpuEditor
1.41 + {
1.42 +public:
1.43 + /**
1.44 + * Derived classes must provide the implementation for
1.45 + * following:
1.46 + *
1.47 + * Tests whether the editor is focused.
1.48 + *
1.49 + * @return If editor is focused, @c ETrue is returned.
1.50 + */
1.51 + virtual TBool CcpuIsFocused() const = 0;
1.52 +
1.53 + /**
1.54 + * Derived classes must provide the implementation for
1.55 + * following:
1.56 + *
1.57 + * Tests whether the selected text can be cut.
1.58 + *
1.59 + * @return @c ETrue if it is possible to cut the selected text.
1.60 + */
1.61 + virtual TBool CcpuCanCut() const = 0;
1.62 +
1.63 + /**
1.64 + * Derived classes must provide the implementation for
1.65 + * following:
1.66 + *
1.67 + * Cuts selected text.
1.68 + */
1.69 + virtual void CcpuCutL() = 0;
1.70 +
1.71 + /**
1.72 + * Derived classes must provide the implementation for
1.73 + * following:
1.74 + *
1.75 + * Tests whether the selected text can be copied.
1.76 + *
1.77 + * @return @c ETrue if it is possible to copy the selected text.
1.78 + */
1.79 + virtual TBool CcpuCanCopy() const = 0;
1.80 +
1.81 + /**
1.82 + * Derived classes must provide the implementation for
1.83 + * following:
1.84 + *
1.85 + * Copies selected text.
1.86 + */
1.87 + virtual void CcpuCopyL() = 0;
1.88 +
1.89 + /**
1.90 + * Derived classes must provide the implementation for
1.91 + * following:
1.92 + *
1.93 + * Tests whether text can be pasted from the clipboard.
1.94 + *
1.95 + * @return @c ETrue if it is possible to paste the clipboard text.
1.96 + */
1.97 + virtual TBool CcpuCanPaste() const = 0;
1.98 +
1.99 + /**
1.100 + * Derived classes must provide the implementation for
1.101 + * following:
1.102 + *
1.103 + * Pastes text from the clipboard to the editor.
1.104 + */
1.105 + virtual void CcpuPasteL() = 0;
1.106 +
1.107 + /**
1.108 + * Derived classes must provide the implementation for
1.109 + * following:
1.110 + *
1.111 + * Tests is it possible to undo previous operation.
1.112 + *
1.113 + * @return @c ETrue if it is possible to undo previous operation.
1.114 + */
1.115 + virtual TBool CcpuCanUndo() const = 0;
1.116 +
1.117 + /**
1.118 + * Derived classes must provide the implementation for
1.119 + * following:
1.120 + *
1.121 + * Undoes the most recent text operation when the editor supports this
1.122 + * feature and when the undo store is not empty
1.123 + */
1.124 + virtual void CcpuUndoL() = 0;
1.125 + };
1.126 +
1.127 +/**
1.128 + * Cut, copy, paste and undo support class. Takes care
1.129 + * of CBA handling and menu command processing when FEP
1.130 + * instructs this control to activate the commands
1.131 + * for ccpu operations.
1.132 + */
1.133 +class CAknCcpuSupport : public CAknControl, public MEikMenuObserver
1.134 + {
1.135 +public:
1.136 + /**
1.137 + * Constructor. ConstructL() must be called after a call
1.138 + * to this function.
1.139 + *
1.140 + * @param aEditor A pointer to the editor implementing the
1.141 + * MEikCcpuEditor interface.
1.142 + */
1.143 + IMPORT_C CAknCcpuSupport(MEikCcpuEditor* aEditor);
1.144 +
1.145 + /**
1.146 + * Destructor.
1.147 + */
1.148 + IMPORT_C ~CAknCcpuSupport();
1.149 +
1.150 + /**
1.151 + * 2nd phase constructor.
1.152 + *
1.153 + * Adds this control to the control stack.
1.154 + */
1.155 + IMPORT_C void ConstructL();
1.156 +
1.157 + /**
1.158 + * Updates the CBA labels according to selection and
1.159 + * clipboard contents.
1.160 + */
1.161 + IMPORT_C void HandleSelectionChangeL();
1.162 +
1.163 + /**
1.164 + * Updates the CBA labels according to editor focus
1.165 + * state.
1.166 + */
1.167 + IMPORT_C void HandleFocusChangeL();
1.168 +
1.169 + // from CCoeControl
1.170 +
1.171 + /**
1.172 + * Responds to key presses.
1.173 + *
1.174 + * Overrides CCoeControl::OfferKeyEventL().
1.175 + *
1.176 + * @param aKeyEvent The key event.
1.177 + * @param aType Not used.
1.178 + * @return Indicates whether or not the key event was consumed.
1.179 + */
1.180 + IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
1.181 +
1.182 + /**
1.183 + * From @c CCoeControl.
1.184 + *
1.185 + * Handles pointer events.
1.186 + *
1.187 + * @param aPointerEvent The pointer event.
1.188 + */
1.189 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.190 +
1.191 + // from MEikMenuObserver
1.192 +
1.193 + /**
1.194 + * From MEikMenuObserver.
1.195 + *
1.196 + * Dynamically initialises a menu pane.
1.197 + *
1.198 + * @param aResourceId Resource ID of the menu.
1.199 + * @param aMenuPane The in-memory representation of the menu pane.
1.200 + */
1.201 + IMPORT_C void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
1.202 +
1.203 + /**
1.204 + * From MEikCommandObserver.
1.205 + *
1.206 + * Processes user commands.
1.207 + *
1.208 + * @param aCommandId ID of the command to respond to.
1.209 + */
1.210 + IMPORT_C void ProcessCommandL(TInt aCommandId);
1.211 +
1.212 +private:
1.213 + void UpdateCBALabelsL();
1.214 + TBool UpdateCBALabelL(TInt aPosition, TInt aCommandId, TInt aTextResId);
1.215 + void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis);
1.216 +
1.217 +private:
1.218 + /**
1.219 + * From CAknControl
1.220 + */
1.221 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.222 +private:
1.223 + TBitFlags iFlags;
1.224 +
1.225 + // Owned
1.226 + CEikButtonGroupContainer* iCba;
1.227 +
1.228 + // Not owned
1.229 + CEikMenuBar* iMenu;
1.230 + MEikCcpuEditor* iEditor;
1.231 + };
1.232 +
1.233 +#endif // EIKCCPU_H