⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 richtexteditorcontainer.h

📁 在syambian s60 3rd上开发的超级计算器 可实现大浮点数的计算
💻 H
字号:
#ifndef RTECONTAINER_H
#define RTECONTAINER_H


#include <coecntrl.h>
#include <eikrted.h>

#include "eiklabel.h"
#include <uikon.hrh>
#include "mypicture.h"
#include <aknnotewrappers.h> 
#include <e32math.h> 

_LIT( KImageBitmapFile, "picture.mbm");
_LIT( KAdd,  "+");
_LIT( KSub,  "-");
_LIT( KMult, "*");
_LIT( KDiv,  "/");

_LIT( KTab, "\t");

_LIT( KZero,"0");
_LIT( KOne,"1");
_LIT( KPoint,".");
_LIT( KEqual,"=");
_LIT( KNull,"");

_LIT( KError1, "Please enter a Operand!" );
_LIT( KError2, "Maxmium 20 digits!" );	
//_LIT( KError3, "璇疯緭鍏ュ悎娉曟暟瀛楋紒" );_LIT( KError4, "Can't be divided by Zero!" );

static enum TOperator { EOpAdd = 0, EOpSub, EOpMult, EOpDiv } CurOp;
static TBuf<200> bufResult; 

class CRTEContainer : public CCoeControl
{
public:
    void ConstructL(const TRect& aRect);
    ~CRTEContainer();

    void InsertTab();
	void SetHorizontalAlignment(CParaFormat::TAlignment );
	void SetVerticalAlignment(CParaFormat::TAlignment );
	void SetSelectionL(TInt,TInt);
	void SetRightTab();
	void SetCharacterBIUAttribL(CEikGlobalTextEditor::TFontStyleFlags );

	#ifdef __SERIES60_3X__
       /**
		* Change the text's font from 3rd Edition onwards
		*/
		void SetFont(TInt aFontId);
	#else
		//! Change the text's font
		void SetFont(const CFont* );
	#endif
		
	#ifdef __SERIES60_3X__
	   /**
		* Change the text's font from 3rd Edition onwards
		*/
		void SetFont(TInt aFontId, TInt, TInt);
	#else
		//! Change the text's font
		void SetFont(const CFont*, TInt, TInt );
	#endif	

	void SetColor(TRgb );
	void SetColor(TRgb , TInt, TInt);	
	
	void Strike();
    void UpdateText();   
    void AboutL();
    void Operate( TInt );    void Equal( TBool aIstemp = EFalse );        TBool GetOperand( TBuf<100> & aBuf, TBool &aFlag );    TBool IsMinor();
    //重载描述符型无符号大浮点数比较
    friend TBool operator >=( const TBuf<100>, const TBuf<100>);   
    
    //浮点数求极限
    template <class T>
    friend void Limit( T &);
    //重载描述符型无符号大浮点数相加
    template <class T>
    friend T operator + ( const T, const T );
    //重载描述符型无符号大浮点数相减
    template <class T>
    friend T operator - ( const T, const T );   
    //重载描述符型无符号大浮点数相乘
    template <class T>
    friend T operator * ( const T, const T );  
    //重载描述符型无符号大浮点数相除
    template <class T>
    friend T operator / ( const T, const T );    
    //重载描述符型大浮点数规范化
    template <class T>
    friend void operator ~ ( T &);
    //重载描述符型无符号大浮点数求倒数
    template <class T>
    friend void operator ! ( T &);
    
public: // Functions from base classes
		CEikRichTextEditor* iRtEd; // Rich Text Editor
private:       		TInt iPosStart;
        TInt iPosEnd;
        TBuf<100> iOperand1;
        TBuf<100> iOperand2;
        TBuf<100> iResult;
        TBuf<200> iCurrentBuf;
        
        TBool iIsOperand1;
        TBool iIsMinor1;
        TBool iIsMinor2;
        TBool iIsComplete;
        TBool iIsAbout;        TBool iCanDecimal;
        TTabStop tabstop;
private:
	void Prepare();
	void SetupL();
	void Echo(TInt );
    void SizeChanged();
    TInt CountComponentControls() const;
    CCoeControl* ComponentControl(TInt aIndex) const;
    void Draw(const TRect& aRect) const;
    TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
    void SetBKColor( TRgb );
	CEikLabel* iStatusLine; // 状态行标记
};

#endif

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -