static const char *widtype = NULL;
-static void _freeze_on(void *data __UNUSED__, Evas_Object *obj,
+static void _freeze_on(void *data __UNUSED__,
+ Evas_Object *obj,
void *event_info __UNUSED__);
static void _freeze_off(void *data __UNUSED__, Evas_Object *obj,
void *event_info __UNUSED__);
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
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;
arrow = 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;
arrow = 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);
arrow = 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);
arrow = ELM_CTXPOPUP_DIRECTION_DOWN;
break;
edje_object_part_swallow(wd->base, "elm.swallow.arrow_right", wd->arrow);
if (base_size.h > 0)
- {
+ {
if (y < (arrow_size.h * 0.5) + base_size.y)
y = 0;
else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5)))
else y = y - base_size.y - (arrow_size.h * 0.5);
edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_right", 0,
(double) (y) / (double) (base_size.h - arrow_size.h));
- }
+ }
break;
case ELM_CTXPOPUP_DIRECTION_DOWN:
edje_object_signal_emit(wd->arrow, "elm,state,top", "elm");
edje_object_part_swallow(wd->base, "elm.swallow.arrow_up", wd->arrow);
if (base_size.w > 0)
{
- if (x < (arrow_size.w * 0.5) + base_size.x)
+ if (x < ((arrow_size.w * 0.5) + base_size.x))
x = 0;
else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
x = base_size.w - arrow_size.w;
else
x = x - base_size.x - (arrow_size.w * 0.5);
- edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_up",
- (double) (x) / (double) (base_size.w - arrow_size.w), 1);
+ edje_object_part_drag_value_set(wd->base,
+ "elm.swallow.arrow_up",
+ (double) (x) / (double) (base_size.w - arrow_size.w),
+ 1);
}
break;
case ELM_CTXPOPUP_DIRECTION_UP:
edje_object_part_swallow(wd->base, "elm.swallow.arrow_down", wd->arrow);
if (base_size.w > 0)
{
- if (x < (arrow_size.w * 0.5) + base_size.x)
+ if (x < ((arrow_size.w * 0.5) + base_size.x))
x = 0;
else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
x = base_size.w - arrow_size.w;
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;
}
}
//TODO: compress item - different from opensource
if (!wd->horizontal && !wd->content)
- _compress_item(obj);
+ _compress_item(obj);
_update_arrow(obj, wd->dir);
_shift_base_by_arrow(wd->arrow, wd->dir, &rect);
//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));
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");
/*
* For separator, if the first item has visible separator,
if (wd->scr)
{
- if (!strncmp(elm_object_style_get(obj), "default",
- strlen("default")))
- elm_object_style_set(wd->scr, "ctxpopup");
+ if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
+ elm_object_style_set(wd->scr, "ctxpopup");
else
- elm_object_style_set(wd->scr, elm_object_style_get(obj));
+ elm_object_style_set(wd->scr, elm_object_style_get(obj));
}
if (wd->visible)
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);
}
wd->items = NULL;
}
-/**
- * Add a new Ctxpopup object to the parent.
- *
- * @param parent Parent object
- * @return New object or @c NULL, if it cannot be created
- *
- * @ingroup Ctxpopup
- */
EAPI Evas_Object *
elm_ctxpopup_add(Evas_Object *parent)
{
return obj;
}
-/**
- * Get the icon object for the given ctxpopup item.
- *
- * @param item Ctxpopup item
- * @return icon object or @c NULL, if the item does not have icon or an error occurred
- *
- * @ingroup Ctxpopup
- */
EAPI Evas_Object *
elm_ctxpopup_item_icon_get(const Elm_Object_Item *it)
{
return item->icon;
}
-/**
- * Sets the side icon associated with the ctxpopup item
- *
- * Once the icon object is set, a previously set one will be deleted.
- * You probably don't want, then, to have the <b>same</b> icon object
- * set for more than one item of the list (when replacing one of its
- * instances).
- *
- * @param item Ctxpopup item
- * @param icon Icon object to be set
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_item_icon_set(Elm_Object_Item *it, Evas_Object *icon)
{
}
}
-/**
- * Get the label object for the given ctxpopup item.
- *
- * @param item Ctxpopup item
- * @return label object or @c NULL, if the item does not have label or an error occured
- *
- * @ingroup Ctxpopup
- *
- */
EAPI const char *
elm_ctxpopup_item_label_get(const Elm_Object_Item *it)
{
return item->label;
}
-/**
- * (Re)set the label on the given ctxpopup item.
- *
- * @param item Ctxpopup item
- * @param label String to set as label
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_item_label_set(Elm_Object_Item *it, const char *label)
{
}
}
-/**
- * Set the Ctxpopup's parent
- * Set the parent object (it would much probably be the
- * window that the ctxpopup is in).
- *
- * @param obj The ctxpopup object
- * @param area The parent to use
- *
- * @note elm_ctxpopup_add() will automatically call this function
- * with its @c parent argument.
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *hover_parent)
{
wd->hover_parent = hover_parent;
}
-/**
- * Get the Ctxpopup's parent
- *
- * @param obj The ctxpopup object
- *
- * @see elm_ctxpopup_hover_parent_set() for more information
- *
- * @ingroup Ctxpopup
- */
EAPI Evas_Object *
elm_ctxpopup_hover_parent_get(const Evas_Object *obj)
{
return wd->hover_parent;
}
-/**
- * Clear all items in the given ctxpopup object.
- *
- * @param obj Ctxpopup object
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_clear(Evas_Object * obj)
{
_list_del(wd);
}
-/**
- * Change the ctxpopup's orientation to horizontal or vertical.
- *
- * @param obj Ctxpopup object
- * @param horizontal @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
{
EINA_LIST_FOREACH(wd->items, elist, item)
{
if (idx++ == 0)
- edje_object_signal_emit(item->base.view, "elm,state,default", "elm");
+ edje_object_signal_emit(item->base.view, "elm,state,default", "elm");
else
- edje_object_signal_emit(item->base.view, "elm,state,vertical", "elm");
+ edje_object_signal_emit(item->base.view, "elm,state,vertical", "elm");
}
}
else
EINA_LIST_FOREACH(wd->items, elist, item)
{
if (idx++ == 0)
- edje_object_signal_emit(item->base.view, "elm,state,default", "elm");
+ edje_object_signal_emit(item->base.view, "elm,state,default", "elm");
else
- edje_object_signal_emit(item->base.view, "elm,state,horizontal", "elm");
+ edje_object_signal_emit(item->base.view, "elm,state,horizontal", "elm");
}
}
_sizing_eval(obj);
}
-/**
- * Get the value of current ctxpopup object's orientation.
- *
- * @param obj Ctxpopup object
- * @return @c EINA_TRUE for horizontal mode, @c EINA_FALSE for vertical mode (or errors)
- *
- * @ingroup Ctxpopup
- */
EAPI Eina_Bool
elm_ctxpopup_horizontal_get(const Evas_Object *obj)
{
return wd->horizontal;
}
-/**
- * Add a new item to a ctxpopup object.
- *
- * Both a item list and a content could not be set at the same time!
- * once you set add a item, the previous content will be removed.
- *
- * @param obj Ctxpopup object
- * @param icon Icon to be set on new item
- * @param label The Label of the new item
- * @param func Convenience function called when item selected
- * @param data Data passed to @p func above
- * @return A handle to the item added or @c NULL, on errors
- *
- * @ingroup Ctxpopup
- */
EAPI Elm_Object_Item *
elm_ctxpopup_item_append(Evas_Object *obj, const char *label,
Evas_Object *icon, Evas_Smart_Cb func,
//The first item is appended.
if (wd->content)
- evas_object_del(elm_ctxpopup_content_unset(obj));
+ evas_object_del(elm_ctxpopup_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);
return (Elm_Object_Item*) item;
}
-/**
- * Delete the given item in a ctxpopup object.
- *
- * @param item Ctxpopup item to be deleted
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_item_del(Elm_Object_Item *it)
{
if (!wd) return;
if (item->icon)
- evas_object_del(item->icon);
+ evas_object_del(item->icon);
if (item->base.view)
- evas_object_del(item->base.view);
+ evas_object_del(item->base.view);
eina_stringshare_del(item->label);
wd->items = eina_list_remove(wd->items, item);
if (eina_list_count(wd->items) < 1)
- wd->items = NULL;
+ wd->items = NULL;
if (wd->visible)
- _sizing_eval(item->base.widget);
+ _sizing_eval(item->base.widget);
free(item);
}
-/**
- * Set the ctxpopup item's state as disabled or enabled.
- *
- * @param item Ctxpopup item to be enabled/disabled
- * @param disabled @c EINA_TRUE to disable it, @c EINA_FALSE to enable it
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
{
if (!wd) return;
if (disabled == item->disabled)
- return;
+ return;
if (disabled)
- edje_object_signal_emit(item->base.view, "elm,state,disabled", "elm");
+ edje_object_signal_emit(item->base.view, "elm,state,disabled", "elm");
else
- edje_object_signal_emit(item->base.view, "elm,state,enabled", "elm");
+ edje_object_signal_emit(item->base.view, "elm,state,enabled", "elm");
item->disabled = !!disabled;
}
-/**
- * Get the ctxpopup item's disabled/enabled state.
- *
- * @param item Ctxpopup item to be enabled/disabled
- * @return disabled @c EINA_TRUE, if disabled, @c EINA_FALSE otherwise
- *
- * @ingroup Ctxpopup
- */
EAPI Eina_Bool
elm_ctxpopup_item_disabled_get(const Elm_Object_Item *it)
{
return item->disabled;
}
-/**
- * Once the content object is set, a previously set one will be deleted.
- * If you want to keep that old content object, use the
- * elm_ctxpopup_content_unset() function
- *
- * Both a item list and a content could not be set at the same time!
- * once you set a content, the previous list items will be removed.
- *
- * @param obj Ctxpopup object
- * @param content Content to be swallowed
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content)
{
wd = elm_widget_data_get(obj);
if ((!wd) || (!content))
- return;
+ return;
if (wd->items)
- elm_ctxpopup_clear(obj);
+ elm_ctxpopup_clear(obj);
if (wd->content)
- evas_object_del(wd->content);
+ evas_object_del(wd->content);
evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _content_del,
obj);
wd->content = content;
if (wd->visible)
- _sizing_eval(obj);
+ _sizing_eval(obj);
}
-/**
- * Unset the ctxpopup content
- *
- * Unparent and return the content object which was set for this widget
- *
- * @param obj Ctxpopup object
- * @return The content that was being used
- *
- * @ingroup Ctxpopup
- */
EAPI Evas_Object *
elm_ctxpopup_content_unset(Evas_Object *obj)
{
return content;
}
-/**
- * Set the direction priority of a ctxpopup.
- * This functions gives a chance to user to set the priority of ctxpopup showing direction.
- *
- * @param obj Ctxpopup object
- * @param first 1st priority of direction
- * @param second 2nd priority of direction
- * @param third 3th priority of direction
- * @param fourth 4th priority of direction
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_direction_priority_set(Evas_Object *obj,
Elm_Ctxpopup_Direction first,
_sizing_eval(obj);
}
-/**
- * Get the direction priority of a ctxpopup.
- *
- * @param obj Ctxpopup object
- * @param first 1st priority of direction to be returned
- * @param second 2nd priority of direction to be returned
- * @param third 3th priority of direction to be returned
- * @param fourth 4th priority of direction to be returned
- *
- * @see elm_ctxpopup_direction_priority_set for more information.
- *
- * @ingroup Ctxpopup
- */
EAPI void
elm_ctxpopup_direction_priority_get(Evas_Object *obj,
Elm_Ctxpopup_Direction *first,
if (fourth) *fourth = wd->dir_priority[3];
}
-/**
- * @brief Get the current direction of a ctxpopup.
- *
- * @param obj Ctxpopup object
- * @return current direction of a ctxpopup
- *
- * @warning Once the ctxpopup showed up, the direction would be determined
- */
-
EAPI Elm_Ctxpopup_Direction
elm_ctxpopup_direction_get(const Evas_Object *obj)
{