Added Livebox resource
authorHeeJu Kang <mobum.kang@samsung.com>
Fri, 8 Feb 2013 01:17:07 +0000 (10:17 +0900)
committerHeeJu Kang <mobum.kang@samsung.com>
Fri, 8 Feb 2013 01:17:07 +0000 (10:17 +0900)
Change-Id: I60489ee861aed0e2c5c2482ba7ab1aa1a73bf0f3
Signed-off-by: HeeJu Kang <mobum.kang@samsung.com>
src/FShell_LiveboxPopup.cpp
src/FShell_LiveboxPopup.h
src/FShell_LiveboxPopupPresenter.cpp
src/FShell_LiveboxPopupPresenter.h

index 468732d..0129fe2 100644 (file)
@@ -325,11 +325,6 @@ _LiveboxPopup::OnActivated(void)
 }
 
 void
-_LiveboxPopup::OnDeactivated(void)
-{
-}
-
-void
 _LiveboxPopup::OnBoundsChanged(void)
 {
        Rectangle bounds = GetBounds();
index 3667a6a..5df3e6f 100644 (file)
@@ -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);
 
index 526b988..cb2995d 100644 (file)
 #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<Bitmap> 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<Bitmap> 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<Canvas> 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
index f8238fa..5124353 100644 (file)
 #include <unique_ptr.h>
 #include <FBaseString.h>
 
+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<Tizen::Graphics::Bitmap> __pBackgroundBitmap;
+       std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowUpBitmap;
+       std::unique_ptr<Tizen::Graphics::Bitmap> __pArrowDownBitmap;
 }; // _LiveboxPopupPresenter
 
 }} // Tizen::Shell