|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // CWsGc and associated classes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __GC_H__ |
|
19 #define __GC_H__ |
|
20 |
|
21 #include "wnredraw.h" |
|
22 #include "cliwin.h" |
|
23 |
|
24 class CWsFbsFont; |
|
25 |
|
26 class CWsGc : public CWsObject |
|
27 { |
|
28 enum {ETextPtrBufLen=0x100}; // Buffer of TText, used on stack |
|
29 // Functions |
|
30 public: |
|
31 static CWsGc* NewL(CWsClient *aOwner); |
|
32 ~CWsGc(); |
|
33 static void InitStaticsL(); |
|
34 static void DeleteStatics(); |
|
35 void Activate(CWsClientWindow *win); |
|
36 void CommandL(TInt aOpcode, const TAny *aCmdData); |
|
37 void Deactivate(); |
|
38 void Reset(); |
|
39 inline CFbsBitGc *Gdi() const; |
|
40 void SetGcAttribute(TInt aOpcode, TWsGcCmdUnion pData); |
|
41 inline void SetNextWinGc(CWsGc *aGc); |
|
42 inline CWsGc *NextWinGc() const; |
|
43 void SetOrigin(const TPoint &aOrigin); |
|
44 TInt ExternalizeL(CBufBase& aBuffer, TInt aStartPos); |
|
45 TInt ExternalizeClippingRegionL(RWriteStream& aWriteStreem); |
|
46 TInt FbsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle); |
|
47 TInt WsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle); |
|
48 void SetOpaque(TBool aDrawOpaque); |
|
49 void Reactivate(); |
|
50 private: |
|
51 CWsGc(CWsClient *aOwner); |
|
52 void ConstructL(); |
|
53 void DoDrawing0L(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData); |
|
54 void DoDrawing1(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData); |
|
55 void DoDrawing2(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData); |
|
56 void Activate(const TInt &aHandle); |
|
57 void DoDrawCommand(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData, const TRegion *aRegion); |
|
58 void SetClippingRegionL(TInt aCountRegion); |
|
59 void SetClippingRect(const TRect &aRect); |
|
60 void CancelClippingRegion(); |
|
61 void DoDrawPolygon(const TWsGcCmdDrawPolygon *aDrawPolygon); |
|
62 void DoDrawPolyLine(const TWsGcCmdDrawPolyLine *aDrawPolyLine, TBool aContinued); |
|
63 void GcOwnerPanic(TClientPanic aPanic); |
|
64 void ResetClippingRect(); |
|
65 void EndSegmentedPolygon(); |
|
66 void StartSegmentedDrawPolygonL(const TWsGcCmdStartSegmentedDrawPolygon* aDrawPolygon); |
|
67 void SegmentedDrawPolygonData(const TWsGcCmdSegmentedDrawPolygonData* aDrawPolygon); |
|
68 void UpdateJustification(TText* aText,TInt aLen); |
|
69 #if defined(_DEBUG) |
|
70 inline TBool IsPolyPointData() {return(iPolyPointListSize>0 || iPolyPoints!=NULL);} |
|
71 #endif |
|
72 void ExternalizeAlphaValueL(RWriteStream& aWriteStream); |
|
73 TPtrC BufferTPtr(TText* aStart,TInt aLen); |
|
74 void CheckPolyData(const TAny* aDataPtr, TInt aHeaderSize, TInt aNumPoints); |
|
75 private: |
|
76 CFbsBitGc *iGdi; |
|
77 CWsClientWindow *iWin; |
|
78 CWsGc *iNextWinGc; |
|
79 CWsFbsFont *iFont; |
|
80 RWsRegion* iUserDefinedClippingRegion; //Clipping region that is set explicitly by the user. |
|
81 TRect iClippingRect; // All drawing clipped to this rectangle in addition to other clipping |
|
82 TBool iClippingRectSet; // ETrue if the iClippingRect is in use |
|
83 TPoint iOrigin; // User defined origin, relative to the top left of the window |
|
84 TPoint iLinePos; // Current line position for LineBy, LineTo etc |
|
85 TPoint *iPolyPoints; |
|
86 TInt iPolyPointListSize; |
|
87 // static variables |
|
88 static CFbsBitmap *iScratchBitmap; |
|
89 static CFbsBitmap *iScratchMaskBitmap; |
|
90 }; |
|
91 |
|
92 inline CFbsBitGc *CWsGc::Gdi() const |
|
93 { |
|
94 return(iGdi); |
|
95 } |
|
96 |
|
97 inline void CWsGc::SetNextWinGc(CWsGc *aGc) |
|
98 { |
|
99 iNextWinGc=aGc; |
|
100 } |
|
101 |
|
102 inline CWsGc *CWsGc::NextWinGc() const |
|
103 { |
|
104 return(iNextWinGc); |
|
105 } |
|
106 |
|
107 #endif |