forked from enlightenment/efl
test_clock.c : Improve API use case.
1. Calls elm_clock_edit_mode_set to change edit mode. 2. Fixed switch indentation. 3. Print more usefull description for 'Next API function'
This commit is contained in:
parent
ae9adc7944
commit
af3bd208b1
|
@ -19,11 +19,22 @@ enum _api_state
|
||||||
CLOCK_EDIT_MIN,
|
CLOCK_EDIT_MIN,
|
||||||
CLOCK_EDIT_HOUR,
|
CLOCK_EDIT_HOUR,
|
||||||
CLOCK_EDIT_ALL,
|
CLOCK_EDIT_ALL,
|
||||||
CLOCK_EDIT_ALL_ARMY,
|
CLOCK_HIDE_AM_PM,
|
||||||
API_STATE_LAST
|
API_STATE_LAST
|
||||||
};
|
};
|
||||||
typedef enum _api_state api_state;
|
typedef enum _api_state api_state;
|
||||||
|
|
||||||
|
static const char* api_state_description[] = {
|
||||||
|
"Hide Sec",
|
||||||
|
"Show AM/PM",
|
||||||
|
"Show Sec",
|
||||||
|
"Edit Min",
|
||||||
|
"Edit Hour",
|
||||||
|
"Edit All",
|
||||||
|
"Hide AM/PM",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_api_state(api_data *api)
|
set_api_state(api_data *api)
|
||||||
{
|
{
|
||||||
|
@ -35,40 +46,42 @@ set_api_state(api_data *api)
|
||||||
/* use elm_box_children_get() to get list of children */
|
/* use elm_box_children_get() to get list of children */
|
||||||
switch(api->state)
|
switch(api->state)
|
||||||
{ /* Put all api-changes under switch */
|
{ /* Put all api-changes under switch */
|
||||||
case CLOCK_HIDE_SEC:
|
case CLOCK_HIDE_SEC:
|
||||||
elm_clock_show_seconds_set(ck, EINA_FALSE);
|
elm_clock_show_seconds_set(ck, EINA_FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOCK_SHOW_AM_PM:
|
case CLOCK_SHOW_AM_PM:
|
||||||
elm_clock_show_am_pm_set(ck, EINA_TRUE);
|
elm_clock_show_am_pm_set(ck, EINA_TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOCK_SHOW_SEC:
|
case CLOCK_SHOW_SEC:
|
||||||
elm_clock_show_seconds_set(ck, EINA_TRUE);
|
elm_clock_show_seconds_set(ck, EINA_TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOCK_EDIT_MIN:
|
case CLOCK_EDIT_MIN:
|
||||||
elm_clock_edit_set(ck, ELM_CLOCK_EDIT_MIN_DECIMAL | ELM_CLOCK_EDIT_MIN_UNIT);
|
elm_clock_edit_set(ck, EINA_TRUE);
|
||||||
break;
|
elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_MIN_DECIMAL | ELM_CLOCK_EDIT_MIN_UNIT);
|
||||||
|
break;
|
||||||
|
|
||||||
case CLOCK_EDIT_HOUR:
|
case CLOCK_EDIT_HOUR:
|
||||||
elm_clock_edit_set(ck, ELM_CLOCK_EDIT_DEFAULT);
|
elm_clock_edit_set(ck, EINA_TRUE);
|
||||||
elm_clock_edit_set(ck, ELM_CLOCK_EDIT_HOUR_DECIMAL | ELM_CLOCK_EDIT_HOUR_UNIT);
|
elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_HOUR_DECIMAL | ELM_CLOCK_EDIT_HOUR_UNIT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOCK_EDIT_ALL:
|
case CLOCK_EDIT_ALL:
|
||||||
elm_clock_edit_set(ck, ELM_CLOCK_EDIT_ALL);
|
elm_clock_edit_set(ck, EINA_TRUE);
|
||||||
break;
|
elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_ALL);
|
||||||
|
break;
|
||||||
|
|
||||||
case CLOCK_EDIT_ALL_ARMY:
|
case CLOCK_HIDE_AM_PM:
|
||||||
elm_clock_show_am_pm_set(ck, EINA_FALSE);
|
elm_clock_show_am_pm_set(ck, EINA_FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case API_STATE_LAST:
|
case API_STATE_LAST:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +92,7 @@ _api_bt_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
||||||
api_data *a = data;
|
api_data *a = data;
|
||||||
char str[128];
|
char str[128];
|
||||||
|
|
||||||
printf("clicked event on API Button: api_state=<%d>\n", a->state);
|
printf("clicked event on API Button: api_state=<%s>\n", api_state_description[a->state]);
|
||||||
set_api_state(a);
|
set_api_state(a);
|
||||||
a->state++;
|
a->state++;
|
||||||
sprintf(str, "Next API function (%u)", a->state);
|
sprintf(str, "Next API function (%u)", a->state);
|
||||||
|
|
Loading…
Reference in New Issue