#include <stdbool.h>
#include <Evas.h>
+struct icon_info {
+ const char *icon_file;
+ const char *focus_icon_file;
+ const char *photo_file;
+ const char *focus_photo_file;
+};
+
+struct icon_info *utils_get_icon_info(void);
+const char *utils_get_focus_photo_from_photo(const char *photo);
+const char *utils_get_focus_icon_from_icon(const char *icon);
+const char *utils_get_icon_from_photo(const char *photo);
+const char *utils_get_photo_from_icon(const char *icon);
+
Evas_Object *utils_add_layout(Evas_Object *base, const char *group,
bool focus_allow, const char *part);
Evas_Object *utils_add_icon(Evas_Object *base, const char *file,
#include "utils.h"
#include "defs.h"
+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
+ }
+};
+
+struct icon_info *utils_get_icon_info(void)
+{
+ return _icon_info;
+}
+
+const char *utils_get_focus_photo_from_photo(const char *photo)
+{
+ int i;
+
+ for (i = 0; i < MAX_ITEM_COUNT; i++) {
+ if (!strcmp(photo, _icon_info[i].photo_file))
+ return _icon_info[i].focus_photo_file;
+ }
+
+ return photo;
+}
+
+const char *utils_get_focus_icon_from_icon(const char *icon)
+{
+ int i;
+
+ for (i = 0; i < MAX_ITEM_COUNT; i++) {
+ if (!strcmp(icon, _icon_info[i].icon_file))
+ return _icon_info[i].focus_icon_file;
+ }
+
+ return icon;
+}
+
+const char *utils_get_icon_from_photo(const char *photo)
+{
+ int i;
+
+ for (i = 0; i < MAX_ITEM_COUNT; i++) {
+ if (!strcmp(photo, _icon_info[i].photo_file))
+ return _icon_info[i].icon_file;
+ }
+
+ return photo;
+}
+
+const char *utils_get_photo_from_icon(const char *icon)
+{
+ int i;
+
+ for (i = 0; i < MAX_ITEM_COUNT; i++) {
+ if (!strcmp(icon, _icon_info[i].icon_file))
+ return _icon_info[i].photo_file;
+ }
+
+ return icon;
+}
+
Evas_Object *utils_add_layout(Evas_Object *base, const char *group,
bool focus_allow, const char *part)
{
#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"
.key_down = _eo_key_down
};
-static Evas_Object *_pack_icon(Evas_Object *table, struct _icon_info *icon_info, 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_info->file, PART_USER_EDIT_ICON_LIST_ITEM);
+ ic = utils_add_icon(eo, _icon_info->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, icon_info->focus_file,
+ focus_ic = utils_add_icon(eo, _icon_info->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;
}
- evas_object_data_set(eo, KEY_ICON, icon_info->message);
- evas_object_data_set(eo, KEY_FOCUS_ICON, icon_info->focus_message);
+ evas_object_data_set(eo, KEY_ICON, _icon_info->photo_file);
+ evas_object_data_set(eo, KEY_FOCUS_ICON, _icon_info->focus_photo_file);
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
- }
- };
+ struct icon_info *_icon_info;
ctxpopup = elm_ctxpopup_add(priv->base);
if (!ctxpopup) {
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], i);
+ _icon_info = utils_get_icon_info();
+
+ for (i = 0; i < MAX_ITEM_COUNT; i++) {
+ eo = _pack_icon(table, &_icon_info[i], i);
if (!eo)
continue;