Applied latest source code
[apps/native/preloaded/MusicPlayer.git] / src / MpYearPickerPanel.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                MpYearPickerPanel.cpp
19  * @brief               This is the implementation file for YearPickerPanel class.
20  */
21
22 #include "MpYearPickerPanel.h"
23 #include "MpNowPlayContentPanel.h"
24
25 using namespace Tizen::Base;
26 using namespace Tizen::Base::Collection;
27 using namespace Tizen::Content;
28 using namespace Tizen::Graphics;
29 using namespace Tizen::Social;
30 using namespace Tizen::Ui;
31 using namespace Tizen::Ui::Controls;
32 using namespace Tizen::Ui::Scenes;
33
34 YearPickerPanel::YearPickerPanel(void)
35 {
36         AppLogDebug("ENTER");
37         AppLogDebug("EXIT");
38 }
39
40 YearPickerPanel::~YearPickerPanel(void)
41 {
42         AppLogDebug("ENTER");
43         AppLogDebug("EXIT");
44 }
45
46 void
47 YearPickerPanel::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
48                                         const Tizen::Ui::Scenes::SceneId& currentSceneId,
49                                         Tizen::Base::Collection::IList* pArgs)
50 {
51         AppLogDebug("ENTER");
52         Form* pForm = dynamic_cast<Form*>(GetParent());
53         AppAssert(pForm);
54
55         CommonUtil::CreateCancelFooter(*pForm);
56         pForm->SetFormBackEventListener(this);
57
58         SceneManager* pSceneManager = SceneManager::GetInstance();
59         AppAssert(pSceneManager);
60         __pPresentationModel->UpdateYearList();
61 //      CommonUtil::ShowNoContentImage(__pPresentationModel->GetAllYearCount(), *__pContentTableView, *__pNoContentImageLabel, *__pNoContentTextLabel);
62
63         if (pSceneManager->IsSceneAlive(IDSCN_PLAYER))
64         {
65                 if (__pNowPlayContentPanel == null)
66                 {
67                         __pNowPlayContentPanel = new (std::nothrow) NowPlayContentPanel();
68                         __pNowPlayContentPanel->Initialize();
69                         AddControl(__pNowPlayContentPanel);
70                 }
71                 CommonUtil::ShowNowPlayPanel(*__pContentTableView, __pNowPlayContentPanel->GetPlayStatus(), pForm->GetClientAreaBounds());
72         }
73
74         if (pArgs != null)
75         {
76                 pArgs->RemoveAll(true);
77                 delete pArgs;
78         }
79         AppLogDebug("EXIT");
80 }
81
82 void
83 YearPickerPanel::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
84                                                 const Tizen::Ui::Scenes::SceneId& nextSceneId)
85 {
86         AppLogDebug("ENTER");
87         Form* pForm = dynamic_cast<Form*>(GetParent());
88         AppAssert(pForm);
89
90         Footer* pFooter = pForm->GetFooter();
91         pFooter->RemoveAllButtons();
92         pFooter->RemoveAllItems();
93         AppLogDebug("EXIT");
94 }
95
96 void
97 YearPickerPanel::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView,
98                                                         int itemIndex,
99                                                         Tizen::Ui::Controls::TableViewItem* pItem,
100                                                         Tizen::Ui::Controls::TableViewItemStatus status)
101 {
102         AppLogDebug("ENTER");
103         SceneManager* pSceneManager = SceneManager::GetInstance();
104         AppAssert(pSceneManager);
105
106         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
107         {
108                 __pPresentationModel->InitializeContentList(itemIndex);
109                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_YEAR_CONTENT_PICKER));
110         }
111         AppLogDebug("EXIT");
112 }