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: Header for slider presentation elements. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUL_SLIDERPROGRESSIVE_H |
|
20 #define MUL_SLIDERPROGRESSIVE_H |
|
21 |
|
22 //INCLUDES |
|
23 |
|
24 #include "alf/alfelement.h" |
|
25 #include "mulslidermodel.h" |
|
26 #include "imulsliderbaseelementinternal.h" |
|
27 #include <alf/alfbitmapprovider.h> |
|
28 #include <alf/ialfwidgeteventhandler.h> |
|
29 namespace Alf |
|
30 { |
|
31 class CAlfWidgetControl; |
|
32 /** |
|
33 * Default Base Element of the slider. |
|
34 */ |
|
35 class MulSliderProgressive : |
|
36 public AlfElement, |
|
37 public IAlfWidgetEventHandler, |
|
38 public IMulSliderBaseElementInternal, |
|
39 public MAlfBitmapProvider |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Constructor |
|
44 * @param aControl Widget control. |
|
45 * @param aName Name of the item element. |
|
46 * @param aCustomData . |
|
47 * @param mNode . |
|
48 * @since S60 ?S60_version |
|
49 */ |
|
50 MulSliderProgressive ( |
|
51 CAlfWidgetControl& aControl, |
|
52 const char* aName, AlfCustomInitDataBase* /*aCustomData*/); |
|
53 /** |
|
54 * Destructor |
|
55 */ |
|
56 virtual ~MulSliderProgressive(); |
|
57 |
|
58 /** |
|
59 * bitmap provider. |
|
60 * @since S60 ?S60_version |
|
61 * @param aId bitmap ID. |
|
62 * @param aBitmap bitmap. |
|
63 * @param aMaskBitmap mask for the bitmap. |
|
64 * @return |
|
65 */ |
|
66 void ProvideBitmapL (TInt aId, |
|
67 CFbsBitmap *& aBitmap, |
|
68 CFbsBitmap *& aMaskBitmap); |
|
69 |
|
70 /** |
|
71 * From IAlfInterfaceBase. |
|
72 * Getter for interfaces provided by the widget class. |
|
73 * @since S60 ?S60_version |
|
74 * @param aType A descriptor to identify the type of the queried |
|
75 * interface. |
|
76 * @return The queried interface, or NULL if the interface is not |
|
77 * supported or available. |
|
78 */ |
|
79 virtual IAlfInterfaceBase* makeInterface(const IfId& aType); |
|
80 /** |
|
81 * @see IAlfWidgetEventHandler |
|
82 */ |
|
83 virtual AlfEventHandlerType eventHandlerType(); |
|
84 /** |
|
85 * @see IAlfWidgetEventHandler |
|
86 */ |
|
87 virtual AlfEventHandlerExecutionPhase eventExecutionPhase(); |
|
88 |
|
89 |
|
90 //-------------------------------------------------------------------------- |
|
91 //Overriden Apis from IAlfWidgetEventHandlers |
|
92 //-------------------------------------------------------------------------- |
|
93 // |
|
94 /** |
|
95 * Used to identify event handlers that are capable of handling |
|
96 * a specified key or custom event. |
|
97 * Pointer event handlers cannot be identified directly, |
|
98 * since they are dependent on the presentation. |
|
99 * Therefore, pointer event handlers should be associated with |
|
100 * a custom event ID that can be used to |
|
101 * simulate the actual pointer event. |
|
102 * @since S60 ?S60_version |
|
103 * @param aEvent The event. |
|
104 * @param aControl |
|
105 * @return <code>ETrue</code> if the event can be processed. |
|
106 * Otherwise <code>EFalse</code>. |
|
107 */ |
|
108 bool accept( |
|
109 CAlfWidgetControl& aControl, const TAlfEvent& aEvent) const; |
|
110 /** |
|
111 * Called when an input event is being offered to this event handler. |
|
112 * The return value is used to indicate if the event was processed. |
|
113 * Processed events may not be offered to other event handlers. |
|
114 * @since S60 ?S60_version |
|
115 * @param aControl The parent control of this event handler. |
|
116 * @param aEvent The event. |
|
117 * @return <code>ETrue</code> if the event was processed. |
|
118 * Otherwise <code>EFalse</code>. |
|
119 */ |
|
120 virtual AlfEventStatus offerEvent( |
|
121 CAlfWidgetControl& aControl, |
|
122 const TAlfEvent& aEvent ); |
|
123 /** |
|
124 * Defines the widget states, where the event handler is active. |
|
125 * By default, if this method |
|
126 * is not called, the event handler is expected |
|
127 * to be active in all states. |
|
128 * @param aStates A bitmask defining the widget |
|
129 * states, where the event |
|
130 * handler is active. The low 16 bits are reserved for the states |
|
131 * defined by the framework in <TODO: add reference>. |
|
132 * The high 16 bits are |
|
133 * available for states defined by the client code. |
|
134 */ |
|
135 void setActiveStates(unsigned int aStates); |
|
136 /** |
|
137 * Sets AlfWidgetEventHandlerInitData to event handler. |
|
138 * @param aData A data structure which contains |
|
139 * for example id of the event |
|
140 * handler. |
|
141 */ |
|
142 virtual void setEventHandlerData( |
|
143 const AlfWidgetEventHandlerInitData& /*aData*/ ) |
|
144 { |
|
145 |
|
146 } |
|
147 /** |
|
148 * Returns AlfWidgetEventHandlerInitData. |
|
149 * @return A pointer to AlfWidgetEventHandlerInitData structure |
|
150 * which contains for example id of the event handler. |
|
151 */ |
|
152 virtual AlfWidgetEventHandlerInitData* eventHandlerData() |
|
153 { |
|
154 return NULL; |
|
155 } |
|
156 |
|
157 //-------------------------------------------------------------------------- |
|
158 //Overriden Apis from IMulSliderBaseElementInternal |
|
159 //-------------------------------------------------------------------------- |
|
160 // |
|
161 |
|
162 /** |
|
163 * Notified when the base layout of slider changes . |
|
164 * Relayouts all the visuals with respect to the new size. |
|
165 */ |
|
166 void baseLayoutSizeChanged(); |
|
167 |
|
168 /** |
|
169 * update visualization |
|
170 * |
|
171 */ |
|
172 void updateVisualization(); |
|
173 |
|
174 /** |
|
175 * create visulization for slider |
|
176 * @param aTemplateId - template id |
|
177 */ |
|
178 void createVisualization(sliderTemplate aTemplateId); |
|
179 |
|
180 |
|
181 /** |
|
182 * Updates Text visualization. |
|
183 * |
|
184 */ |
|
185 void updateTextVisualization(); |
|
186 |
|
187 private: |
|
188 |
|
189 /** |
|
190 * layoutVisuals setpos visulization for slider |
|
191 * @param aTemplateId - template id |
|
192 */ |
|
193 void layoutVisuals(sliderTemplate templateid); |
|
194 |
|
195 /** |
|
196 * initializeSliderData to initialize the model and widget pointers |
|
197 */ |
|
198 void initializeSliderData(); |
|
199 |
|
200 /** |
|
201 * Normalise the template specific data with that from the Model. |
|
202 */ |
|
203 |
|
204 void NormalizeRange(); |
|
205 /** |
|
206 * Sets the position of the handle |
|
207 * |
|
208 * @param aCurrTick The new position of the progress bar |
|
209 * |
|
210 */ |
|
211 void SetTickPosition(int aCurrTick); |
|
212 |
|
213 private: // Class Data |
|
214 struct MulSliderProgressBarImpl* mData; |
|
215 MulSliderModel * mSliderModel; |
|
216 MulSliderWidget * mSliderWidget; |
|
217 CFbsBitmap* iBitmap; |
|
218 }; // end of class |
|
219 |
|
220 } // end of namespace Alf |
|
221 |
|
222 #endif //MUL_SLIDERPROGRESSIVE_H |
|
223 //End Of File |
|