if (pContextMenu->GetAccessibilityContainer() != null)
{
pContextMenu->GetAccessibilityContainer()->Activate(true);
+ pContextMenu->GetAccessibilityContainer()->AddListener(*pContextMenu);
}
if (style == CONTEXT_MENU_CORE_STYLE_LIST)
SetAllAccessibilityElement();
_VisualElement* pVisualElement = GetVisualElement();
-
FloatRectangle pBounds = pVisualElement->GetBounds();
-
float oldBoundsX = pBounds.x;
float oldBoundsY = pBounds.y;
float distanceX = 0.0f;
__pContextMenuPresenter->SetAllAccessibilityElement();
}
+bool
+_ContextMenu::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_ContextMenu::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_ContextMenu::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_ContextMenu::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_ContextMenu::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_ContextMenu::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_ContextMenu::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ SetVisibleState(false);
+
+ return true;
+}
+
+bool
+_ContextMenu::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_ContextMenu::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
void
_ContextMenu::RemoveAllAccessibilityElement(void)
{
- while (__accessibilityElements.GetCount() > 0)
+ _AccessibilityContainer* pAccessibilityContainer = GetAccessibilityContainer();
+ if (pAccessibilityContainer && pAccessibilityContainer->IsActivated())
{
- _AccessibilityElement* pElement = null;
- if (__accessibilityElements.GetAt(0, pElement) == E_SUCCESS)
- {
- __accessibilityElements.RemoveAt(0);
- pElement->GetParent()->RemoveElement(*pElement);
- }
+ pAccessibilityContainer->RemoveAllElement();
}
}
bodyRect.y = topBoundary;
}
+ float correctLength = __arrowTopMargin - __anchorPopupOverlap;
windowRect.x = bodyRect.x;
- windowRect.y = bodyRect.y + __arrowTopMargin - __anchorPopupOverlap;
+ windowRect.y = bodyRect.y + correctLength;
windowRect.width = bodyRect.width;
- windowRect.height = bodyRect.height + arrowRect.height - (__arrowTopMargin - __anchorPopupOverlap);
+ windowRect.height = bodyRect.height + arrowRect.height - correctLength;
bodyRect.x = 0.0f;
bodyRect.y = 0.0f;
// Set arrow position
arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
- arrowRect.y = bodyRect.height - (__arrowTopMargin - __anchorPopupOverlap);
+ arrowRect.y = bodyRect.height - correctLength;
}
else if (dropPosition == CONTEXT_MENU_CORE_DROP_POSITION_DOWN) // up Arrow
{
bodyRect.y = bottomBoundary - bodyRect.height;
}
+ float correctLength = __arrowBottomMargin - __anchorPopupOverlap;
windowRect.x = bodyRect.x;
windowRect.y = bodyRect.y - arrowRect.height;
windowRect.width = bodyRect.width;
- windowRect.height = bodyRect.height + arrowRect.height - __arrowBottomMargin + __anchorPopupOverlap;
+ windowRect.height = bodyRect.height + arrowRect.height - correctLength;
bodyRect.x = 0.0f;
- bodyRect.y = arrowRect.height - __arrowBottomMargin + __anchorPopupOverlap;
+ bodyRect.y = arrowRect.height - correctLength;
// Set arrow position
arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
bodyRect.y = bottomBoundary - bodyRect.height;
}
- windowRect.x = bodyRect.x + __arrowRightMargin - __anchorPopupOverlap;
+ float correctLength = __arrowRightMargin - __anchorPopupOverlap;
+ windowRect.x = bodyRect.x + correctLength;
windowRect.y = bodyRect.y;
- windowRect.width = bodyRect.width + arrowRect.width - (__arrowRightMargin - __anchorPopupOverlap);
+ windowRect.width = bodyRect.width + arrowRect.width - correctLength;
windowRect.height = bodyRect.height;
bodyRect.x = 0.0f;
bodyRect.y = 0.0f;
// Set arrow position
- arrowRect.x = bodyRect.width - (__arrowRightMargin - __anchorPopupOverlap);
+ arrowRect.x = bodyRect.width - correctLength;
arrowRect.y = anchorPosition.y - (arrowRect.height / 2.0f) - windowRect.y;
}
else // left Arrow
bodyRect.y = bottomBoundary - bodyRect.height;
}
+ float correctLength = __arrowLeftMargin - __anchorPopupOverlap;
windowRect.x = bodyRect.x;
windowRect.y = bodyRect.y;
- windowRect.width = bodyRect.width + arrowRect.width - __arrowLeftMargin + __anchorPopupOverlap;
+ windowRect.width = bodyRect.width + arrowRect.width - correctLength;
windowRect.height = bodyRect.height;
- bodyRect.x = arrowRect.width - __arrowLeftMargin + __anchorPopupOverlap;
+ bodyRect.x = arrowRect.width - correctLength;
bodyRect.y = 0.0f;
// Set arrow position
FloatRectangle drawRect;
float width = lineWidthList[line];
int count = lineItemCountList[line];
- float margin = (maxWidth - width) / count;
+ float blank = maxWidth - width;
+ float addMargin = blank / count;
+ if (_FloatCompareGE(blank, 100.0f) && line == lineCount - 1)
+ {
+ addMargin = 0.0f;
+ }
float pressedTopMargin = 0.0f, pressedBottomMargin = 0.0f;
if (line == 0)
drawRect = pItem->GetDrawRect();
- drawRect.width = drawRect.width + margin;
- drawRect.x = drawRect.x + (i * margin);
+ drawRect.width = drawRect.width + addMargin;
+ drawRect.x = drawRect.x + (i * addMargin);
pItem->SetDrawRect(drawRect);
_AccessibilityContainer* pContainer = __pContextMenu->GetAccessibilityContainer();
if (pContainer != null)
{
- /* not confirmed yet
- _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
- if (pElement != null)
- {
- pElement->SetTrait(L"Contextual popup");
- pElement->SetHint(L"double tap to close");
- pElement->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height));
- pContainer->AddElement(*pElement);
- __pContextMenu->AddAccessibilityElement(*pElement);
- }
- */
+ _AccessibilityElement* pElementContextMenu = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturnVoidResult(NID_UI_CTRL, pElementContextMenu, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+ pElementContextMenu->SetSupportOperatingGesture(false);
+ pElementContextMenu->SetTrait(L"Contextual popup");
+ pElementContextMenu->SetHint(L"double tap to close");
+ pElementContextMenu->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height));
+ pContainer->AddElement(*pElementContextMenu);
+ __pContextMenu->AddAccessibilityElement(*pElementContextMenu);
int itemCount = __pModel->GetItemCount();
for (int i = 0; i < itemCount; i++)
GET_COLOR_CONFIG(CONTEXTMENU::LIST_ITEM_DIVIDER_01_NORMAL, __lowerDividerLineColor); // lower divider of item n and
GET_COLOR_CONFIG(CONTEXTMENU::LIST_ITEM_DIVIDER_02_NORMAL, __upperDividerLineColor); // upper divider of item n+1 are bonded together.
GET_BITMAP_CONFIG_N(CONTEXTMENU::ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pMagentaBgBitmap);
+
+ InitializeAccessibilityElement();
}
_ContextMenuItem::~_ContextMenuItem(void)
delete __pLowerDividerLineLabel;
__pLowerDividerLineLabel = null;
}
+
+ _AccessibilityContainer* pContainer = GetAccessibilityContainer();
+ if (pContainer)
+ {
+ pContainer->RemoveAllElement();
+ }
}
_ContextMenuItem*
}
void
+_ContextMenuItem::InitializeAccessibilityElement(void)
+{
+ _AccessibilityContainer* pContainer = GetAccessibilityContainer();
+ if (pContainer)
+ {
+ pContainer->Activate(true);
+ _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturnVoidResult(NID_UI_CTRL, pElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+ pElement->SetTrait(L"Contextual popup");
+ pElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
+ pContainer->AddElement(*pElement);
+ }
+
+ return;
+}
+
+void
_ContextMenuItem::SetBitmapLabel(_Label* pLabel)
{
__pBitmapLabel = pLabel;
}
void
+_ContextMenuItem::OnBoundsChanged(void)
+{
+ _AccessibilityContainer* pContainer = GetAccessibilityContainer();
+ if (pContainer)
+ {
+ _AccessibilityElement* pElement = pContainer->GetChildElement(0);
+ if (pElement)
+ {
+ pElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
+ }
+ }
+}
+
+void
_ContextMenuItem::OnDraw(void)
{
DrawItem();
__pUpperDividerLineLabel->SetBounds(FloatRectangle(__leftMargin, 0.0f, bounds.width - __leftMargin - __rightMargin, __dividerHeight));
AttachChild(*__pUpperDividerLineLabel);
+
+ _AccessibilityContainer* pContainer = __pUpperDividerLineLabel->GetAccessibilityContainer();
+ if (pContainer)
+ {
+ pContainer->Activate(false);
+ }
}
Color dividerLineColor = Color(0, 0, 0, 0);
__pUpperDividerLineLabel->SetBackgroundColor(dividerLineColor);
__pUpperDividerLineLabel->Invalidate();
-
- _AccessibilityContainer* pContainer = __pUpperDividerLineLabel->GetAccessibilityContainer();
- if (pContainer)
- {
- pContainer->Activate(false);
- }
}
void
__pBackgroundLabel->SetTouchPressThreshold(TOUCH_PRESS_THRESHOLD_INSENSITIVE);
AttachChild(*__pBackgroundLabel);
MoveChildToBottom(*__pBackgroundLabel);
+
+ _AccessibilityContainer* pContainer = __pBackgroundLabel->GetAccessibilityContainer();
+ if (pContainer)
+ {
+ pContainer->Activate(false);
+ }
}
Color color= Color(0, 0, 0, 0);
}
float bottomOverlap = bounds.y + bounds.height - (pScrollPanel->GetScrollPosition() + boundsScrollPanel.height);
- if (bottomOverlap > 0.0f)
+ if (bottomOverlap > 0.0f)
{
bottomMargin = bottomOverlap + __bgPressedMargin;
}
BgBitmap = null;
__pBackgroundLabel->Invalidate();
-
- _AccessibilityContainer* pContainer = __pBackgroundLabel->GetAccessibilityContainer();
- if (pContainer)
- {
- pContainer->Activate(false);
- }
}
void
__pLowerDividerLineLabel->SetBounds(FloatRectangle(__leftMargin, bounds.height - __dividerHeight, bounds.width - __leftMargin - __rightMargin, __dividerHeight));
AttachChild(*__pLowerDividerLineLabel);
+
+ _AccessibilityContainer* pContainer = __pLowerDividerLineLabel->GetAccessibilityContainer();
+ if (pContainer)
+ {
+ pContainer->Activate(false);
+ }
}
Color dividerLineColor = Color(0, 0, 0, 0);
__pLowerDividerLineLabel->SetBackgroundColor(dividerLineColor);
__pLowerDividerLineLabel->Invalidate();
-
- _AccessibilityContainer* pContainer = __pLowerDividerLineLabel->GetAccessibilityContainer();
- if (pContainer)
- {
- pContainer->Activate(false);
- }
}
_UiTouchEventDelivery
bodyRect.y = topBoundary;
}
+ float correctLength = __arrowTopMargin - __anchorPopupOverlap;
windowRect.x = bodyRect.x;
- windowRect.y = bodyRect.y + __arrowTopMargin - __anchorPopupOverlap;
+ windowRect.y = bodyRect.y + correctLength;
windowRect.width = bodyRect.width;
- windowRect.height = bodyRect.height + arrowRect.height - (__arrowTopMargin - __anchorPopupOverlap);
+ windowRect.height = bodyRect.height + arrowRect.height - correctLength;
bodyRect.x = 0.0f;
bodyRect.y = 0.0f;
// Set arrow position
arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
- arrowRect.y = bodyRect.height - (__arrowTopMargin - __anchorPopupOverlap);
+ arrowRect.y = bodyRect.height - correctLength;
}
else if (dropPosition == CONTEXT_MENU_CORE_DROP_POSITION_DOWN) // up Arrow
{
bodyRect.y = bottomBoundary - bodyRect.height;
}
+ float correctLength = __arrowBottomMargin - __anchorPopupOverlap;
windowRect.x = bodyRect.x;
windowRect.y = bodyRect.y - arrowRect.height;
windowRect.width = bodyRect.width;
- windowRect.height = bodyRect.height + arrowRect.height - __arrowBottomMargin + __anchorPopupOverlap;
+ windowRect.height = bodyRect.height + arrowRect.height - correctLength;
bodyRect.x = 0.0f;
- bodyRect.y = arrowRect.height - __arrowBottomMargin + __anchorPopupOverlap;
+ bodyRect.y = arrowRect.height - correctLength;
// Set arrow position
arrowRect.x = anchorPosition.x - (arrowRect.width / 2.0f) - windowRect.x;
bodyRect.y = bottomBoundary - bodyRect.height;
}
- windowRect.x = bodyRect.x + __arrowRightMargin - __anchorPopupOverlap;
+ float correctLength = __arrowRightMargin - __anchorPopupOverlap;
+ windowRect.x = bodyRect.x + correctLength;
windowRect.y = bodyRect.y;
- windowRect.width = bodyRect.width + arrowRect.width - (__arrowRightMargin - __anchorPopupOverlap);
+ windowRect.width = bodyRect.width + arrowRect.width - correctLength;
windowRect.height = bodyRect.height;
bodyRect.x = 0.0f;
bodyRect.y = 0.0f;
// Set arrow position
- arrowRect.x = bodyRect.width - (__arrowRightMargin - __anchorPopupOverlap);
+ arrowRect.x = bodyRect.width - correctLength;
arrowRect.y = anchorPosition.y - (arrowRect.height / 2.0f) - windowRect.y;
}
else // left Arrow
bodyRect.y = bottomBoundary - bodyRect.height;
}
+ float correctLength = __arrowLeftMargin - __anchorPopupOverlap;
windowRect.x = bodyRect.x;
windowRect.y = bodyRect.y;
- windowRect.width = bodyRect.width + arrowRect.width - __arrowLeftMargin + __anchorPopupOverlap;
+ windowRect.width = bodyRect.width + arrowRect.width - correctLength;
windowRect.height = bodyRect.height;
- bodyRect.x = arrowRect.width - __arrowLeftMargin + __anchorPopupOverlap;
+ bodyRect.x = arrowRect.width - correctLength;
bodyRect.y = 0.0f;
// Set arrow position
void
_ContextMenuListPresenter::SetAllAccessibilityElement(void)
{
- _AccessibilityContainer* pContainer = __pContextMenu->GetAccessibilityContainer();
- if (pContainer != null)
+ _AccessibilityContainer* pContainerContextMenu = __pContextMenu->GetAccessibilityContainer();
+ if (pContainerContextMenu != null)
{
- /* not confirmed yet
- _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
- if (pElement != null)
- {
- pElement->SetTrait(L"Contextual popup");
- pElement->SetHint(L"double tap to close");
- pElement->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height));
- pContainer->AddElement(*pElement);
- __pContextMenu->AddAccessibilityElement(*pElement);
- }
- */
+ _AccessibilityElement* pElementContextMenu = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturnVoidResult(NID_UI_CTRL, pElementContextMenu, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+ pElementContextMenu->SetSupportOperatingGesture(false);
+ pElementContextMenu->SetTrait(L"Contextual popup");
+ pElementContextMenu->SetHint(L"double tap to close");
+ pElementContextMenu->SetBounds(FloatRectangle(0.0f, 0.0f, __pContextMenu->GetBoundsF().width, __pContextMenu->GetBoundsF().height));
+ pContainerContextMenu->AddElement(*pElementContextMenu);
+ __pContextMenu->AddAccessibilityElement(*pElementContextMenu);
int itemCount = __pModel->GetItemCount();
for (int i = 0; i < itemCount; i++)
{
_ContextMenuItem* pItem = __pModel->GetItem(i);
- _AccessibilityElement* pElement = new (std::nothrow) _AccessibilityElement(true);
- if (pItem != null && pElement != null)
+ if (pItem)
{
- pElement->SetName(L"ContextMenuItem" + Integer::ToString(i));
- if (pItem->GetType() == CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP)
- {
- pElement->SetLabel(L"icon " + pItem->GetText());
- }
- else
+ _AccessibilityContainer* pContainer = pItem->GetAccessibilityContainer();
+ if (pContainer != null)
{
- pElement->SetLabel(pItem->GetText());
+ LinkedListT<_AccessibilityElement*> accessibilityElements;
+ _AccessibilityElement* pElement = null;
+
+ pContainer->GetElements(accessibilityElements);
+ if (accessibilityElements.GetAt(0, pElement) == E_SUCCESS)
+ {
+ pElement->SetName(L"ContextMenuItem" + Integer::ToString(i));
+ if (pItem->GetType() == CONTEXT_MENU_ITEM_DRAWING_TYPE_BITMAP)
+ {
+ pElement->SetLabel(L"icon " + pItem->GetText());
+ }
+ else
+ {
+ pElement->SetLabel(pItem->GetText());
+ }
+
+ pElement->SetBounds(FloatRectangle(0.0f, 0.0f, pItem->GetBoundsF().width, pItem->GetBoundsF().height));
+ }
+ pContainerContextMenu->AddChildContainer(*pContainer);
}
-
- pElement->SetTrait(L"Contextual popup");
- pElement->SetBounds(pItem->GetDrawRect());
- pContainer->AddElement(*pElement);
- __pContextMenu->AddAccessibilityElement(*pElement);
- }
- else
- {
- delete pElement;
}
}
}
-
}
_ContextMenuItemInfo
, virtual public Tizen::Base::Runtime::IEventListener
, virtual public _IUiEventListener
, virtual public _IUiEventPreviewer
+ , public _IAccessibilityListener
{
DECLARE_CLASS_BEGIN(_ContextMenu, _Control);
DECLARE_PROPERTY("color", GetPropertyColor, SetPropertyColor);
virtual void OnChangeLayout(_ControlOrientation orientation);
virtual void OnOwnerChanged(_Control* pOldOwner);
+ virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+
Tizen::Ui::_AccessibilityElement* GetAccessibilityElement(const int mainIndex) const;
void AddAccessibilityElement(const _AccessibilityElement& element);
static _ContextMenuItem* CreateContextMenuItemN(void);
+ void InitializeAccessibilityElement(void);
+
void SetType(ContextMenuItemDrawingType type);
ContextMenuItemDrawingType GetType(void) const;
void SetAndInvalidate(bool flag);
const Tizen::Graphics::Bitmap* GetMagentaBgBitmap(void) const;
+ virtual void OnBoundsChanged(void);
// draw
virtual void OnDraw(void);
void DrawItem(void);