|
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: Viewport layout |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "alf/alfviewportlayout.h" |
|
21 #include "alf/alfcontrol.h" |
|
22 #include "alf/alfenv.h" |
|
23 #include "alfclient.h" |
|
24 #include "alf/alfconstants.h" |
|
25 #include "alf/alfgencomponent.h" |
|
26 #include "alflogger.h" |
|
27 |
|
28 // ======== LOCAL FUNCTIONS ======== |
|
29 |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // 1st phase constructor |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 EXPORT_C CAlfViewportLayout::CAlfViewportLayout() |
|
38 : CAlfLayout() |
|
39 { |
|
40 } |
|
41 |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // 2nd phase constructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C void CAlfViewportLayout::ConstructL(CAlfControl& aOwner) |
|
48 { |
|
49 CAlfLayout::ConstructL(aOwner); |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // Destructor |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C CAlfViewportLayout::~CAlfViewportLayout() |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Creates new anchor layout for the control. |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C CAlfViewportLayout* CAlfViewportLayout::AddNewL( |
|
66 CAlfControl& aOwnerControl, |
|
67 CAlfLayout* aParentLayout ) |
|
68 { |
|
69 CAlfViewportLayout* layout = STATIC_CAST(CAlfViewportLayout*, |
|
70 aOwnerControl.AppendLayoutL(EAlfLayoutTypeViewport, aParentLayout)); |
|
71 return layout; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // Set virtual size of view area. |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C void CAlfViewportLayout::SetVirtualSize(const TAlfRealSize& aSize, TInt aTransitionTime) |
|
79 { |
|
80 TAlfTimedPoint safeSize(aSize.iWidth, aSize.iHeight, aTransitionTime); |
|
81 safeSize.SetStyle(EAlfTimedValueStyleLinear); |
|
82 |
|
83 TPckgC<TAlfTimedPoint> pckg(safeSize); |
|
84 |
|
85 TInt err = Comms()->DoCmdNoReply(EAlfViewportLayoutSetVirtualSize, pckg ); |
|
86 |
|
87 if ( err ) |
|
88 { |
|
89 __ALFLOGSTRING1( "CAlfViewportLayout::SetVirtualSize ignore error %d", err ) |
|
90 } |
|
91 |
|
92 // No need to update children. That is done on the server side. |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // Sets viewport size in virtual units. |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C void CAlfViewportLayout::SetViewportSize(const TAlfRealSize& aSize, TInt aTransitionTime) |
|
100 { |
|
101 TAlfTimedPoint safeSize(aSize.iWidth, aSize.iHeight, aTransitionTime); |
|
102 safeSize.SetStyle(EAlfTimedValueStyleLinear); |
|
103 |
|
104 TPckgC<TAlfTimedPoint> pckg(safeSize); |
|
105 |
|
106 TInt err = Comms()->DoCmdNoReply(EAlfViewportLayoutSetViewportSize, pckg ); |
|
107 |
|
108 if ( err ) |
|
109 { |
|
110 __ALFLOGSTRING1( "CAlfViewportLayout::SetViewportSize ignore error %d", err ) |
|
111 } |
|
112 |
|
113 // No need to update children. That is done on the server side. |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // Sets viewport pos in virtual units. |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C void CAlfViewportLayout::SetViewportPos(const TAlfRealPoint& aPos, TInt aTransitionTime) |
|
121 { |
|
122 TAlfTimedPoint safeSize(aPos.iX, aPos.iY, aTransitionTime); |
|
123 safeSize.SetStyle(EAlfTimedValueStyleLinear); |
|
124 |
|
125 TPckgC<TAlfTimedPoint> pckg(safeSize); |
|
126 |
|
127 TInt err = Comms()->DoCmdNoReply(EAlfViewportLayoutSetViewportPos, pckg ); |
|
128 |
|
129 if ( err ) |
|
130 { |
|
131 __ALFLOGSTRING1( "CAlfViewportLayout::SetViewportPos ignore error %d", err ) |
|
132 } |
|
133 |
|
134 // No need to update children. That is done on the server side. |
|
135 } |
|
136 |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // Place holder from CAlfVisual |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 EXPORT_C void CAlfViewportLayout::RemoveAndDestroyAllD() |
|
143 { |
|
144 CAlfLayout::RemoveAndDestroyAllD(); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // Place holder from CAlfVisual |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 EXPORT_C void CAlfViewportLayout::UpdateChildrenLayout(TInt aTransitionTime ) |
|
152 { |
|
153 CAlfLayout::UpdateChildrenLayout( aTransitionTime ); |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // Place holder from CAlfVisual |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C CAlfVisual* CAlfViewportLayout::FindTag(const TDesC8& aTag) |
|
161 { |
|
162 return CAlfLayout::FindTag( aTag ); |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // Place holder from CAlfVisual |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 EXPORT_C void CAlfViewportLayout::DoRemoveAndDestroyAllD() |
|
170 { |
|
171 CAlfLayout::DoRemoveAndDestroyAllD(); |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // Place holder from CAlfLayout |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 EXPORT_C TAlfXYMetric CAlfViewportLayout::BaseUnit() const |
|
179 { |
|
180 return CAlfLayout::BaseUnit(); |
|
181 } |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // future proofing |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 EXPORT_C void CAlfViewportLayout::PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams) |
|
188 { |
|
189 CAlfLayout::PropertyOwnerExtension(aExtensionUid,aExtensionParams); |
|
190 } |
|
191 |