, __pBackgroundNormalBitmap(null)
, __pBackgroundEffectBitmap(null)
, __dropPosition(CONTEXT_MENU_CORE_DROP_POSITION_INVALID)
+ , __pCurrentFrame(null)
, __layout(_CONTROL_ORIENTATION_PORTRAIT)
, __rotation(_CONTROL_ROTATION_0)
, __pScrollPanel(null)
_ContextMenu::~_ContextMenu(void)
{
+ if (__pCurrentFrame)
+ {
+ __pCurrentFrame->RemoveFrameEventListener(*this);
+ __pCurrentFrame = null;
+ }
+
if (__isAttachedToMainTree && GetOwner() != null)
{
GetOwner()->UnlockInputEvent();
_Control* pOwner = GetOwner();
if (pOwner == null)
{
- _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
- SysTryReturn(NID_UI_CTRL, pFrame != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Current frame instance is not available.");
+ __pCurrentFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
+ SysTryReturn(NID_UI_CTRL, __pCurrentFrame != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Current frame instance is not available.");
- _Form* pForm = pFrame->GetCurrentForm();
- pForm != null ? SetOwner(pForm) : SetOwner(pFrame);
+ __pCurrentFrame->AddFrameEventListener(*this);
+
+ _Form* pForm = __pCurrentFrame->GetCurrentForm();
+ pForm != null ? SetOwner(pForm) : SetOwner(__pCurrentFrame);
pOwner = GetOwner();
return r;
}
+void
+_ContextMenu::OnFrameDeactivated(const _Frame& source)
+{
+ SetVisibleState(false);
+ return;
+}
+
+void
+_ContextMenu::OnFrameActivated(const _Frame& source)
+{
+ return;
+}
+
+void
+_ContextMenu::OnFrameMinimized(const _Frame& source)
+{
+ return;
+}
+void
+_ContextMenu::OnFrameRestored(const _Frame& source)
+{
+ return;
+}
+
result
_ContextMenu::AddItem(const Base::String& text, int actionId, const Bitmap* pNormalBitmap, const Bitmap* pPressedBitmap,
const Bitmap* pHighlightedBitmap)
}
bounds = GetBoundsF();
- if (__selected == false)
- {
- dividerLineColor = __upperDividerLineColor;
- }
- __pUpperDividerLineLabel->SetBounds(FloatRectangle(__leftMargin, 0.0f, bounds.width - __leftMargin - __rightMargin, __dividerHeight));
+ dividerLineColor = __upperDividerLineColor;
+
+ __pUpperDividerLineLabel->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width , __dividerHeight));
__pUpperDividerLineLabel->SetBackgroundColor(dividerLineColor);
__pUpperDividerLineLabel->Invalidate();
}
FloatRectangle boundsScrollPanel = pScrollPanel->GetBoundsF();
float topOverlap = pScrollPanel->GetScrollPosition() - bounds.y;
- if (topOverlap > 0.0f)
+ if (topOverlap >= 0.0f)
{
- topMargin = topOverlap + __bgPressedMargin;
+ topMargin = topOverlap;
}
- else if (!__upperDividerLine)
+ else
{
topMargin = __bgPressedMargin;
}
float bottomOverlap = bounds.y + bounds.height - (pScrollPanel->GetScrollPosition() + boundsScrollPanel.height);
- if (bottomOverlap > 0.0f)
+ if (bottomOverlap >= 0.0f)
{
- bottomMargin = bottomOverlap + __bgPressedMargin;
+ bottomMargin = bottomOverlap;
}
- else if (!__lowerDividerLine)
+ else
{
bottomMargin = __bgPressedMargin;
}
}
bounds = GetBoundsF();
- if (__selected == false)
- {
- dividerLineColor = __lowerDividerLineColor;
- }
- __pLowerDividerLineLabel->SetBounds(FloatRectangle(__leftMargin, bounds.height - __dividerHeight, bounds.width - __leftMargin - __rightMargin, __dividerHeight));
+ dividerLineColor = __lowerDividerLineColor;
+
+ __pLowerDividerLineLabel->SetBounds(FloatRectangle(0.0f, bounds.height - __dividerHeight, bounds.width, __dividerHeight));
__pLowerDividerLineLabel->SetBackgroundColor(dividerLineColor);
__pLowerDividerLineLabel->Invalidate();
}
// _Scroll visual interaction if Bounds < ScrollAreaBounds
if (__pContextMenu->IsVisible())
{
- __pContextMenu->GetScrollPanel()->SetBounds(FloatRectangle(bodyRect.x + bodyLeftMargin, bodyRect.y + bodyTopMargin, __layoutSize.width, __layoutSize.height));
+ int itemTopMargin;
+ GET_SHAPE_CONFIG(CONTEXTMENU::ITEM_BG_PRESSED_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemTopMargin);
+ __pContextMenu->GetScrollPanel()->SetBounds(FloatRectangle(bodyRect.x + bodyLeftMargin, bodyRect.y + bodyTopMargin + itemTopMargin,
+ __layoutSize.width, __layoutSize.height - 2 * itemTopMargin));
int itemCount = __pModel->GetItemCount();
float itemHeight = __itemHeight + (__dividerHeight * 2.0f);
float layoutClientHeight = itemCount * itemHeight - (__dividerHeight * 2.0f);
- __pContextMenu->GetScrollPanel()->SetClientAreaHeight(layoutClientHeight);
+ __pContextMenu->GetScrollPanel()->SetClientAreaHeight(layoutClientHeight - 2 * itemTopMargin);
}
__pContextMenu->SetMovable(true);
#include <FGrp_BitmapImpl.h>
#include "FUi_ControlImplManager.h"
+#include "FUi_EcoreEvasMgr.h"
#include "FUi_ResourceManager.h"
#include "FUiAnim_VisualElement.h"
#include "FUiAnim_AnimationManager.h"
, __pBackgroundNormalBitmap(null)
, __pBackgroundEffectBitmap(null)
, __layout(_CONTROL_ORIENTATION_PORTRAIT)
+ , __rotation(_CONTROL_ROTATION_0)
, __pScrollPanel(null)
, __pSubMenu(null)
+ , __pCurrentFrame(null)
, __subMenuIndex(-1)
{
__backgroundColor = Color(255, 255, 255, 255);
_OptionMenu::~_OptionMenu(void)
{
+ if (__pCurrentFrame)
+ {
+ __pCurrentFrame->RemoveFrameEventListener(*this);
+ __pCurrentFrame = null;
+ }
+
if (__isAttachedToMainTree && GetOwner() != null)
{
GetOwner()->UnlockInputEvent();
{
result r = E_SUCCESS;
- __layout = _ControlManager::GetInstance()->GetOrientation();
__isAttachedToMainTree = true;
+
_Control* pOwner = GetOwner();
if (pOwner == null)
{
- _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
- SysTryReturn(NID_UI_CTRL, pFrame != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Current frame instance is not available.");
+ __pCurrentFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
+ SysTryReturn(NID_UI_CTRL, __pCurrentFrame != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Current frame instance is not available.");
- _Form* pForm = pFrame->GetCurrentForm();
- pForm != null ? SetOwner(pForm) : SetOwner(pFrame);
+ __pCurrentFrame->AddFrameEventListener(*this);
+
+ _Form* pForm = __pCurrentFrame->GetCurrentForm();
+ pForm != null ? SetOwner(pForm) : SetOwner(__pCurrentFrame);
+
+ pOwner = GetOwner();
}
else
{
pOwner->LockInputEvent();
}
+ __layout = pOwner->GetOrientation();
+
+ _Window* pOwnerWindow = pOwner->GetRootWindow();
+
+ if (pOwnerWindow != null)
+ {
+ int ownerRotation = GetEcoreEvasMgr()->GetEcoreEvas()->GetWindowRotation(*pOwnerWindow);
+ switch (ownerRotation)
+ {
+ case 0:
+ __rotation = _CONTROL_ROTATION_0;
+ break;
+
+ case 90:
+ __rotation = _CONTROL_ROTATION_90;
+ break;
+
+ case 180:
+ __rotation = _CONTROL_ROTATION_180;
+ break;
+
+ case 270:
+ __rotation = _CONTROL_ROTATION_270;
+ break;
+
+ default:
+ __rotation = _CONTROL_ROTATION_0;
+ break;
+ }
+ }
+
r = __pOptionMenuPresenter->CalculateWindowRect();
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
}
void
+_OptionMenu::OnFrameDeactivated(const _Frame& source)
+{
+ DestroySubMenu();
+ SetVisibleState(false);
+ return;
+}
+
+void
+_OptionMenu::OnFrameActivated(const _Frame& source)
+{
+ return;
+}
+
+void
+_OptionMenu::OnFrameMinimized(const _Frame& source)
+{
+ return;
+}
+void
+_OptionMenu::OnFrameRestored(const _Frame& source)
+{
+ return;
+}
+
+void
_OptionMenu::OnActivated(void)
{
_TouchManager* pTouchManager = _TouchManager::GetInstance();
FloatRectangle itemBounds = item.GetBoundsF();
itemBounds.height = itemHeight;
float scrollPosition = __pScrollPanel->GetScrollPosition();
- FloatPoint anchorPosition(0.0f, 0.0f);
- _ControlRotation rotation = _ControlManager::GetInstance()->GetScreenRotation();
- ContextMenuCoreAlign alignment = CONTEXT_MENU_CORE_ALIGN_RIGHT;
+ FloatPoint anchorPosition(0.0f, 0.0f);
+ ContextMenuCoreAlign alignment = CONTEXT_MENU_CORE_ALIGN_RIGHT;
- if (rotation == _CONTROL_ROTATION_270 && __layout == _CONTROL_ORIENTATION_LANDSCAPE)
- {
- alignment = CONTEXT_MENU_CORE_ALIGN_LEFT;
- }
- else
- {
- alignment = CONTEXT_MENU_CORE_ALIGN_RIGHT;
- }
+ if (__rotation == _CONTROL_ROTATION_270 && __layout == _CONTROL_ORIENTATION_LANDSCAPE)
+ {
+ alignment = CONTEXT_MENU_CORE_ALIGN_LEFT;
+ }
+ else
+ {
+ alignment = CONTEXT_MENU_CORE_ALIGN_RIGHT;
+ }
- anchorPosition = FloatPoint(GetBoundsF().x + itemBounds.x + itemBounds.width / 2.0f, GetBoundsF().y + itemBounds.y + itemBounds.height / 2.0f - scrollPosition);
+ anchorPosition = FloatPoint(GetBoundsF().x + itemBounds.x + itemBounds.width / 2.0f, GetBoundsF().y + itemBounds.y + itemBounds.height / 2.0f - scrollPosition);
- __pSubMenu = _ContextMenu::CreateContextMenuN(anchorPosition, CONTEXT_MENU_CORE_STYLE_LIST, alignment);
+ __pSubMenu = _ContextMenu::CreateContextMenuN(anchorPosition, CONTEXT_MENU_CORE_STYLE_LIST, alignment);
if (__pSubMenu == null)
{
GET_SHAPE_CONFIG(OPTIONMENU::MAX_VISIBLE_ITEM_COUNT, __layout, __showItemCount);
}
+ if (__isAttachedToMainTree == true)
+ {
+ if(__rotation != rotation)
+ {
+ SetVisibleState(false);
+ }
+ }
+
+ __rotation = rotation;
+
__pOptionMenuPresenter->ResetSelectedItem();
__pOptionMenuPresenter->CalculateWindowRect();
}
return __layout;
}
+_ControlRotation
+_OptionMenu::GetRotation(void) const
+{
+ return __rotation;
+}
+
}}} // Tizen::Ui: Control
, __arrowRightMargin(0.0f)
, __arrowMargin(0.0f)
, __itemHeight(0.0f)
+ , __bgPressedLeftRightMargin(0.0f)
+ , __bgPressedTopBottomMargin(0.0f)
, __textSize(0.0f)
, __text(L"")
, __pMagentaBgBitmap(null)
GET_SHAPE_CONFIG(OPTIONMENU::LIST_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __rightMargin);
GET_SHAPE_CONFIG(OPTIONMENU::LIST_DIVIDER_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __dividerHeight);
GET_SHAPE_CONFIG(OPTIONMENU::ITEM_BG_PRESSED_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __bgPressedMargin);
+ GET_SHAPE_CONFIG(OPTIONMENU::ITEM_BG_PRESSED_LEFT_RIGHT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __bgPressedLeftRightMargin);
+ GET_SHAPE_CONFIG(OPTIONMENU::ITEM_BG_PRESSED_TOP_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, __bgPressedTopBottomMargin);
GET_SHAPE_CONFIG(OPTIONMENU::TEXT_LEFT_MARGIN, orientation, __textLeftMargin);
GET_SHAPE_CONFIG(OPTIONMENU::TEXT_RIGHT_MARGIN, orientation, __textRightMargin);
}
bounds = GetBoundsF();
- if (__selected == false)
- {
- dividerLineColor = __upperDividerLineColor;
- }
+
+ dividerLineColor = __upperDividerLineColor;
__pUpperDividerLineLabel->SetBounds(FloatRectangle(0.0f, 0.0f, bounds.width, __dividerHeight));
__pUpperDividerLineLabel->SetBackgroundColor(dividerLineColor);
_OptionMenuItem::DrawItemBackground(void)
{
SetBackgroundColor(Color(0, 0, 0, 0));
+ float topMargin = 0.0f;
+ float bottomMargin = 0.0f;
if (__pBackgroundLabel == null)
{
}
}
+ FloatRectangle bounds = GetBoundsF();
+
Color color= Color(0, 0, 0, 0);
if (__selected == true)
{
color = __selectedBgColor;
}
- FloatRectangle bounds = GetBoundsF();
_ScrollPanel* pScrollPanel = static_cast<_ScrollPanel*>(GetParent());
FloatRectangle boundsScrollPanel = pScrollPanel->GetBoundsF();
- __pBackgroundLabel->SetBounds(FloatRectangle(0, 0, bounds.width, bounds.height));
+ float topOverlap = pScrollPanel->GetScrollPosition() - bounds.y;
+ if (topOverlap >= 0.0f)
+ {
+ topMargin = topOverlap;
+ }
+ else
+ {
+ topMargin = __bgPressedTopBottomMargin;
+ }
+
+ float bottomOverlap = bounds.y + bounds.height - (pScrollPanel->GetScrollPosition() + boundsScrollPanel.height);
+ if (bottomOverlap >= 0.0f)
+ {
+ bottomMargin = bottomOverlap;
+ }
+ else
+ {
+ bottomMargin = __bgPressedTopBottomMargin;
+ }
+
+ __pBackgroundLabel->SetBounds(FloatRectangle(__bgPressedLeftRightMargin, topMargin, bounds.width - __bgPressedLeftRightMargin * 2.0f,
+ bounds.height - topMargin - bottomMargin));
Bitmap* BgBitmap = _BitmapImpl::GetColorReplacedBitmapN(*__pMagentaBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
SysTryReturnVoidResult(NID_UI_CTRL, BgBitmap, E_OUT_OF_MEMORY, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
}
bounds = GetBoundsF();
- if (__selected == false)
- {
- dividerLineColor = __lowerDividerLineColor;
- }
+
+ dividerLineColor = __lowerDividerLineColor;
__pLowerDividerLineLabel->SetBounds(FloatRectangle(0.0f, bounds.height - __dividerHeight, bounds.width, __dividerHeight));
__pLowerDividerLineLabel->SetBackgroundColor(dividerLineColor);
float bodyRightMargin = __rightMargin;
FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF();
- _ControlRotation rotation = _ControlManager::GetInstance()->GetScreenRotation();
+ _ControlRotation rotation = __pOptionMenu->GetRotation();
if (__pOptionMenu->GetLayout() == _CONTROL_ORIENTATION_LANDSCAPE)
{
// _Scroll visual interaction if Bounds < ScrollAreaBounds
if (__pOptionMenu->IsVisible())
{
- __pOptionMenu->GetScrollPanel()->SetBounds(FloatRectangle(bodyRect.x + bodyLeftMargin, bodyRect.y + bodyTopMargin, __layoutSize.width, __layoutSize.height));
+ int itemTopMargin;
+ GET_SHAPE_CONFIG(OPTIONMENU::ITEM_BG_PRESSED_TOP_BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, itemTopMargin);
+
+ __pOptionMenu->GetScrollPanel()->SetBounds(FloatRectangle(bodyRect.x + bodyLeftMargin, bodyRect.y + bodyTopMargin + itemTopMargin,
+ __layoutSize.width, __layoutSize.height - 2 * itemTopMargin));
int itemCount = __pModel->GetItemCount();
float itemHeight = __itemHeight + (__dividerHeight * 2.0f);
float layoutClientHeight = itemCount * itemHeight - (__dividerHeight * 2.0f);
- __pOptionMenu->GetScrollPanel()->SetClientAreaHeight(layoutClientHeight);
+ __pOptionMenu->GetScrollPanel()->SetClientAreaHeight(layoutClientHeight - 2 * itemTopMargin);
}
__pOptionMenu->SetMovable(true);
_TabBarPresenter::ShiftToFocusedItem(int itemIndex, _FocusDirectionMove direction)
{
int firstDrawnItemIndex = __pTabBarModel->GetFirstDrawnItemIndex();
- int lastDrawnItemIndex = __pTabBarModel->GetLastDrawnItemIndex();
int index = 0;
result r = E_SUCCESS;
String accessibilityLabel;
String space = L" ";
int childControlCount = GetChildCount();
- int groupIndex = -1;
- int itemIndex = -1;
for (int i = 0; i < childControlCount; i++)
{
#include "FUiCtrl_ContextMenuListPresenter.h"
#include "FUiCtrl_ActionEvent.h"
#include "FUiCtrl_IActionEventListener.h"
+#include "FUiCtrl_IFrameEventListener.h"
#include "FUiCtrl_ScrollPanel.h"
, virtual public _IUiEventListener
, virtual public _IUiEventPreviewer
, public _IAccessibilityListener
+ , virtual public _IFrameEventListener
{
DECLARE_CLASS_BEGIN(_ContextMenu, _Control);
DECLARE_PROPERTY("color", GetPropertyColor, SetPropertyColor);
virtual result OnAttachedToMainTree(void);
virtual result OnDetachingFromMainTree(void);
+ virtual void OnFrameActivated(const Tizen::Ui::Controls::_Frame& source);
+ virtual void OnFrameDeactivated(const Tizen::Ui::Controls::_Frame& source);
+ virtual void OnFrameMinimized(const Tizen::Ui::Controls::_Frame& source);
+ virtual void OnFrameRestored(const Tizen::Ui::Controls::_Frame& source);
virtual void OnDraw(void);
virtual _UiTouchEventDelivery OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
Tizen::Graphics::Bitmap* __pBackgroundNormalBitmap;
Tizen::Graphics::Bitmap* __pBackgroundEffectBitmap;
enum ContextMenuCoreDropPosition __dropPosition;
+ Tizen::Ui::Controls::_Frame* __pCurrentFrame;
enum _ControlOrientation __layout;
enum _ControlRotation __rotation;
#include "FUiCtrl_OptionMenuPresenter.h"
#include "FUiCtrl_ActionEvent.h"
#include "FUiCtrl_IActionEventListener.h"
+#include "FUiCtrl_IFrameEventListener.h"
#include "FUiCtrl_ScrollPanel.h"
, virtual public _IUiEventListener
, virtual public _IUiEventPreviewer
, public _IAccessibilityListener
+ , virtual public _IFrameEventListener
{
DECLARE_CLASS_BEGIN(_OptionMenu, _Control);
DECLARE_PROPERTY("color", GetPropertyColor, SetPropertyColor);
const Tizen::Graphics::Bitmap* GetBackgroundNormalBitmap(void) const;
const Tizen::Graphics::Bitmap* GetBackgroundEffectBitmap(void) const;
_ControlOrientation GetLayout(void) const;
+ _ControlRotation GetRotation(void) const;
virtual result OnAttachedToMainTree(void);
virtual result OnDetachingFromMainTree(void);
+ virtual void OnFrameActivated(const Tizen::Ui::Controls::_Frame& source);
+ virtual void OnFrameDeactivated(const Tizen::Ui::Controls::_Frame& source);
+ virtual void OnFrameMinimized(const Tizen::Ui::Controls::_Frame& source);
+ virtual void OnFrameRestored(const Tizen::Ui::Controls::_Frame& source);
virtual void OnDraw(void);
virtual _UiTouchEventDelivery OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
Tizen::Graphics::Bitmap* __pBackgroundNormalBitmap;
Tizen::Graphics::Bitmap* __pBackgroundEffectBitmap;
enum _ControlOrientation __layout;
+ enum _ControlRotation __rotation;
Tizen::Graphics::Color __backgroundColor;
Tizen::Graphics::Color __textColor[OPTION_MENU_ITEM_STATUS_COUNT];
_ScrollPanel* __pScrollPanel;
_ContextMenu* __pSubMenu;
+ Tizen::Ui::Controls::_Frame* __pCurrentFrame;
int __subMenuIndex;
}; // _OptionMenu
float __arrowRightMargin;
float __arrowMargin;
float __itemHeight;
+ float __bgPressedLeftRightMargin;
+ float __bgPressedTopBottomMargin;
float __textSize;
Tizen::Base::String __text;
DECLARE_SHAPE_CONFIG(LIST_ICON_WIDTH, 22);
DECLARE_SHAPE_CONFIG(LIST_ICON_HEIGHT, 23);
DECLARE_SHAPE_CONFIG(LIST_ITEM_FONT_SIZE, 24);
+ DECLARE_SHAPE_CONFIG(ITEM_BG_PRESSED_LEFT_RIGHT_MARGIN, 25);
+ DECLARE_SHAPE_CONFIG(ITEM_BG_PRESSED_TOP_BOTTOM_MARGIN, 26);
DECLARE_END_UI_CONFIG(OPTIONMENU);
#endif //_FUI_RESOURCE_OPTION_MENU_CONFIG_H_
ADD_SHAPE_CONFIG(LIST_ITEM_FONT_SIZE, 40);
ADD_SHAPE_CONFIG(LIST_DIVIDER_HEIGHT, 1);
+ ADD_SHAPE_CONFIG(ITEM_BG_PRESSED_LEFT_RIGHT_MARGIN, 4);
+ ADD_SHAPE_CONFIG(ITEM_BG_PRESSED_TOP_BOTTOM_MARGIN, 3);
}
END_UI_CONFIG_MODE(720x1280);