1 /* |
|
2 * Copyright (c) 2009 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: Widget interface with utilities for scrollbar widget. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef ALF_SCROLLBARWIDGET_H |
|
21 #define ALF_SCROLLBARWIDGET_H |
|
22 |
|
23 |
|
24 // WidgetModel Includes |
|
25 #include <alf/ialfwidgeteventhandler.h> |
|
26 #include "alf/alfwidget.h" |
|
27 #include <alf/alfexceptions.h> |
|
28 |
|
29 // Widget Includes |
|
30 #include <alf/ialfscrollbarwidget.h> |
|
31 #include <alf/ialfscrollbarmodel.h> |
|
32 |
|
33 |
|
34 // Forward Declarations |
|
35 class CAlfEnv; |
|
36 |
|
37 // From namespace Alf |
|
38 namespace Alf |
|
39 { |
|
40 // Forward Declarations |
|
41 class CAlfWidgetControl; |
|
42 class IAlfModel; |
|
43 } |
|
44 |
|
45 //From name space duiuimodel |
|
46 namespace duiuimodel |
|
47 { |
|
48 class DuiNode; |
|
49 } |
|
50 |
|
51 namespace Alf |
|
52 { |
|
53 |
|
54 /** |
|
55 * A basic scrollbar widget implementation. |
|
56 * Contains methods for creating the default |
|
57 * building blocks for the scrollbar widget. |
|
58 */ |
|
59 class AlfScrollBarWidget : public IAlfScrollBarWidget |
|
60 { |
|
61 public: |
|
62 |
|
63 /** |
|
64 * Creator Method. |
|
65 * |
|
66 * @param aEnv The environment for the widget. |
|
67 * @param aContainer The container widget where this widget is contained. |
|
68 * @param aWidgetId The name of the widget. Not Owned. |
|
69 * @param aFilePath Path to XML file describing the presentation |
|
70 * of the widget. Not Owned. |
|
71 * @param aCustomData Custom data. Not Owned. |
|
72 * @param aNode Node. Not Owned. |
|
73 * @return AlfScrollBarWidget , or NULL if it does not create |
|
74 */ |
|
75 static AlfScrollBarWidget* create(CAlfEnv& aEnv, |
|
76 IAlfContainerWidget& aContainer, |
|
77 const char* aWidgetId, |
|
78 DuiNode *aNode=NULL, |
|
79 const char* aFilePath=NULL, |
|
80 AlfCustomInitDataBase* aCustomData=NULL); |
|
81 |
|
82 /** |
|
83 * Virtual Destructor. |
|
84 */ |
|
85 virtual ~AlfScrollBarWidget(); |
|
86 |
|
87 // From IAlfInterfaceBase |
|
88 /** |
|
89 * Getter for interfaces provided by the scrollbar widget class. |
|
90 * |
|
91 * @since S60 ?S60_version |
|
92 * @param aType A descriptor to identify the type of the queried interface. |
|
93 * @return The queried interface, or NULL if the interface is not |
|
94 * supported or available. |
|
95 */ |
|
96 IAlfInterfaceBase* makeInterface(const IfId& aType); |
|
97 |
|
98 // From IAlfWidget |
|
99 |
|
100 /** |
|
101 * Return the control |
|
102 */ |
|
103 CAlfWidgetControl* control() const; |
|
104 |
|
105 /** |
|
106 * getter for the parent container. The ownership is not passed. |
|
107 * @param none |
|
108 * @return the parent container or NULL if the widget is the root-widget. |
|
109 */ |
|
110 virtual IAlfContainerWidget* parent() const; |
|
111 |
|
112 /** |
|
113 * Setter for the control. The control is owned by the Alfred environment. |
|
114 * |
|
115 * @since S60 ?S60_version |
|
116 * @param aControl The control for this widget. |
|
117 * @param aDeletePreviousControl delete previous control.TRUE by default. |
|
118 * @return void. |
|
119 */ |
|
120 void setControl(CAlfWidgetControl* aControl, |
|
121 bool aDeletePreviousControl = true); |
|
122 |
|
123 /** |
|
124 * Gets the model. |
|
125 */ |
|
126 IAlfModel* model(); |
|
127 |
|
128 /** |
|
129 * Sets the model. |
|
130 |
|
131 * @return void. |
|
132 */ |
|
133 void setModel(IAlfModel* aModel, bool /*param*/); |
|
134 |
|
135 /** |
|
136 * Return the widget name |
|
137 */ |
|
138 const char* widgetName() const; |
|
139 |
|
140 /** |
|
141 * sets the focus to the child. |
|
142 |
|
143 * @return void. |
|
144 */ |
|
145 void setChildFocus(bool /*aFocus*/); |
|
146 |
|
147 |
|
148 |
|
149 /** |
|
150 * Sets the presentation for the widget using presentation XML file. |
|
151 |
|
152 * Destroys any existing presentation. |
|
153 * @param aFilePath Path to XML file describing the presentation |
|
154 * of the widget. Not Owned. |
|
155 * @exception AlfWidgetException if no visualization node available |
|
156 * in Presentation XML or if no control |
|
157 * is associated with the widget. |
|
158 * @exception bad_alloc |
|
159 * @since S60 ?S60_version |
|
160 * @return void. |
|
161 */ |
|
162 virtual void setPresentation(const char* aFilePath); |
|
163 |
|
164 /** |
|
165 * Sets whether or not tactile feedback is enabled. |
|
166 * |
|
167 * @param aFlag Whether or not tactile is enabled. |
|
168 */ |
|
169 void enableTactile(bool aFlag); |
|
170 |
|
171 /** |
|
172 * Returns the state of tactile feedback whether it is enabled/disabled. |
|
173 * |
|
174 */ |
|
175 bool IsTactileEnabled(); |
|
176 |
|
177 protected: |
|
178 |
|
179 /** |
|
180 * C++ constructor. |
|
181 * |
|
182 * @param aEnv The environment for the widget. |
|
183 * @param aContainer The container widget where this widget is contained. |
|
184 * @param aWidgetId The name of the widget. Not Owned. |
|
185 * @param aFilePath Path to XML file describing the presentation |
|
186 * of the widget. Not Owned. |
|
187 * @param aCustomData Custom data. |
|
188 * @param aNode Node. Not Owned. |
|
189 */ |
|
190 AlfScrollBarWidget(CAlfEnv& aEnv, |
|
191 IAlfContainerWidget& aContainer, |
|
192 const char* aWidgetId, |
|
193 DuiNode *aNode=NULL, |
|
194 const char *aFilePath=NULL, |
|
195 AlfCustomInitDataBase* aCustomData=NULL); |
|
196 |
|
197 /** |
|
198 * Methods to create different default elements and control of scroll bar. |
|
199 * |
|
200 * @param aEnv The environment for the widget. |
|
201 * @return void. |
|
202 */ |
|
203 void constructDefault(CAlfEnv& aEnv); |
|
204 |
|
205 /** |
|
206 * Creates the default control. |
|
207 * |
|
208 * @param aEnv The environment for the widget. |
|
209 * @return The Control. |
|
210 */ |
|
211 CAlfWidgetControl *constructDefaultControl(CAlfEnv& aEnv); |
|
212 |
|
213 private: |
|
214 |
|
215 /** |
|
216 * Base widget. Own. |
|
217 */ |
|
218 auto_ptr<AlfWidget> mWidget; |
|
219 |
|
220 IAlfScrollBarModel * mScrollModel; |
|
221 CAlfWidgetControl * mScrollControl; |
|
222 }; // class AlfScrollBarWidget |
|
223 |
|
224 } // namespace Alf |
|
225 |
|
226 #endif // C_ALFSCROLLBARWIDGET_H |
|