2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
#define ELM_WIDGET_ITEM_PROTECTED
|
2010-10-19 13:21:53 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2010-10-19 13:21:53 -07:00
|
|
|
#include "elm_priv.h"
|
2012-08-30 09:45:51 -07:00
|
|
|
#include "elm_widget_ctxpopup.h"
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_CTXPOPUP_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Ctxpopup"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_ctxpopup"
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
EAPI const char ELM_CTXPOPUP_SMART_NAME[] = "elm_ctxpopup";
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2013-09-02 16:39:02 -07:00
|
|
|
#define ELM_PRIV_CTXPOPUP_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_DISMISSED, "dismissed", "") \
|
|
|
|
|
|
|
|
ELM_PRIV_CTXPOPUP_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
2013-02-11 22:58:05 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2013-09-02 16:39:02 -07:00
|
|
|
ELM_PRIV_CTXPOPUP_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
|
2014-01-23 02:30:34 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2010-12-08 08:18:30 -08:00
|
|
|
{NULL, NULL}
|
2010-10-19 13:21:53 -07:00
|
|
|
};
|
2013-10-18 10:20:34 -07:00
|
|
|
#undef ELM_PRIV_CTXPOPUP_SIGNALS
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2014-04-16 23:41:50 -07:00
|
|
|
static Eina_Bool _key_action_move(Evas_Object *obj, const char *params);
|
|
|
|
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params);
|
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"move", _key_action_move},
|
|
|
|
{"escape", _key_action_escape},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_translate(Eo *obj, Elm_Ctxpopup_Data *sd)
|
2013-02-11 22:58:05 -08:00
|
|
|
{
|
2013-04-23 04:30:15 -07:00
|
|
|
Eina_List *l;
|
2014-09-27 22:14:47 -07:00
|
|
|
Elm_Object_Item *it;
|
2013-04-23 04:30:15 -07:00
|
|
|
|
2014-02-09 01:11:47 -08:00
|
|
|
if (sd->auto_hide) evas_object_hide(obj);
|
2013-02-11 22:58:05 -08:00
|
|
|
|
2013-04-23 04:30:15 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, it)
|
2014-08-19 00:52:24 -07:00
|
|
|
eo_do(it, elm_wdg_item_translate());
|
2013-04-23 04:30:15 -07:00
|
|
|
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, elm_obj_widget_translate());
|
2014-01-23 03:20:43 -08:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
2013-02-11 22:58:05 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *_pd EINA_UNUSED)
|
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] ctxpopup, focus-chain
i'd like to raise an issue about focus chain on the ctxpopup. the focus
would go around only in the ctxpopup. (IMHO, raster keep the previous
popup
patch. so definitely!!)
but.. first of all, current ctxpopup does not have focus_next(). even
though there is focus_next(), it is not work properly,
because the parent of ctxpopup would be a widget which does not take
care
of sub objects in the focus_next(); such as elm_list.
(every widget can be a parent of ctxpopup, if the widget is enough
size to
display ctxpopup. thus the elm_list can be a parent of ctxpopup also).
anyhow, to resolve this issue, the patch uses event() of
elm_widget_event_hook_set().
the ctxpopup item is equal to the elm_list item. but the focus chain of
elm_list does not work properly.
generally, we use 'Tab' key to move focus, but elm_list uses the
(up,down)
arrow key moreover it is not a focus.
if you want to check this patch, it would be better to use
ELM_ACCESS_MODE=1.
SVN revision: 74650
2012-07-31 05:30:48 -07:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_focus_next(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd, Elm_Focus_Direction dir, Evas_Object **next)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd)
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_FALSE;
|
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] ctxpopup, focus-chain
i'd like to raise an issue about focus chain on the ctxpopup. the focus
would go around only in the ctxpopup. (IMHO, raster keep the previous
popup
patch. so definitely!!)
but.. first of all, current ctxpopup does not have focus_next(). even
though there is focus_next(), it is not work properly,
because the parent of ctxpopup would be a widget which does not take
care
of sub objects in the focus_next(); such as elm_list.
(every widget can be a parent of ctxpopup, if the widget is enough
size to
display ctxpopup. thus the elm_list can be a parent of ctxpopup also).
anyhow, to resolve this issue, the patch uses event() of
elm_widget_event_hook_set().
the ctxpopup item is equal to the elm_list item. but the focus chain of
elm_list does not work properly.
generally, we use 'Tab' key to move focus, but elm_list uses the
(up,down)
arrow key moreover it is not a focus.
if you want to check this patch, it would be better to use
ELM_ACCESS_MODE=1.
SVN revision: 74650
2012-07-31 05:30:48 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!elm_widget_focus_next_get(sd->box, dir, next))
|
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] ctxpopup, focus-chain
i'd like to raise an issue about focus chain on the ctxpopup. the focus
would go around only in the ctxpopup. (IMHO, raster keep the previous
popup
patch. so definitely!!)
but.. first of all, current ctxpopup does not have focus_next(). even
though there is focus_next(), it is not work properly,
because the parent of ctxpopup would be a widget which does not take
care
of sub objects in the focus_next(); such as elm_list.
(every widget can be a parent of ctxpopup, if the widget is enough
size to
display ctxpopup. thus the elm_list can be a parent of ctxpopup also).
anyhow, to resolve this issue, the patch uses event() of
elm_widget_event_hook_set().
the ctxpopup item is equal to the elm_list item. but the focus chain of
elm_list does not work properly.
generally, we use 'Tab' key to move focus, but elm_list uses the
(up,down)
arrow key moreover it is not a focus.
if you want to check this patch, it would be better to use
ELM_ACCESS_MODE=1.
SVN revision: 74650
2012-07-31 05:30:48 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_widget_focused_object_clear(sd->box);
|
|
|
|
elm_widget_focus_next_get(sd->box, dir, next);
|
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] ctxpopup, focus-chain
i'd like to raise an issue about focus chain on the ctxpopup. the focus
would go around only in the ctxpopup. (IMHO, raster keep the previous
popup
patch. so definitely!!)
but.. first of all, current ctxpopup does not have focus_next(). even
though there is focus_next(), it is not work properly,
because the parent of ctxpopup would be a widget which does not take
care
of sub objects in the focus_next(); such as elm_list.
(every widget can be a parent of ctxpopup, if the widget is enough
size to
display ctxpopup. thus the elm_list can be a parent of ctxpopup also).
anyhow, to resolve this issue, the patch uses event() of
elm_widget_event_hook_set().
the ctxpopup item is equal to the elm_list item. but the focus chain of
elm_list does not work properly.
generally, we use 'Tab' key to move focus, but elm_list uses the
(up,down)
arrow key moreover it is not a focus.
if you want to check this patch, it would be better to use
ELM_ACCESS_MODE=1.
SVN revision: 74650
2012-07-31 05:30:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] ctxpopup, focus-chain
i'd like to raise an issue about focus chain on the ctxpopup. the focus
would go around only in the ctxpopup. (IMHO, raster keep the previous
popup
patch. so definitely!!)
but.. first of all, current ctxpopup does not have focus_next(). even
though there is focus_next(), it is not work properly,
because the parent of ctxpopup would be a widget which does not take
care
of sub objects in the focus_next(); such as elm_list.
(every widget can be a parent of ctxpopup, if the widget is enough
size to
display ctxpopup. thus the elm_list can be a parent of ctxpopup also).
anyhow, to resolve this issue, the patch uses event() of
elm_widget_event_hook_set().
the ctxpopup item is equal to the elm_list item. but the focus chain of
elm_list does not work properly.
generally, we use 'Tab' key to move focus, but elm_list uses the
(up,down)
arrow key moreover it is not a focus.
if you want to check this patch, it would be better to use
ELM_ACCESS_MODE=1.
SVN revision: 74650
2012-07-31 05:30:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd, const Evas_Object *base, double degree, Evas_Object **direction, double *weight)
|
2013-04-09 06:24:53 -07:00
|
|
|
{
|
|
|
|
Eina_Bool int_ret;
|
|
|
|
|
|
|
|
Eina_List *l = NULL;
|
|
|
|
void *(*list_data_get)(const Eina_List *list);
|
|
|
|
|
|
|
|
if (!sd)
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_FALSE;
|
2013-04-09 06:24:53 -07:00
|
|
|
|
|
|
|
list_data_get = eina_list_data_get;
|
|
|
|
|
|
|
|
l = eina_list_append(l, sd->box);
|
|
|
|
|
|
|
|
int_ret = elm_widget_focus_list_direction_get
|
|
|
|
(obj, base, l, list_data_get, degree, direction, weight);
|
|
|
|
eina_list_free(l);
|
2014-03-20 06:06:33 -07:00
|
|
|
|
|
|
|
return int_ret;
|
2013-04-09 06:24:53 -07:00
|
|
|
}
|
|
|
|
|
2014-04-16 23:41:50 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_move(Evas_Object *obj, const char *params)
|
|
|
|
{
|
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
|
|
|
const char *dir = params;
|
|
|
|
|
|
|
|
if (!sd->box) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (!strcmp(dir, "previous"))
|
|
|
|
elm_widget_focus_cycle(sd->box, ELM_FOCUS_PREVIOUS);
|
|
|
|
else if (!strcmp(dir, "next"))
|
|
|
|
elm_widget_focus_cycle(sd->box, ELM_FOCUS_NEXT);
|
|
|
|
else if (!strcmp(dir, "left"))
|
|
|
|
elm_widget_focus_cycle(sd->box, ELM_FOCUS_LEFT);
|
|
|
|
else if (!strcmp(dir, "right"))
|
|
|
|
elm_widget_focus_cycle(sd->box, ELM_FOCUS_RIGHT);
|
|
|
|
else if (!strcmp(dir, "up"))
|
|
|
|
elm_widget_focus_cycle(sd->box, ELM_FOCUS_UP);
|
|
|
|
else if (!strcmp(dir, "down"))
|
|
|
|
elm_widget_focus_cycle(sd->box, ELM_FOCUS_DOWN);
|
|
|
|
else return EINA_FALSE;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
2014-04-16 23:51:37 -07:00
|
|
|
elm_ctxpopup_dismiss(obj);
|
2014-04-16 23:41:50 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_event(Eo *obj, Elm_Ctxpopup_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
2011-08-27 19:38:48 -07:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
2013-10-28 07:06:14 -07:00
|
|
|
(void)src;
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
From: Kim Shinwoo <kimcinoo.efl@gmail.com>
Subject: [E-devel] [patch][elementary] ctxpopup, focus-chain
i'd like to raise an issue about focus chain on the ctxpopup. the focus
would go around only in the ctxpopup. (IMHO, raster keep the previous
popup
patch. so definitely!!)
but.. first of all, current ctxpopup does not have focus_next(). even
though there is focus_next(), it is not work properly,
because the parent of ctxpopup would be a widget which does not take
care
of sub objects in the focus_next(); such as elm_list.
(every widget can be a parent of ctxpopup, if the widget is enough
size to
display ctxpopup. thus the elm_list can be a parent of ctxpopup also).
anyhow, to resolve this issue, the patch uses event() of
elm_widget_event_hook_set().
the ctxpopup item is equal to the elm_list item. but the focus chain of
elm_list does not work properly.
generally, we use 'Tab' key to move focus, but elm_list uses the
(up,down)
arrow key moreover it is not a focus.
if you want to check this patch, it would be better to use
ELM_ACCESS_MODE=1.
SVN revision: 74650
2012-07-31 05:30:48 -07:00
|
|
|
|
2014-04-16 23:41:50 -07:00
|
|
|
if (!_elm_config_key_binding_call(obj, ev, key_actions))
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_FALSE;
|
2011-08-27 19:38:48 -07:00
|
|
|
|
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
2011-08-27 19:38:48 -07:00
|
|
|
}
|
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_x_pos_adjust(Evas_Coord_Point *pos,
|
|
|
|
Evas_Coord_Point *base_size,
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
Evas_Coord_Rectangle *hover_area)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
pos->x -= (base_size->x / 2);
|
|
|
|
|
|
|
|
if (pos->x < hover_area->x)
|
2011-08-13 20:47:51 -07:00
|
|
|
pos->x = hover_area->x;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
else if ((pos->x + base_size->x) > (hover_area->x + hover_area->w))
|
2011-08-13 20:47:51 -07:00
|
|
|
pos->x = (hover_area->x + hover_area->w) - base_size->x;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
if (base_size->x > hover_area->w)
|
2011-08-13 20:47:51 -07:00
|
|
|
base_size->x -= (base_size->x - hover_area->w);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
if (pos->x < hover_area->x)
|
2011-08-13 20:47:51 -07:00
|
|
|
pos->x = hover_area->x;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_y_pos_adjust(Evas_Coord_Point *pos,
|
|
|
|
Evas_Coord_Point *base_size,
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
Evas_Coord_Rectangle *hover_area)
|
|
|
|
{
|
|
|
|
pos->y -= (base_size->y / 2);
|
|
|
|
|
|
|
|
if (pos->y < hover_area->y)
|
2011-08-13 20:47:51 -07:00
|
|
|
pos->y = hover_area->y;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
else if ((pos->y + base_size->y) > (hover_area->y + hover_area->h))
|
2011-08-13 20:47:51 -07:00
|
|
|
pos->y = hover_area->y + hover_area->h - base_size->y;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
if (base_size->y > hover_area->h)
|
2011-08-13 20:47:51 -07:00
|
|
|
base_size->y -= (base_size->y - hover_area->h);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
if (pos->y < hover_area->y)
|
2011-08-13 20:47:51 -07:00
|
|
|
pos->y = hover_area->y;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Ctxpopup_Direction
|
2012-08-30 09:45:51 -07:00
|
|
|
_base_geometry_calc(Evas_Object *obj,
|
|
|
|
Evas_Coord_Rectangle *rect)
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
Elm_Ctxpopup_Direction dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
|
|
|
Evas_Coord_Rectangle hover_area;
|
2011-01-11 01:54:41 -08:00
|
|
|
Evas_Coord_Point pos = {0, 0};
|
2012-08-30 09:45:51 -07:00
|
|
|
Evas_Coord_Point arrow_size;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
Evas_Coord_Point base_size;
|
|
|
|
Evas_Coord_Point max_size;
|
|
|
|
Evas_Coord_Point min_size;
|
|
|
|
Evas_Coord_Point temp;
|
|
|
|
int idx;
|
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
2013-10-05 01:11:57 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ELM_CTXPOPUP_DIRECTION_DOWN);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2013-04-08 03:28:01 -07:00
|
|
|
if (!rect || !sd->parent) return ELM_CTXPOPUP_DIRECTION_DOWN;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2014-08-04 02:27:27 -07:00
|
|
|
edje_object_part_geometry_get(sd->arrow, "base", NULL, NULL,
|
|
|
|
&arrow_size.x, &arrow_size.y);
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_resize(sd->arrow, arrow_size.x, arrow_size.y);
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2011-03-23 19:17:34 -07:00
|
|
|
//Initialize Area Rectangle.
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_geometry_get
|
|
|
|
(sd->parent, &hover_area.x, &hover_area.y, &hover_area.w,
|
|
|
|
&hover_area.h);
|
2014-06-03 03:35:28 -07:00
|
|
|
if (sd->parent && eo_isa(sd->parent, ELM_WIN_CLASS))
|
2013-03-29 05:29:24 -07:00
|
|
|
hover_area.x = hover_area.y = 0;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &pos.x, &pos.y, NULL, NULL);
|
|
|
|
|
2011-03-23 19:17:34 -07:00
|
|
|
//recalc the edje
|
2012-08-30 09:45:51 -07:00
|
|
|
edje_object_size_min_calc
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, &base_size.x, &base_size.y);
|
|
|
|
evas_object_smart_calculate(wd->resize_obj);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
//Limit to Max Size
|
|
|
|
evas_object_size_hint_max_get(obj, &max_size.x, &max_size.y);
|
|
|
|
|
|
|
|
if ((max_size.y > 0) && (base_size.y > max_size.y))
|
2011-08-13 20:47:51 -07:00
|
|
|
base_size.y = max_size.y;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
if ((max_size.x > 0) && (base_size.x > max_size.x))
|
2011-08-13 20:47:51 -07:00
|
|
|
base_size.x = max_size.x;
|
2011-03-23 19:17:34 -07:00
|
|
|
//Limit to Min Size
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
evas_object_size_hint_min_get(obj, &min_size.x, &min_size.y);
|
|
|
|
|
|
|
|
if ((min_size.y > 0) && (base_size.y < min_size.y))
|
2011-08-13 20:47:51 -07:00
|
|
|
base_size.y = min_size.y;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
if ((min_size.x > 0) && (base_size.x < min_size.x))
|
2011-08-13 20:47:51 -07:00
|
|
|
base_size.x = min_size.x;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2014-01-21 22:17:45 -08:00
|
|
|
//Check available directions. If there is one, it adjusts ctxpopup's position
|
|
|
|
// and size.
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
for (idx = 0; idx < 4; idx++)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
switch (sd->dir_priority[idx])
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
{
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_UP:
|
2012-08-30 09:45:51 -07:00
|
|
|
temp.y = (pos.y - base_size.y);
|
|
|
|
if ((temp.y - arrow_size.y) < hover_area.y)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
_x_pos_adjust(&pos, &base_size, &hover_area);
|
|
|
|
pos.y -= base_size.y;
|
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_UP;
|
|
|
|
break;
|
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_LEFT:
|
2012-08-30 09:45:51 -07:00
|
|
|
temp.x = (pos.x - base_size.x);
|
|
|
|
if ((temp.x - arrow_size.x) < hover_area.x)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
_y_pos_adjust(&pos, &base_size, &hover_area);
|
|
|
|
pos.x -= base_size.x;
|
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_LEFT;
|
|
|
|
break;
|
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_RIGHT:
|
2012-08-30 09:45:51 -07:00
|
|
|
temp.x = (pos.x + base_size.x);
|
|
|
|
if ((temp.x + arrow_size.x) >
|
|
|
|
(hover_area.x + hover_area.w))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
_y_pos_adjust(&pos, &base_size, &hover_area);
|
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
|
|
|
|
break;
|
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_DOWN:
|
2012-08-30 09:45:51 -07:00
|
|
|
temp.y = (pos.y + base_size.y);
|
|
|
|
if ((temp.y + arrow_size.y) >
|
|
|
|
(hover_area.y + hover_area.h))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
_x_pos_adjust(&pos, &base_size, &hover_area);
|
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_DOWN;
|
|
|
|
break;
|
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
default:
|
2012-09-12 01:35:42 -07:00
|
|
|
continue;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
break;
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
//In this case, all directions are invalid because of lack of space.
|
|
|
|
if (idx == 4)
|
|
|
|
{
|
|
|
|
Evas_Coord length[2];
|
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->horizontal)
|
2011-08-12 22:40:16 -07:00
|
|
|
{
|
|
|
|
length[0] = pos.y - hover_area.y;
|
|
|
|
length[1] = (hover_area.y + hover_area.h) - pos.y;
|
|
|
|
|
2011-08-12 23:05:19 -07:00
|
|
|
// ELM_CTXPOPUP_DIRECTION_UP
|
2011-08-12 22:40:16 -07:00
|
|
|
if (length[0] > length[1])
|
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
_x_pos_adjust(&pos, &base_size, &hover_area);
|
2011-08-12 22:40:16 -07:00
|
|
|
pos.y -= base_size.y;
|
2011-08-12 23:05:19 -07:00
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_UP;
|
|
|
|
if (pos.y < (hover_area.y + arrow_size.y))
|
2011-08-12 22:40:16 -07:00
|
|
|
{
|
2011-08-13 20:47:51 -07:00
|
|
|
base_size.y -= ((hover_area.y + arrow_size.y) - pos.y);
|
|
|
|
pos.y = hover_area.y + arrow_size.y;
|
2011-08-12 22:40:16 -07:00
|
|
|
}
|
|
|
|
}
|
2011-08-12 23:05:19 -07:00
|
|
|
//ELM_CTXPOPUP_DIRECTION_DOWN
|
2011-08-12 22:40:16 -07:00
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
_x_pos_adjust(&pos, &base_size, &hover_area);
|
2011-08-12 23:05:19 -07:00
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_DOWN;
|
|
|
|
if ((pos.y + arrow_size.y + base_size.y) >
|
|
|
|
(hover_area.y + hover_area.h))
|
2012-08-30 09:45:51 -07:00
|
|
|
base_size.y -=
|
|
|
|
((pos.y + arrow_size.y + base_size.y) -
|
|
|
|
(hover_area.y + hover_area.h));
|
2011-08-12 22:40:16 -07:00
|
|
|
}
|
|
|
|
}
|
2011-04-25 21:31:23 -07:00
|
|
|
else
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
{
|
2011-08-12 22:40:16 -07:00
|
|
|
length[0] = pos.x - hover_area.x;
|
|
|
|
length[1] = (hover_area.x + hover_area.w) - pos.x;
|
2011-08-12 23:05:19 -07:00
|
|
|
|
|
|
|
//ELM_CTXPOPUP_DIRECTION_LEFT
|
2011-08-12 22:40:16 -07:00
|
|
|
if (length[0] > length[1])
|
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
_y_pos_adjust(&pos, &base_size, &hover_area);
|
2011-08-12 22:40:16 -07:00
|
|
|
pos.x -= base_size.x;
|
2011-08-12 23:05:19 -07:00
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_LEFT;
|
|
|
|
if (pos.x < (hover_area.x + arrow_size.x))
|
2011-08-12 22:40:16 -07:00
|
|
|
{
|
|
|
|
base_size.x -= ((hover_area.x + arrow_size.x) - pos.x);
|
|
|
|
pos.x = hover_area.x + arrow_size.x;
|
|
|
|
}
|
|
|
|
}
|
2011-08-12 23:05:19 -07:00
|
|
|
//ELM_CTXPOPUP_DIRECTION_RIGHT
|
2011-08-12 22:40:16 -07:00
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
_y_pos_adjust(&pos, &base_size, &hover_area);
|
2011-08-12 23:05:19 -07:00
|
|
|
dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
|
|
|
|
if (pos.x + (arrow_size.x + base_size.x) >
|
2011-08-12 22:40:16 -07:00
|
|
|
hover_area.x + hover_area.w)
|
2012-08-30 09:45:51 -07:00
|
|
|
base_size.x -=
|
|
|
|
((pos.x + arrow_size.x + base_size.x) -
|
|
|
|
(hover_area.x + hover_area.w));
|
2011-08-12 22:40:16 -07:00
|
|
|
}
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-23 19:17:34 -07:00
|
|
|
//Final position and size.
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
rect->x = pos.x;
|
|
|
|
rect->y = pos.y;
|
|
|
|
rect->w = base_size.x;
|
|
|
|
rect->h = base_size.y;
|
|
|
|
|
2011-08-12 23:05:19 -07:00
|
|
|
return dir;
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_arrow_update(Evas_Object *obj,
|
|
|
|
Elm_Ctxpopup_Direction dir,
|
2011-12-15 21:31:47 -08:00
|
|
|
Evas_Coord_Rectangle base_size)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
Evas_Coord_Rectangle arrow_size;
|
2012-08-30 09:45:51 -07:00
|
|
|
Evas_Coord x, y;
|
2011-10-24 17:27:18 -07:00
|
|
|
double drag;
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
2013-10-05 01:11:57 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2010-10-19 13:21:53 -07:00
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_geometry_get
|
|
|
|
(sd->arrow, NULL, NULL, &arrow_size.w, &arrow_size.h);
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
/* arrow is not being kept as sub-object on purpose, here. the
|
|
|
|
* design of the widget does not help with the contrary */
|
2011-10-13 19:22:59 -07:00
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
switch (dir)
|
|
|
|
{
|
2011-08-12 23:05:19 -07:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_RIGHT:
|
2012-08-30 09:45:51 -07:00
|
|
|
edje_object_signal_emit(sd->arrow, "elm,state,left", "elm");
|
2014-04-28 08:00:54 -07:00
|
|
|
if (!edje_object_part_swallow(wd->resize_obj,
|
2012-09-19 06:00:00 -07:00
|
|
|
(elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
|
2014-04-28 08:00:54 -07:00
|
|
|
"elm.swallow.arrow_left"), sd->arrow))
|
|
|
|
{
|
|
|
|
evas_object_hide(sd->arrow);
|
|
|
|
break;
|
|
|
|
}
|
2012-09-19 06:00:00 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
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))
|
|
|
|
y = base_size.h - arrow_size.h;
|
|
|
|
else
|
|
|
|
y = y - base_size.y - (arrow_size.h * 0.5);
|
|
|
|
drag = (double)(y) / (double)(base_size.h - arrow_size.h);
|
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj,
|
2012-09-19 06:00:00 -07:00
|
|
|
(elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
|
|
|
|
"elm.swallow.arrow_left"), 1, drag);
|
2012-08-30 09:45:51 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-08-12 23:05:19 -07:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_LEFT:
|
2012-08-30 09:45:51 -07:00
|
|
|
edje_object_signal_emit(sd->arrow, "elm,state,right", "elm");
|
2014-04-28 08:00:54 -07:00
|
|
|
if (!edje_object_part_swallow(wd->resize_obj,
|
2012-09-19 06:00:00 -07:00
|
|
|
(elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
|
2014-04-28 08:00:54 -07:00
|
|
|
"elm.swallow.arrow_right"), sd->arrow))
|
|
|
|
{
|
|
|
|
evas_object_hide(sd->arrow);
|
|
|
|
break;
|
|
|
|
}
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
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)))
|
|
|
|
y = base_size.h - arrow_size.h;
|
|
|
|
else
|
|
|
|
y = y - base_size.y - (arrow_size.h * 0.5);
|
|
|
|
drag = (double)(y) / (double)(base_size.h - arrow_size.h);
|
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj,
|
2012-09-19 06:00:00 -07:00
|
|
|
(elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
|
|
|
|
"elm.swallow.arrow_right"), 0, drag);
|
2012-08-30 09:45:51 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-08-12 23:05:19 -07:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_DOWN:
|
2012-08-30 09:45:51 -07:00
|
|
|
edje_object_signal_emit(sd->arrow, "elm,state,top", "elm");
|
2014-04-28 08:00:54 -07:00
|
|
|
if (!edje_object_part_swallow(wd->resize_obj, "elm.swallow.arrow_up", sd->arrow))
|
|
|
|
{
|
|
|
|
evas_object_hide(sd->arrow);
|
|
|
|
break;
|
|
|
|
}
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
if (base_size.w > 0)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
drag = (double)(x) / (double)(base_size.w - arrow_size.w);
|
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.swallow.arrow_up", drag,
|
2012-08-30 09:45:51 -07:00
|
|
|
1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-08-12 23:05:19 -07:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_UP:
|
2012-08-30 09:45:51 -07:00
|
|
|
edje_object_signal_emit(sd->arrow, "elm,state,bottom", "elm");
|
2014-04-28 08:00:54 -07:00
|
|
|
if (!edje_object_part_swallow(wd->resize_obj, "elm.swallow.arrow_down", sd->arrow))
|
|
|
|
{
|
|
|
|
evas_object_hide(sd->arrow);
|
|
|
|
break;
|
|
|
|
}
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
if (base_size.w > 0)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
drag = (double)(x) / (double)(base_size.w - arrow_size.w);
|
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.swallow.arrow_down",
|
2012-08-30 09:45:51 -07:00
|
|
|
drag, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
default:
|
2012-08-30 09:45:51 -07:00
|
|
|
break;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
2012-03-22 03:14:58 -07:00
|
|
|
|
|
|
|
//should be here for getting accurate geometry value
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_smart_calculate(wd->resize_obj);
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2012-02-01 03:26:25 -08:00
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_show_signals_emit(Evas_Object *obj,
|
|
|
|
Elm_Ctxpopup_Direction dir)
|
2012-02-01 03:26:25 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
2012-02-01 03:26:25 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->visible) return;
|
|
|
|
if ((sd->list) && (!sd->list_visible)) return;
|
2013-10-16 04:17:57 -07:00
|
|
|
if (sd->emitted) return;
|
2012-02-01 03:26:25 -08:00
|
|
|
|
2013-10-16 04:17:57 -07:00
|
|
|
sd->emitted = EINA_TRUE;
|
2012-02-01 03:26:25 -08:00
|
|
|
switch (dir)
|
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_UP:
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,show,up", "elm");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_LEFT:
|
2012-09-20 01:13:28 -07:00
|
|
|
elm_layout_signal_emit(obj,
|
|
|
|
(elm_widget_mirrored_get(obj) ? "elm,state,show,right" :
|
|
|
|
"elm,state,show,left"), "elm");
|
2012-08-30 09:45:51 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_RIGHT:
|
2012-09-20 01:13:28 -07:00
|
|
|
elm_layout_signal_emit(obj,
|
|
|
|
(elm_widget_mirrored_get(obj) ? "elm,state,show,left" :
|
|
|
|
"elm,state,show,right"), "elm");
|
2012-08-30 09:45:51 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_DOWN:
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,show,down", "elm");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-02-01 03:26:25 -08:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,show", "elm");
|
2012-02-01 03:26:25 -08:00
|
|
|
}
|
|
|
|
|
2011-08-24 00:02:26 -07:00
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_hide_signals_emit(Evas_Object *obj,
|
|
|
|
Elm_Ctxpopup_Direction dir)
|
2011-08-24 00:02:26 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
2011-08-24 00:02:26 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->visible) return;
|
2011-08-24 00:02:26 -07:00
|
|
|
|
|
|
|
switch (dir)
|
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
case ELM_CTXPOPUP_DIRECTION_UP:
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,hide,up", "elm");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_LEFT:
|
2012-09-20 01:13:28 -07:00
|
|
|
elm_layout_signal_emit(obj,
|
|
|
|
(elm_widget_mirrored_get(obj) ? "elm,state,hide,right" :
|
|
|
|
"elm,state,hide,left"), "elm");
|
2012-08-30 09:45:51 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_RIGHT:
|
2012-09-20 01:13:28 -07:00
|
|
|
elm_layout_signal_emit(obj,
|
|
|
|
(elm_widget_mirrored_get(obj) ? "elm,state,hide,left" :
|
|
|
|
"elm,state,hide,right"), "elm");
|
2012-08-30 09:45:51 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_DOWN:
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,hide,down", "elm");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2011-08-24 00:02:26 -07:00
|
|
|
}
|
2012-08-30 09:45:51 -07:00
|
|
|
edje_object_signal_emit(sd->bg, "elm,state,hide", "elm");
|
2013-06-21 23:21:00 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,hide", "elm");
|
2011-08-24 00:02:26 -07:00
|
|
|
}
|
|
|
|
|
2010-11-18 04:55:28 -08:00
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_base_shift_by_arrow(Evas_Object *arrow,
|
|
|
|
Elm_Ctxpopup_Direction dir,
|
|
|
|
Evas_Coord_Rectangle *rect)
|
|
|
|
{
|
|
|
|
Evas_Coord arrow_w, arrow_h;
|
|
|
|
|
|
|
|
evas_object_geometry_get(arrow, NULL, NULL, &arrow_w, &arrow_h);
|
|
|
|
switch (dir)
|
|
|
|
{
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_RIGHT:
|
|
|
|
rect->x += arrow_w;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_LEFT:
|
|
|
|
rect->x -= arrow_w;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_DOWN:
|
|
|
|
rect->y += arrow_h;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_CTXPOPUP_DIRECTION_UP:
|
|
|
|
rect->y -= arrow_h;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_layout_sub_object_add_enable(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *_pd EINA_UNUSED)
|
2012-08-30 09:45:51 -07:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_sub_object_add(Eo *obj, Elm_Ctxpopup_Data *_pd EINA_UNUSED, Evas_Object *sobj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-03 05:46:17 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_sub_object_add(sobj));
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
return int_ret;
|
2012-08-30 09:45:51 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_layout_sizing_eval(Eo *obj, Elm_Ctxpopup_Data *sd)
|
2010-11-18 04:55:28 -08:00
|
|
|
{
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
Evas_Coord_Rectangle rect = { 0, 0, 1, 1 };
|
2014-02-09 01:11:47 -08:00
|
|
|
Evas_Coord_Point list_size = { 0, 0 }, parent_size = {0, 0};
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2013-10-05 01:11:57 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
if (!sd->arrow) return; /* simple way to flag "under deletion" */
|
2013-04-08 03:28:01 -07:00
|
|
|
if (!sd->parent) return; /* do not calculate sizes unless parent is set */
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
|
|
|
//Base
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->dir = _base_geometry_calc(obj, &rect);
|
|
|
|
|
|
|
|
_arrow_update(obj, sd->dir, rect);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
_base_shift_by_arrow(sd->arrow, sd->dir, &rect);
|
|
|
|
|
|
|
|
if ((sd->list) && (sd->list_visible))
|
2012-03-22 03:14:58 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_geometry_get(sd->list, 0, 0, &list_size.x, &list_size.y);
|
2012-03-22 03:14:58 -07:00
|
|
|
if ((list_size.x >= rect.w) || (list_size.y >= rect.h))
|
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_list_mode_set(sd->list, ELM_LIST_COMPRESS);
|
2014-08-04 03:46:03 -07:00
|
|
|
evas_object_size_hint_min_set(obj, list_size.x, list_size.y);
|
2012-03-22 03:14:58 -07:00
|
|
|
}
|
2014-08-04 03:46:03 -07:00
|
|
|
/*
|
|
|
|
Decrease height of main object initiate recalc of size (sizing_eval).
|
|
|
|
At each iteration of calculating size height of the object
|
|
|
|
will be closer to the height of the list.
|
|
|
|
*/
|
|
|
|
if (list_size.y < rect.h) rect.h--;
|
|
|
|
}
|
|
|
|
else if (sd->content)
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(sd->content, 0, 0, &list_size.x, &list_size.y);
|
|
|
|
if ((list_size.x >= rect.w) || (list_size.y >= rect.h))
|
|
|
|
evas_object_size_hint_min_set(obj, list_size.x, list_size.y);
|
2012-08-30 09:45:51 -07:00
|
|
|
}
|
|
|
|
|
2014-02-09 01:11:47 -08:00
|
|
|
evas_object_geometry_get(sd->parent, NULL, NULL, &parent_size.x, &parent_size.y);
|
|
|
|
evas_object_resize(sd->bg, parent_size.x, parent_size.y);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_move(wd->resize_obj, rect.x, rect.y);
|
|
|
|
evas_object_resize(wd->resize_obj, rect.w, rect.h);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
_show_signals_emit(obj, sd->dir);
|
2010-11-18 04:55:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_on_parent_del(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2010-11-18 04:55:28 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_del(data);
|
|
|
|
}
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
static void
|
|
|
|
_on_parent_move(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-08-30 09:45:51 -07:00
|
|
|
{
|
|
|
|
ELM_CTXPOPUP_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
|
|
|
|
|
|
|
if (sd->visible) elm_layout_sizing_eval(data);
|
2010-11-18 04:55:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_on_parent_resize(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2010-11-18 04:55:28 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(data, sd);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2014-02-09 01:11:47 -08:00
|
|
|
if (sd->auto_hide)
|
|
|
|
{
|
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2014-02-09 01:11:47 -08:00
|
|
|
evas_object_hide(data);
|
|
|
|
evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->visible)
|
|
|
|
elm_layout_sizing_eval(data);
|
|
|
|
}
|
2010-11-18 04:55:28 -08:00
|
|
|
}
|
|
|
|
|
2010-10-19 13:21:53 -07:00
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_parent_detach(Evas_Object *obj)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->parent) return;
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_on_content_resized(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(data, sd);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_box_recalculate(sd->box);
|
|
|
|
elm_layout_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
//FIXME: lost the content size when theme hook is called.
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_theme_apply(Eo *obj, Elm_Ctxpopup_Data *sd)
|
2012-08-30 09:45:51 -07:00
|
|
|
{
|
2014-04-03 05:46:17 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_theme_apply());
|
2014-03-20 06:06:33 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2011-10-23 23:49:08 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, sd->bg, "ctxpopup", "bg", elm_widget_style_get(obj));
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, sd->arrow, "ctxpopup", "arrow", elm_widget_style_get(obj));
|
2011-10-24 17:27:18 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->list)
|
2011-01-31 00:47:19 -08:00
|
|
|
{
|
2011-10-24 17:27:18 -07:00
|
|
|
if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_object_style_set(sd->list, "ctxpopup");
|
2011-03-23 19:17:34 -07:00
|
|
|
else
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_object_style_set(sd->list, elm_object_style_get(obj));
|
2011-01-31 00:47:19 -08:00
|
|
|
}
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
2011-08-28 00:12:16 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
/* kind of a big and tricky override here: an internal box will hold
|
|
|
|
* the actual content. content aliases won't be of much help here */
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_container_content_set(Eo *obj, Elm_Ctxpopup_Data *sd, const char *part, Evas_Object *content)
|
2011-08-02 21:38:44 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_TRUE;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
if ((part) && (strcmp(part, "default")))
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_container_content_set(part, content));
|
2014-03-20 06:06:33 -07:00
|
|
|
return int_ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
if (!content) return EINA_FALSE;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
if (content == sd->content) return EINA_TRUE;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(sd->content);
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->content == sd->list) sd->list = NULL;
|
|
|
|
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_fill_set
|
|
|
|
(content, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
|
|
|
|
elm_box_pack_end(sd->box, content);
|
2014-03-06 01:53:57 -08:00
|
|
|
evas_object_show(content);
|
2011-12-15 21:27:11 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->content = content;
|
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
2011-08-02 21:38:44 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
2011-08-28 00:12:16 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
2011-08-02 21:38:44 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_container_content_get(Eo *obj, Elm_Ctxpopup_Data *sd, const char *part)
|
2011-08-02 21:38:44 -07:00
|
|
|
{
|
|
|
|
|
2012-09-04 07:10:00 -07:00
|
|
|
if ((part) && (strcmp(part, "default")))
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
Evas_Object *ret = NULL;
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, ret = elm_obj_container_content_get(part));
|
2014-03-20 06:06:33 -07:00
|
|
|
return ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-09-04 07:10:00 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
return sd->content;
|
2011-08-02 21:38:44 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_container_content_unset(Eo *obj, Elm_Ctxpopup_Data *sd, const char *part)
|
2011-08-02 21:38:44 -07:00
|
|
|
{
|
2014-04-03 05:46:17 -07:00
|
|
|
Evas_Object *content = NULL;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2012-09-04 07:10:00 -07:00
|
|
|
if ((part) && (strcmp(part, "default")))
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, content = elm_obj_container_content_unset(part));
|
2014-03-20 06:06:33 -07:00
|
|
|
return content;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-09-04 07:10:00 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
content = sd->content;
|
2014-03-20 06:06:33 -07:00
|
|
|
if (!content) return content;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2013-10-07 23:41:06 -07:00
|
|
|
elm_box_unpack(sd->box, content);
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->content = NULL;
|
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
|
|
|
|
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
|
|
|
|
2014-05-06 20:51:51 -07:00
|
|
|
return content;
|
2011-08-02 21:38:44 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_ctxpopup_item_elm_widget_item_part_text_set(Eo *eo_ctxpopup_it EINA_UNUSED,
|
|
|
|
Elm_Ctxpopup_Item_Data *ctxpopup_it,
|
|
|
|
const char *part,
|
|
|
|
const char *label)
|
2011-11-16 18:16:38 -08:00
|
|
|
{
|
2012-03-22 03:14:58 -07:00
|
|
|
if ((part) && (strcmp(part, "default"))) return;
|
2011-11-16 18:16:38 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
|
2011-11-16 18:16:38 -08:00
|
|
|
|
2012-03-22 03:14:58 -07:00
|
|
|
elm_object_item_part_text_set(ctxpopup_it->list_item, "default", label);
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
2011-11-16 18:16:38 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
|
2011-11-16 18:16:38 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static const char *
|
|
|
|
_elm_ctxpopup_item_elm_widget_item_part_text_get(Eo *eo_ctxpopup_it EINA_UNUSED,
|
|
|
|
Elm_Ctxpopup_Item_Data *ctxpopup_it,
|
|
|
|
const char *part)
|
2011-11-16 18:16:38 -08:00
|
|
|
{
|
|
|
|
if (part && strcmp(part, "default")) return NULL;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2012-03-22 03:14:58 -07:00
|
|
|
return elm_object_item_part_text_get(ctxpopup_it->list_item, "default");
|
2011-11-16 18:16:38 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_ctxpopup_item_elm_widget_item_part_content_set(Eo *eo_ctxpopup_it EINA_UNUSED,
|
|
|
|
Elm_Ctxpopup_Item_Data *ctxpopup_it,
|
|
|
|
const char *part,
|
|
|
|
Evas_Object *content)
|
2011-11-16 18:16:38 -08:00
|
|
|
{
|
2012-03-22 03:14:58 -07:00
|
|
|
if ((part) && (strcmp(part, "icon"))
|
|
|
|
&& (strcmp(part, "start"))
|
|
|
|
&& (strcmp(part, "end"))) return;
|
2011-11-16 18:16:38 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
|
2011-11-16 18:16:38 -08:00
|
|
|
|
2012-03-22 03:14:58 -07:00
|
|
|
if ((part) && (!strcmp(part, "end")))
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_object_item_part_content_set(ctxpopup_it->list_item, "end", content);
|
2012-03-22 03:14:58 -07:00
|
|
|
else
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_object_item_part_content_set
|
|
|
|
(ctxpopup_it->list_item, "start", content);
|
2012-03-22 03:14:58 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
2011-11-16 18:16:38 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
|
2011-11-16 18:16:38 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static Evas_Object *
|
|
|
|
_elm_ctxpopup_item_elm_widget_item_part_content_get(Eo *eo_ctxpopup_it EINA_UNUSED,
|
|
|
|
Elm_Ctxpopup_Item_Data *ctxpopup_it,
|
|
|
|
const char *part)
|
2011-11-16 18:16:38 -08:00
|
|
|
{
|
2012-03-22 03:14:58 -07:00
|
|
|
if (part && strcmp(part, "icon") && strcmp(part, "start")
|
|
|
|
&& strcmp(part, "end")) return NULL;
|
|
|
|
|
|
|
|
if (part && !strcmp(part, "end"))
|
2012-08-30 09:45:51 -07:00
|
|
|
return elm_object_item_part_content_get(ctxpopup_it->list_item, "end");
|
2012-03-22 03:14:58 -07:00
|
|
|
else
|
2012-08-30 09:45:51 -07:00
|
|
|
return elm_object_item_part_content_get(ctxpopup_it->list_item, "start");
|
2011-11-16 18:16:38 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_ctxpopup_item_elm_widget_item_disable(Eo *eo_ctxpopup_it,
|
|
|
|
Elm_Ctxpopup_Item_Data *ctxpopup_it)
|
2011-11-16 18:16:38 -08:00
|
|
|
{
|
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_object_item_disabled_set
|
2014-09-27 22:14:47 -07:00
|
|
|
(ctxpopup_it->list_item, eo_do(eo_ctxpopup_it, elm_wdg_item_disabled_get()));
|
2011-11-16 18:16:38 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_ctxpopup_item_elm_widget_item_signal_emit(Eo *eo_ctxpopup_it EINA_UNUSED,
|
|
|
|
Elm_Ctxpopup_Item_Data *ctxpopup_it,
|
|
|
|
const char *emission,
|
|
|
|
const char *source)
|
2011-11-16 18:16:38 -08:00
|
|
|
{
|
2012-03-22 03:14:58 -07:00
|
|
|
elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source);
|
2011-11-16 18:16:38 -08:00
|
|
|
}
|
|
|
|
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_bg_clicked_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
_hide_signals_emit(data, sd->dir);
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_on_show(void *data EINA_UNUSED,
|
|
|
|
Evas *e EINA_UNUSED,
|
2012-08-30 09:45:51 -07:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
2012-03-22 03:14:58 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->list)
|
2012-03-22 03:14:58 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_list_go(sd->list);
|
|
|
|
sd->visible = EINA_TRUE;
|
2014-03-31 10:50:53 -07:00
|
|
|
/*
|
|
|
|
* XXX: Giving focus to the list when it has nothing selected makes
|
|
|
|
* it select the first of its items, which makes the popup in
|
|
|
|
* Terminology never open and instead just trigger the first option.
|
|
|
|
* I'll let as an excercise to the reader to figure out why that
|
|
|
|
* is so fucking annoying. Extra points for noting why this is my
|
|
|
|
* choice of a "fix" instead of fixing the actual focus/select issue
|
|
|
|
* that seems to be spread all over Elementary.
|
|
|
|
*/
|
|
|
|
//elm_object_focus_set(sd->list, EINA_TRUE);
|
2012-03-22 03:14:58 -07:00
|
|
|
return;
|
|
|
|
}
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->content) return;
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2013-10-16 04:17:57 -07:00
|
|
|
sd->emitted = EINA_FALSE;
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->visible = EINA_TRUE;
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2013-10-16 04:17:57 -07:00
|
|
|
_show_signals_emit(obj, sd->dir);
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2011-08-27 19:38:48 -07:00
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2012-02-01 03:26:25 -08:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_on_hide(void *data EINA_UNUSED,
|
|
|
|
Evas *e EINA_UNUSED,
|
2012-08-30 09:45:51 -07:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2012-02-01 03:26:25 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(obj, sd);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->visible) return;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->visible = EINA_FALSE;
|
|
|
|
sd->list_visible = EINA_FALSE;
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2011-12-15 21:27:11 -08:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_on_move(void *data EINA_UNUSED,
|
|
|
|
Evas *e EINA_UNUSED,
|
2012-08-30 09:45:51 -07:00
|
|
|
Evas_Object *obj,
|
2014-01-06 06:30:02 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2011-12-15 21:27:11 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-12-15 21:27:11 -08:00
|
|
|
}
|
|
|
|
|
2010-10-19 13:21:53 -07:00
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_hide_finished_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_hide(data);
|
|
|
|
evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:51 -07:00
|
|
|
_list_resize_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(data, sd);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->visible) return;
|
|
|
|
if (sd->list_visible) return;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->list_visible = EINA_TRUE;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_layout_sizing_eval(data);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_list_del(Elm_Ctxpopup_Data *sd)
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
{
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(sd->list, evas_object_del);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_ctxpopup_item_elm_widget_item_del_pre(Eo *eo_ctxpopup_it,
|
|
|
|
Elm_Ctxpopup_Item_Data *ctxpopup_it)
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
{
|
2012-03-22 03:14:58 -07:00
|
|
|
Evas_Object *list;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
|
2012-03-22 03:14:58 -07:00
|
|
|
list = elm_object_item_widget_get(ctxpopup_it->list_item);
|
|
|
|
|
|
|
|
if (eina_list_count(elm_list_items_get(list)) < 2)
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
{
|
2014-05-10 07:13:12 -07:00
|
|
|
if (ctxpopup_it->list_item)
|
2014-09-27 22:14:47 -07:00
|
|
|
elm_object_item_del(ctxpopup_it->list_item);
|
|
|
|
sd->items = eina_list_remove(sd->items, eo_ctxpopup_it);
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
evas_object_hide(WIDGET(ctxpopup_it));
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2012-01-27 03:56:14 -08:00
|
|
|
return EINA_TRUE;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
}
|
|
|
|
|
2014-05-10 07:13:12 -07:00
|
|
|
if (ctxpopup_it->list_item)
|
2014-09-27 22:14:47 -07:00
|
|
|
elm_object_item_del(ctxpopup_it->list_item);
|
|
|
|
sd->items = eina_list_remove(sd->items, eo_ctxpopup_it);
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->list_visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_disable(Eo *obj, Elm_Ctxpopup_Data *sd)
|
2012-08-30 09:45:51 -07:00
|
|
|
{
|
2014-04-03 05:46:17 -07:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, int_ret = elm_obj_widget_disable());
|
2014-03-20 06:06:33 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2013-12-12 18:21:08 -08:00
|
|
|
if (sd->list)
|
|
|
|
elm_object_disabled_set(sd->list, elm_widget_disabled_get(obj));
|
|
|
|
else if (sd->content)
|
2013-12-14 10:47:43 -08:00
|
|
|
elm_object_disabled_set(sd->content, elm_widget_disabled_get(obj));
|
2012-01-27 03:56:14 -08:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
return EINA_TRUE;
|
elementary/menu, ctxpopup, index, segment_control, diskselector, multibuttonentry, toolbar, naviframe, slideshow, hoversel, filpselector - deprecated xxxx_item_del() APIs.
But instead, made to use the elm_object_item_del() APIs
for this, elm_widget_item needed to provide elm_widget_item_del_pre_hook.
SVN revision: 67010
2012-01-09 21:02:11 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_ctxpopup_evas_object_smart_add(Eo *obj, Elm_Ctxpopup_Data *priv)
|
2012-03-14 06:03:38 -07:00
|
|
|
{
|
2014-01-14 21:42:13 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "ctxpopup", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2013-03-01 18:04:31 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_layout_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(obj, "elm,action,hide,finished", "*", _hide_finished_cb, obj);
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
//Background
|
|
|
|
priv->bg = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_theme_object_set(obj, priv->bg, "ctxpopup", "bg", "default");
|
|
|
|
edje_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(priv->bg, "elm,action,click", "*", _bg_clicked_cb, obj);
|
2014-01-14 21:42:13 -08:00
|
|
|
evas_object_smart_member_add(priv->bg, obj);
|
|
|
|
evas_object_stack_below(priv->bg, wd->resize_obj);
|
2012-03-14 06:03:38 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
//Arrow
|
|
|
|
priv->arrow = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, priv->arrow, "ctxpopup", "arrow", "default");
|
2014-01-14 21:42:13 -08:00
|
|
|
evas_object_smart_member_add(priv->arrow, obj);
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
priv->dir_priority[0] = ELM_CTXPOPUP_DIRECTION_UP;
|
|
|
|
priv->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT;
|
|
|
|
priv->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT;
|
|
|
|
priv->dir_priority[3] = ELM_CTXPOPUP_DIRECTION_DOWN;
|
|
|
|
priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
2014-02-09 01:11:47 -08:00
|
|
|
priv->auto_hide = EINA_TRUE;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
priv->box = elm_box_add(obj);
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(priv->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
|
|
|
|
|
|
|
|
/* box will be our content placeholder, thus the parent's version call */
|
2014-04-03 05:46:17 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, elm_obj_container_content_set("elm.swallow.content", priv->box));
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _on_hide, NULL);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _on_move, NULL);
|
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2012-03-14 06:03:38 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-06-03 03:35:28 -07:00
|
|
|
_elm_ctxpopup_evas_object_smart_del(Eo *obj, Elm_Ctxpopup_Data *sd)
|
2012-03-14 06:03:38 -07:00
|
|
|
{
|
2014-09-27 22:14:47 -07:00
|
|
|
Elm_Object_Item *it;
|
2012-08-30 09:45:51 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
|
|
|
|
_parent_detach(obj);
|
|
|
|
|
|
|
|
elm_ctxpopup_clear(obj);
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(sd->arrow, evas_object_del); /* stops _sizing_eval() from going on on deletion */
|
|
|
|
ELM_SAFE_FREE(sd->bg, evas_object_del);
|
2012-08-30 09:45:51 -07:00
|
|
|
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->items, it)
|
2014-08-19 00:52:24 -07:00
|
|
|
eo_del(it);
|
2013-01-18 01:07:03 -08:00
|
|
|
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
|
2012-03-14 06:03:38 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_elm_widget_parent_set(Eo *obj, Elm_Ctxpopup_Data *_pd EINA_UNUSED, Evas_Object *parent)
|
2012-03-14 06:03:38 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
//default parent is to be hover parent
|
|
|
|
elm_ctxpopup_hover_parent_set(obj, parent);
|
2012-03-14 06:03:38 -07:00
|
|
|
}
|
|
|
|
|
2010-12-08 08:18:30 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_ctxpopup_add(Evas_Object *parent)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2012-11-25 22:32:53 -08:00
|
|
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
2013-02-14 01:20:54 -08:00
|
|
|
|
|
|
|
/* access: parent could be any object such as elm_list which does
|
|
|
|
not know elc_ctxpopup as its child object in the focus_next(); */
|
2013-10-05 01:11:57 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
2013-02-14 01:20:54 -08:00
|
|
|
wd->highlight_root = EINA_TRUE;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
return obj;
|
|
|
|
}
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_eo_base_constructor(Eo *obj, Elm_Ctxpopup_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-03-18 09:07:38 -07:00
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
2012-11-25 22:32:53 -08:00
|
|
|
eo_do(obj,
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
|
2014-06-10 19:07:15 -07:00
|
|
|
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks),
|
|
|
|
elm_interface_atspi_accessible_role_set(ELM_ATSPI_ROLE_POPUP_MENU));
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_hover_parent_set(Eo *obj, Elm_Ctxpopup_Data *sd, Evas_Object *parent)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2011-08-29 08:59:56 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
2010-12-03 06:08:33 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!parent) return;
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
_parent_detach(obj);
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
|
|
|
|
|
|
|
|
sd->parent = parent;
|
2011-08-29 08:28:05 -07:00
|
|
|
|
2011-09-01 21:09:17 -07:00
|
|
|
//Update Background
|
2011-08-29 09:05:24 -07:00
|
|
|
evas_object_geometry_get(parent, &x, &y, &w, &h);
|
2014-06-03 03:35:28 -07:00
|
|
|
if (parent && eo_isa(parent, ELM_WIN_CLASS))
|
2013-03-29 05:29:24 -07:00
|
|
|
x = y = 0;
|
2012-08-30 09:45:51 -07:00
|
|
|
evas_object_move(sd->bg, x, y);
|
|
|
|
evas_object_resize(sd->bg, w, h);
|
2011-08-29 08:59:56 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_hover_parent_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
return sd->parent;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_clear(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
_list_del(sd);
|
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_horizontal_set(Eo *obj, Elm_Ctxpopup_Data *sd, Eina_Bool horizontal)
|
2010-10-19 13:21:53 -07:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->horizontal = !!horizontal;
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (!sd->list) return;
|
2010-10-19 13:21:53 -07:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
elm_list_horizontal_set(sd->list, sd->horizontal);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_horizontal_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
return sd->horizontal;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2013-01-18 01:07:03 -08:00
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_item_wrap_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2013-01-18 01:07:03 -08:00
|
|
|
{
|
2014-09-27 22:14:47 -07:00
|
|
|
Elm_Ctxpopup_Item_Data *item = data;
|
2013-05-02 04:25:42 -07:00
|
|
|
if (!item->wcb.org_func_cb) return;
|
2014-09-27 22:14:47 -07:00
|
|
|
item->wcb.org_func_cb((void *)item->wcb.org_data, item->wcb.cobj, EO_OBJ(item));
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_elm_ctxpopup_item_eo_base_constructor(Eo *obj, Elm_Ctxpopup_Item_Data *it)
|
|
|
|
{
|
|
|
|
eo_do_super(obj, ELM_CTXPOPUP_ITEM_CLASS, eo_constructor());
|
|
|
|
it->base = eo_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
|
2013-01-18 01:07:03 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Elm_Object_Item*
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_item_append(Eo *obj, Elm_Ctxpopup_Data *sd, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-09-27 22:14:47 -07:00
|
|
|
Eo *eo_item;
|
|
|
|
|
|
|
|
eo_item = eo_add(ELM_CTXPOPUP_ITEM_CLASS, obj, elm_obj_ctxpopup_item_init(func, data));
|
|
|
|
if (!eo_item) return NULL;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
ELM_CTXPOPUP_ITEM_DATA_GET(eo_item, item);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
item->list_item =
|
2013-01-18 01:07:03 -08:00
|
|
|
elm_list_item_append(sd->list, label, icon, NULL, _item_wrap_cb, item);
|
2014-09-27 22:14:47 -07:00
|
|
|
sd->items = eina_list_append(sd->items, eo_item);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
return eo_item;
|
2010-10-19 13:21:53 -07:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_direction_priority_set(Eo *obj, Elm_Ctxpopup_Data *sd, Elm_Ctxpopup_Direction first, Elm_Ctxpopup_Direction second, Elm_Ctxpopup_Direction third, Elm_Ctxpopup_Direction fourth)
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
sd->dir_priority[0] = first;
|
|
|
|
sd->dir_priority[1] = second;
|
|
|
|
sd->dir_priority[2] = third;
|
|
|
|
sd->dir_priority[3] = fourth;
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
|
2012-08-30 09:45:51 -07:00
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_direction_priority_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd, Elm_Ctxpopup_Direction *first, Elm_Ctxpopup_Direction *second, Elm_Ctxpopup_Direction *third, Elm_Ctxpopup_Direction *fourth)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
if (first) *first = sd->dir_priority[0];
|
|
|
|
if (second) *second = sd->dir_priority[1];
|
|
|
|
if (third) *third = sd->dir_priority[2];
|
|
|
|
if (fourth) *fourth = sd->dir_priority[3];
|
From: ChunEon Park <chuneon.park@samsung.com>
Subject: [PATCH] elc_ctxpopup
Here code is for the ctxpopup.
Since the functionalities of ctxpopup are somewhat different,
I'm trying to overwrite the ctxpopup code entirely first.
The main reason is,
Original ctxpopup could determine it's size and position by itself.
Of course, upstreamed version supports this. But it can not be reduced
it's
size
And it supposes the arrow position to center of box edje.
Basically,
This version calculates it's box size first then find available space
from
the it's position.
The origin position of the box is not expected, it finds the available
positions.
But if there is not enough space to be shown, then it finds a best
direction
to be shown again.
In this case, it reduces it's size also as to be shown entirely.
Since the ctxpopup supports scroller, the reduced box could show the all
items also.
(The point is ctxpopup should know the size of total items...)
I'm not sure the upstreamed version could cover the above scenario,
If then, I need to modify it first.
(fixed some minor formatting issue too)
SVN revision: 56021
2011-01-10 00:59:40 -08:00
|
|
|
}
|
2011-08-28 00:12:16 -07:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Elm_Ctxpopup_Direction
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_direction_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
2012-03-06 21:58:38 -08:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
return sd->dir;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_dismiss(Eo *obj, Elm_Ctxpopup_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:51 -07:00
|
|
|
_hide_signals_emit(obj, sd->dir);
|
2012-03-06 21:58:38 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_auto_hide_disabled_set(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd, Eina_Bool disabled)
|
2014-02-09 01:11:47 -08:00
|
|
|
{
|
|
|
|
disabled = !!disabled;
|
|
|
|
if (sd->auto_hide == !disabled) return;
|
|
|
|
sd->auto_hide = !disabled;
|
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_auto_hide_disabled_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
2014-02-09 01:11:47 -08:00
|
|
|
{
|
2014-03-20 06:06:33 -07:00
|
|
|
return sd->auto_hide;
|
2014-02-09 01:11:47 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 06:06:33 -07:00
|
|
|
EOLIAN static void
|
2014-04-22 05:51:46 -07:00
|
|
|
_elm_ctxpopup_class_constructor(Eo_Class *klass)
|
2014-02-09 01:11:47 -08:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2014-03-20 06:06:33 -07:00
|
|
|
|
2014-07-03 04:05:28 -07:00
|
|
|
EOLIAN static const Eina_List*
|
|
|
|
_elm_ctxpopup_items_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
|
|
|
{
|
|
|
|
return sd->items;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_ctxpopup_first_item_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
|
|
|
{
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
|
|
|
return eina_list_data_get(sd->items);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_ctxpopup_last_item_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd)
|
|
|
|
{
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
|
|
|
return eina_list_data_get(eina_list_last(sd->items));
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Elm_Object_Item*
|
|
|
|
_elm_ctxpopup_item_prepend(Eo *obj, Elm_Ctxpopup_Data *sd, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
|
|
|
|
{
|
2014-09-27 22:14:47 -07:00
|
|
|
Eo *eo_item;
|
2014-07-03 04:05:28 -07:00
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
eo_item = eo_add(ELM_CTXPOPUP_ITEM_CLASS, obj, elm_obj_ctxpopup_item_init(func, data));
|
|
|
|
if (!eo_item) return NULL;
|
|
|
|
|
|
|
|
ELM_CTXPOPUP_ITEM_DATA_GET(eo_item, item);
|
2014-07-03 04:05:28 -07:00
|
|
|
|
|
|
|
item->list_item =
|
|
|
|
elm_list_item_prepend(sd->list, label, icon, NULL, _item_wrap_cb, item);
|
2014-09-27 22:14:47 -07:00
|
|
|
sd->items = eina_list_prepend(sd->items, eo_item);
|
2014-07-03 04:05:28 -07:00
|
|
|
|
|
|
|
if (sd->visible) elm_layout_sizing_eval(obj);
|
|
|
|
|
2014-08-19 00:52:24 -07:00
|
|
|
return eo_item;
|
2014-07-03 04:05:28 -07:00
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_ctxpopup_item_prev_get(Eo *eo_item EINA_UNUSED, Elm_Ctxpopup_Item_Data *item)
|
2014-07-03 04:05:28 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
ELM_CTXPOPUP_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
l = eina_list_data_find_list(sd->items, eo_item);
|
2014-07-03 04:05:28 -07:00
|
|
|
if (l && l->prev) return eina_list_data_get(l->prev);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static Elm_Object_Item *
|
|
|
|
_elm_ctxpopup_item_next_get(Eo *eo_item EINA_UNUSED, Elm_Ctxpopup_Item_Data *item)
|
2014-07-03 04:05:28 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
ELM_CTXPOPUP_DATA_GET(WIDGET(item), sd);
|
|
|
|
|
|
|
|
if (!sd->items) return NULL;
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
l = eina_list_data_find_list(sd->items, eo_item);
|
2014-07-03 04:05:28 -07:00
|
|
|
if (l && l->next) return eina_list_data_get(l->next);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_ctxpopup_item_init(Eo *eo_item,
|
|
|
|
Elm_Ctxpopup_Item_Data *item,
|
2014-07-03 04:05:28 -07:00
|
|
|
Evas_Smart_Cb func,
|
|
|
|
const void *data)
|
|
|
|
{
|
2014-09-27 22:14:47 -07:00
|
|
|
Eo *obj = eo_do(eo_item, eo_parent_get());
|
|
|
|
Elm_Ctxpopup_Data *sd = eo_data_scope_get(obj, ELM_CTXPOPUP_CLASS);
|
2014-07-03 04:05:28 -07:00
|
|
|
if (!sd->list)
|
|
|
|
{
|
|
|
|
sd->list = elm_list_add(obj);
|
|
|
|
if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
|
|
|
|
elm_object_style_set(sd->list, "ctxpopup");
|
|
|
|
else elm_object_style_set(sd->list, elm_object_style_get(obj));
|
|
|
|
elm_list_mode_set(sd->list, ELM_LIST_EXPAND);
|
|
|
|
elm_list_horizontal_set(sd->list, sd->horizontal);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj);
|
|
|
|
elm_layout_content_set(obj, "default", sd->list);
|
|
|
|
}
|
|
|
|
|
|
|
|
item->wcb.org_func_cb = func;
|
|
|
|
item->wcb.org_data = data;
|
|
|
|
item->wcb.cobj = obj;
|
|
|
|
|
|
|
|
sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2014-07-25 01:33:19 -07:00
|
|
|
EOLIAN static const Elm_Atspi_Action*
|
|
|
|
_elm_ctxpopup_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Data *sd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "move,previous", "move", "previous", _key_action_move},
|
|
|
|
{ "move,next", "move", "next", _key_action_move},
|
|
|
|
{ "move,left", "move", "left", _key_action_move},
|
|
|
|
{ "move,right", "move", "right", _key_action_move},
|
|
|
|
{ "move,up", "move", "up", _key_action_move},
|
|
|
|
{ "move,down", "move", "down", _key_action_move},
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:14:47 -07:00
|
|
|
#include "elm_ctxpopup_item.eo.c"
|
2014-08-11 07:46:11 -07:00
|
|
|
#include "elm_ctxpopup.eo.c"
|