|
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: Defines item in display background. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "uiacceltk/huidisplaybackgrounditem.h" // Class definition |
|
21 #include "uiacceltk/HuiDisplay.h" |
|
22 |
|
23 |
|
24 |
|
25 // Constructors |
|
26 EXPORT_C THuiDisplayBackgroundItem::THuiDisplayBackgroundItem() |
|
27 :iRect(TRect(0,0,0,0)), |
|
28 iSkinID(KAknsIIDNone), |
|
29 iColorIndex(0), |
|
30 iColor(KRgbWhite), |
|
31 iClearMode(CHuiDisplay::EClearNone) |
|
32 { |
|
33 } |
|
34 |
|
35 EXPORT_C THuiDisplayBackgroundItem::THuiDisplayBackgroundItem( const TRect& aRect ) |
|
36 :iRect(aRect), |
|
37 iSkinID(KAknsIIDNone), |
|
38 iColorIndex(0), |
|
39 iColor(KRgbWhite), |
|
40 iClearMode(CHuiDisplay::EClearNone) |
|
41 { |
|
42 } |
|
43 |
|
44 EXPORT_C THuiDisplayBackgroundItem::THuiDisplayBackgroundItem( const TRect& aRect, |
|
45 const TAknsItemID& aSkinID ) |
|
46 :iRect(aRect), |
|
47 iSkinID(aSkinID), |
|
48 iColorIndex(0), |
|
49 iColor(KRgbWhite), |
|
50 iClearMode(CHuiDisplay::EClearWithSkinBackground) |
|
51 { |
|
52 } |
|
53 |
|
54 EXPORT_C THuiDisplayBackgroundItem::THuiDisplayBackgroundItem( const TRect& aRect, |
|
55 const TAknsItemID& aSkinID, |
|
56 TInt aColorIndex ) |
|
57 :iRect(aRect), |
|
58 iSkinID(aSkinID), |
|
59 iColorIndex(aColorIndex), |
|
60 iColor(KRgbWhite), |
|
61 iClearMode(CHuiDisplay::EClearWithColor) |
|
62 { |
|
63 } |
|
64 |
|
65 EXPORT_C THuiDisplayBackgroundItem::THuiDisplayBackgroundItem( const TRect& aRect, |
|
66 const TRgb& aColor ) |
|
67 :iRect(aRect), |
|
68 iSkinID(KAknsIIDNone), |
|
69 iColorIndex(0), |
|
70 iColor(aColor), |
|
71 iClearMode(CHuiDisplay::EClearWithColor) |
|
72 { |
|
73 } |
|
74 |
|
75 EXPORT_C void THuiDisplayBackgroundItem::SetRect( const TRect& aRect ) |
|
76 { |
|
77 iRect = aRect; |
|
78 } |
|
79 |
|
80 EXPORT_C void THuiDisplayBackgroundItem::SetColor( const TRgb& aColor ) |
|
81 { |
|
82 iColor = aColor; |
|
83 iClearMode = CHuiDisplay::EClearWithColor; |
|
84 } |
|
85 |
|
86 EXPORT_C void THuiDisplayBackgroundItem::SetColor( const TAknsItemID& aSkinID, TInt aColorIndex ) |
|
87 { |
|
88 iSkinID = aSkinID; |
|
89 iColorIndex = aColorIndex; |
|
90 iClearMode = CHuiDisplay::EClearWithColor; |
|
91 } |
|
92 |
|
93 EXPORT_C void THuiDisplayBackgroundItem::SetSkinBackground( const TAknsItemID& aSkinID ) |
|
94 { |
|
95 iSkinID = aSkinID; |
|
96 iClearMode = CHuiDisplay::EClearWithSkinBackground; |
|
97 } |
|
98 |
|
99 EXPORT_C TInt THuiDisplayBackgroundItem::ClearMode() const |
|
100 { |
|
101 return iClearMode; |
|
102 } |
|
103 |
|
104 EXPORT_C TRect THuiDisplayBackgroundItem::Rect() const |
|
105 { |
|
106 return iRect; |
|
107 } |
|
108 |
|
109 EXPORT_C TRgb THuiDisplayBackgroundItem::Color() const |
|
110 { |
|
111 // If skin color has been defined, return it. Otherwise use rgb color. |
|
112 if (iSkinID != KAknsIIDNone) |
|
113 { |
|
114 TRgb skinnedColor = KRgbBlack; |
|
115 CHuiStatic::GetCachedColor(skinnedColor, iSkinID, iColorIndex); |
|
116 return skinnedColor; |
|
117 } |
|
118 else |
|
119 { |
|
120 return iColor; |
|
121 } |
|
122 } |
|
123 |
|
124 EXPORT_C TAknsItemID THuiDisplayBackgroundItem::SkinBackground() const |
|
125 { |
|
126 return iSkinID; |
|
127 } |
|
128 |