int lower = 0;
int upper = 0;
- GetRemainingSpace(lower, upper);
+ __pLiveboxView->GetRemainingSpace(lower, upper);
if (lower > upper)
{
int lower = 0;
int upper = 0;
- GetRemainingSpace(lower, upper);
+ Dimension anchorSize = __pLiveboxView->GetAnchorSize();
+ __pLiveboxView->GetRemainingSpace(lower, upper);
if (lower > upper)
{
- popupBounds.y = absoluteViewBounds.y - size.height;
+ popupBounds.y = absoluteViewBounds.y - size.height + anchorSize.height;
}
else
{
- popupBounds.y = absoluteViewBounds.y + absoluteViewBounds.height;
+ popupBounds.y = absoluteViewBounds.y + absoluteViewBounds.height - anchorSize.height;
}
SetBounds(popupBounds);
}
void
-_LiveboxPopupView::GetRemainingSpace(int& lower, int& upper) const
-{
- const _Control* pParent = __pLiveboxView->GetParent();
- result r = GetLastResult();
- SysTryReturnVoidResult(NID_UI_CTRL, pParent, r, "[%s] Propagating.", GetErrorMessage(r));
-
- Rectangle parentClientBounds = pParent->GetClientBounds();
- Rectangle viewBounds = __pLiveboxView->GetBounds();
-
- lower = viewBounds.y;
- upper = parentClientBounds.height - viewBounds.y - viewBounds.height;
-
- SysLog(NID_UI_CTRL, "[%d %d]", lower, upper);
-}
-
-void
_LiveboxPopupView::FireLiveboxPopupEvent(bool open)
{
if (__pLiveboxPopupViewEvent)
r = GetLastResult();
SysTryReturn(NID_UI_CTRL, __pLivebox, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ Bitmap* pResourceBitmap = null;
+
+ r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_UP, BITMAP_PIXEL_FORMAT_ARGB8888, pResourceBitmap);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<Bitmap> pArrowUpBitmap(pResourceBitmap);
+
+ r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_DOWN, BITMAP_PIXEL_FORMAT_ARGB8888, pResourceBitmap);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pArrowUpBitmap = move(pArrowUpBitmap);
+ __pArrowDownBitmap.reset(pResourceBitmap);
+
return r;
}
return __updated;
}
+Dimension
+_LiveboxView::GetAnchorSize(void) const
+{
+ Bitmap* pArrowBitmap = null;
+ int lower = 0;
+ int upper = 0;
+
+ GetRemainingSpace(lower, upper);
+
+ if (lower > upper)
+ {
+ pArrowBitmap = __pArrowDownBitmap.get();
+ }
+ else
+ {
+ pArrowBitmap = __pArrowUpBitmap.get();
+ }
+
+ return Dimension(pArrowBitmap->GetWidth(), pArrowBitmap->GetHeight());
+}
+
livebox*
_LiveboxView::GetNativeLivebox(void) const
{
Rectangle bounds = GetBounds();
Rectangle absoluteBounds = GetAbsoluteBounds();
- int leftMargin = 0;
- int rightMargin = 0;
- int topMargin = 0;
- int bottomMargin = 0;
- _ControlOrientation orientation = GetOrientation();
+ int lower = 0;
+ int upper = 0;
- GET_SHAPE_CONFIG(LIVEBOX::POPUP_TOP_MARGIN, orientation, topMargin);
- GET_SHAPE_CONFIG(LIVEBOX::POPUP_BOTTOM_MARGIN, orientation, bottomMargin);
+ Dimension anchorSize = GetAnchorSize();
+ GetRemainingSpace(lower, upper);
- Rectangle parentClientBounds = pParent->GetClientBounds();
- int remainingSpace = parentClientBounds.height - bounds.y - bounds.height;
- if (size.height > remainingSpace)
+ if (lower > upper)
{
- popupBounds.y = absoluteBounds.y - size.height + bottomMargin;
+ popupBounds.y = absoluteBounds.y - size.height + anchorSize.height;
}
else
{
- popupBounds.y = absoluteBounds.y + absoluteBounds.height - topMargin;
+ popupBounds.y = absoluteBounds.y + absoluteBounds.height - anchorSize.height;
}
- SysLog(NID_UI_CTRL, "[%d %d %d %d]", parentClientBounds.height, remainingSpace, popupBounds.y, size.height);
+ SysLog(NID_UI_CTRL, "[%d %d]", popupBounds.y, size.height);
if (!__pLiveboxPopupView)
{
pVisualElement->AddAnimation(L"Scale", animation);
}
+void
+_LiveboxView::GetRemainingSpace(int& lower, int& upper) const
+{
+ const _Control* pParent = GetParent();
+ result r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pParent, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ Rectangle parentClientBounds = pParent->GetClientBounds();
+ Rectangle viewBounds = GetBounds();
+
+ lower = viewBounds.y;
+ upper = parentClientBounds.height - viewBounds.y - viewBounds.height;
+
+ SysLog(NID_UI_CTRL, "[%d %d]", lower, upper);
+}
+
result
_LiveboxView::OnAttachedToMainTree(void)
{
Tizen::Graphics::Bitmap* GetAppIconBitmap(void) const;
Tizen::Graphics::Bitmap* GetBitmap(void) const;
bool IsUpdated(void) const;
+ Tizen::Graphics::Dimension GetAnchorSize(void) const;
protected:
_LiveboxView(void);
void GetTouchPostion(const Tizen::Graphics::Point& point, double& x, double& y) const;
void PlayClickAnimation(void);
void PlayFlickAnimation(void);
+ void GetRemainingSpace(int& lower, int& upper) const;
virtual result OnAttachedToMainTree(void);
virtual result OnDetachingFromMainTree(void);
std::unique_ptr<_LiveboxViewPresenter> __pLiveboxViewPresenter;
std::unique_ptr<Tizen::Graphics::Bitmap> __pBitmap;
std::unique_ptr<Tizen::Graphics::Bitmap> __pAppIconBitmap;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowUpBitmap;
+ std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowDownBitmap;
struct livebox* __pLivebox;
friend class _LiveboxViewManager;
class _LiveboxViewManager* __pLiveboxViewManager;