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: layoutmanager implementation class with focus handling in 1D (next/previous) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <alf/ialfwidgetcontrol.h> |
|
20 #include <alf/alfvisual.h> |
|
21 #include <alf/alfanchorlayout.h> |
|
22 #include "alf/alfwidget.h" |
|
23 #include <alf/alfvisualfactory.h> |
|
24 #include <alf/alfexceptions.h> |
|
25 #include <alf/ialflayoutpreferences.h> |
|
26 #include <osn/osnnew.h> |
|
27 |
|
28 //stl |
|
29 #include <algorithm> //for min & max |
|
30 |
|
31 #include "alfanchorlayoutmanagerimpl.h" |
|
32 |
|
33 using namespace Alf; |
|
34 |
|
35 namespace Alf |
|
36 { |
|
37 // ======== MEMBER FUNCTIONS ======== |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // layoutmanagerimpl constructor |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 AlfAnchorLayoutManagerImpl::AlfAnchorLayoutManagerImpl( |
|
44 AlfAnchorLayoutManager& aAnchorLayoutManager) : |
|
45 mAnchorLayoutManager(aAnchorLayoutManager) |
|
46 { |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // creates the layout used by the layoutmanager. |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 AlfAnchorLayoutManagerImpl::~AlfAnchorLayoutManagerImpl() |
|
54 { |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // from IAlfLayoutPreferences |
|
59 // Returns the minimum area that this layout manager can occupy by observing |
|
60 // the minimum sizes of the child UI elements in the layout |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 bool AlfAnchorLayoutManagerImpl::getMinimumSize( TAlfXYMetric& /*aMinSize*/ ) const |
|
64 { |
|
65 return false; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // from IAlfLayoutPreferences |
|
70 // Returns the maximum area that this layout manager can occupy by observing |
|
71 // the maximum sizes of the child UI elements in the layout |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 bool AlfAnchorLayoutManagerImpl::getMaximumSize( TAlfXYMetric& /*aMaxSize*/ ) const |
|
75 { |
|
76 return false; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // Combines and returns the preferred sizes of all child UI elements according |
|
81 // to the layouting rules. |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 bool AlfAnchorLayoutManagerImpl::getPreferredSize(TAlfXYMetric& /*aPreferredSize*/) const |
|
85 { |
|
86 return false; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // from IAlfLayoutPreferences |
|
91 // At the moment doesn't do anything since preferred size is being queried |
|
92 // from the child UI elements added to this layout manager. |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void AlfAnchorLayoutManagerImpl::setPreferredSize( const TAlfXYMetric& aPreferredSize) |
|
96 { |
|
97 TAlfTimedPoint size((float)aPreferredSize.iX.iMagnitude,(float)aPreferredSize.iY.iMagnitude); |
|
98 layout().SetSize(size); |
|
99 mAnchorLayoutManager.owner().updateParentLayout(); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // From class IAlfInterfaceBase. |
|
104 // Getter for interfaces provided by the element. |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 IAlfInterfaceBase* AlfAnchorLayoutManagerImpl::makeInterface(const IfId& aType) |
|
108 { |
|
109 UString param(aType.mImplementationId); |
|
110 if (param == IAlfLayoutPreferences::type().mImplementationId) |
|
111 { |
|
112 return this; |
|
113 } |
|
114 |
|
115 return NULL; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // returns the anchorlayout used by the layoutmanager |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 CAlfAnchorLayout& AlfAnchorLayoutManagerImpl::layout() const |
|
123 { |
|
124 return dynamic_cast<CAlfAnchorLayout&>(mAnchorLayoutManager.getLayout()); |
|
125 } |
|
126 |
|
127 } // Alf |
|