scale, 1;
description {
state, "default" 0.0;
+ color, 255 255 255 255;
min, 218 64;
}
description {
}
}
}
+
+group {
+ name, "elm/button/base/style.option.button";
+ inherit, "elm/button/base/style.sort.button";
+ parts {
+ part {
+ name, "part.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 218 56;
+ }
+ description {
+ state, "focused" 0.0;
+ inherit, "default" 0.0;
+ color, 0 119 246 255;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ }
+ }
+
+ part {
+ name, "part.inside.line.up";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "focused" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ }
+ }
+
+ part {
+ name, "part.inside.line.left";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "focused" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ }
+ }
+
+ part {
+ name, "part.inside.line.down";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "focused" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ }
+ }
+
+ part {
+ name, "part.inside.line.right";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ description {
+ state, "focused" 0.0;
+ inherit, "default" 0.0;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ }
+ }
+
+ part {
+ name, "elm.text";
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 87 87 87 255;
+ min, 158 0;
+ text {
+ font, FONT_TIZENSANS_LIGHT;
+ size, 28;
+ align, 0.0 0.5;
+ }
+ }
+ description {
+ state, "focused" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ description {
+ state, "selected" 0.0;
+ inherit, "default" 0.0;
+ color, 64 136 211 255;
+ }
+ }
+ }
+}
--- /dev/null
+group {
+ name, "elm/ctxpopup/base/style.sort.ctxpopup";
+ data.item, "focus_hightlight" "on";
+ parts {
+ part {
+ name, "part.bg";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 255 255 255 255;
+ min, 220 170;
+ }
+ }
+
+ part {
+ name, "part.inside.line.up";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 154 154 154 255;
+ min, 220 1;
+ rel2.relative, 0.0 0.0;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ }
+ }
+
+ part {
+ name, "part.inside.line.left";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 154 154 154 255;
+ min, 1 170;
+ rel2.relative, 0.0 0.0;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ }
+ }
+
+ part {
+ name, "part.inside.line.down";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 154 154 154 255;
+ min, 220 1;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 0.0 1.0;
+ align, 0.0 1.0;
+ fixed, 1 1;
+ }
+ }
+
+ part {
+ name, "part.inside.line.right";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ color, 154 154 154 255;
+ min, 1 170;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 0.0;
+ align, 1.0 0.0;
+ fixed, 1 1;
+ }
+ }
+
+ part {
+ name, "padding.elm.swallow.content";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 1 1;
+ rel2.relative, 0.0 0.0;
+ align, 0.0 0.0;
+ fixed, 1 1;
+ }
+ }
+
+ part {
+ name, "elm.swallow.content";
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 218 168;
+ rel1 {
+ to, "padding.elm.swallow.content";
+ relative, 1.0 1.0;
+ }
+ rel2.to, "padding.elm.swallow.content";
+ align, 0.0 0.0;
+ fixed, 1 1;
+ }
+ }
+ }
+}
Evas_Object *menu_btn[MENU_COUNT];
Evas_Object *focused_menu;
Evas_Object *sort_btn;
+ Evas_Object *sort_popup;
Evas_Object *grid;
Elm_Object_Item *cur_grid_item;
struct gridmgr *gmgr;
Eina_List *app_list;
enum sort_type sort_type;
};
+
static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Mouse_Move *ev)
{
}
}
+static void _destroy_sort_ctxpopup(struct _priv *priv)
+{
+ if (!priv || !priv->sort_popup) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ evas_object_hide(priv->sort_popup);
+ evas_object_del(priv->sort_popup);
+ priv->sort_popup = NULL;
+}
+
+static void _option_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev)
+{
+ struct _priv *priv;
+
+ if (!data || !ev) {
+ _ERR("Invalid argument.");
+ return;
+ }
+ priv = data;
+
+ if (!strcmp(ev->key, KEY_BACK)) {
+ _destroy_sort_ctxpopup(priv);
+ } else if (!strcmp(ev->key, KEY_ENTER)) {
+ switch (id) {
+ case SORT_RECENT:
+ /* It should be implemented later. */
+ break;
+
+ case SORT_A_TO_Z:
+ /* It should be implemented later. */
+ break;
+
+ case SORT_Z_TO_A:
+ /* It should be implemented later. */
+ break;
+
+ default:
+ _ERR("Invalid sort type.");
+ }
+
+ _destroy_sort_ctxpopup(priv);
+ }
+}
+
+static input_handler _option_input_handler = {
+ .mouse_move = _mouse_move_cb,
+ .key_down = _option_key_down_cb
+ /* It will be implemented later. */
+};
+
+static bool _draw_sort_option(struct _priv *priv)
+{
+ Evas_Object *ctxpopup, *box, *btn, *firstbtn;
+ Evas_Coord x, y, w, h;
+ int i;
+
+ if (!priv) {
+ _ERR("Invalid argument.");
+ return false;
+ }
+
+ ctxpopup = elm_ctxpopup_add(priv->base);
+ if (!ctxpopup) {
+ _ERR("elm_ctxpopup_add failed.");
+ return false;
+ }
+
+ box = add_box(ctxpopup, NULL, EINA_FALSE,
+ SIZE_SORT_BOX_PAD_H, SIZE_SORT_BOX_PAD_V);
+ if (!box) {
+ _ERR("elm_box_add failed.");
+ evas_object_del(ctxpopup);
+ return false;
+ }
+
+ elm_object_style_set(ctxpopup, STYLE_SORT_CTXPOPUP);
+ elm_object_content_set(ctxpopup, box);
+
+ elm_ctxpopup_direction_priority_set(ctxpopup, 0, 0, 0, 0);
+ evas_object_geometry_get(priv->sort_btn, &x, &y, &w, &h);
+ evas_object_move(ctxpopup, (x + w / 2) * elm_config_scale_get(),
+ y * elm_config_scale_get());
+ evas_object_show(ctxpopup);
+
+ priv->sort_popup = ctxpopup;
+
+ for (i = 0; i < SORT_COUNT; i++) {
+ btn = add_button(box, NULL, str_sort[i], STYLE_OPTION_BTN);
+ if (!btn) {
+ _ERR("Add button failed.");
+ evas_object_del(ctxpopup);
+ return false;
+ }
+
+ elm_box_pack_end(box, btn);
+
+ inputmgr_add_callback(btn, i, &_option_input_handler, priv);
+
+ if (i == 0)
+ firstbtn = btn;
+ }
+
+ if (firstbtn && btn) {
+ elm_object_focus_set(firstbtn, EINA_TRUE);
+ elm_object_focus_next_object_set(firstbtn, btn, ELM_FOCUS_UP);
+ elm_object_focus_next_object_set(btn, firstbtn, ELM_FOCUS_DOWN);
+ }
+
+ return true;
+}
+
static void _sort_clicked_cb(int id, void *data, Evas_Object *obj)
{
- if (!obj) {
+ struct _priv *priv;
+
+ if (!data || !obj) {
_ERR("Invalid argument.");
return;
}
+ priv = data;
+
+ if (!_draw_sort_option(priv)) {
+ _ERR("Draw sort ctxpopup failed.");
+ return;
+ }
elm_object_signal_emit(obj, SIG_SELECTED, "");
- /* It will be implemented later. */
}
static void _sort_focused_cb(int id, void *data, Evas_Object *obj,
/* It will be implemented later. */
}
+static void _sort_key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev)
+{
+ if (!ev) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ if (!strcmp(ev->key, KEY_BACK))
+ ui_app_exit();
+}
+
static void _grid_focused_cb(int id, void *data, Evas_Object *obj,
Elm_Object_Item *item)
{
static input_handler _sort_input_handler = {
.mouse_move = _mouse_move_cb,
.clicked = _sort_clicked_cb,
- .focused = _sort_focused_cb
+ .focused = _sort_focused_cb,
+ .key_down = _sort_key_down_cb
/* It will be implemented later. */
};
elm_object_part_text_set(priv->base, PART_TOP_TITLE, STR_APPS);
box = add_box(priv->base, PART_MENU, EINA_TRUE,
- SIZE_BOX_PAD_H, SIZE_BOX_PAD_V);
+ SIZE_MENU_BOX_PAD_H, SIZE_MENU_BOX_PAD_V);
if (!box) {
_ERR("Add box failed.");
return false;
elm_object_focus_next_object_set(priv->menu_btn[0],
priv->menu_btn[MENU_COUNT - 1], ELM_FOCUS_LEFT);
- elm_object_focus_next_object_set(priv->menu_btn[MENU_COUNT -1],
+ elm_object_focus_next_object_set(priv->menu_btn[MENU_COUNT - 1],
priv->menu_btn[0], ELM_FOCUS_RIGHT);
elm_object_focus_set(priv->menu_btn[0], EINA_TRUE);