📄 fepcontrol.h
字号:
#if !defined(__E32BASE_H__)
#include <E32BASE.H>
#endif
#if !defined(__W32STD_H__)
#include <W32STD.H>
#endif
#if !defined(__FRMTLAY_H__)
#include <FRMTLAY.H>
#endif
#if !defined(__COEMAIN_H__)
#include <COEMAIN.H>
#endif
#if !defined(__COECNTRL_H__)
#include <COECNTRL.H>
#endif
#if !defined(__FEPBASE_H__)
#include <FEPBASE.H>
#endif
#if !defined(__FEPITFR_H__)
#include <FEPITFR.H>
#endif
#if !defined(__EIKDIALG_H__)
#include <EIKDIALG.H>
#endif
#if !defined(__AKNLISTS_H__)
#include <AKNLISTS.H>
#endif
#if !defined(__EIKMOBS_H__)
#include <EIKMOBS.H>
#endif
#if !defined(__AKNEDSTSOBS_H__)
#include <AKNEDSTSOBS.H>
#endif
#include "eQtapnumeric.h"
#include "eQTapMultitap.h"
#include "eQTapInterpunction.h"
#include "eQTapSmartEnglish.h"
#include "eQTapSmartChinese.h"
#include "eQTapStroke.h"
// Forward declarations
class CExampleFep;
class CAknEdwinState;
class CExampleFepMultiTapEngine;
class CAknNavigationControlContainer;
class CAknNavigationDecorator;
class CFepIndicator;
class CeQTapNumeric;
class CeQTapMultitap;
class CeQTapInterpunction;
class CeQTapSmartEnglish;
class CeQTapSmartChinese;
class CeQTapStroke;
#ifdef __WINS__
#define KEYCHANGEIM 19
#else
#define KEYCHANGEIM 18
#endif
#define EAknEditorBiHUa 0x100 //笔画
#define EAknEditorInterpunction 0x101 //标点
#define EAknEditorSmartEnglish 0x102 //英文
#define EAknEditorEnglish 0x103 //字母
#define EAKnEditorSmartChinese 0x104 //拼音
#define ENABLETEXT 0x20
#define DISABLETEXT 0x10
#ifdef USE_SMARTENGLISH
#define TOTAL_IM_MODE 5
const TInt g_nIMModeArray[] =
{
EAknEditorTextInputMode,/// ABC
EAknEditorBiHUa, ///
// EAknEditorEnglish,
EAknEditorSmartEnglish,
EAKnEditorSmartChinese,
EAknEditorNumericInputMode,
};
#else //USE_SMARTENGLISH
#define TOTAL_IM_MODE 4
const TInt g_nIMModeArray[] =
{
EAknEditorTextInputMode,/// ABC
EAknEditorBiHUa, ///
// EAknEditorEnglish,
// EAknEditorSmartEnglish,
EAKnEditorSmartChinese,
EAknEditorNumericInputMode,
};
#endif//USE_SMARTENGLISH
#define TEXTCOLOR TRgb(0,0,0) //文本颜色
#define HIGHLIGHTTEXTCOLOR TRgb(255,0,0) //高亮字的颜色
#define DISPLAYBRUSHCOLOR TRgb(255,255,206) //上面两个选区的颜色
#define CANDBRUSHCOLOR TRgb(247,219,212) //备选的颜色
#define LINECOLOR TRgb(123,123,123) //分隔线的颜色
#define CANDCOLOR TRgb(0,0,255) //备选字标号的颜色
#define ARROWCOLOR TRgb(200,200,200) //分隔线的颜色
#define DISABLETEXTCOLOR TRgb(100,100,100) //分隔线的颜色
class CeQTapControl : public CCoeControl, private MFepInlineTextFormatRetriever, MFepPointerEventHandlerDuringInlineEdit
{
private:
//constructor
CeQTapControl(CExampleFep& aFep);
void ConstructL();
public:
static CeQTapControl* NewL(CExampleFep& aFep);
~CeQTapControl();
//From CCoeControl
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
// from MFepInlineTextFormatRetriever
virtual void GetFormatOfFepInlineText(TCharFormat& aFormat, TInt& aNumberOfCharactersWithSameFormat, TInt aPositionOfCharacter) const;
// from MFepPointerEventHandlerDuringInlineEdit
virtual void HandlePointerEventInInlineTextL(TPointerEvent::TType aType, TUint aModifiers, TInt aPositionInInlineText);
public: // New methods
TKeyResponse OfferKeyEventInMultiTapModeL(const TKeyEvent& aKeyEvent, TEventCode aType);
// TKeyResponse OfferKeyEventInNumericModeL(const TKeyEvent& aKeyEvent, TEventCode aType);
TKeyResponse OfferKeyEventInSecretAlphaModeL(const TKeyEvent& aKeyEvent, TEventCode aType);
void HandleMultiTapModeKeyCodeL(TUint aKeyCode);
void SimulateKeyEventL(TUint aCharacter);
void HandleChangeInFocus();
void HandleChangeInFocusL();
// Start of inline text editing
void StartInlineEditL(MCoeFepAwareTextEditor& aFepAwareTextEditor, const TDesC& aInitialInlineText,
TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility);
void CancelInlineEdit(MCoeFepAwareTextEditor& aFepAwareTextEditor);
void UpdateInlineEditL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText);
void CommitInlineEditL(MCoeFepAwareTextEditor& aFepAwareTextEditor, TBool aCursorVisibility);
void ClearBuffer(void);
public: // new methods
void SwitchInputModeL(TUint aInputMode); // For switching input mode
CAknEdwinState* EditorState() const; // Get current Avkon eidtor state
// TKeyCode GetPreviousMultitapKeyCode(){ return iPreviousMultiTapKeyCode;}
// void CancelMultitapTimer(){ iMultiTapEngine->Cancel();}
TInt IsInlineEditTrans(){return iInsideInlineEditingTransaction;}
void GetCursorSelection(TCursorSelection& cursel){iInputCapabilities.FepAwareTextEditor()->GetCursorSelectionForFep(cursel);}
void SetCursorSelection(TCursorSelection& cursel){iInputCapabilities.FepAwareTextEditor()->SetCursorSelectionForFepL(cursel);}
inline TCursorSelection& GetUnCommittedText(){return iUncommittedText;}
inline void CommitInlineEdit(TBool aCursorVisibility)
{
CommitInlineEditL(*(iInputCapabilities.FepAwareTextEditor()), aCursorVisibility);
}
inline void StartInlineEdit(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility)
{
StartInlineEditL(*(iInputCapabilities.FepAwareTextEditor()), aInitialInlineText, aPositionOfInsertionPointInInlineText, aCursorVisibility);
}
TKeyResponse OfferKeyEventInSwichModeL();
inline void FreshIPWindow(){Window().Invalidate(m_pEQTAPInterpunction->Rect());}
inline void FreshSEWindow(){Window().Invalidate(Rect());}
inline void FreshSCWindow(){Window().Invalidate(Rect());}
inline void FreshSTKWindow(){Window().Invalidate(Rect());}
RWindow& GetRWindow() { return Window();}
void Draw(const TRect& aRect) const;
void ActiveFepWindow(TBool aActive);
inline TBool GetWindowVisibleState(){return m_bWindowVisible;}
inline void SetWindowVisibleState(TBool bVisible){ m_bWindowVisible = bVisible;}
inline int* GetChineseDictionary(){return m_pDictionaryChinese;}
inline void SetChineseDictionary(int* pDict) { m_pDictionaryChinese = pDict;}
inline OUTBUFFER* GetChineseSentence(){return m_pSentenceChinese;}
inline void SetChineseSentence(OUTBUFFER* pout){m_pSentenceChinese = pout;}
void FreshFepWindow();
TKeyResponse DoFunctionKeys(TInt Keycode);
inline CFepIndicator* GetFepIndicator(){return iIndicator;}
private:
CExampleFep& iFep;
TCoeInputCapabilities iInputCapabilities;
TUint iInputMode;
// TUint iPreviousMultiTapKeyCode;
TInt iInsideInlineEditingTransaction; // Flag for editor inline editing
// CExampleFepMultiTapEngine* iMultiTapEngine;
TCursorSelection iUncommittedText;
CFepIndicator* iIndicator;
TInt iResId; // For containing the T9 resource ID
CeQTapNumeric* m_pEQTAPNumberic;
CeQTapMultitap* m_pEQTAPMultitap;
CeQTapSmartEnglish* m_pEQTAPSmartEnglish;
TInt m_CurrentIMIndex;
CeQTapInterpunction* m_pEQTAPInterpunction;//hejja
TBool m_bWindowVisible;
CeQTapSmartChinese* m_pEQTAPSmartChinese;
CeQTapStroke* m_pEQTAPStroke;
int * m_pDictionaryChinese;
OUTBUFFER * m_pSentenceChinese;
};
// End of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -