Touch Support
Touch events are derived from generic events and are equally easy to implement.
For an example of use have a look at the ToggleButtonWidget and it's base class CgiEventWidget.
- Set EventMask. The EventMask determines which event types will be sent.
const UInt cTbTouchEventExit = CgiEventWidget::TouchEventExit; const UInt cTbTouchEventUp = CgiEventWidget::TouchEventUp; const UInt cTbTouchEventDown = CgiEventWidget::TouchEventDown; Base::SetEventMask(cTbTouchEventExit | cTbTouchEventUp | cTbTouchEventDown); - Override listener function.
protected: virtual void OnTouchEvent(TouchEvent touchEvent, Candera::Node* node, const CgiApplication::MouseEvent& event); - Define your actions inside the listener function OnTouchEvent.
switch(touchEvent) { case TouchEventDown: m_focus = true; SetOn(!IsOn()); break; case TouchEventUp: if (m_focus) { SendUiEvent(TouchEventClick, 0); } break; case TouchEventExit: m_focus = false; m_down = !m_down; SwitchTexture(); break; default: break; }