3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (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
9 // http://floralicense.org/license/
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.
19 * @file SlideShowPopUp.cpp
20 * @brief This file contains the definitions of the SlideShowPopUp class.
23 #include <FUiScenes.h>
25 #include "GlResourceManager.h"
26 #include "GlSlideSettingListener.h"
27 #include "GlSlideShowPopUp.h"
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Graphics;
33 using namespace Tizen::Ui;
34 using namespace Tizen::Ui::Controls;
35 using namespace Tizen::Ui::Scenes;
37 static const int ID_FORMAT_START = 501;
38 static const int ID_FORMAT_SETTING = 502;
39 static const int ID_CANCEL_BUTTON = 503;
41 SlideShowPopUp::SlideShowPopUp(void)
47 SlideShowPopUp::~SlideShowPopUp(void)
52 SlideShowPopUp::Initialize(void)
54 Button* pCancelButton = null;
55 Popup::Construct(L"IDL_SLIDESHOW_SETTING_POPUP");
56 Popup::SetPropagatedKeyEventListener(this);
58 __pList = static_cast<ListView*>(GetControl(L"IDC_POPUP_LIST"));
65 __pList->SetItemProvider(*this);
66 __pList->AddListViewItemEventListener(*this);
68 pCancelButton = static_cast<Button*>(GetControl(L"IDC_BUTTON", true));
70 if (pCancelButton != null)
72 pCancelButton->AddActionEventListener(*this);
73 pCancelButton->SetActionId(ID_CANCEL_BUTTON);
80 SlideShowPopUp::OnTerminating(void)
86 SlideShowPopUp::OnActionPerformed(const Control& source, int actionId)
90 case ID_CANCEL_BUTTON:
92 Popup::SetShowState(false);
104 SlideShowPopUp::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
106 if (__pListener != null)
108 __pListener->OnSlideSettingPopUpItemSelected(index);
113 SlideShowPopUp::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo& keyEventInfo)
115 AppLogDebug("ENTER");
117 if(keyEventInfo.GetKeyCode() == KEY_BACK)
119 Popup::SetShowState(false);
126 SlideShowPopUp::CreateItem(int index, int itemWidth)
128 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
129 int listItemHeight = 112;
131 CustomItem* pItem = new (std::nothrow) CustomItem();
132 result r = pItem->Construct(Dimension(GetClientAreaBounds().width, listItemHeight), style);
133 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));
137 AppLogDebug("Create Item Failed with error %s", GetErrorMessage(r));
145 pItem->AddElement(Rectangle(25, 0, GetClientAreaBounds().width -50, listItemHeight), ID_FORMAT_START,
146 ResourceManager::GetString(L"IDS_MEDIABR_OPT_START_SLIDESHOW"), true);
152 pItem->AddElement(Rectangle(25, 0, GetClientAreaBounds().width -50, listItemHeight), ID_FORMAT_SETTING,
153 ResourceManager::GetString(L"IDS_MEDIABR_BODY_SLIDESHOW_SETTINGS"), true);
166 SlideShowPopUp::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
172 SlideShowPopUp::GetItemCount(void)
178 SlideShowPopUp::SetEventListner(ISlideSettingListener* listner)
180 __pListener = listner;