Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrlGalleryItem.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        FUiCtrlGalleryItem.cpp
19  * @brief       This file contains implementation of GalleryItem class.
20  */
21
22 //includes
23 #include <FIoFile.h>
24 #include <FUiCtrlGalleryItem.h>
25 #include <FBaseSysLog.h>
26 #include "FUiCtrl_GalleryItemImpl.h"
27
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31 using namespace Tizen::Io;
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 GalleryItem::GalleryItem(void)
37         : __pImpl(null)
38 {
39         // Do nothing
40 }
41
42 GalleryItem::~GalleryItem(void)
43 {
44         delete __pImpl;
45 }
46
47 result
48 GalleryItem::Construct(const Bitmap& bitmap, GalleryImageRotation rotation)
49 {
50         return Construct(bitmap, L"", rotation);
51 }
52
53 result
54 GalleryItem::Construct(const Bitmap& bitmap, const String& filePath, GalleryImageRotation rotation)
55 {
56         _GalleryItemImpl* pImpl = _GalleryItemImpl::GetInstance(*this);
57         SysAssertf(pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
58
59         result r = E_SUCCESS;
60         if (filePath != L"")
61         {
62                 SysTryReturn(NID_UI_CTRL, File::IsFileExist(filePath), E_FILE_NOT_FOUND, E_FILE_NOT_FOUND, "[E_FILE_NOT_FOUND] File does not exist.");
63         }
64
65         String imagefilePath(filePath);
66
67         pImpl = _GalleryItemImpl::CreateGalleryItemImplN(this, bitmap, rotation, imagefilePath);
68         r = GetLastResult();
69         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
70
71         __pImpl = pImpl;
72
73         return E_SUCCESS;
74
75 CATCH:
76         delete pImpl;
77
78         return r;
79 }
80
81 }}} // Tizen::Ui::Controls