From cd4a05dbfa7ab2010828d5474fd79868e75f34b9 Mon Sep 17 00:00:00 2001 From: HeeJu Kang Date: Fri, 8 Feb 2013 10:17:07 +0900 Subject: [PATCH] Added Livebox resource Change-Id: I60489ee861aed0e2c5c2482ba7ab1aa1a73bf0f3 Signed-off-by: HeeJu Kang --- src/FShell_LiveboxPopup.cpp | 5 ----- src/FShell_LiveboxPopup.h | 1 - src/FShell_LiveboxPopupPresenter.cpp | 40 +++++++++++++++++++++++++++++++++--- src/FShell_LiveboxPopupPresenter.h | 8 ++++++++ 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/FShell_LiveboxPopup.cpp b/src/FShell_LiveboxPopup.cpp index 468732d..0129fe2 100644 --- a/src/FShell_LiveboxPopup.cpp +++ b/src/FShell_LiveboxPopup.cpp @@ -325,11 +325,6 @@ _LiveboxPopup::OnActivated(void) } void -_LiveboxPopup::OnDeactivated(void) -{ -} - -void _LiveboxPopup::OnBoundsChanged(void) { Rectangle bounds = GetBounds(); diff --git a/src/FShell_LiveboxPopup.h b/src/FShell_LiveboxPopup.h index 3667a6a..5df3e6f 100644 --- a/src/FShell_LiveboxPopup.h +++ b/src/FShell_LiveboxPopup.h @@ -73,7 +73,6 @@ private: virtual result CreateLayer(void); #endif // MULTI_WINDOW virtual void OnActivated(void); - virtual void OnDeactivated(void); virtual void OnBoundsChanged(void); virtual void OnDraw(void); diff --git a/src/FShell_LiveboxPopupPresenter.cpp b/src/FShell_LiveboxPopupPresenter.cpp index 526b988..cb2995d 100644 --- a/src/FShell_LiveboxPopupPresenter.cpp +++ b/src/FShell_LiveboxPopupPresenter.cpp @@ -24,18 +24,20 @@ #include "FShell_LiveboxPopupPresenter.h" #include "FShell_LiveboxPopup.h" #include "FShell_LiveboxPopupModel.h" +#include "FUi_ResourceManager.h" +using namespace std; using namespace Tizen::Base; using namespace Tizen::Graphics; +using namespace Tizen::Ui; namespace Tizen { namespace Shell { _LiveboxPopupPresenter::_LiveboxPopupPresenter(const _LiveboxPopup& liveBoxPopup) - : __pLiveboxPopup(null) + : __pLiveboxPopup(const_cast<_LiveboxPopup*>(&liveBoxPopup)) , __pLiveboxPopupModel(new (std::nothrow) _LiveboxPopupModel) { - __pLiveboxPopup = const_cast <_LiveboxPopup*>(&liveBoxPopup); } _LiveboxPopupPresenter::~_LiveboxPopupPresenter(void) @@ -46,7 +48,24 @@ _LiveboxPopupPresenter::~_LiveboxPopupPresenter(void) result _LiveboxPopupPresenter::Initialize(void) { - result r = E_SUCCESS; + Bitmap* pBitmap = null; + + result r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + std::unique_ptr pBackgroundBitmap(pBitmap); + + r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_UP, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + std::unique_ptr pArrowUpBitmap(pBitmap); + + r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_DOWN, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + __pBackgroundBitmap = move(pBackgroundBitmap); + __pArrowUpBitmap = move(pArrowUpBitmap); + __pArrowDownBitmap.reset(pBitmap); return r; } @@ -66,6 +85,21 @@ _LiveboxPopupPresenter::GetProviderId(void) const void _LiveboxPopupPresenter::Draw(void) { + unique_ptr pCanvas(__pLiveboxPopup->GetCanvasN()); + SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); + + Rectangle bounds = __pLiveboxPopup->GetBounds(); + bounds.x = 0; + bounds.y = 0; + + if (__pBackgroundBitmap->IsNinePatchedBitmap()) + { + pCanvas->DrawNinePatchedBitmap(bounds, *__pBackgroundBitmap); + } + else + { + pCanvas->DrawBitmap(bounds, *__pBackgroundBitmap, Rectangle(0, 0, __pBackgroundBitmap->GetWidth(), __pBackgroundBitmap->GetHeight())); + } } }} // Tizen::Shell diff --git a/src/FShell_LiveboxPopupPresenter.h b/src/FShell_LiveboxPopupPresenter.h index f8238fa..5124353 100644 --- a/src/FShell_LiveboxPopupPresenter.h +++ b/src/FShell_LiveboxPopupPresenter.h @@ -26,6 +26,11 @@ #include #include +namespace Tizen { namespace Graphics +{ +class Bitmap; +}} // Tizen::Graphics + namespace Tizen { namespace Shell { @@ -50,6 +55,9 @@ private: private: _LiveboxPopup* __pLiveboxPopup; std::unique_ptr<_LiveboxPopupModel> __pLiveboxPopupModel; + std::unique_ptr __pBackgroundBitmap; + std::unique_ptr __pArrowUpBitmap; + std::unique_ptr __pArrowDownBitmap; }; // _LiveboxPopupPresenter }} // Tizen::Shell -- 2.7.4