|
1 /* |
|
2 * Copyright (c) 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: anchorlayoutmanager with focus handling in 1D (next/previous) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <alf/alfanchorlayoutmanager.h> |
|
20 #include <alf/alfexceptions.h> |
|
21 #include <alf/alfwidgetcontrol.h> |
|
22 #include <osn/ustring.h> |
|
23 #include <osn/osnnew.h> |
|
24 |
|
25 #include "alfanchorlayoutmanagerimpl.h" |
|
26 |
|
27 using osncore::UString; |
|
28 |
|
29 using namespace Alf; |
|
30 |
|
31 namespace Alf |
|
32 { |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // layout manager constructor |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 OSN_EXPORT AlfAnchorLayoutManager::AlfAnchorLayoutManager() |
|
41 : AlfLayoutManager(EAlfLayoutTypeAnchor) |
|
42 { |
|
43 mData.reset(new (EMM) AlfAnchorLayoutManagerImpl(*this)); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // virtual destructor |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 OSN_EXPORT AlfAnchorLayoutManager::~AlfAnchorLayoutManager() |
|
51 { |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // from AlfLayoutManager |
|
56 // notifies the layout manager, that the child control's layout |
|
57 // must be updated. |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 OSN_EXPORT void AlfAnchorLayoutManager::updateChildLayout( |
|
61 CAlfWidgetControl* aControl) |
|
62 { |
|
63 CAlfLayout& layout = getLayout(); |
|
64 doUpdateChildLayout(aControl); |
|
65 layout.UpdateChildrenLayout(); |
|
66 |
|
67 //doUpdateChildLayout changes the visual size and position. |
|
68 //need to notify the widget that size and position has changed. |
|
69 |
|
70 //set the size and postion for aControl |
|
71 TAlfRealRect rect; |
|
72 if (controlRect(*aControl, rect)) //returns the real rect (of the root visual) |
|
73 { |
|
74 setControlRect(*aControl, rect); |
|
75 } |
|
76 |
|
77 // Inform parent layout manager about the changed presentation size |
|
78 owner().updateParentLayout(); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // from IAlfLayoutManager |
|
83 // notifies the layout manager, that the control's has been |
|
84 // removed from the layout. |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 OSN_EXPORT void AlfAnchorLayoutManager::childRemoved(CAlfWidgetControl* aControl) |
|
88 { |
|
89 //when control is removed from layout, no change to other widget rects, |
|
90 // just call the base class |
|
91 AlfLayoutManager::childRemoved(aControl); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // from AlfLayoutManager |
|
96 // notifies the layout manager, that the child control's layout |
|
97 // must be updated. |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 OSN_EXPORT void AlfAnchorLayoutManager::doUpdateChildLayout( |
|
101 CAlfWidgetControl* /*aControl*/) |
|
102 { |
|
103 //anchorlayout changes the position and size, nothing to do here. |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // From class IAlfInterfaceBase. |
|
108 // Getter for interfaces provided by the element. |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 OSN_EXPORT IAlfInterfaceBase* AlfAnchorLayoutManager::makeInterface( |
|
112 const IfId& aType ) |
|
113 { |
|
114 UString param(aType.mImplementationId); |
|
115 if (param == IAlfLayoutManager::type().mImplementationId) |
|
116 { |
|
117 return this; |
|
118 } |
|
119 |
|
120 // Let the implementation class try the interface creation |
|
121 IAlfInterfaceBase* pInterface = mData->makeInterface(aType); |
|
122 return pInterface; |
|
123 } |
|
124 } // Alf |