commands/fed/inc/textview.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // textview.h
       
     2 // 
       
     3 // Copyright (c) 2009 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 #ifndef TEXTVIEW_H_
       
    13 #define TEXTVIEW_H_
       
    14 
       
    15 #include <e32base.h>
       
    16 
       
    17 #include "viewbase.h"
       
    18 
       
    19 class CColorConsoleBase;
       
    20 class CFileBuffer;
       
    21 
       
    22 /*
       
    23  Main parent class for all views able to show any texts on the screen using data read/written from/to the universal
       
    24  memory buffer CFileBuffer (unicode, left-to-right, right-to-left, up-to-down), etc.
       
    25 */
       
    26 class CTextView : public CFedViewBase
       
    27 {
       
    28 protected:
       
    29 	CTextView(MConsoleProvider& aConsoleProvider, CFedBufferBase& aBuffer, TInt aPriority = CActive::EPriorityStandard);
       
    30 	void ConstructL();
       
    31 	~CTextView();
       
    32 
       
    33 public:
       
    34 	//CActive
       
    35 	void DoCancel();
       
    36 	void RunL();
       
    37 	TInt RunError(TInt aError);
       
    38 
       
    39 	void ResizeL(const TWindow& aWindow);
       
    40 	void RedrawL(const TWindow& aWindow);
       
    41 	void DeactivateL();
       
    42 
       
    43 	//MSharedCacheClient
       
    44 	void InvalidateBuffer(TRequestStatus& aStatus);
       
    45 
       
    46 	CFedBufferBase& Buffer();
       
    47 
       
    48 protected:
       
    49 	void RequestData(TBool aFromTheTop, TInt aOffset);
       
    50 	void SeekData(TInt aDocumentPosition, TInt aNumLines);
       
    51 	virtual void UpdateCursor(const TPoint& aNewPos);
       
    52 	virtual void ValidateCursor();
       
    53 	void ShowCursor();
       
    54 	void HideCursor();
       
    55 	void HandleDataLoadError(TInt aError);
       
    56 
       
    57 protected:
       
    58 	virtual void DoResizeL(const TWindow& aOldWindow) = 0;
       
    59 	virtual void DoRedrawL() = 0;
       
    60 	virtual void DoDrawL() = 0;
       
    61 
       
    62 private:
       
    63 	enum TState
       
    64 		{
       
    65 		EStateNone,
       
    66 		EStateGetData,
       
    67 		} iState;
       
    68 
       
    69 	//member variables to use by inheriting classes
       
    70 protected:
       
    71 	CFedBufferBase& iBuffer;
       
    72 	TPtrC16 iDes;		// This is set to whatever cache block is currently active	
       
    73 	TBool iActive;		// Whether the view is active and can draw on the screen or not
       
    74 	TPoint iCursor;		// Current position of cursor on the screen (in window coords, NOT console coords)
       
    75 	TPoint iDrawPoint;	// Current position of drawing new characters on the screen (in console coordinates)
       
    76 	RBuf iLine;			// Temp buffer for chars to be drawn on the screen
       
    77 	TRange iRange;		// Document range of last fetched data (iDes)
       
    78 	TInt iRangeStartLineNumber; // Line number for the first character of iRange
       
    79 };
       
    80 
       
    81 #endif /*TEXTVIEW_H_*/