|
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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUIBRUSHARRAY_H__ |
|
21 #define __HUIBRUSHARRAY_H__ |
|
22 |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <uiacceltk/HuiOwnedPointer.h> |
|
26 #include <uiacceltk/HuiBrush.h> |
|
27 |
|
28 |
|
29 /* Forward declarations. */ |
|
30 class CHuiVisual; |
|
31 |
|
32 |
|
33 /** |
|
34 * Array of brushes. |
|
35 */ |
|
36 NONSHARABLE_CLASS(CHuiBrushArray) : public CBase |
|
37 { |
|
38 public: |
|
39 |
|
40 IMPORT_C static CHuiBrushArray* NewL(); |
|
41 |
|
42 IMPORT_C static CHuiBrushArray* NewLC(); |
|
43 |
|
44 IMPORT_C virtual ~CHuiBrushArray(); |
|
45 |
|
46 |
|
47 /* Methods. */ |
|
48 |
|
49 /** |
|
50 * |
|
51 */ |
|
52 IMPORT_C void Reset(); |
|
53 |
|
54 /** |
|
55 * Appends a new brush to the array. |
|
56 * |
|
57 * @param aBrush Brush instance. |
|
58 * @param aOwnership Ownership of the brush. |
|
59 */ |
|
60 IMPORT_C void AppendL(CHuiBrush* aBrush, THuiOwnership aOwnership); |
|
61 |
|
62 /** |
|
63 * Inserts a brush to the array. |
|
64 * |
|
65 * @param aPos Index for the new brush instance. |
|
66 * @param aBrush Brush instance. |
|
67 * @param aOwnership Ownership of the brush. |
|
68 */ |
|
69 IMPORT_C void InsertL(TInt aPos, CHuiBrush* aBrush, THuiOwnership aOwnership); |
|
70 |
|
71 /** |
|
72 * Removes a brush from the array. If the array has ownership of the |
|
73 * brush, it will be deleted. |
|
74 * |
|
75 * @param aPos Index of the brush instance to remove. |
|
76 */ |
|
77 IMPORT_C void Remove(TInt aPos); |
|
78 |
|
79 /** |
|
80 * Count the number of brushes in the array. |
|
81 * |
|
82 * @return Number of brushes. |
|
83 */ |
|
84 IMPORT_C TInt Count() const; |
|
85 |
|
86 /** |
|
87 * Returns a reference to a brush in the array. |
|
88 * |
|
89 * @param aPos Index. |
|
90 */ |
|
91 IMPORT_C CHuiBrush& operator [] (TInt aPos); |
|
92 |
|
93 /** |
|
94 * Returns a reference to a brush in the array. |
|
95 * |
|
96 * @param aPos Index. |
|
97 */ |
|
98 IMPORT_C CHuiBrush& At(TInt aPos); |
|
99 |
|
100 /** |
|
101 * Count the number of brushes on a certain layer. |
|
102 * |
|
103 * @param aLayer Layer to count. |
|
104 */ |
|
105 IMPORT_C TInt LayerBrushCount(THuiBrushLayer aLayer) const; |
|
106 |
|
107 /** |
|
108 * Draws all the brushes in the array. |
|
109 * |
|
110 * @param aLayer Which layer to draw. |
|
111 * @param aGc Graphics context. |
|
112 * @param aDisplayRect Area affected by the brush. |
|
113 */ |
|
114 IMPORT_C void Draw(THuiBrushLayer aLayer, CHuiGc& aGc, const MHuiBrushGuide& aGuide) const; |
|
115 |
|
116 /** |
|
117 * Determines if a change flag is raised in the array. |
|
118 * |
|
119 * @return <code>ETrue</code>, if there is something to refresh. |
|
120 * <code>EFalse</code>, if no changes. |
|
121 */ |
|
122 TBool Changed() const; |
|
123 |
|
124 /** |
|
125 * Clears the change flags of the brushes. |
|
126 */ |
|
127 void ClearChanged(); |
|
128 |
|
129 /** |
|
130 * Expands the dirty region of a visual. Called when a visual's dirty |
|
131 * region is being determined. |
|
132 * |
|
133 * @param aRect Rectangle to expand. Visual's dirty region. |
|
134 */ |
|
135 void ExpandVisualRect(TRect& aRect) const; |
|
136 |
|
137 /** |
|
138 * Notifies change in the brush guide |
|
139 */ |
|
140 void ActivateBrushGuide(const CHuiVisual* aNewGuide) const; |
|
141 /** |
|
142 * aBrushType is CHuiBrush::TType2 enum |
|
143 */ |
|
144 IMPORT_C TInt BrushWithTypeCount(TInt aBrushType) const; |
|
145 IMPORT_C CHuiBrush *BrushWithTypeAt(TInt aBrushType, TInt aIndex); |
|
146 protected: |
|
147 |
|
148 CHuiBrushArray(); |
|
149 |
|
150 private: |
|
151 |
|
152 |
|
153 |
|
154 private: |
|
155 |
|
156 typedef RHuiOwnedPointer<CHuiBrush> RArrayElement; |
|
157 |
|
158 RPointerArray<RArrayElement> iElements; |
|
159 |
|
160 }; |
|
161 |
|
162 |
|
163 #endif // __HUIBRUSHARRAY_H__ |
|
164 |