using namespace Tizen::Ui;
using namespace Tizen::Ui::Controls;
-static const int IDA_GO_TO_DATE_POPUP_CANCEL = 10902;
-
GoToDatePopup::GoToDatePopup(void)
: __pEditDate(null)
, __pTarget(null)
}
result
+GoToDatePopup::Initialize(void)
+{
+ return Construct(L"IDL_GO_TO_DATE_POPUP");
+}
+
+void
+GoToDatePopup::RequestPopup(const DateTime& initialDate, Control* pTarget)
+{
+ __date = initialDate;
+ __pTarget = pTarget;
+
+ SetShowState(true);
+ Show();
+}
+
+result
GoToDatePopup::OnInitializing(void)
{
__pEditDate = dynamic_cast<EditDate*>(GetControl(L"IDC_EDITDATE"));
- AppAssertf(__pEditDate != null, "[E_FAILURE] Unable to get button.");
__pEditDate->SetYearRange(Calendarbook::GetMinDateTime().GetYear() + 1, Calendarbook::GetMaxDateTime().GetYear() - 1);
__pEditDate->SetDate(__date);
SetTitleText(title);
Button* pButtonDone = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_DONE"));
- AppAssertf(pButtonDone != null, "[E_FAILURE] Unable to get button.");
pButtonDone->SetActionId(IDA_GO_TO_DATE_POPUP_DONE);
pButtonDone->AddActionEventListener(*this);
Button* pButtonCancel = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_CANCEL"));
- AppAssertf(pButtonCancel != null, "[E_FAILURE] Unable to get button.");
pButtonCancel->SetActionId(IDA_GO_TO_DATE_POPUP_CANCEL);
pButtonCancel->AddActionEventListener(*this);
{
case IDA_GO_TO_DATE_POPUP_DONE:
__date = __pEditDate->GetDate();
- SetShowState(false);
- if (__pTarget != null)
+ if (__pTarget)
{
LinkedList* pArgs = new (std::nothrow) LinkedList();
pArgs->Add(new (std::nothrow) DateTime(__date));
__pTarget->SendUserEvent(IDA_GO_TO_DATE_POPUP_DONE, pArgs);
}
- delete this;
+ SetShowState(false);
break;
case IDA_GO_TO_DATE_POPUP_CANCEL:
SetShowState(false);
- delete this;
break;
}
}
-
-void
-GoToDatePopup::RequestGoToDate(const DateTime& initialDate, Control* pTarget)
-{
- GoToDatePopup* pPopup = new (std::nothrow) GoToDatePopup();
- pPopup->__date = initialDate;
- pPopup->__pTarget = pTarget;
- pPopup->Construct(L"IDL_GO_TO_DATE_POPUP");
- pPopup->Show();
-}