|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUICANVASBACKGROUND_H__ |
|
21 #define __HUICANVASBACKGROUND_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <uiacceltk/HuiDisplay.h> |
|
26 |
|
27 class CHuiCanvasGc; |
|
28 class CHuiCanvasVisual; |
|
29 |
|
30 |
|
31 class CHuiCanvasBackground : public CBase |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Constructor. |
|
37 */ |
|
38 CHuiCanvasBackground(); |
|
39 |
|
40 |
|
41 /** |
|
42 * Destructor. |
|
43 */ |
|
44 ~CHuiCanvasBackground(); |
|
45 |
|
46 /** |
|
47 * Constructor. |
|
48 */ |
|
49 static CHuiCanvasBackground* NewL(); |
|
50 |
|
51 /** |
|
52 * Constructor. |
|
53 */ |
|
54 static CHuiCanvasBackground* NewLC(); |
|
55 |
|
56 /** |
|
57 * Second-phase constructor. |
|
58 */ |
|
59 void ConstructL(); |
|
60 |
|
61 /** |
|
62 * Sets visual which is using this background. |
|
63 */ |
|
64 void SetVisual(CHuiCanvasVisual* aVisual); |
|
65 |
|
66 /** |
|
67 * Drawing. |
|
68 */ |
|
69 void DrawSelf(CHuiGc& aGc, const TRect& aDisplayRect); |
|
70 |
|
71 /** |
|
72 * Sets the flag that tells the canvas to clear the background before |
|
73 * doing a refresh. |
|
74 * |
|
75 * @param aClearBackground Background clearing mode. |
|
76 * @see SetBackgroundColor() |
|
77 */ |
|
78 void SetClearBackground(CHuiDisplay::TClearMode aClearBackground); |
|
79 |
|
80 /** |
|
81 * Gets the flag that tells the canvas to clear the background before |
|
82 * doing a refresh. |
|
83 * |
|
84 * @return Background clearing mode. |
|
85 */ |
|
86 TInt ClearBackground(); |
|
87 |
|
88 /** |
|
89 * Sets the background color of the display, if background clearing has |
|
90 * been enabled. |
|
91 * |
|
92 * @param aBackgroundColor The color to set the background to. |
|
93 * @see SetClearBackgroundL() |
|
94 */ |
|
95 void SetBackgroundColor(const TRgb& aBackgroundColor); |
|
96 |
|
97 /** |
|
98 * Sets the items that specify how to clear display before display refresh. |
|
99 * Items may have overlapping rectangles, drawing order is same as item order |
|
100 * in the parameter array. But having lots of overlapping drawing |
|
101 * causes negative performance impact. |
|
102 * |
|
103 * This method is alternative to SetClearBackgroundL and SetBackgroundColor |
|
104 * methods. |
|
105 * |
|
106 * @see SetBackgroundColor() |
|
107 * @see SetClearBackgroundL() |
|
108 * @param aItems Array of items that specify how to clear the background. |
|
109 */ |
|
110 void SetBackgroundItems(const RArray<THuiDisplayBackgroundItem>& aItems); |
|
111 |
|
112 /** |
|
113 * Gets the number of THuiDisplayBackground items set, for the canvas visual |
|
114 * |
|
115 * @return Number of background items |
|
116 */ |
|
117 TInt BackgroundItemsCount(); |
|
118 |
|
119 /** |
|
120 * Gets the items that specify how to clear display before display refresh. |
|
121 * @param aItems Returned items are written into the array. |
|
122 */ |
|
123 void GetBackgroundItems(RArray<THuiDisplayBackgroundItem>& aItems); |
|
124 |
|
125 /** |
|
126 * Gets the background color of the display, if background clearing has |
|
127 * been enabled. |
|
128 * |
|
129 * @return The color to set the background to. |
|
130 */ |
|
131 TRgb BackgroundColor() const; |
|
132 |
|
133 private: |
|
134 |
|
135 void ClearWithColor(CHuiGc& aGc, const TRect& aDisplayRect); |
|
136 |
|
137 void ClearWithSkinBackground(const TRect& aDisplayRect); |
|
138 |
|
139 void ClearWithBackgroundItems(const TRect& aDisplayRect); |
|
140 |
|
141 private: |
|
142 |
|
143 /** Canavas visual which uses this background */ |
|
144 CHuiCanvasVisual* iCanvasVisual; |
|
145 |
|
146 /** Determines if the background should be cleared before drawing. */ |
|
147 TInt iClearBackground; |
|
148 |
|
149 /** Background color for the display, if clearing enabled. */ |
|
150 TRgb iBackgroundColor; |
|
151 |
|
152 /** Array of background items */ |
|
153 RArray<THuiDisplayBackgroundItem> iBackgroundItems; |
|
154 |
|
155 }; |
|
156 |
|
157 #endif |
|
158 |