00001
00002
00003
00004
00005
00006 #if !defined(__EIKCONSO_H__)
00007 #define __EIKCONSO_H__
00008
00009 #if !defined(__E32CONS_H__)
00010 #include <e32cons.h>
00011 #endif
00012
00013 #if !defined(__EIKSBOBS_H__)
00014 #include <eiksbobs.h>
00015 #endif
00016
00017 #if !defined(__EIKSBFRM_H__)
00018 #include <eiksbfrm.h>
00019 #endif
00020
00021 #include <akncontrol.h>
00022
00023 #define ATT_DOUBLEWIDTH 0x60
00024 #define ATT_DOUBLETOP 0x20
00025 #define ATT_DOUBLEBOTTOM 0x40
00026
00027 #define ATT_ITALIC 0x08
00028 #define ATT_INVERSE 0x04
00029 #define ATT_UNDERLINE 0x02
00030 #define ATT_BOLD 0x01
00031
00032 #define ATT_COLORMASK 0x80 // &x!=0 : color
00033 #define ATT_DOUBLEMASK 0x60 // &x : only the bits relevant for doublewidth/doubleheight
00034 #define ATT_RIGHTMASK 0x10 // |x to set RIGHT indicator
00035 #define ATT_IGNORE_RIGHTLEFT 0xEF // &x to clear the RIGHT/LEFT flag
00036 #define ATT_IGNORE_INVERSE 0xFB // &x to clear the INVERSE flag
00037
00038 #define ATT_MAXVALUE 0xFF // all flags set (maximum value of attribute byte)
00039 #define ATT_NORMAL 0 // the default character attribute
00040
00041 enum TEikConsWinUnits
00042 {
00043 EEikConsWinInPixels,
00044 EEikConsWinInChars
00045 };
00046
00047
00059 class CEikConsoleControl;
00060 class CEikConsoleScreen : public CConsoleBase
00061 {
00062 public:
00063 enum TEikConsoleFlags
00064 {
00065 EUseBackedUpWindow =0x1,
00066 ENoInitialCursor =0x2
00067 };
00068 public:
00072 IMPORT_C CEikConsoleScreen();
00076 IMPORT_C ~CEikConsoleScreen();
00077
00085 IMPORT_C TInt Create(const TDesC& aTitle,TSize aSize);
00089 IMPORT_C void Read(TRequestStatus& aStatus);
00093 IMPORT_C void ReadCancel();
00097 IMPORT_C TKeyCode KeyCode() const;
00101 IMPORT_C TUint KeyModifiers() const;
00107 IMPORT_C void ConstructL(const TDesC &aTitle,TInt aFlags);
00115 IMPORT_C void ConstructL(const TDesC &aTitle,const TSize &aSize,TInt aFlags,TEikConsWinUnits aUnit=EEikConsWinInChars);
00124 IMPORT_C void ConstructL(const TDesC &aTitle,TPoint aTopLeft,const TSize &aSize,TInt aFlags,TEikConsWinUnits aUnit=EEikConsWinInChars);
00129 IMPORT_C void SetConsWin(CEikConsoleControl *aConsWin);
00134 inline CEikConsoleControl* ConsoleControl() const {return iConsoleControl;};
00135
00140 IMPORT_C void SetTitle(const TDesC &aTitle);
00145 IMPORT_C void SetTitleL(const TDesC &aTitle);
00150 inline HBufC *Title() const {return iConsoleTitle;};
00151
00156 IMPORT_C TSize ScreenSize() const;
00159 IMPORT_C void FlushChars();
00163 IMPORT_C TPoint CursorPos() const;
00168 IMPORT_C void SetCursorPosAbs(const TPoint &aPoint);
00173 IMPORT_C void SetCursorPosRel(const TPoint &aPoint);
00178 IMPORT_C void SetCursorHeight(TInt aPercentage);
00183 IMPORT_C void Write(const TDesC &aDes);
00187 IMPORT_C void ClearScreen();
00191 IMPORT_C void ClearToEndOfLine();
00197 IMPORT_C void ClearChars(const TRect &aRect,TUint aCharacterAttributes);
00202 IMPORT_C TInt HideCursor();
00205 IMPORT_C void DrawCursor();
00210 IMPORT_C void DrawInSight(TPoint aPosition);
00213 IMPORT_C void DrawCursorInSight();
00214
00218 IMPORT_C void Up(TUint aCount=1);
00222 IMPORT_C void Down(TUint aCount=1);
00226 IMPORT_C void Right(TUint aCount=1);
00230 IMPORT_C void Left(TUint aCount=1);
00233 IMPORT_C void Cr();
00236 IMPORT_C void Lf();
00241 IMPORT_C void ScrollChars(const TRect &anArea,const TPoint &aVector);
00242
00246 IMPORT_C void Redraw(const TRect &aRect);
00250 IMPORT_C void MoveTopLeft(TPoint aVector);
00251
00255 inline TUint HistorySize() const {return iNoChrExtra;};
00260 IMPORT_C void SetHistorySizeL(TUint aMaxChrExtra,TUint aMaxAttExtra);
00261
00265 inline TUint Att() const {return iAtt;};
00266
00270 IMPORT_C void SetAtt(TUint aCharacterAttributes);
00275 IMPORT_C void SetAtt(TUint aForegroundGray16,TUint aBackgroundGray16);
00276
00280 IMPORT_C void SetFontL(const TFontSpec &aFontDesc);
00284 IMPORT_C const TFontSpec& Font() const;
00285
00289 IMPORT_C void SetSelection(const TRect &aRange);
00292 IMPORT_C void SelectCursor();
00296 IMPORT_C TRect Selection();
00301 IMPORT_C HBufC *RetrieveL(const TRect &aRange);
00302
00306 IMPORT_C void SetPureCRLF(TUint aFlag);
00310 IMPORT_C void SetAllPrintable(TUint aFlag);
00314 IMPORT_C void SetScrollLock(TUint aFlag);
00318 IMPORT_C void SetKeepCursorInSight(TUint aFlag);
00323 IMPORT_C void SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility);
00327 IMPORT_C TBool UpdateScrollBars();
00328
00329 private:
00330
00331 void MemScrPut(const TDesC &aString,TPoint aPos,TUint8 aCharacterAttributes);
00332 void MemScrClr(const TRect &aRect,TUint8 aCharacterAttributes);
00333 void MemScrScrollUp(TUint aLines=1);
00334 void MemScrMove(TPoint anOldPt,TPoint aNewPt,TUint aLen);
00335 void MemScrScroll(const TRect &aRect,TPoint aVector);
00336
00337 TPtr MemChrPtr(TPoint aPos,TUint aLen);
00338 TPtr8 MemAttPtr(TPoint aPos,TUint aLen);
00339
00340 TPoint ScrToVis(TPoint aPoint);
00341 TRect ScrToVis(const TRect &aRect);
00342
00343 TBool RecalculateSize();
00344
00345 TPoint GetAnInSightPosition(TPoint aPosition) const;
00346
00347 void DrawCursorWhereNeeded();
00348
00349 void ClipCursor();
00350
00351 void RedrawChars(TInt anX,TInt anY,TInt aLength,TUint aCharacterAttributes);
00352
00353 void InvertOverlap(TPoint aStart,TPoint aEnd,TPoint bStart,TPoint bEnd);
00354 void InvertRange(const TRect &aRect);
00355
00356 private:
00357 CEikConsoleControl *iConsoleControl;
00358 TSize iConsoleSize;
00359 HBufC *iConsoleTitle;
00360 TRect iSelection;
00361 TPoint iCursor;
00362 TUint iAtt;
00363
00364 TInt iWriteNow;
00365 TBuf<256> iWriteBuffer;
00366
00367 TInt iMaxChrExtra;
00368 TInt iNoChrExtra;
00369 TInt iMaxAttExtra;
00370 TText *iChrBuf;
00371 TUint8 *iAttBuf;
00372
00373 TPoint iTopLeft;
00374 TRect iVisWin;
00375 TSize iVisSize;
00376
00377
00378 TUint iPureCRLF;
00379 TUint iAllPrintable;
00380 TUint iScrollLock;
00381 TUint iKeepCursorInSight;
00382 TUint iCursorBlinking;
00383
00384 TInt iConsFlags;
00385 };
00386
00387 class CEikConsoleControl : public CAknControl, public MEikScrollBarObserver
00388 {
00389 public:
00390
00393 IMPORT_C CEikConsoleControl();
00396 IMPORT_C ~CEikConsoleControl();
00397
00398
00399 IMPORT_C void ConstructL(TInt aFlags);
00400
00401
00402 IMPORT_C void ConstructL(TPoint aTopLeft,const TSize &aSize,TInt aFlags,TEikConsWinUnits aUnit);
00406 IMPORT_C void SetRedrawer(CEikConsoleScreen *aConsole);
00407
00408
00413 IMPORT_C void SetFontL(const TFontSpec &aFontSpec,const CFbsFont* aFont);
00416 inline const TFontSpec& Font() const {return iFontSpec;};
00417
00420 inline const TSize& CharSize() const {return iCharSize;};
00424 IMPORT_C TSize VisibleSize() const;
00425
00426
00430 IMPORT_C void SetCursorHeight(TUint aPercentage);
00434 IMPORT_C void DrawCursor(TPoint aPosition);
00437 IMPORT_C void HideCursor();
00438
00439
00445 IMPORT_C void DrawChars(const TDesC &aString,const TPoint &aPosition,TUint aCharacterAttributes);
00450 IMPORT_C void ClearChars(const TRect &anArea,TUint aCharacterAttributes);
00454 IMPORT_C void InvertChars(const TRect &anArea);
00459 IMPORT_C void ScrollChars(const TRect &anArea,const TPoint &aVector);
00460
00461
00466 IMPORT_C TInt SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility);
00473 IMPORT_C TBool UpdateScrollbarsL(const TSize &aDataSize,const TSize& aVisibleSize,TPoint aPos);
00478 IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);
00481 IMPORT_C void UpdateArea();
00482
00483 public:
00486 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00489 IMPORT_C virtual void HandleResourceChange(TInt aType);
00492 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00493
00494 protected:
00495
00498 IMPORT_C void Draw(const TRect& aRect) const;
00501 IMPORT_C void SizeChanged();
00504 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
00507 IMPORT_C virtual TInt CountComponentControls() const;
00510 IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const;
00513 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00514
00515 private:
00516 IMPORT_C virtual void Reserved_2();
00517
00518 private:
00522 IMPORT_C void* ExtensionInterface( TUid aInterface );
00523
00524 private:
00525 TPoint CharsToPixels(TPoint aPoint);
00526 TRect CharsToPixels(const TRect &aRect);
00527 TRect PixelsToChars(const TRect &aRect);
00528 void ClearPixels(const TRect &anArea,TRgb aColor) const;
00529
00530 void NextFontL();
00531 void InterpretAttribute(TUint AnAtt);
00532 void InterpretColorBits(TUint aCharacterAttributes);
00533 inline CEikConsoleControl &M() const {return((CEikConsoleControl&)(*this));}
00534 void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
00535 void InitFontSpecL();
00536
00537 private:
00538 CEikConsoleScreen *iConsole;
00539 TRgb iBackGray16;
00540 TRgb iPenGray16;
00541 TUint iLastAtt;
00542 TUint iLastFontFlags;
00543
00544 TSize iCharSize;
00545 TSize iViewInPixels;
00546 TSize iViewInChars;
00547
00548 TTextCursor iTextCursor;
00549 TUint iCursorHeightPercentage;
00550
00551 TInt iRedrawing;
00552
00553 CEikScrollBarFrame* iSBFrame;
00554 CEikScrollBarFrame::TScrollBarVisibility iHBarVisibility;
00555 CEikScrollBarFrame::TScrollBarVisibility iVBarVisibility;
00556 TPoint iLastThumbPos;
00557
00558 const CFont *iCurrentFont;
00559 TFontSpec iFontSpec;
00560 TFontUnderline iFontUnderline;
00561 TUint iFontHeight;
00562 TUint iFontIsProportional;
00563 };
00564
00565
00566
00567 #endif