ScrollTC handles BREW pointer events for these widgets and responds by
- Sending scroll events to the child widget ScrollTC sends EVT_WDG_SCROLL to the widget it decorates, with different wParam and dwParam based on the location of the pointer events. For example, when the pointer event is located on scroll arrows, the corresponding parameter for EVT_WDG_SCROLL is WSCROLL_LEFT or WSCROLL_RIGHT for a horizontal scrollbar while WSCROLL_UP or WSCROLL_DOWN for a vertical scrollbar. (Similar parameters are used for ScrollIndicator Widget). If the pointer event is for the scrollbar handle, then on EVT_POINTER_DOWN, ScrollTC sets capture mode on and starts a drag operation. Subsequent pointer move events result in EVT_WDG_SCROLL sent to the child widget with wParam being WSCROLL_VPOSITION (for vertical scrollbar) or WSCROLL_HPOSITION ( for horizontal scrollbar). The capture mode gets released on EVT_POINTER_UP. If the pointer event is located between the scrollbar handle and arrows(but within scrollbar), then ScrollTC starts sending EVT_WDG_SCROLL with wParam being WETYPE_SCROLL_PAGExx. In this case as well, on EVT_POINTER_DOWN, the capture mode is set on. ScrollTC also keeps an internal timer to repeat these scroll events when clicked on arrows on region between the handle and the arrows. When pointer events happen in the content region of the scrollbar, then the events are propogated to the child widget. Note that ScrollTC itself can not handle the scrolling by itself. It needs to co-ordinate this with the child widget. As explained above, ScrollTC sends EVT_WDG_SCROLL events to the child widget which in turn has to respond to these events and change its view correspondingly. This re-layout from the childwidget will result in a viewmodel notification that ScrollbarWidget listens to, causing its own view to be updated. Thus, its ChildWidget's responsibility to respond to the scroll event based in wParam and dwParam specified in the event. - Setting the element states Apart from sending EVT_WDG_SCROLL events to the child widget, ScrollTC also sets element states for the elements of the ScrollWidget by calling IWIDGET_SetElementState(). On EVT_POINTER_DOWN, it sets the element state to WESTATE_PRESSED for the element located by pointer event ( e.g. WETYPE_LEFT_ARROW). On EVT_POINTER_UP, the state is reset to WESTATE_NORMAL.
Using ScrollTC from your application:
Applications do not need to deal with ScrollTC directly if they want to have the default behavior as described above. If the application needs to customize the behavior of this touch controller, it can do so by overriding handler for the touchcontroller.
If the application wants to have a custom scrolling behavior - then it should set a hander on the CHILD WIDGET that is decorated by ScrollWidget and handle EVT_WDG_SCROLL. The wParam and dwParam will determine the direction and amount by which to scroll.
Note that ListWidget, TextWidget , Viewport widget and HTMLWidget provided with BUIW respond to EVT_WDG_SCROLL events and no special handling is required for these widgets.