21
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 |
// system includes
|
|
19 |
#include <peninputlayout.h>
|
|
20 |
#include <AknIconUtils.h>
|
|
21 |
#include <coemain.h>
|
|
22 |
#include <AknsUtils.h>
|
|
23 |
#include <AknsDrawUtils.h>
|
|
24 |
// user includes
|
|
25 |
#include "peninputcommonbgctrl.h"
|
|
26 |
|
|
27 |
// ======== MEMBER FUNCTIONS ========
|
|
28 |
|
|
29 |
CAknFepCtrlCommonBgCtrl* CAknFepCtrlCommonBgCtrl::NewL(CFepUiLayout* aUiLayout,
|
|
30 |
TInt aControlId,
|
|
31 |
TAknsItemID aFrameID,
|
|
32 |
TAknsItemID aCenterID)
|
|
33 |
{
|
|
34 |
CAknFepCtrlCommonBgCtrl* self = NewLC(aUiLayout,
|
|
35 |
aControlId,
|
|
36 |
aFrameID,
|
|
37 |
aCenterID);
|
|
38 |
CleanupStack::Pop(self);
|
|
39 |
|
|
40 |
return self;
|
|
41 |
}
|
|
42 |
|
|
43 |
CAknFepCtrlCommonBgCtrl* CAknFepCtrlCommonBgCtrl::NewLC(CFepUiLayout* aUiLayout,
|
|
44 |
TInt aControlId,
|
|
45 |
TAknsItemID aFrameID,
|
|
46 |
TAknsItemID aCenterID)
|
|
47 |
{
|
|
48 |
CAknFepCtrlCommonBgCtrl* self = new (ELeave) CAknFepCtrlCommonBgCtrl(aUiLayout,
|
|
49 |
aControlId,
|
|
50 |
aFrameID,
|
|
51 |
aCenterID);
|
|
52 |
CleanupStack::PushL(self);
|
|
53 |
self->BaseConstructL();
|
|
54 |
self->SetOrdinalPos(CFepUiBaseCtrl::EOrderBackground);
|
|
55 |
return self;
|
|
56 |
}
|
|
57 |
|
|
58 |
void CAknFepCtrlCommonBgCtrl::SizeChanged(const TRect& aRect)
|
|
59 |
{
|
|
60 |
if (aRect.Size().iWidth == 0 || aRect.Size().iHeight == 0)
|
|
61 |
{
|
|
62 |
return;
|
|
63 |
}
|
|
64 |
|
|
65 |
TRect rect = Rect();
|
|
66 |
if ( aRect == rect )
|
|
67 |
{
|
|
68 |
return;
|
|
69 |
}
|
|
70 |
|
|
71 |
SetRect( aRect );
|
|
72 |
|
|
73 |
Draw();
|
|
74 |
UpdateArea(Rect(), EFalse);
|
|
75 |
}
|
|
76 |
|
|
77 |
TBool CAknFepCtrlCommonBgCtrl::Contains(const TPoint& /*aPt*/)
|
|
78 |
{
|
|
79 |
return EFalse;
|
|
80 |
}
|
|
81 |
|
|
82 |
CAknFepCtrlCommonBgCtrl::CAknFepCtrlCommonBgCtrl(CFepUiLayout* aUiLayout,
|
|
83 |
TInt aControlId,
|
|
84 |
TAknsItemID aFrameID,
|
|
85 |
TAknsItemID aCenterID)
|
|
86 |
: CFepUiBaseCtrl(TRect(), aUiLayout, aControlId),
|
|
87 |
iFrameID(aFrameID), iCenterID(aCenterID)
|
|
88 |
{
|
|
89 |
SetControlType( ECtrlBackgroundCtrl );
|
|
90 |
}
|
|
91 |
|
|
92 |
CAknFepCtrlCommonBgCtrl::~CAknFepCtrlCommonBgCtrl()
|
|
93 |
{
|
|
94 |
iSubItems.Reset();
|
|
95 |
iSubItems.Close();
|
|
96 |
}
|
|
97 |
|
|
98 |
void CAknFepCtrlCommonBgCtrl::SetFrameID( TAknsItemID aFrameID, TAknsItemID aCenterID )
|
|
99 |
{
|
|
100 |
iFrameID = aFrameID;
|
|
101 |
iCenterID = aCenterID;
|
|
102 |
}
|
|
103 |
|
|
104 |
void CAknFepCtrlCommonBgCtrl::Draw()
|
|
105 |
{
|
|
106 |
if(Hiden() || !Ready() || Rect().Size() == TSize(0,0))
|
|
107 |
{
|
|
108 |
return;
|
|
109 |
}
|
|
110 |
|
|
111 |
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
|
|
112 |
|
|
113 |
//mask bitmaps
|
|
114 |
DrawOpaqueMaskBackground();
|
|
115 |
TRect rect = Rect();
|
|
116 |
// ----- draw frame -----
|
|
117 |
gc->Activate( BitmapDevice() );
|
|
118 |
gc->Clear(rect);
|
|
119 |
DrawFrame( gc, rect, iFrameID, iCenterID);
|
|
120 |
|
|
121 |
for( TInt i = 0; i < iSubItems.Count(); i++ )
|
|
122 |
{
|
|
123 |
if( iSubItems[i].iIsShow )
|
|
124 |
{
|
|
125 |
DrawFrame( gc,
|
|
126 |
iSubItems[i].iRect,
|
|
127 |
iSubItems[i].iFrameID,
|
|
128 |
iSubItems[i].iCenterID );
|
|
129 |
}
|
|
130 |
}
|
|
131 |
}
|
|
132 |
|
|
133 |
void CAknFepCtrlCommonBgCtrl::ReDrawRect(const TRect& aRect)
|
|
134 |
{
|
|
135 |
if(Hiden() || !Ready() || Rect().Size() == TSize(0,0))
|
|
136 |
{
|
|
137 |
return;
|
|
138 |
}
|
|
139 |
|
|
140 |
CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());
|
|
141 |
DrawOpaqueMaskBackground();
|
|
142 |
gc->Activate( BitmapDevice() );
|
|
143 |
gc->Clear(aRect);
|
|
144 |
|
|
145 |
gc->SetClippingRect( aRect );
|
|
146 |
TRect rect = Rect();
|
|
147 |
|
|
148 |
DrawFrame( gc, rect, iFrameID, iCenterID);
|
|
149 |
|
|
150 |
for( TInt i = 0; i < iSubItems.Count(); i++ )
|
|
151 |
{
|
|
152 |
if( iSubItems[i].iIsShow )
|
|
153 |
{
|
|
154 |
DrawFrame( gc,
|
|
155 |
iSubItems[i].iRect,
|
|
156 |
iSubItems[i].iFrameID,
|
|
157 |
iSubItems[i].iCenterID );
|
|
158 |
}
|
|
159 |
}
|
|
160 |
gc->CancelClippingRect();
|
|
161 |
}
|
|
162 |
|
|
163 |
void CAknFepCtrlCommonBgCtrl::AddSubBgItemL( const TCommonBgCtrlSubItem& aSubItem )
|
|
164 |
{
|
|
165 |
iSubItems.AppendL( aSubItem );
|
|
166 |
}
|
|
167 |
|
|
168 |
void CAknFepCtrlCommonBgCtrl::ShowSubBgItem( TInt aIndex, TBool aShow )
|
|
169 |
{
|
|
170 |
iSubItems[aIndex].iIsShow = aShow;
|
|
171 |
}
|
|
172 |
|
|
173 |
void CAknFepCtrlCommonBgCtrl::DrawFrame( CFbsBitGc* aGc,
|
|
174 |
const TRect& aRect,
|
|
175 |
TAknsItemID aFrameID,
|
|
176 |
TAknsItemID aCenterID )
|
|
177 |
{
|
|
178 |
MAknsSkinInstance* skin = UiLayout()->SkinInstance();
|
|
179 |
TRect innerRect = aRect;
|
|
180 |
innerRect.Shrink( 4, 4 );
|
|
181 |
|
|
182 |
AknsDrawUtils::DrawFrame(
|
|
183 |
skin, *aGc,
|
|
184 |
aRect, innerRect,
|
|
185 |
aFrameID, aCenterID);
|
|
186 |
}
|
|
187 |
|
|
188 |
TCommonBgCtrlSubItem& CAknFepCtrlCommonBgCtrl::GetSubBgItem( TInt aIndex )
|
|
189 |
{
|
|
190 |
return iSubItems[aIndex];
|
|
191 |
}
|
|
192 |
// End Of File
|