Fixed Nabi issue N_SE-40542,N_SE-39949,N_SE-40229
[apps/osp/Internet.git] / src / IntConfirmationPopup.cpp
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
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 /*
19  * IntConfirmationPopup.cpp
20  *@file:        IntConfirmationPopup.cpp
21  *@brief:       Common popup to show delete confirmation
22  */
23
24 #include <FAppUiApp.h>
25 #include <FUi.h>
26
27 #include "IntCommonLib.h"
28 #include "IntConfirmationPopup.h"
29 #include "IntHistoryPresentationModel.h"
30 #include "IntSettingPresentationModel.h"
31
32
33 using namespace Tizen::Base;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Ui::Controls;
36 using namespace Tizen::Ui;
37 //
38 //static const int IDA_BUTTON_NO = 1000;
39 //static const int IDA_BUTTON_YES = 1001;
40
41
42 ConfirmationPopup::ConfirmationPopup(void)
43 {
44         __pPopupText = null;
45         __pYesButton = null;
46         __pNoButton = null;
47 }
48
49 ConfirmationPopup::~ConfirmationPopup(void)
50 {
51
52 }
53
54 bool
55 ConfirmationPopup::Initialize(void)
56 {
57         Button* pYesButton = null;
58         Button* pNoButton = null;
59         Popup::Construct(L"IDL_CONFIRMATION_POPUP");
60
61         __pYesButton = static_cast< Button* >(GetControl(L"IDC_BUTTON_OK", true));
62         if (__pYesButton)
63         {
64                 __pYesButton->SetActionId(IDA_BUTTON_YES);
65         }
66
67         __pNoButton = static_cast< Button* >(GetControl(L"IDC_BUTTON_CANCEL", true));
68         if (__pNoButton)
69         {
70                 __pNoButton->SetActionId(IDA_BUTTON_NO);
71         }
72
73         __pPopupText = static_cast< Label* >(GetControl(L"IDC_LABEL1", true));
74
75         return true;
76 }
77
78 result
79 ConfirmationPopup::OnTerminating(void)
80 {
81         return E_SUCCESS;
82 }
83
84 void
85 ConfirmationPopup::setMessage(String& str)
86 {
87         __message = str;
88         __pPopupText->SetText(str);
89 }
90
91 String
92 ConfirmationPopup::GetMessage(void)
93 {
94         return __message;
95 }
96
97 void
98 ConfirmationPopup::AddActionListener(IActionEventListener& listener)
99 {
100         __pYesButton->AddActionEventListener(listener);
101         __pNoButton->AddActionEventListener(listener);
102 }
103
104 void
105 ConfirmationPopup::RemoveActionListener(IActionEventListener& listener)
106 {
107         __pYesButton->RemoveActionEventListener(listener);
108         __pNoButton->RemoveActionEventListener(listener);
109 }