2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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
8 // http://floralicense.org/license/
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.
18 * @file ClTwoButtonPopup.cpp
19 * @brief This is the implementation file for the TwoButtonPopup class.
24 #include "ClTwoButtonPopup.h"
25 #include "ClResourceManager.h"
27 using namespace Tizen::Base;
28 using namespace Tizen::Base::Collection;
29 using namespace Tizen::Social;
30 using namespace Tizen::Ui;
31 using namespace Tizen::Ui::Controls;
33 static const int IDA_EVENT_POPUP_CANCEL = 10902;
35 TwoButtonPopup::TwoButtonPopup(void)
42 TwoButtonPopup::~TwoButtonPopup(void)
47 TwoButtonPopup::Initialize(void)
49 result r = Construct(L"IDL_TWO_BUTTON_POPUP");
52 __pTitle = dynamic_cast<Label*>(GetControl(L"IDC_LABEL"));
53 AppAssertf(__pTitle != null, "[E_FAILURE] Unable to get label.");
59 TwoButtonPopup::RequestPopup(TwoButtonPopupStyle style, Control* pTarget, const CalEventInstance* pEvent)
63 case TWO_BUTTON_POPUP_STYLE_REPEATED_EVENT:
64 __pTitle->SetText(ResourceManager::GetString(IDS_POPUP_DELETE_MULTIPLE_REPEATED_EVENT));
67 __pTitle->SetText(ResourceManager::GetString(IDS_COM_POP_DELETE_Q));
74 __pEvent = (pEvent != null) ? new (std::nothrow) CalEventInstance(*pEvent) : null;
81 TwoButtonPopup::OnInitializing(void)
83 Button* pButtonDone = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_DELETE"));
84 AppAssertf(pButtonDone != null, "[E_FAILURE] Unable to get button.");
85 pButtonDone->SetActionId(IDA_EVENT_POPUP_DELETE);
86 pButtonDone->AddActionEventListener(*this);
88 Button* pButtonCancel = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_CANCEL"));
89 AppAssertf(pButtonCancel != null, "[E_FAILURE] Unable to get button.");
90 pButtonCancel->SetActionId(IDA_EVENT_POPUP_CANCEL);
91 pButtonCancel->AddActionEventListener(*this);
97 TwoButtonPopup::OnTerminating(void)
103 TwoButtonPopup::OnActionPerformed(const Control& source, int actionId)
107 if (actionId != IDA_EVENT_POPUP_CANCEL && actionId > 0 && __pTarget != null)
109 LinkedList* pArgs = null;
110 if (__pEvent != null)
112 pArgs = new (std::nothrow) LinkedList();
113 pArgs->Add(__pEvent);
116 __pTarget->SendUserEvent(actionId, pArgs);