pSplitPanel->SetBackgroundColor(Color(0,0,0,0));
- pSplitPanel->GetAccessibilityContainer()->Activate(true);
+ if (pSplitPanel->GetAccessibilityContainer())
+ {
+ pSplitPanel->GetAccessibilityContainer()->Activate(true);
+ }
return pSplitPanel;
return __pSplitPanelPresenter->OnTapGestureCanceled(gesture);
}
+bool
+_SplitPanel::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ return __pSplitPanelPresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_SplitPanel::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ return __pSplitPanelPresenter->OnKeyReleased(source, keyInfo);
+}
+
+void
+_SplitPanel::OnDrawFocus(void)
+{
+ __pSplitPanelPresenter->DrawFocus();
+ return;
+}
+
+bool
+_SplitPanel::OnFocusGained(const _Control& source)
+{
+ return _Control::OnFocusGained(source);
+}
+
+bool
+_SplitPanel::OnFocusLost(const _Control& source)
+{
+ result r = __pSplitPanelPresenter->ReleaseFocus();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _Control::OnFocusLost(source);
+ return true;
+}
+
result
_SplitPanel::SetPane(_Control* pControl, SplitPanelPaneOrder paneOrder)
{
{
if (__pDividerVisualElement)
{
- __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
- SysTryReturn(NID_UI_CTRL, __pAccessibilityElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-
dividerRect = __pSplitPanelPresenter->GetDividerRectangle();
if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED)
{
- hintText = String(L"double tap to open/close the split area");
- __pAccessibilityElement->SetTrait(L"Split view button");
+ hintText = String(L"Drag scroll Fixed");
}
else
{
- hintText = String(L"double tap and move to adjust split area");
- __pAccessibilityElement->SetTrait(L"Drag scroll");
+ hintText = String(L"Drag scroll, double tap and move to adjust split area");
}
- __pAccessibilityElement->SetBounds(dividerRect);
+ __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturn(NID_UI_CTRL, __pAccessibilityElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ __pAccessibilityElement->SetBounds(_CoordinateSystemUtils::ConvertToInteger(dividerRect));
+ __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
__pAccessibilityElement->SetHint(hintText);
__pAccessibilityElement->SetLabel(L"");
__pAccessibilityElement->SetName(L"SplitPanelDivider");
, __pDividerBackgroundBitmap(null)
, __pDividerBackgroundEffectBitmap(null)
, __pDividerThumbBitmap(null)
+ , __pFocusBitmap(null)
, __transactionIdMaximize(0)
, __transactionIdRestore(0)
+ , __currentFocusedPane(SPLIT_PANEL_PANE_ORDER_FIRST)
, __controlAnimatorInterpolator(ANIMATION_INTERPOLATOR_LINEAR)
, __visualElementInterpolator(L"Linear")
{
delete __pDividerBackgroundEffectBitmap;
__pDividerBackgroundEffectBitmap = null;
+
+ delete __pFocusBitmap;
+ __pFocusBitmap = null;
}
result
{
FloatPoint point(0.0f, 0.0f);
+ ReleaseFocus();
+
point = touchinfo.GetCurrentPosition();
if (CheckDividerTouchRegion(point.x, point.y) == true)
{
__splitPanelDividerPressed = true;
+ Draw();
+ return true;
}
- Draw();
-
- return E_SUCCESS;
+ return false;
}
bool
_SplitPanelPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
{
+ ReleaseFocus();
+
if (__splitPanelDividerPressed == true)
{
PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
__splitPanelDividerPressed = false;
Draw();
+ return true;
}
-
- if (__isChangeBounds == true)
+ else
{
- __isChangeBounds = false;
+ if (__isChangeBounds == true)
+ {
+ __isChangeBounds = false;
+ }
+ return false;
}
-
- return E_SUCCESS;
}
bool
FloatPoint point(0.0f, 0.0f);
Bitmap* pThumbBitmap = null;
+ ReleaseFocus();
+
if (__pSplitPanel != &source || __splitPanelDividerPressed == false )
{
return false;
return false;
}
+bool
+_SplitPanelPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (keyCode == _KEY_RIGHT)
+ {
+ if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_FIRST)
+ {
+ ReleaseFocus();
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_SECOND;
+ DrawFocus(__currentFocusedPane);
+ }
+ }
+ else if (keyCode == _KEY_LEFT)
+ {
+ if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_SECOND)
+ {
+ ReleaseFocus();
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_FIRST;
+ DrawFocus(__currentFocusedPane);
+ }
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+_SplitPanelPresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (keyCode == _KEY_RIGHT || keyCode == _KEY_LEFT)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+result
+_SplitPanelPresenter::DrawFocus(SplitPanelPaneOrder focusedPane)
+{
+ result r = E_SUCCESS;
+ Canvas* pSplitPanelCanvas = null;
+ FloatRectangle currentFocusBounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+ _Control* pControl = null;
+
+ if (focusedPane == SPLIT_PANEL_PANE_ORDER_FIRST)
+ {
+ pControl = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_FIRST);
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_FIRST;
+ currentFocusBounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST);
+ }
+ else
+ {
+ pControl = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_SECOND);
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_SECOND;
+ currentFocusBounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND);
+ }
+
+ if (pControl != null)
+ {
+ pControl->SetFocused();
+ pControl->DrawFocus();
+ }
+ else
+ {
+ pSplitPanelCanvas = __pSplitPanel->GetCanvasN();
+ SysTryReturnResult(NID_UI_CTRL, (pSplitPanelCanvas != null), E_SYSTEM, "A system error has occurred. Failed to get the canvas of SplitPanel.");
+
+ //give focus
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pFocusBitmap))
+ {
+ r = pSplitPanelCanvas->DrawNinePatchedBitmap(currentFocusBounds, *__pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ r = pSplitPanelCanvas->DrawBitmap(currentFocusBounds, *__pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ delete pSplitPanelCanvas;
+ }
+
+ return r;
+
+CATCH:
+ delete pSplitPanelCanvas;
+ return r;
+}
+
+result
+_SplitPanelPresenter::ReleaseFocus(void)
+{
+ result r = E_SUCCESS;
+ Canvas* pSplitPanelCanvas = null;
+ FloatRectangle panebounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+ if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_FIRST &&
+ __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_FIRST) == null)
+ {
+ panebounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST);
+ }
+ else if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_SECOND &&
+ __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_SECOND) == null)
+ {
+ panebounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND);
+ }
+ else
+ {
+ return r;
+ }
+
+ pSplitPanelCanvas = __pSplitPanel->GetCanvasN();
+ SysTryReturnResult(NID_UI_CTRL, (pSplitPanelCanvas != null), E_SYSTEM, "A system error has occurred. Failed to get the canvas of SplitPanel.");
+
+ //reset
+ pSplitPanelCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pSplitPanelCanvas->Clear(panebounds);
+
+ delete pSplitPanelCanvas;
+
+ return r;
+}
+
result
_SplitPanelPresenter::SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle)
{
__pDividerBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pDividerBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), __dividerBackgroundColor);
SysTryCatch(NID_UI_CTRL, (__pDividerBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(GetLastResult()));
+ r = GET_BITMAP_CONFIG_N(FOCUSUI::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, __pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
delete pDividerBackgroundBitmap;
return r;
FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle secondPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
+ FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatPoint panePostion(0.0f, 0.0f);
_Control* pFirstPane = null;
_Control* pSecondPane = null;
{
secondPaneBounds = FloatRectangle(0.0f, clientBounds.height + __dividerRectangle.height, clientBounds.width, clientBounds.height - __dividerRectangle.y - __dividerRectangle.height);
}
+
+ dividerBounds = __dividerRectangle;
+ dividerBounds.x = clientBounds.width;
+
+ __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
}
else if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_SECOND))
{
{
firstPaneBounds = FloatRectangle(0.0f, clientBounds.y -__dividerRectangle.y - __dividerRectangle.height, clientBounds.width, __dividerRectangle.y);
}
+
+ dividerBounds = __dividerRectangle;
+ dividerBounds.x = -__dividerRectangle.width;
+
+ __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
}
else
{
{
if (pFirstPane->IsResizable())
{
- pFirstPane->SetBounds(firstPaneBounds);
+ r = pFirstPane->SetBounds(firstPaneBounds);
+ if (IsFailed(r))
+ {
+ SysLog(NID_UI_CTRL, "[%s] SetBounds failed.", GetErrorMessage(r));
+ }
}
r = pFirstPane->SetPosition(Point(0.0f, 0.0f));
{
if (pSecondPane->IsResizable())
{
- pSecondPane->SetBounds(secondPaneBounds);
+ r = pSecondPane->SetBounds(secondPaneBounds);
+ if (IsFailed(r))
+ {
+ SysLog(NID_UI_CTRL, "[%s] SetBounds failed.", GetErrorMessage(r));
+ }
}
r = pSecondPane->SetPosition(Point(0.0f, 0.0f));
float width = 0.0f;
float height = 0.0f;
FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
- FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f);
_ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
Bitmap* pThumbBitmap = null;
{
__dividerRectangle = FloatRectangle(dividerPosition, 0.0f, width, height);
__dividerThumbRectangle = FloatRectangle(dividerPosition, ((height - pThumbBitmap->GetHeightF()) / 2.0f), pThumbBitmap->GetWidthF(), pThumbBitmap->GetHeightF());
-
- dividerBounds = __dividerRectangle;
-
- if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_FIRST))
- {
- dividerBounds.x = clientBounds.width;
- }
- else if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_SECOND))
- {
- dividerBounds.x = -__dividerRectangle.width;
- }
}
}
else
{
__dividerRectangle = FloatRectangle(0.0f, dividerPosition, width, height);
__dividerThumbRectangle = FloatRectangle(((width - pThumbBitmap->GetWidth()) / 2.0f), dividerPosition, pThumbBitmap->GetWidthF(), pThumbBitmap->GetHeightF());
-
- dividerBounds = __dividerRectangle;
-
- if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_FIRST))
- {
- dividerBounds.y = clientBounds.height;
- }
- else if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_SECOND))
- {
- dividerBounds.y = -__dividerRectangle.height;
- }
}
}
- __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
+ __pSplitPanel->SetDividerVisualElementBounds(__dividerRectangle);
}
result
return secondPaneBounds;
}
+FloatRectangle
+_SplitPanelPresenter::GetPaneBounds(SplitPanelPaneOrder paneOrder)
+{
+ FloatRectangle firstPaneBounds;
+ FloatRectangle secondPaneBounds;
+
+ FloatRectangle clientBounds = __pSplitPanel->GetBoundsF();
+
+ if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
+ {
+ firstPaneBounds = FloatRectangle(0.0f, 0.0f, __dividerRectangle.x, clientBounds.height);
+ secondPaneBounds = FloatRectangle(__dividerRectangle.x + __dividerRectangle.width, 0.0f, clientBounds.width - __dividerRectangle.x - __dividerRectangle.width, clientBounds.height);
+ }
+ else
+ {
+ firstPaneBounds = FloatRectangle(0.0f, 0.0f, clientBounds.width, __dividerRectangle.y);
+ secondPaneBounds = FloatRectangle(0.0f, __dividerRectangle.y + __dividerRectangle.height, clientBounds.width, clientBounds.height - __dividerRectangle.y - __dividerRectangle.height);
+ }
+
+ if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
+ {
+ return firstPaneBounds;
+ }
+
+ return secondPaneBounds;
+}
+
VisualElementPropertyAnimation*
_SplitPanelPresenter::GetVisualElementAnimation(Tizen::Base::String propertyName)
{