#define NOTIFICATION_ITEM_PADDING 26
#define NOTIFICATION_ITEMS_IN_COL 4.0
+#define SIG_ITEM_FOCUSED "item,focused"
+#define SIG_ITEM_UNFOCUSED "item,unfocused"
+
+enum _update_type {
+ UPDATE_TYPE_SHOW_POPUP,
+};
+
+enum _obj_id {
+ OBJ_CLEAR,
+ OBJ_TITLE,
+ OBJ_GRID
+};
+
enum notification_category {
CATEGORY_FIRST = 0,
CATEGORY_TODAY = CATEGORY_FIRST,
Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev);
static void _category_unfocused_cb(int id, void *data,
Evas_Object *obj, Elm_Object_Item *it);
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Mouse_Move *ev);
static input_handler base_handler = {
.key_up = _base_key_up_cb,
static input_handler category_handler = {
.unfocused = _category_unfocused_cb,
};
+static input_handler focus_handler = {
+ .mouse_move = _mouse_move,
+};
static const char *_get_category_title(int category)
{
}
}
+static void _show_popup(void *data)
+{
+ viewmgr_update_view(NOTIFICATION_VIEW,
+ UPDATE_TYPE_SHOW_POPUP, data);
+}
+
+static void _grid_select(void *data, Evas_Object *obj, void *event_info)
+{
+ notification_h noti;
+
+ noti = elm_object_item_data_get(event_info);
+ if (!noti)
+ return;
+
+ ecore_job_add(_show_popup, noti);
+}
+
static Evas_Object *_add_category_title(Evas_Object *base, int category)
{
Evas_Object *btn;
elm_gengrid_horizontal_set(grid, EINA_TRUE);
evas_object_size_hint_weight_set(grid,
EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS);
elm_object_content_set(base, grid);
elm_object_focus_next_object_set(grid, grid, ELM_FOCUS_RIGHT);
inputmgr_add_callback(title, category, &category_handler, priv);
+ inputmgr_add_callback(title, OBJ_TITLE, &focus_handler, NULL);
inputmgr_add_callback(grid, category, &category_handler, priv);
+ inputmgr_add_callback(grid, OBJ_GRID, &focus_handler, NULL);
elm_box_pack_end(priv->category_container, ly);
evas_object_show(grid);
notification_list_h ongoing_list, notification_list_h noti_list)
{
notification_h noti;
+ Elm_Object_Item *it;
int count = 0, col, w;
if (category < CATEGORY_FIRST ||
while (ongoing_list != NULL) {
noti = notification_list_get_data(ongoing_list);
- elm_gengrid_item_append(priv->category[category]->grid,
- priv->grid_class, noti, NULL, noti);
+ it = elm_gengrid_item_append(priv->category[category]->grid,
+ priv->grid_class, noti, _grid_select, priv);
+ elm_object_item_data_set(it, noti);
ongoing_list = notification_list_remove(ongoing_list, noti);
count++;
while (noti_list != NULL) {
noti = notification_list_get_data(noti_list);
- elm_gengrid_item_append(priv->category[category]->grid,
- priv->grid_class, noti, NULL, noti);
+ it = elm_gengrid_item_append(priv->category[category]->grid,
+ priv->grid_class, noti, _grid_select, priv);
+ elm_object_item_data_set(it, noti);
noti_list = notification_list_remove(noti_list, noti);
count++;
elm_object_content_set(priv->base, scroller);
elm_scroller_step_size_set(scroller,
NOTIFICATION_CATEGORY_STEP_SIZE, 0);
- elm_object_focus_allow_set(scroller, EINA_FALSE);
priv->category_container = elm_box_add(scroller);
elm_object_content_set(scroller, priv->category_container);
elm_box_padding_set(priv->category_container,
NOTIFICATION_CATEGORY_PADDING_X,
NOTIFICATION_CATEGORY_PADDING_Y);
+ elm_object_focus_allow_set(scroller, EINA_FALSE);
+ elm_object_focus_allow_set(priv->category_container, EINA_FALSE);
priv->clear_btn = elm_layout_add(priv->base);
elm_layout_file_set(priv->clear_btn, EDJEFILE, GRP_NOTIFICATION_CLEAR);
PART_NOTIFICATION_CLEAR, priv->clear_btn);
evas_object_show(priv->clear_btn);
inputmgr_add_callback(priv->clear_btn, 0, &clear_handler, NULL);
+ inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, NULL);
priv->grid_class = elm_gengrid_item_class_new();
priv->grid_class->item_style = STYLE_GRID_ITEM;
return;
}
+ elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
+
priv = (struct _priv *) view_data;
evas_object_show(priv->base);
if (priv->category[i]) {
inputmgr_remove_callback(priv->category[i]->title,
&category_handler);
+ inputmgr_remove_callback(priv->category[i]->title,
+ &focus_handler);
inputmgr_remove_callback(priv->category[i]->grid,
&category_handler);
+ inputmgr_remove_callback(priv->category[i]->grid,
+ &focus_handler);
free(priv->category[i]);
}
}
free(priv);
}
+static void _update(void *view_data, int type, void *data)
+{
+ struct _priv *priv;
+ notification_h noti;
+
+ if (!view_data) {
+ _ERR("failed to get view data");
+ return;
+ }
+
+ priv = view_data;
+
+ switch (type) {
+ case UPDATE_TYPE_SHOW_POPUP:
+ noti = data;
+
+ if (!noti)
+ return;
+
+ util_show_notification_popup(priv->base, noti);
+ break;
+ }
+}
+
static view_class vclass = {
.view_id = NOTIFICATION_VIEW,
.create = _create,
.show = _show,
.hide = _hide,
.destroy = _destroy,
+ .update = _update,
};
static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
priv->category[id]->title, ELM_FOCUS_DOWN);
}
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Mouse_Move *ev)
+{
+ Elm_Object_Item *it;
+
+ switch (id) {
+ case OBJ_GRID:
+ it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+ ev->cur.canvas.y, NULL, NULL);
+
+ if (!it)
+ return;
+
+ if (!elm_object_item_focus_get(it))
+ elm_object_item_focus_set(it, EINA_TRUE);
+ break;
+ case OBJ_CLEAR:
+ case OBJ_TITLE:
+ elm_object_focus_set(obj, EINA_TRUE);
+ break;
+ }
+}
+
view_class *notification_view_get_vclass(void)
{
return &vclass;