{
}
-void CalDialogEditReminderRadioItem::setSelectCb(std::function<void(void)> selectCb)
+void CalDialogEditReminderRadioItem::setSelectCb(std::function<void(const CalScheduleReminder &reminder)> selectCb)
{
__selectCb = selectCb;
}
-void CalDialogEditReminderRadioItem::setRadioChangeCb(std::function<void(const CalScheduleReminder& reminder)> changeCb)
-{
- __changeCb = changeCb;
-}
Elm_Genlist_Item_Class *CalDialogEditReminderRadioItem::getItemClassStatic()
{
c_retv_if(NULL == radio_main, NULL);
Evas_Object *radio = elm_radio_add(obj);
- evas_object_propagate_events_set(radio, EINA_FALSE);
evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_radio_value_set(radio, item->__radioIndex);
}
- evas_object_smart_callback_add(radio, "changed",
- [](void *data, Evas_Object *obj, void *event_info) {
- CalDialogEditReminderRadioItem *item = (CalDialogEditReminderRadioItem *)data;
- if (item->__radioIndex == elm_radio_value_get(obj) && item->__changeCb) {
- item->__changeCb(item->__reminder);
- }
- }, item
- );
-
return radio;
}
return NULL;
{
WENTER();
if (__selectCb) {
- __selectCb();
+ __selectCb(__reminder);
}
}
* @param selectCb Select callback
*
*/
- void setSelectCb(std::function<void(void)> selectCb);
+ void setSelectCb(std::function<void(const CalScheduleReminder &reminder)> selectCb);
- /**
- * @brief Set Radio change callback
- *
- * @param changeCb Radio changed callback
- *
- */
- void setRadioChangeCb(std::function<void(const CalScheduleReminder& reminder)> changeCb);
private:
WDISABLE_COPY_AND_ASSIGN(CalDialogEditReminderRadioItem);
virtual Elm_Genlist_Item_Class *getItemClassStatic();
virtual void onSelect();
private:
- std::function<void(const CalScheduleReminder reminder)> __changeCb;
const CalScheduleReminder __reminderOri;
int __radioIndex;
CalScheduleReminder __reminder;
- std::function<void(void)> __selectCb;
+ std::function<void(const CalScheduleReminder &reminder)> __selectCb;
bool __setRadio;
};
#include "CalScheduleRepeat.h"
#include "CalDialogEditRepeatRadioItem.h"
-CalDialogEditRepeatRadioItem::CalDialogEditRepeatRadioItem(std::function<void(void)> selectCb, std::function<void(const CalScheduleRepeat::UnitType repeatType)> changeCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType) :
- __changeCb(changeCb),
+CalDialogEditRepeatRadioItem::CalDialogEditRepeatRadioItem(std::function<void(CalScheduleRepeat::UnitType repeatType)> selectCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType) :
__radioIndex(radioIndex),
__repeatType(unitType),
__selectCb(selectCb),
c_retv_if(NULL == radio_main, NULL);
Evas_Object *radio = elm_radio_add(obj);
- evas_object_propagate_events_set(radio, EINA_FALSE);
evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_radio_value_set(radio, item->__radioIndex);
}
- evas_object_smart_callback_add(radio, "changed",
- [](void *data, Evas_Object *obj, void *event_info) {
- CalDialogEditRepeatRadioItem *item = (CalDialogEditRepeatRadioItem *)data;
- if (item->__radioIndex == elm_radio_value_get(obj)) {
- item->__changeCb(item->__repeatType);
- }
- }, item
- );
-
return radio;
}
return NULL;
{
WENTER();
if (__selectCb) {
- __selectCb();
+ __selectCb(__repeatType);
}
}
* @brief Create item
*
* @param selectCb Select callback
- * @param changeCb Change callback
* @param radioIndex Radio index
* @param unitType Repeat unit type
* @param defaultUnitType Default repeat unit type
*
*/
- CalDialogEditRepeatRadioItem(std::function<void(void)> selectCb, std::function<void(const CalScheduleRepeat::UnitType repeatType)> changeCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType);
+ CalDialogEditRepeatRadioItem(std::function<void(CalScheduleRepeat::UnitType repeatType)> selectCb, int radioIndex, CalScheduleRepeat::UnitType unitType, CalScheduleRepeat::UnitType defaultUnitType);
/**
* @brief Destructor
virtual Elm_Genlist_Item_Class *getItemClassStatic();
virtual void onSelect();
private:
- std::function<void(const CalScheduleRepeat::UnitType repeatType)> __changeCb;
- //const CalScheduleRepeat __repeatOri;
int __radioIndex;
- //CalScheduleRepeat __repeat;
CalScheduleRepeat::UnitType __repeatType;
- std::function<void(void)> __selectCb;
+ std::function<void(CalScheduleRepeat::UnitType repeatType)> __selectCb;
CalScheduleRepeat::UnitType __defaultRepeatType;
};
return WPopup::onCreate(parent, viewParam);
}
-void CalEditReminderPopup::__addRadioItem(CalDialogControl *dialog, Evas_Object *radioObj, int& radioIndex, CalScheduleReminder::UnitType type, int unitValue)
+void CalEditReminderPopup::__addRadioItem(CalDialogControl *dialog, Evas_Object *radioObj, int &radioIndex, CalScheduleReminder::UnitType type, int unitValue)
{
bool setRadio = false;
if (__isEditReminder && __reminder.unitType == type && __reminder.unitValue == unitValue) {
setRadio = true;
}
CalDialogEditReminderRadioItem *radioItem = new CalDialogEditReminderRadioItem(__reminder, radioIndex, type, unitValue, setRadio, type == CalScheduleReminder::NONE);
- radioItem->setSelectCb([this, radioObj, radioIndex](void)->void {
+ radioItem->setSelectCb([this, radioObj, radioIndex](const CalScheduleReminder &reminder) {
if (__radio_index == radioIndex) {
if (__doneCb) {
__doneCb(__reminder, __radio_index);
}
elm_radio_value_set(radioObj, radioIndex);
__radio_index = radioIndex;
- Evas_Object *radio = elm_radio_selected_object_get(radioObj);
- evas_object_smart_callback_call(radio, "changed", NULL);
- }
- );
- radioItem->setRadioChangeCb([this, radioIndex](const CalScheduleReminder& reminder)->void {
__reminder = reminder;
- __radio_index = radioIndex;
std::string reminderText;
__reminder.getString(reminderText);
WDEBUG("Reminder: %s", reminderText.c_str());
radioIndex++;
}
-void CalEditReminderPopup::__addRadioCustomItem(CalDialogControl *dialog, Evas_Object *radioObj, int& radioIndex)
+void CalEditReminderPopup::__addRadioCustomItem(CalDialogControl *dialog, Evas_Object *radioObj, int &radioIndex)
{
bool setRadio = false;
__customItem = new CalDialogEditReminderRadioItem(__reminder, radioIndex, setRadio, false);
- __customItem->setSelectCb([this, radioObj, radioIndex](void)->void {
+ __customItem->setSelectCb([this, radioObj, radioIndex](const CalScheduleReminder &reminder) {
elm_radio_value_set(radioObj, radioIndex);
__radio_index = 10;
- Evas_Object *radio = elm_radio_selected_object_get(radioObj);
- evas_object_smart_callback_call(radio, "changed", NULL);
- }
- );
- __customItem->setRadioChangeCb([this](const CalScheduleReminder& reminder)->void {
+
if (__customSelectedCb) {
- __radio_index = 10;
__customSelectedCb(__reminder, __radio_index);
}
}
CalDialogEditRepeatRadioItem *CalEditRepeatPopup::__addRadioItem(Evas_Object *radio_main, int radio_index, CalScheduleRepeat::UnitType unitType)
{
return new CalDialogEditRepeatRadioItem(
- [radio_main, radio_index]() {
+ [this, radio_main, radio_index](CalScheduleRepeat::UnitType repeatType) {
elm_radio_value_set(radio_main, radio_index);
- Evas_Object *radio = elm_radio_selected_object_get(radio_main);
- evas_object_smart_callback_call(radio, "changed", NULL);
- },
- [this](const CalScheduleRepeat::UnitType repeatType) {
WDEBUG("repeat.unitType=%d", repeatType);
__repeatUnitType = repeatType;
__doneCb(__repeatUnitType);