2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "accessibility-adaptor-impl.h"
24 #include <Ecore_Wayland.h>
25 #include <Elementary.h>
27 #include <dali/public-api/object/type-registry.h>
28 #include <dali/integration-api/debug.h>
29 #include <dali/integration-api/events/gesture-requests.h>
32 #include "system-settings.h"
43 bool AccessibilityAdaptor::HandleActionNextEvent(bool allowEndFeedback)
49 ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
52 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
57 bool AccessibilityAdaptor::HandleActionPreviousEvent(bool allowEndFeedback)
63 ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback);
66 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
71 bool AccessibilityAdaptor::HandleActionActivateEvent()
77 ret = mActionHandler->AccessibilityActionActivate();
80 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
85 bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain)
89 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %d , %d\n", __FUNCTION__, __LINE__, x, y);
94 Dali::AccessibilityAdaptor handle( this );
96 bool indicatorFocused = false;
98 // Check whether the Indicator is focused
99 if( mIndicator && mIndicator->IsConnected() )
101 // Check the position and size of Indicator actor
102 Dali::Actor indicatorActor = mIndicator->GetActor();
103 Vector3 position = Vector3(0.0f, 0.0f, 0.0f);
104 Vector3 size = indicatorActor.GetCurrentSize();
106 if(mReadPosition.x >= position.x &&
107 mReadPosition.x <= position.x + size.width &&
108 mReadPosition.y >= position.y &&
109 mReadPosition.y <= position.y + size.height)
111 indicatorFocused = true;
112 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] Indicator area!!!!\n", __FUNCTION__, __LINE__);
118 if( !mIndicatorFocused && indicatorFocused )
120 // If Indicator is focused, the focus should be cleared in Dali focus chain.
123 mActionHandler->ClearAccessibilityFocus();
126 else if( mIndicatorFocused && !indicatorFocused )
130 mIndicatorFocused = indicatorFocused;
132 // Send accessibility READ action information to Indicator
133 if( mIndicatorFocused )
138 if( mActionHandler && !mIndicatorFocused)
140 // If Indicator is not focused, the accessibility actions should be handled by the registered
141 // accessibility action handler (e.g. focus manager)
142 ret = mActionHandler->AccessibilityActionRead(allowReadAgain);
143 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
149 bool AccessibilityAdaptor::HandleActionReadNextEvent(bool allowEndFeedback)
153 Dali::AccessibilityAdaptor handle( this );
157 ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback);
160 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
165 bool AccessibilityAdaptor::HandleActionReadPreviousEvent(bool allowEndFeedback)
171 ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback);
174 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
179 bool AccessibilityAdaptor::HandleActionUpEvent()
185 ret = mActionHandler->AccessibilityActionUp();
188 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
193 bool AccessibilityAdaptor::HandleActionDownEvent()
197 Dali::AccessibilityAdaptor handle( this );
201 ret = mActionHandler->AccessibilityActionDown();
204 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
209 bool AccessibilityAdaptor::HandleActionScrollUpEvent()
215 ret = mActionHandler->AccessibilityActionScrollUp();
218 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
224 bool AccessibilityAdaptor::HandleActionScrollDownEvent()
230 ret = mActionHandler->AccessibilityActionScrollDown();
233 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
238 bool AccessibilityAdaptor::HandleActionPageLeftEvent()
244 ret = mActionHandler->AccessibilityActionPageLeft();
247 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
252 bool AccessibilityAdaptor::HandleActionPageRightEvent()
258 ret = mActionHandler->AccessibilityActionPageRight();
261 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
266 bool AccessibilityAdaptor::HandleActionPageUpEvent()
272 ret = mActionHandler->AccessibilityActionPageUp();
275 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
280 bool AccessibilityAdaptor::HandleActionPageDownEvent()
286 ret = mActionHandler->AccessibilityActionPageDown();
289 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
294 bool AccessibilityAdaptor::HandleActionMoveToFirstEvent()
300 ret = mActionHandler->AccessibilityActionMoveToFirst();
303 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
308 bool AccessibilityAdaptor::HandleActionMoveToLastEvent()
314 ret = mActionHandler->AccessibilityActionMoveToLast();
317 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
322 bool AccessibilityAdaptor::HandleActionReadFromTopEvent()
328 ret = mActionHandler->AccessibilityActionReadFromTop();
331 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
336 bool AccessibilityAdaptor::HandleActionReadFromNextEvent()
342 ret = mActionHandler->AccessibilityActionReadFromNext();
345 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
350 bool AccessibilityAdaptor::HandleActionZoomEvent()
356 ret = mActionHandler->AccessibilityActionZoom();
359 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
364 bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent()
370 ret = mActionHandler->AccessibilityActionReadIndicatorInformation();
373 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
378 bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent()
384 ret = mActionHandler->AccessibilityActionReadPauseResume();
387 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
392 bool AccessibilityAdaptor::HandleActionStartStopEvent()
398 ret = mActionHandler->AccessibilityActionStartStop();
401 DALI_LOG_INFO(gAccessibilityAdaptorLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
406 } // namespace Adaptor
408 } // namespace Internal