|
1 // Copyright (c) 2007-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 // |
|
15 |
|
16 #ifndef SURFACECONFIGURATION_H |
|
17 #define SURFACECONFIGURATION_H |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <graphics/surface.h> |
|
21 #include <bitstd.h> |
|
22 |
|
23 /** |
|
24 The base class for the surface configuration containing the size of the surface configuration. |
|
25 Provides a Size function to help identify which attributes are available. |
|
26 |
|
27 @publishedPartner |
|
28 @prototype |
|
29 */ |
|
30 class TSurfaceConfigurationSize |
|
31 { |
|
32 public: |
|
33 inline TInt Size() const; |
|
34 protected: |
|
35 inline TSurfaceConfigurationSize(TInt aSize); |
|
36 template <class Member> TBool MemberAccessible (const Member& aMember) const |
|
37 { |
|
38 return iSize>=sizeof(Member)+TInt(&aMember)-TInt(this); |
|
39 } |
|
40 inline TBool operator == (const TSurfaceConfigurationSize& aRhs)const; |
|
41 private: |
|
42 inline TSurfaceConfigurationSize(); |
|
43 inline TSurfaceConfigurationSize(const TSurfaceConfigurationSize& /*aSurfaceConfigurationSize*/); |
|
44 inline TSurfaceConfigurationSize operator = (const TSurfaceConfigurationSize& /*aRhs*/)const; |
|
45 protected: |
|
46 TInt iSize; |
|
47 }; |
|
48 |
|
49 /** |
|
50 The first set of surface configuration attributes containing the surface id, viewport, extent |
|
51 and orientation of the surface, along with a SupportsAllMembers function to help identify which |
|
52 attributes are available. |
|
53 |
|
54 @publishedPartner |
|
55 @prototype |
|
56 */ |
|
57 class TSurfaceConfiguration1: public TSurfaceConfigurationSize |
|
58 { |
|
59 public: |
|
60 inline TSurfaceConfiguration1(); |
|
61 inline TInt SetSurfaceId (const TSurfaceId& aSurfaceId); |
|
62 inline void GetSurfaceId (TSurfaceId& aSurfaceId) const; |
|
63 inline TInt SetViewport (const TRect& aViewport); |
|
64 inline void GetViewport (TRect& aViewport) const; |
|
65 inline TInt SetOrientation (CFbsBitGc::TGraphicsOrientation aOrientation); |
|
66 inline CFbsBitGc::TGraphicsOrientation Orientation() const; |
|
67 inline TInt SetExtent(const TRect& aExtent); |
|
68 inline void GetExtent(TRect& aExtent) const; |
|
69 inline TBool SupportsAllMembers(); |
|
70 protected: |
|
71 inline TSurfaceConfiguration1(TInt aSize); |
|
72 inline TBool operator == (const TSurfaceConfiguration1& aRhs)const; |
|
73 private: |
|
74 inline TSurfaceConfiguration1(const TSurfaceConfiguration1& /*aSurfaceConfiguration1*/); |
|
75 inline TSurfaceConfiguration1 operator = (const TSurfaceConfiguration1& /*aRhs*/)const; |
|
76 private: |
|
77 TSurfaceId iSurfaceId; |
|
78 CFbsBitGc::TGraphicsOrientation iOrientation; |
|
79 TRect iExtent; |
|
80 TRect iViewport; |
|
81 }; |
|
82 |
|
83 /** |
|
84 The second set of surface configuration attributes containing the flip attribute of the surface, along with a SupportsAllMembers function to help identify which |
|
85 attributes are available. |
|
86 |
|
87 @publishedPartner |
|
88 @prototype |
|
89 */ |
|
90 class TSurfaceConfiguration2: public TSurfaceConfiguration1 |
|
91 { |
|
92 public: |
|
93 inline TSurfaceConfiguration2(); |
|
94 inline TInt SetFlip(TBool aFlip); |
|
95 inline TBool Flip()const; |
|
96 inline TBool SupportsAllMembers(); |
|
97 protected: |
|
98 inline TSurfaceConfiguration2(TInt aSize); |
|
99 inline TBool operator == (const TSurfaceConfiguration2& aRhs)const; |
|
100 private: |
|
101 inline TSurfaceConfiguration2(const TSurfaceConfiguration2& /*aSurfaceConfiguration2*/); |
|
102 inline TSurfaceConfiguration2 operator = (const TSurfaceConfiguration2& /*aRhs*/)const; |
|
103 //iFlip is a x-axis flip |
|
104 TBool iFlip; |
|
105 }; |
|
106 |
|
107 /** |
|
108 TSurfaceConfiguration is provided as a chain of derived classes representing the growing |
|
109 history of the class. |
|
110 |
|
111 @publishedPartner |
|
112 @prototype |
|
113 */ |
|
114 class TSurfaceConfiguration: public TSurfaceConfiguration2 |
|
115 { |
|
116 typedef TSurfaceConfiguration2 TBiggestConfiguration; |
|
117 public: |
|
118 inline TSurfaceConfiguration(); |
|
119 inline TSurfaceConfiguration(const TSurfaceConfiguration& aSurfaceConfiguration); |
|
120 inline TSurfaceConfiguration(TInt aPreferredMaxSize); |
|
121 inline TBool operator == (const TSurfaceConfiguration& aRhs)const |
|
122 { |
|
123 return TSurfaceConfiguration2::operator==(aRhs); |
|
124 } |
|
125 private: |
|
126 inline TSurfaceConfiguration operator = (const TSurfaceConfiguration& /*aRhs*/); |
|
127 }; |
|
128 #include <graphics/surfaceconfiguration.inl> |
|
129 #endif // SURFACECONFIGURATION_H |