#include "elm_priv.h"
typedef struct _Widget_Data Widget_Data;
+typedef struct _Elm_Ctxpopup_Item Elm_Ctxpopup_Item;
struct _Elm_Ctxpopup_Item
{
Widget_Data *wd = elm_widget_data_get(obj);
if ((!wd) || (!wd->hover_parent))
- return;
+ return;
evas_object_event_callback_del_full(wd->hover_parent, EVAS_CALLBACK_DEL,
_hover_parent_del, obj);
pos->x -= (base_size->x / 2);
if (pos->x < hover_area->x)
- pos->x = hover_area->x;
+ pos->x = hover_area->x;
else if ((pos->x + base_size->x) > (hover_area->x + hover_area->w))
- pos->x = (hover_area->x + hover_area->w) - base_size->x;
+ pos->x = (hover_area->x + hover_area->w) - base_size->x;
if (base_size->x > hover_area->w)
- base_size->x -= (base_size->x - hover_area->w);
+ base_size->x -= (base_size->x - hover_area->w);
if (pos->x < hover_area->x)
- pos->x = hover_area->x;
+ pos->x = hover_area->x;
}
static void
pos->y -= (base_size->y / 2);
if (pos->y < hover_area->y)
- pos->y = hover_area->y;
+ pos->y = hover_area->y;
else if ((pos->y + base_size->y) > (hover_area->y + hover_area->h))
- pos->y = hover_area->y + hover_area->h - base_size->y;
+ pos->y = hover_area->y + hover_area->h - base_size->y;
if (base_size->y > hover_area->h)
- base_size->y -= (base_size->y - hover_area->h);
+ base_size->y -= (base_size->y - hover_area->h);
if (pos->y < hover_area->y)
- pos->y = hover_area->y;
+ pos->y = hover_area->y;
}
static void
if (!wd) return;
if (wd->visible)
- _sizing_eval(obj);
+ _sizing_eval(obj);
}
static Elm_Ctxpopup_Direction
wd = elm_widget_data_get(obj);
if ((!wd) || (!rect))
- return ELM_CTXPOPUP_DIRECTION_DOWN;
+ return ELM_CTXPOPUP_DIRECTION_DOWN;
edje_object_part_geometry_get(wd->arrow, "ctxpopup_arrow", NULL, NULL,
&arrow_size.x, &arrow_size.y);
//Initialize Area Rectangle.
if (wd->hover_parent)
- evas_object_geometry_get(wd->hover_parent, &hover_area.x, &hover_area.y,
- &hover_area.w, &hover_area.h);
+ evas_object_geometry_get(wd->hover_parent, &hover_area.x, &hover_area.y,
+ &hover_area.w, &hover_area.h);
else
{
evas_object_geometry_get(wd->parent, &parent_size.x, &parent_size.y,
evas_object_size_hint_max_get(obj, &max_size.x, &max_size.y);
if ((max_size.y > 0) && (base_size.y > max_size.y))
- base_size.y = max_size.y;
+ base_size.y = max_size.y;
if ((max_size.x > 0) && (base_size.x > max_size.x))
- base_size.x = max_size.x;
+ base_size.x = max_size.x;
//Limit to Min Size
evas_object_size_hint_min_get(obj, &min_size.x, &min_size.y);
if ((min_size.y > 0) && (base_size.y < min_size.y))
- base_size.y = min_size.y;
+ base_size.y = min_size.y;
if ((min_size.x > 0) && (base_size.x < min_size.x))
- base_size.x = min_size.x;
+ base_size.x = min_size.x;
//Check the Which direction is available.
//If find a avaialble direction, it adjusts position and size.
case ELM_CTXPOPUP_DIRECTION_UP:
temp.y = (pos.y - base_size.y);
if ((temp.y - arrow_size.y) < hover_area.y)
- continue;
+ continue;
_adjust_pos_x(&pos, &base_size, &hover_area);
pos.y -= base_size.y;
dir = ELM_CTXPOPUP_DIRECTION_UP;
case ELM_CTXPOPUP_DIRECTION_LEFT:
temp.x = (pos.x - base_size.x);
if ((temp.x - arrow_size.x) < hover_area.x)
- continue;
+ continue;
_adjust_pos_y(&pos, &base_size, &hover_area);
pos.x -= base_size.x;
dir = ELM_CTXPOPUP_DIRECTION_LEFT;
temp.x = (pos.x + base_size.x);
if ((temp.x + arrow_size.x) >
(hover_area.x + hover_area.w))
- continue;
+ continue;
_adjust_pos_y(&pos, &base_size, &hover_area);
dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
break;
temp.y = (pos.y + base_size.y);
if ((temp.y + arrow_size.y) >
(hover_area.y + hover_area.h))
- continue;
+ continue;
_adjust_pos_x(&pos, &base_size, &hover_area);
dir = ELM_CTXPOPUP_DIRECTION_DOWN;
break;
dir = ELM_CTXPOPUP_DIRECTION_UP;
if (pos.y < (hover_area.y + arrow_size.y))
{
- base_size.y -= ((hover_area.y + arrow_size.y) - pos.y);
- pos.y = hover_area.y + arrow_size.y;
+ base_size.y -= ((hover_area.y + arrow_size.y) - pos.y);
+ pos.y = hover_area.y + arrow_size.y;
}
}
//ELM_CTXPOPUP_DIRECTION_DOWN
if (!wd->horizontal)
{
if (_box_size.x > box_size.x)
- box_size.x = _box_size.x;
+ box_size.x = _box_size.x;
if (_box_size.y != -1)
- box_size.y += _box_size.y;
+ box_size.y += _box_size.y;
}
else
{
if (_box_size.x != -1)
- box_size.x += _box_size.x;
+ box_size.x += _box_size.x;
if (_box_size.y > box_size.y)
- box_size.y = _box_size.y;
+ box_size.y = _box_size.y;
}
}
//resize scroller according to final size.
if (!wd->content)
- evas_object_smart_calculate(wd->scr);
+ evas_object_smart_calculate(wd->scr);
evas_object_move(wd->base, rect.x, rect.y);
evas_object_resize(wd->base, rect.w, rect.h);
EINA_LIST_FOREACH(wd->items, elist, item)
{
if (item->label && item->icon)
- _elm_theme_object_set(obj, item->base.view, "ctxpopup",
- "icon_text_style_item",
- elm_widget_style_get(obj));
+ _elm_theme_object_set(obj, item->base.view, "ctxpopup",
+ "icon_text_style_item",
+ elm_widget_style_get(obj));
else if (item->label)
- _elm_theme_object_set(obj, item->base.view, "ctxpopup", "text_style_item",
- elm_widget_style_get(obj));
+ _elm_theme_object_set(obj, item->base.view, "ctxpopup", "text_style_item",
+ elm_widget_style_get(obj));
else if (item->icon)
- _elm_theme_object_set(obj, item->base.view, "ctxpopup", "icon_style_item",
- elm_widget_style_get(obj));
+ _elm_theme_object_set(obj, item->base.view, "ctxpopup", "icon_style_item",
+ elm_widget_style_get(obj));
if (item->label)
- edje_object_part_text_set(item->base.view, "elm.text", item->label);
+ edje_object_part_text_set(item->base.view, "elm.text", item->label);
if (item->disabled)
- edje_object_signal_emit(item->base.view, "elm,state,disabled", "elm");
+ edje_object_signal_emit(item->base.view, "elm,state,disabled", "elm");
edje_object_message_signal_process(item->base.view);
}
wd->content = content;
if (wd->visible)
- _sizing_eval(obj);
+ _sizing_eval(obj);
}
static Evas_Object *
wd = elm_widget_data_get(obj);
if ((!wd) || (!wd->visible))
- return;
+ return;
_hide(obj);
}
}
if (wd->max_sc_w < w)
- wd->max_sc_w = w;
+ wd->max_sc_w = w;
if (wd->max_sc_h < h)
- wd->max_sc_h = h;
+ wd->max_sc_h = h;
_sizing_eval(data);
}
if (!wd) return;
if (wd->visible)
- evas_object_show(wd->arrow);
+ evas_object_show(wd->arrow);
_scroller_size_reset(wd);
_sizing_eval(obj);
if (item->disabled) return;
if (item->func)
- item->func((void*) item->base.data, item->base.widget, data);
+ item->func((void*) item->base.data, item->base.widget, data);
}
static void
_item_label_set(Elm_Ctxpopup_Item *item, const char *label)
{
if (!eina_stringshare_replace(&item->label, label))
- return;
+ return;
edje_object_part_text_set(item->base.view, "elm.text", label);
edje_object_message_signal_process(item->base.view);
EINA_LIST_FOREACH(wd->items, elist, item)
{
if (item->label)
- eina_stringshare_del(item->label);
+ eina_stringshare_del(item->label);
if (item->icon)
- evas_object_del(item->icon);
+ evas_object_del(item->icon);
wd->items = eina_list_remove(wd->items, item);
free(item);
}
//The first item is appended.
if (wd->content)
- evas_object_del(elm_object_content_unset(obj));
+ evas_object_del(elm_object_content_unset(obj));
if (!wd->items)
- _list_new(obj);
+ _list_new(obj);
item->func = func;
item->base.data = data;
if (icon && label)
- _item_new(item, "icon_text_style_item");
+ _item_new(item, "icon_text_style_item");
else if (label)
- _item_new(item, "text_style_item");
+ _item_new(item, "text_style_item");
else
- _item_new(item, "icon_style_item");
+ _item_new(item, "icon_style_item");
_item_icon_set(item, icon);
_item_label_set(item, label);
if (ctxpopup_it->icon)
evas_object_del(ctxpopup_it->icon);
if (ctxpopup_it->base.view)
- evas_object_del(ctxpopup_it->base.view);
+ evas_object_del(ctxpopup_it->base.view);
eina_stringshare_del(ctxpopup_it->label);
wd->items = eina_list_remove(wd->items, ctxpopup_it);
if (eina_list_count(wd->items) < 1)
- wd->items = NULL;
+ wd->items = NULL;
if (wd->visible)
- _sizing_eval(ctxpopup_it->base.widget);
+ _sizing_eval(ctxpopup_it->base.widget);
free(ctxpopup_it);
}
ctxpopup_it = ELM_CAST(it);
if (disabled == ctxpopup_it->disabled)
- return;
+ return;
if (disabled)
- edje_object_signal_emit(ctxpopup_it->base.view, "elm,state,disabled", "elm");
+ edje_object_signal_emit(ctxpopup_it->base.view, "elm,state,disabled", "elm");
else
- edje_object_signal_emit(ctxpopup_it->base.view, "elm,state,enabled", "elm");
+ edje_object_signal_emit(ctxpopup_it->base.view, "elm,state,enabled", "elm");
ctxpopup_it->disabled = !!disabled;
}
wd->dir_priority[3] = fourth;
if (wd->visible)
- _sizing_eval(obj);
+ _sizing_eval(obj);
}
EAPI void