// http://www.apache.org/licenses/LICENSE-2.0/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an ”AS IS” BASIS,
+// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
}
pEditTime->AcquireHandle();
+ pEditTime->SetTouchPressThreshold(_TOUCH_PRESS_THRESHOLD_INSENSITIVE);
return pEditTime;
__pEditTimePresenter->Draw();
- if(likely((_AccessibilityManager::IsActivated())))
+ if (unlikely((_AccessibilityManager::IsActivated())))
{
UpdateAccessibilityElement();
}
__pEditTimePresenter->Initialize();
- if (__pAccessibilityEditTimeElement)
- {
- __pAccessibilityEditTimeElement->SetBounds(GetClientBoundsF());
- }
+ SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityEditTimeElement != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime accessibility element must not be null.");
+ SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityHourElement != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Hour accessibility element must not be null.");
+ SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityMinuteElement != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Minute accessibility element must not be null.");
+
+ __pAccessibilityEditTimeElement->SetBounds(GetClientBoundsF());
FloatRectangle hourBounds = __pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
FloatRectangle minuteBounds = __pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
FloatRectangle ampmBounds = __pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
- if (__pAccessibilityHourElement)
- {
- __pAccessibilityHourElement->SetBounds(hourBounds);
- }
- if (__pAccessibilityMinuteElement)
- {
- __pAccessibilityMinuteElement->SetBounds(minuteBounds);
- }
+ __pAccessibilityHourElement->SetBounds(hourBounds);
+ __pAccessibilityMinuteElement->SetBounds(minuteBounds);
+
if (__pAccessibilityAmPmElement)
{
__pAccessibilityHourElement->SetBounds(FloatRectangle(hourBounds.x, ampmBounds.y, hourBounds.width, ampmBounds.height));
{
if (!__isCalledBoundsChanged && !__isXmlBoundsExist)
{
- FloatDimension dim;
+ FloatRectangle bounds = GetBoundsF();
- GET_SHAPE_CONFIG(EDITTIME::WIDTH, GetOrientation(), dim.width);
- GET_SHAPE_CONFIG(EDITTIME::HEIGHT, GetOrientation(), dim.height);
+ GET_SHAPE_CONFIG(EDITTIME::WIDTH, GetOrientation(), bounds.width);
+ GET_SHAPE_CONFIG(EDITTIME::HEIGHT, GetOrientation(), bounds.height);
- SetSize(dim);
+ SetBounds(bounds, false);
}
__pEditTimePresenter->Initialize();
bool
_EditTime::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
- SetFocused(true);
-
FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
{
return;
}
+void
+_EditTime::OnDrawFocus(void)
+{
+ __pEditTimePresenter->SetFocusState(true);
+ __pEditTimePresenter->SetFocusedElement();
+ __pEditTimePresenter->DrawFocus();
+ return;
+}
+
+bool
+_EditTime::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ switch (keyCode)
+ {
+ case _KEY_ENTER:
+ {
+ FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
+
+ if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
+ {
+ CalculateDateTimeBarPosition();
+ }
+ break;
+ }
+ default:
+ break;
+
+ }
+
+ return __pEditTimePresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_EditTime::OnFocusGained(const _Control &source)
+{
+ __pEditTimePresenter->SetFocusedElement();
+ return true;
+}
+
+bool
+_EditTime::OnFocusLost(const _Control &source)
+{
+ return __pEditTimePresenter->OnFocusLost(source);
+}
+
+void
+_EditTime::OnFocusModeStateChanged(void)
+{
+ __pEditTimePresenter->OnFocusModeStateChanged();
+ return;
+}
+
FloatRectangle
_EditTime::GetParentWindowBounds(void) const
{
String string;
- if (__pAccessibilityEditTimeElement == null && __pAccessibilityHourElement == null
- && __pAccessibilityMinuteElement == null)
- {
- return;
- }
+ SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityEditTimeElement != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime accessibility element must not be null.");
+ SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityHourElement != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Hour accessibility element must not be null.");
+ SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityMinuteElement != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Minute accessibility element must not be null.");
if (__title.IsEmpty() == false)
{
if (Is24HourNotationEnabled() == false)
{
_AccessibilityContainer* pContainer = GetAccessibilityContainer();
+ SysTryReturnVoidResult(NID_UI_CTRL, (pContainer != null), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- if (pContainer != null && __pAccessibilityAmPmElement == null)
+ if (__pAccessibilityAmPmElement == null)
{
__pAccessibilityAmPmElement = new (std::nothrow) _AccessibilityElement(true);
SysTryReturnVoidResult(NID_UI_CTRL, (__pAccessibilityAmPmElement != null), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
__pAccessibilityHourElement->SetBounds(FloatRectangle(hourBounds.x, ampmBounds.y, hourBounds.width, ampmBounds.height));
__pAccessibilityMinuteElement->SetBounds(FloatRectangle(minuteBounds.x, ampmBounds.y, minuteBounds.width, ampmBounds.height));
}
- else if (__pAccessibilityAmPmElement != null)
+ else
{
__pAccessibilityAmPmElement->Activate(true);
}
- String hintAmPmText(L"Double tap to change to ");
+ String hintAmPmText(L"Double tap to edit");
String amString;
String pmString;
if (__pEditTimePresenter->GetAmEnabled() == true)
{
__pAccessibilityAmPmElement->SetLabel(amString);
- hintAmPmText.Append(pmString.GetPointer());
string.Append(amString.GetPointer());
}
else
{
__pAccessibilityAmPmElement->SetLabel(pmString);
- hintAmPmText.Append(amString.GetPointer());
string.Append(pmString.GetPointer());
}
}
bool
-_EditTime::OnAccessibilityReadedElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+_EditTime::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
{
return false;
}