TimerView::~TimerView()
{
+ if (selector_)
+ evas_object_del(selector_);
+ if (layout_)
+ evas_object_del(layout_);
+
delete counter_;
}
TimerView *object = static_cast<TimerView *>(data);
elm_entry_select_all(obj);
-
- elm_object_signal_emit(object->layout_, "menu.editing.show", "timer");
}
void TimerView::EntryUnfocusedCb(void *data, Evas_Object *obj, void *event_info)
object->UpdateTime();
- if (object->set_time_.Hour || object->set_time_.Min || object->set_time_.Sec)
+ if (object->set_time_.Hour || object->set_time_.Min || object->set_time_.Sec) {
object->SetEnabledStartButton(true);
- else
+ object->ShowEditingMenu();
+ } else {
object->SetEnabledStartButton(false);
+ object->ShowStartupMenu();
+ }
object->counter_->DisplayTime(
object->set_time_.Hour,
elm_object_focus_set(entry, EINA_FALSE);
}
+void TimerView::ShowSelector()
+{
+ Evas_Object *content = elm_object_part_content_get(layout_, "sw.content");
+ if (selector_ && content != selector_) {
+ elm_object_part_content_unset(layout_, "sw.content");
+ evas_object_hide(content);
+
+ elm_object_part_content_set(layout_, "sw.content", selector_);
+ evas_object_show(selector_);
+ }
+}
+
+void TimerView::ShowCounter()
+{
+ Evas_Object *content = elm_object_part_content_unset(layout_, "sw.content");
+ if (counter_->GetEvasObject() && content != counter_->GetEvasObject()) {
+ elm_object_part_content_unset(layout_, "sw.content");
+ evas_object_hide(content);
+
+ elm_object_part_content_set(layout_, "sw.content", counter_->GetEvasObject());
+ evas_object_show(counter_->GetEvasObject());
+ }
+}
+
void TimerView::ShowStartupMenu(void)
{
if (!layout_)
return;
- Evas_Object *content = elm_object_part_content_unset(layout_, "sw.content");
- if (content)
- evas_object_hide(content);
+ if (set_time_.Hour || set_time_.Min || set_time_.Sec) {
+ ShowEditingMenu();
+ return;
+ }
+
+ ShowSelector();
- if (selector_)
- elm_object_part_content_set(layout_, "sw.content", selector_);
elm_object_signal_emit(layout_, "menu.startup.show", "timer");
elm_object_signal_emit(layout_, "arrow.btn.show", "timer");
}
if (!layout_)
return;
- Evas_Object *content = elm_object_part_content_unset(layout_, "sw.content");
- if (content)
- evas_object_hide(content);
-
- if (counter_->GetEvasObject())
- elm_object_part_content_set(layout_, "sw.content", counter_->GetEvasObject());
+ ShowCounter();
elm_object_signal_emit(layout_, "arrow.btn.hide", "timer");
elm_object_signal_emit(layout_, "menu.running.show", "timer");
}
-void TimerView::ShowPausedMenu(void)
+void TimerView::ShowEditingMenu(void)
{
if (!layout_)
return;
- elm_object_signal_emit(layout_, "menu.paused.show", "timer");
+ ShowSelector();
+
+ elm_object_signal_emit(layout_, "arrow.btn.show", "timer");
+ elm_object_signal_emit(layout_, "menu.editing.show", "timer");
}
-void TimerView::ShowEditingMenu(void)
+void TimerView::ShowPausedMenu(void)
{
if (!layout_)
return;
- elm_object_signal_emit(layout_, "menu.editing.show", "timer");
+ elm_object_signal_emit(layout_, "menu.paused.show", "timer");
}
void TimerView::CreateMenuButtons()