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: Base interface for all container widgets |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef I_ALFCONTAINERWIDGET_H |
|
20 #define I_ALFCONTAINERWIDGET_H |
|
21 |
|
22 #include <alf/ialfwidget.h> |
|
23 class CAlfLayout; |
|
24 |
|
25 namespace Alf |
|
26 { |
|
27 class IAlfLayoutManager; |
|
28 |
|
29 namespace ialfcontainerwidget |
|
30 { |
|
31 static const IfId ident = |
|
32 { |
|
33 0, "container" |
|
34 }; |
|
35 } |
|
36 |
|
37 /** |
|
38 * The interface for container widget. |
|
39 * |
|
40 * Container widget maintains it's own control group. When a widget control is set to container |
|
41 * widget throught the IAlfWidget::setControl() - method the control is automatically appended to the |
|
42 * container widget's control group. If the control that is being set to the container widget is |
|
43 * already part of another control group it will be removed from the previous control group and appended |
|
44 * to the container widget's control group. |
|
45 * |
|
46 * @lib alfwidgetmodel.lib |
|
47 * @since S60 ?S60_version |
|
48 * @status Draft |
|
49 */ |
|
50 class IAlfContainerWidget : public IAlfWidget |
|
51 { |
|
52 public: |
|
53 |
|
54 static inline const IfId& type() |
|
55 { |
|
56 return ialfcontainerwidget::ident; |
|
57 } |
|
58 |
|
59 virtual ~IAlfContainerWidget() {} |
|
60 |
|
61 /** |
|
62 * Returns total number of widgets contained by this container. |
|
63 * |
|
64 * @return int Total number of widgets. |
|
65 */ |
|
66 virtual int widgetCount() const = 0; |
|
67 |
|
68 /** |
|
69 * Adds a child widget to the container. |
|
70 * |
|
71 * This will throw an osncore::AlfException exception with error code |
|
72 * osncore::EInvalidArgument if the aWidget is the same widget that the container |
|
73 * widget itself or if user tries to add a view widget into a container |
|
74 * widget. |
|
75 * |
|
76 * Adding a widget instance that is already added will be silently |
|
77 * ignored. |
|
78 * |
|
79 * @exception osncore::AlfException with error code osncore::EInvalidArgument if the |
|
80 * aWidget is the same widget as the container widget or when |
|
81 * a view widget is attempted to be added to a container. |
|
82 * |
|
83 * @param aWidget Child widget to be added to container. |
|
84 */ |
|
85 virtual void addWidget(IAlfWidget& aWidget) = 0; |
|
86 |
|
87 /** |
|
88 * Returns child widget at given index. If index is not found return null. |
|
89 * |
|
90 * @param aIndex Index of widget to be returned. |
|
91 * @return Widget at given index or null if the widget is not found. |
|
92 */ |
|
93 virtual IAlfWidget* getWidget(int aIndex) const = 0; |
|
94 |
|
95 /** |
|
96 * Returns the child index, when given the child widget. |
|
97 * |
|
98 * @param aWidget child widget, which index is returned |
|
99 * @return the index of the child widget, or -1, if widget is not child of this container. |
|
100 */ |
|
101 virtual int getWidgetIndex(IAlfWidget& aWidget) const = 0; |
|
102 |
|
103 /** |
|
104 * Removes the child widget from given index. |
|
105 * |
|
106 * If widget for the given index is not found then the call |
|
107 * is silently ignored. |
|
108 * |
|
109 * @param aIndex Index from which widget has to be removed. |
|
110 */ |
|
111 virtual void removeWidget(int aIndex) = 0; |
|
112 |
|
113 /** |
|
114 * Sets the base layout of container widget. Ownership of the |
|
115 * layout manager is transferred to container widget. |
|
116 * |
|
117 * @param aLayout New base layout of container widget. |
|
118 */ |
|
119 virtual void applyLayout(IAlfLayoutManager& aLayout) = 0; |
|
120 |
|
121 |
|
122 }; |
|
123 |
|
124 } // namespace Alf |
|
125 |
|
126 #endif // I_ALFCONTAINERWIDGET_H |
|