#define MESSAGE_ENTRY_NAME "User Name"
#define MESSAGE_ENTRY_ACCOUNT "sample@tizen.com"
#define MESSAGE_ENTRY_PIN "Pin code"
+#define ICON_ADD "add"
+#define KEY_ICON "icon"
+#define KEY_FOCUS_ICON "focusicon"
#define CTXPOPUP_X 294
#define CTXPOPUP_Y 310
-static const char *icon_info[][2] = {
- { IMAGE_USER_DEFAULT, IMAGE_USER_DEFAULT_FOCUS },
- { IMAGE_USER_DEFAULT_02, IMAGE_USER_DEFAULT_02_FOCUS },
- { IMAGE_USER_DEFAULT_03, IMAGE_USER_DEFAULT_03_FOCUS },
- { IMAGE_USER_DEFAULT_04, IMAGE_USER_DEFAULT_04_FOCUS },
- { IMAGE_USER_DEFAULT_05, IMAGE_USER_DEFAULT_05_FOCUS },
- { IMAGE_USER_DEFAULT_06, IMAGE_USER_DEFAULT_06_FOCUS },
- { IMAGE_USER_DEFAULT_07, IMAGE_USER_DEFAULT_07_FOCUS },
- { IMAGE_USER_ADD, IMAGE_USER_ADD_FOCUS }
+struct _icon_info {
+ const char *file;
+ const char *focus_file;
+ const char *message;
+ const char *focus_message;
};
struct _priv {
elm_object_signal_emit(obj, SIG_UNFOCUS, SRC_PROG);
}
+static void _load_user_icon(struct _priv *priv, const char *file,
+ const char *focus_file)
+{
+ Evas_Object *icon, *focus_icon;
+
+ icon = utils_add_icon(priv->photo, file, PART_USER_EDIT_PHOTO);
+ if (!icon)
+ _ERR("failed to add icon");
+
+ focus_icon = utils_add_icon(priv->photo, focus_file,
+ PART_USER_EDIT_PHOTO_FOCUS);
+ if (!focus_icon)
+ _ERR("failed to add focus icon");
+
+ priv->icon = icon;
+ priv->focus_icon = focus_icon;
+}
+
static void _eo_key_down(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Key_Down *ev)
{
+ struct _priv *priv;
+ const char *file, *focus_file;
+
+ if (!data)
+ return;
+
+ priv = data;
+
if (!strcmp(ev->keyname, KEY_BACK) ||
!strcmp(ev->keyname, KEY_BACK_REMOTE)) {
- evas_object_del(data);
+ evas_object_del(priv->ctxpopup);
+ priv->ctxpopup = NULL;
} else if (!strcmp(ev->keyname, KEY_ENTER) ||
!strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
- /* It should be implemented later */
- evas_object_del(data);
- viewmgr_push_view(VIEW_PHOTO);
+ evas_object_del(priv->ctxpopup);
+ priv->ctxpopup = NULL;
+
+ file = evas_object_data_get(obj, KEY_ICON);
+ focus_file = evas_object_data_get(obj, KEY_FOCUS_ICON);
+
+ if (!strcmp(file, ICON_ADD) || !strcmp(focus_file, ICON_ADD))
+ viewmgr_push_view(VIEW_PHOTO);
+ else
+ _load_user_icon(priv, file, focus_file);
}
}
.key_down = _eo_key_down
};
-static Evas_Object *_pack_icon(Evas_Object *table, const char *icon_file,
- const char *focus_icon_file, int i)
+static Evas_Object *_pack_icon(Evas_Object *table, struct _icon_info *icon_info, int i)
{
Evas_Object *eo, *ic, *focus_ic;
evas_object_show(eo);
elm_table_pack(table, eo, i % 4, i / 4, 1, 1);
- ic = utils_add_icon(eo, icon_file, PART_USER_EDIT_ICON_LIST_ITEM);
+ ic = utils_add_icon(eo, icon_info->file, PART_USER_EDIT_ICON_LIST_ITEM);
if (!ic) {
_ERR("failed to add icon");
evas_object_del(eo);
return NULL;
}
- focus_ic = utils_add_icon(eo, focus_icon_file,
+ focus_ic = utils_add_icon(eo, icon_info->focus_file,
PART_USER_EDIT_ICON_LIST_ITEM_FOCUS);
if (!focus_ic) {
_ERR("failed to add focus icon");
evas_object_del(eo);
return NULL;
}
+ evas_object_data_set(eo, KEY_ICON, icon_info->message);
+ evas_object_data_set(eo, KEY_FOCUS_ICON, icon_info->focus_message);
return eo;
}
Evas_Coord x, y, w, h;
Evas_Object *ctxpopup, *ly, *table, *eo;
int i;
+ struct _icon_info icon_info[] = {
+ {
+ IMAGE_USER_DEFAULT,
+ IMAGE_USER_DEFAULT_FOCUS,
+ IMAGE_USER_CURRENT_DEFAULT,
+ IMAGE_USER_CURRENT_DEFAULT_FOCUS
+ },
+ {
+ IMAGE_USER_DEFAULT_02,
+ IMAGE_USER_DEFAULT_02_FOCUS,
+ IMAGE_USER_CURRENT_DEFAULT_02,
+ IMAGE_USER_CURRENT_DEFAULT_02_FOCUS
+ },
+ {
+ IMAGE_USER_DEFAULT_03,
+ IMAGE_USER_DEFAULT_03_FOCUS,
+ IMAGE_USER_CURRENT_DEFAULT_03,
+ IMAGE_USER_CURRENT_DEFAULT_03_FOCUS
+ },
+ {
+ IMAGE_USER_DEFAULT_04,
+ IMAGE_USER_DEFAULT_04_FOCUS,
+ IMAGE_USER_CURRENT_DEFAULT_04,
+ IMAGE_USER_CURRENT_DEFAULT_04_FOCUS
+ },
+ {
+ IMAGE_USER_DEFAULT_05,
+ IMAGE_USER_DEFAULT_05_FOCUS,
+ IMAGE_USER_CURRENT_DEFAULT_05,
+ IMAGE_USER_CURRENT_DEFAULT_05_FOCUS
+ },
+ {
+ IMAGE_USER_DEFAULT_06,
+ IMAGE_USER_DEFAULT_06_FOCUS,
+ IMAGE_USER_CURRENT_DEFAULT_06,
+ IMAGE_USER_CURRENT_DEFAULT_06_FOCUS
+ },
+ {
+ IMAGE_USER_DEFAULT_07,
+ IMAGE_USER_DEFAULT_07_FOCUS,
+ IMAGE_USER_CURRENT_DEFAULT_07,
+ IMAGE_USER_CURRENT_DEFAULT_07_FOCUS
+ },
+ {
+ IMAGE_USER_ADD,
+ IMAGE_USER_ADD_FOCUS,
+ ICON_ADD,
+ ICON_ADD
+ }
+ };
ctxpopup = elm_ctxpopup_add(priv->base);
if (!ctxpopup) {
EVAS_HINT_EXPAND);
for (i = 0; i < sizeof(icon_info) / sizeof(*icon_info); i++) {
- eo = _pack_icon(table, icon_info[i][0], icon_info[i][1], i);
+ eo = _pack_icon(table, &icon_info[i], i);
if (!eo)
continue;
- inputmgr_add_callback(eo, 0, &icon_handler, ctxpopup);
+ inputmgr_add_callback(eo, 0, &icon_handler, priv);
if (i == 0)
elm_object_focus_set(eo, EINA_TRUE);
}
return base;
}
-static void _load_user_edit(struct _priv *priv)
-{
- Evas_Object *icon, *focus_icon;
-
- /* check state of user edit */
-
- elm_object_part_text_set(priv->base, PART_USER_EDIT_TITLE,
- MESSAGE_ADD_USER);
- icon = utils_add_icon(priv->photo, IMAGE_USER_CURRENT_DEFAULT,
- PART_USER_EDIT_PHOTO);
- if (!icon)
- _ERR("failed to add icon");
-
- focus_icon = utils_add_icon(priv->photo,
- IMAGE_USER_CURRENT_DEFAULT_FOCUS,
- PART_USER_EDIT_PHOTO_FOCUS);
- if (!focus_icon)
- _ERR("failed to add focus icon");
-
- priv->icon = icon;
- priv->focus_icon = focus_icon;
-}
-
static void _show(void *data)
{
struct _priv *priv;
priv = data;
evas_object_show(priv->base);
-
- _load_user_edit(priv);
+ elm_object_part_text_set(priv->base, PART_USER_EDIT_TITLE,
+ MESSAGE_ADD_USER);
+ _load_user_icon(priv, IMAGE_USER_CURRENT_DEFAULT,
+ IMAGE_USER_CURRENT_DEFAULT_FOCUS);
}
static void _hide(void *data)