author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 21 | 9da50d567e3c |
parent 20 | f4a778e096c2 |
permissions | -rw-r--r-- |
20 | 1 |
/* |
2 |
* Copyright (c) 2002 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: This class provides drawing a shadow. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include "SpdiaControl.hrh" |
|
23 |
#include "SpdiaControl.h" |
|
24 |
#include "SpdiaGrid.h" |
|
25 |
#include "Speeddial.laf" |
|
26 |
||
27 |
#include <AknsControlContext.h> |
|
28 |
#include <AknsDrawUtils.h> |
|
29 |
#include <applayout.cdl.h> |
|
30 |
#include <aknlayoutscalable_apps.cdl.h> |
|
31 |
#include <layoutmetadata.cdl.h> |
|
32 |
#include <akntitle.h> |
|
33 |
#include <StringLoader.h> |
|
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
34 |
#include <spdctrl.rsg> |
20 | 35 |
const TInt KItemPrimary(3); |
36 |
const TInt KItemSecondary(3); |
|
37 |
||
38 |
// ================= MEMBER FUNCTIONS ======================= |
|
39 |
// --------------------------------------------------------- |
|
40 |
// CSpdiaGridDlg::NewL() |
|
41 |
// |
|
42 |
// --------------------------------------------------------- |
|
43 |
CSpdiaGrid* CSpdiaGrid::NewL(const CSpdiaControl& aControl) |
|
44 |
{ |
|
45 |
CSpdiaGrid* self = new (ELeave) CSpdiaGrid(aControl); |
|
46 |
return self; |
|
47 |
} |
|
48 |
||
49 |
CSpdiaGrid::CSpdiaGrid() |
|
50 |
{ |
|
51 |
} |
|
52 |
||
53 |
CSpdiaGrid::CSpdiaGrid(const CSpdiaControl& aControl) |
|
54 |
{ |
|
55 |
iControl = CONST_CAST(CSpdiaControl*, &aControl); |
|
56 |
} |
|
57 |
||
58 |
CSpdiaGrid::~CSpdiaGrid() |
|
59 |
{ |
|
60 |
} |
|
61 |
||
62 |
void CSpdiaGrid::Draw(const TRect& aRect) const |
|
63 |
{ |
|
64 |
CWindowGc& gc = SystemGc(); |
|
65 |
AknsDrawUtils::Background( |
|
66 |
AknsUtils::SkinInstance(), |
|
67 |
AknsDrawUtils::ControlContext( iControl ), |
|
68 |
this, |
|
69 |
gc, |
|
70 |
iControl->Rect() ); |
|
71 |
if ( iControl ) |
|
72 |
{ |
|
73 |
iControl->DrawShadow( gc ); |
|
74 |
} |
|
75 |
CAknGrid::Draw(aRect); |
|
76 |
} |
|
77 |
||
78 |
void CSpdiaGrid::SizeChanged() |
|
79 |
{ |
|
80 |
TRAP_IGNORE( SizeChangedL() ); |
|
81 |
} |
|
82 |
||
83 |
void CSpdiaGrid::SizeChangedL() |
|
84 |
{ |
|
85 |
//Scalable UI. |
|
86 |
TAknLayoutRect areaLayout; |
|
87 |
TRect mainPaneRect ; |
|
88 |
TRect statusPaneRect; |
|
89 |
||
90 |
if ( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
91 |
{ |
|
92 |
TAknLayoutRect mainQdialPaneRect; |
|
93 |
TAknLayoutRect gridQdialPaneRect; |
|
94 |
if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
95 |
{ |
|
96 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
97 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
98 |
mainPaneRect.iTl = statusPaneRect.iTl; |
|
99 |
} |
|
100 |
else |
|
101 |
{ |
|
102 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect); |
|
103 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect); |
|
104 |
mainPaneRect.iTl= statusPaneRect.iTl; |
|
105 |
} |
|
106 |
mainQdialPaneRect.LayoutRect(mainPaneRect,AknLayoutScalable_Apps::main_qdial_pane().LayoutLine()); |
|
107 |
gridQdialPaneRect.LayoutRect(mainQdialPaneRect.Rect(),AknLayoutScalable_Apps::grid_qdial_pane().LayoutLine()); |
|
108 |
TAknWindowLineLayout area = AknLayoutScalable_Apps::grid_qdial_pane().LayoutLine(); |
|
109 |
areaLayout.LayoutRect(mainQdialPaneRect.Rect() ,area); |
|
110 |
} |
|
111 |
else |
|
112 |
{ |
|
113 |
TAknWindowLineLayout area = AppLayout::Speed_Dial_descendants_Line_1(); |
|
114 |
areaLayout.LayoutRect(Rect() ,area); |
|
115 |
} |
|
116 |
||
117 |
TInt areaWidth = areaLayout.Rect().Width(); |
|
118 |
TInt areaHeight = areaLayout.Rect().Height(); |
|
119 |
TInt areaIl = areaLayout.Rect().iTl.iX; |
|
120 |
TInt areaIt = areaLayout.Rect().iTl.iY; |
|
121 |
TAknLayoutRect r; |
|
122 |
r.LayoutRect( Rect(), AknLayoutScalable_Apps::main_qdial_pane() ); |
|
123 |
r.LayoutRect( r.Rect(), AknLayoutScalable_Apps::grid_qdial_pane() ); |
|
124 |
SetPosition( r.Rect().iTl ); |
|
125 |
||
126 |
SetSizeWithoutNotification( MinimumSize() ); |
|
127 |
||
128 |
CFormattedCellListBoxData* data = ItemDrawer()->FormattedCellData(); |
|
129 |
||
130 |
// set skin style to samre rect... |
|
131 |
data->SetBackgroundSkinStyle(&KAknsIIDQsnBgAreaMainQdial, TRect(r.Rect())); |
|
132 |
||
133 |
CAknQdialStyleGrid::SizeChanged(); |
|
134 |
//Scalable UI |
|
135 |
if ( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
136 |
{ |
|
137 |
TAknLayoutRect mainQdialPaneRect; |
|
138 |
TAknLayoutRect gridQdialPaneRect; |
|
139 |
TAknLayoutRect callQdialPaneRect; |
|
140 |
TAknLayoutRect areaRect; |
|
141 |
||
142 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); |
|
143 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneRect ); |
|
144 |
mainPaneRect.iTl = statusPaneRect.iTl; |
|
145 |
mainQdialPaneRect.LayoutRect( mainPaneRect,AknLayoutScalable_Apps::main_qdial_pane().LayoutLine() ); |
|
146 |
gridQdialPaneRect.LayoutRect( mainQdialPaneRect.Rect(), AknLayoutScalable_Apps::grid_qdial_pane().LayoutLine() ); |
|
147 |
TAknWindowComponentLayout areaNew = AknLayoutScalable_Apps::cell_qdial_pane( 0, 0 ).LayoutLine(); |
|
148 |
areaRect.LayoutRect( mainQdialPaneRect.Rect(), areaNew.LayoutLine() ); |
|
149 |
||
150 |
if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
151 |
{ |
|
152 |
areaWidth = areaRect.Rect().Width(); |
|
153 |
areaHeight = areaRect.Rect().Height(); |
|
154 |
} |
|
155 |
else |
|
156 |
{ |
|
157 |
areaWidth = ( mainPaneRect.Width() / 3 ) - 1; |
|
158 |
areaHeight = ( mainPaneRect.Height() / 3 ) - 7; |
|
159 |
} |
|
160 |
} |
|
161 |
else |
|
162 |
{ |
|
163 |
TAknWindowLineLayout area = AppLayout::cell_qdial_pane( 0, 0 ); |
|
164 |
areaLayout.LayoutRect( Rect(), area ); |
|
165 |
areaWidth = areaLayout.Rect().Width(); |
|
166 |
areaHeight = areaLayout.Rect().Height(); |
|
167 |
} |
|
168 |
||
169 |
TInt language = User::Language(); |
|
170 |
TBool LeftToRight = ETrue; |
|
171 |
||
172 |
// According to the UI Spec: |
|
173 |
// When Arabic and Hebrew input is in use, the Arabic and Hebrew browsing order |
|
174 |
// is not followed. Instead, the browsing order is the same as in Western variants. |
|
175 |
if ( language == ELangUrdu /*|| language == ELangArabic*/ ) |
|
176 |
{ |
|
177 |
LeftToRight = EFalse; |
|
178 |
} |
|
179 |
TRAP_IGNORE( SetLayoutL( |
|
180 |
EFalse, // aVerticalOrientation |
|
181 |
LeftToRight, // aLeftToRight |
|
182 |
ETrue, // aTopToBottom |
|
183 |
KItemPrimary, // aNumOfItemsInPrimaryOrient |
|
184 |
KItemSecondary, // aNumOfItemsInSecondaryOrient |
|
185 |
TSize( areaWidth, areaHeight ) // NewScalableUI changes |
|
186 |
// aWidthOfSpaceBetweenItems = 0 |
|
187 |
) |
|
188 |
); |
|
189 |
||
190 |
data->SetTransparentSubCellL( SDM_TN_CIF_TURNED, ETrue ); // 5 |
|
191 |
data->SetTransparentSubCellL( SDM_TN_CIF, ETrue ); // 7 |
|
192 |
data->SetTransparentSubCellL( SDM_TN_VGA_TURNED, ETrue ); // 9 |
|
193 |
data->SetTransparentSubCellL( SDM_TN_VGA, ETrue ); // 11 |
|
194 |
data->SetTransparentSubCellL( SDM_TN_OTHER, ETrue ); // 13 |
|
195 |
||
196 |
ScrollBarFrame()->SetScrollBarVisibilityL( |
|
197 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff ); |
|
198 |
data->SetBackgroundSkinStyle(&KAknsIIDQsnBgAreaMainQdial, mainPaneRect); |
|
199 |
iControl->SetLayout( Rect() ); |
|
200 |
if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
201 |
{ |
|
202 |
CEikStatusPane *sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
203 |
CAknTitlePane* title = STATIC_CAST(CAknTitlePane*, sp->ControlL( TUid::Uid(EEikStatusPaneUidTitle) ) ); |
|
204 |
HBufC* prompt = StringLoader::LoadLC(R_QTN_SPDIA_TITLE, iCoeEnv); |
|
205 |
title->SetTextL(*prompt); |
|
206 |
title->MakeVisible(ETrue); |
|
207 |
title->DrawNow(); |
|
208 |
CleanupStack::PopAndDestroy(prompt); |
|
209 |
CEikonEnv::Static()->AppUiFactory()->StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
210 |
} |
|
211 |
} |
|
212 |
||
213 |
||
214 |
// --------------------------------------------------------- |
|
215 |
// CSpdiaGrid::MopSupplyObject() |
|
216 |
// Pass skin information if need. |
|
217 |
// --------------------------------------------------------- |
|
218 |
// |
|
219 |
TTypeUid::Ptr CSpdiaGrid::MopSupplyObject(TTypeUid aId) |
|
220 |
{ |
|
221 |
if ( aId.iUid == MAknsControlContext::ETypeId ) |
|
222 |
{ |
|
223 |
return MAknsControlContext::SupplyMopObject( aId, AknsDrawUtils::ControlContext(iControl) ); |
|
224 |
} |
|
225 |
return CCoeControl::MopSupplyObject( aId ); |
|
226 |
} |
|
227 |
||
228 |
// End of File |