|
1 /* |
|
2 * Copyright (c) 2006 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: Frame brush definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_ALFFRAMEBRUSH_H |
|
21 #define C_ALFFRAMEBRUSH_H |
|
22 |
|
23 #include <AknsItemID.h> |
|
24 #include <alf/alfbrush.h> |
|
25 |
|
26 struct TAlfXYMetric; |
|
27 class TAlfImage; |
|
28 |
|
29 /** |
|
30 * Frame brush. |
|
31 * FrameBrush draws a 1-part or 9-part frame around a visual using bitmaps provided by the |
|
32 * theme. The constructor takes a theme item identifier as a parameter. The bitmaps are rasterized |
|
33 * when CAlfFrameBrush::SetFrameRects() is called. |
|
34 * Develper must call this method and specify the dimensions of the frame before the frame can be drawn. |
|
35 * |
|
36 * Usage: |
|
37 * @code |
|
38 * //Create framebrush instance |
|
39 * CAlfFrameBrush* frameBrush = CAlfFrameBrush::NewL( *iEnv, *image, TAlfXYMetric( TAlfMetric( 5 ) ) ); |
|
40 * |
|
41 * //Create rect to set for framebrush |
|
42 * TRect innerRect( TPoint( 10, 10 ), TPoint( 20, 20 ) ); |
|
43 * TRect outerRect( TPoint( 0, 0 ), TPoint( 30, 30 ) ); |
|
44 * |
|
45 * //Set dimentions for framebrush |
|
46 * frameBrush->SetFrameRects( innerRect, outerRect ); |
|
47 * |
|
48 * @endcode |
|
49 * @lib alfclient.lib |
|
50 * @since S60 v3.2 |
|
51 */ |
|
52 |
|
53 NONSHARABLE_CLASS( CAlfFrameBrush ): public CAlfBrush |
|
54 { |
|
55 public: |
|
56 |
|
57 enum TFrameParts |
|
58 { |
|
59 EFramePartCornerTl = 0, |
|
60 EFramePartCornerTr, |
|
61 EFramePartCornerBl, |
|
62 EFramePartCornerBr, |
|
63 EFramePartSideT, |
|
64 EFramePartSideB, |
|
65 EFramePartSideL, |
|
66 EFramePartSideR, |
|
67 EFramePartCenter |
|
68 }; |
|
69 |
|
70 /** |
|
71 * Constructor. |
|
72 * @param aEnv Environmnet |
|
73 * @param aImage Image for the frame. Image will be used as such, |
|
74 * framerects (if set) are ignored. |
|
75 * @param aEdgeOffset Coordinates of the offset in metric units. |
|
76 * @return New instance. Onwership tranferred to the caller. |
|
77 */ |
|
78 IMPORT_C static CAlfFrameBrush* NewL(CAlfEnv& aEnv, const TAlfImage& aImage, const TAlfXYMetric& aEdgeOffset); |
|
79 |
|
80 /** |
|
81 * Constructor. The new brush is left on the cleanup stack. |
|
82 * @param aEnv Environmnet |
|
83 * @param aImage Image for the frame. Image will be used as such, |
|
84 * framerects (if set) are ignored. |
|
85 * @param aEdgeOffset Coordinates of the offset in metric units. |
|
86 * @return New instance. Onwership tranferred to the caller. |
|
87 */ |
|
88 IMPORT_C static CAlfFrameBrush* NewLC(CAlfEnv& aEnv, const TAlfImage& aImage, const TAlfXYMetric& aEdgeOffset); |
|
89 |
|
90 /** |
|
91 * Constructor. |
|
92 * @param aEnv Environmnet |
|
93 * @param aIID Skin ID for the frame. |
|
94 * @param aEdgeOffset Coordinates of the offset in metric units. |
|
95 * @return New instance. Onwership tranferred to the caller. |
|
96 */ |
|
97 IMPORT_C static CAlfFrameBrush* NewL(CAlfEnv& aEnv, const TAknsItemID& aIID, const TAlfXYMetric& aEdgeOffset); |
|
98 |
|
99 /** |
|
100 * Constructor. The new brush is left on the cleanup stack. |
|
101 * @param aEnv Environmnet |
|
102 * @param aIID Skin ID for the frame. |
|
103 * @param aEdgeOffset Coordinates of the offset in metric units. |
|
104 * @return New instance. Onwership tranferred to the caller. |
|
105 */ |
|
106 IMPORT_C static CAlfFrameBrush* NewLC(CAlfEnv& aEnv, const TAknsItemID& aIID, const TAlfXYMetric& aEdgeOffset); |
|
107 |
|
108 /** |
|
109 * Constructor. |
|
110 * @deprecated |
|
111 * @param aIID Skin ID for the frame. |
|
112 * @param aEdgeOffsetX X coordinate of the offset in pixels. |
|
113 * @param aEdgeOffsetY Y coordinate of the offset in pixels. |
|
114 * @return New instance. Onwership tranferred to the caller. |
|
115 */ |
|
116 IMPORT_C static CAlfFrameBrush* NewL(CAlfEnv& aEnv, const TAknsItemID& aIID, TInt aEdgeOffsetX = 0, TInt aEdgeOffsetY = 0); |
|
117 |
|
118 /** |
|
119 * Constructor. The new brush is left on the cleanup stack. |
|
120 * @deprecated |
|
121 * @param aIID Skin ID for the frame. |
|
122 * @param aEdgeOffsetX X coordinate of the offset in pixels. |
|
123 * @param aEdgeOffsetY Y coordinate of the offset in pixels. |
|
124 * @return New instance. Onwership tranferred to the caller. |
|
125 */ |
|
126 IMPORT_C static CAlfFrameBrush* NewLC(CAlfEnv& aEnv, const TAknsItemID& aIID, TInt aEdgeOffsetX = 0, TInt aEdgeOffsetY = 0); |
|
127 |
|
128 /** |
|
129 * Sets frame rects. |
|
130 * @param aInnerRect Inner rect of the frame |
|
131 * @param aOuterRect Outer rect of the frame |
|
132 */ |
|
133 IMPORT_C void SetFrameRectsL(const TRect& aInnerRect, const TRect& aOuterRect); |
|
134 |
|
135 /** |
|
136 * Sets edge offset. |
|
137 * @param aEdgeOffset Coordinates of the offset in metric units. |
|
138 */ |
|
139 IMPORT_C void SetEdgeOffset(const TAlfXYMetric& aEdgeOffset); |
|
140 |
|
141 /** |
|
142 * Sets whole frame image. Image will be used as such, framerects (if set) are ignored. |
|
143 * @param aImage Image for the frame. |
|
144 */ |
|
145 IMPORT_C void SetImage(const TAlfImage& aImage); |
|
146 |
|
147 /** |
|
148 * Sets framepart image. Whole frame will be constrcuted from 9 parts, each part has |
|
149 * to be set separately using this method. Genrally using 9-piece frame is not as |
|
150 * efficient as 1-pice frame, so this method should be used only when really needed. |
|
151 * @param aFramePart Frame part to which the image is intended. |
|
152 * @param aImage Image for the frame part. |
|
153 */ |
|
154 IMPORT_C void SetImage(TFrameParts aFramePart, const TAlfImage& aImage); |
|
155 |
|
156 /** |
|
157 * Destructor. |
|
158 */ |
|
159 virtual ~CAlfFrameBrush(); |
|
160 |
|
161 private: |
|
162 |
|
163 CAlfFrameBrush(const TAknsItemID& aIID, TInt aEdgeOffsetX, TInt aEdgeOffsetY); |
|
164 |
|
165 CAlfFrameBrush(const TAknsItemID& aIID, const TAlfXYMetric& aEdgeOffset); |
|
166 |
|
167 CAlfFrameBrush(); |
|
168 |
|
169 void ConstructL(CAlfEnv& aEnv, const TAknsItemID& aIID, TInt aEdgeOffsetX, TInt aEdgeOffsetY); |
|
170 |
|
171 void ConstructL(CAlfEnv& aEnv, const TAknsItemID& aIID, const TAlfXYMetric& aEdgeOffset); |
|
172 |
|
173 void ConstructL(CAlfEnv& aEnv, const TAlfImage& aImage, const TAlfXYMetric& aEdgeOffset); |
|
174 |
|
175 private: |
|
176 |
|
177 // Private data. Owned. |
|
178 struct TFrameBrushPrivateData; |
|
179 TFrameBrushPrivateData* iFrameBrushData; |
|
180 }; |
|
181 |
|
182 #endif |