#define MESSAGE_ENTRY_ACCOUNT "sample@tizen.com"
#define MESSAGE_ENTRY_PIN "Pin code"
+#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 _priv {
Evas_Object *win;
Evas_Object *base;
Evas_Object *focus_icon;
Evas_Object *done;
Evas_Object *cancel;
+ Evas_Object *ctxpopup;
struct datamgr *dm;
};
elm_object_signal_emit(obj, SIG_UNFOCUS, SRC_PROG);
}
+static void _eo_key_down(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK) ||
+ !strcmp(ev->keyname, KEY_BACK_REMOTE)) {
+ evas_object_del(data);
+ } else if (!strcmp(ev->keyname, KEY_ENTER) ||
+ !strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
+ /* It should be implemented later */
+ evas_object_del(data);
+ }
+}
+
+static input_handler icon_handler = {
+ .focused = _focused,
+ .unfocused = _unfocused,
+ .key_down = _eo_key_down
+};
+
+static Evas_Object *_pack_icon(Evas_Object *table, const char *icon_file,
+ const char *focus_icon_file, int i)
+{
+ Evas_Object *eo, *ic, *focus_ic;
+
+ eo = utils_add_layout(table, GRP_USER_EDIT_ICON_LIST_ITEM, true, NULL);
+ if (!eo) {
+ _ERR("failed to add layout");
+ return NULL;
+ }
+ 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);
+ if (!ic) {
+ _ERR("failed to add icon");
+ evas_object_del(eo);
+ return NULL;
+ }
+
+ focus_ic = utils_add_icon(eo, focus_icon_file,
+ PART_USER_EDIT_ICON_LIST_ITEM_FOCUS);
+ if (!focus_ic) {
+ _ERR("failed to add focus icon");
+ evas_object_del(eo);
+ return NULL;
+ }
+
+ return eo;
+}
+
+static void _add_icon_list(struct _priv *priv)
+{
+ Evas_Coord x, y, w, h;
+ Evas_Object *ctxpopup, *ly, *table, *eo;
+ int i;
+
+ ctxpopup = elm_ctxpopup_add(priv->base);
+ if (!ctxpopup) {
+ _ERR("failed to add ctxpopup");
+ return;
+ }
+ elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE);
+ elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
+
+ ly = utils_add_layout(ctxpopup, GRP_USER_EDIT_ICON_LIST, false, NULL);
+ if (!ly) {
+ _ERR("failed to layout");
+ evas_object_del(ctxpopup);
+ return;
+ }
+ elm_object_content_set(ctxpopup, ly);
+ evas_object_show(ly);
+ evas_object_show(ctxpopup);
+
+ evas_object_geometry_get(priv->photo, &x, &y, &w, &h);
+ evas_object_move(ctxpopup,
+ (x + w + CTXPOPUP_X) * elm_config_scale_get(),
+ (y + CTXPOPUP_Y) * elm_config_scale_get());
+
+ table = utils_add_table(ly, true, PART_USER_EDIT_ICON_LIST);
+ if (!table) {
+ _ERR("failed to add table");
+ evas_object_del(ctxpopup);
+ return;
+ }
+ elm_table_padding_set(table, elm_config_scale_get() * 1,
+ elm_config_scale_get() * 1);
+ evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND,
+ 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);
+ if (!eo)
+ continue;
+
+ inputmgr_add_callback(eo, 0, &icon_handler, ctxpopup);
+ if (i == 0)
+ elm_object_focus_set(eo, EINA_TRUE);
+ }
+
+ priv->ctxpopup = ctxpopup;
+}
+
static void _photo_key_down(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Key_Down *ev)
{
- /* It should be implemented later to drawing icon list */
+ if (!strcmp(ev->keyname, KEY_ENTER)) {
+ _add_icon_list(data);
+ }
}
static input_handler photo_handler = {