2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2016-04-11 09:51:15 -07:00
|
|
|
#define ELM_WIDGET_PROTECTED
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2009-09-23 04:15:55 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2009-09-23 04:15:55 -07:00
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:05:27 -07:00
|
|
|
#include "elm_widget_notify.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_container.h"
|
2009-09-23 04:15:55 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_notify_part.eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_NOTIFY_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Notify"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_notify"
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
static Efl_Ui_Theme_Apply_Result
|
2010-07-14 12:04:22 -07:00
|
|
|
_notify_theme_apply(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
const char *style = elm_widget_style_get(obj);
|
2014-08-21 06:38:39 -07:00
|
|
|
const char *position;
|
2012-10-30 06:14:45 -07:00
|
|
|
double ax, ay;
|
2010-08-18 12:18:42 -07:00
|
|
|
|
2012-05-03 15:44:51 -07:00
|
|
|
ELM_NOTIFY_DATA_GET(obj, sd);
|
|
|
|
|
2012-10-30 06:14:45 -07:00
|
|
|
ax = sd->horizontal_align;
|
|
|
|
ay = sd->vertical_align;
|
|
|
|
|
2014-08-21 06:45:01 -07:00
|
|
|
if (ay == 0.0)
|
2014-08-21 06:38:39 -07:00
|
|
|
{
|
2014-08-21 06:45:01 -07:00
|
|
|
if (ax == 0.0)
|
2014-08-21 06:38:39 -07:00
|
|
|
position = "top_left";
|
2014-08-21 06:45:01 -07:00
|
|
|
else if (ax == 1.0)
|
2014-08-21 06:38:39 -07:00
|
|
|
position = "top_right";
|
|
|
|
else
|
|
|
|
position = "top";
|
|
|
|
}
|
2014-08-21 06:45:01 -07:00
|
|
|
else if (ay == 1.0)
|
2014-08-21 06:38:39 -07:00
|
|
|
{
|
2014-08-21 06:45:01 -07:00
|
|
|
if (ax == 0.0)
|
2014-08-21 06:38:39 -07:00
|
|
|
position = "bottom_left";
|
2014-08-21 06:45:01 -07:00
|
|
|
else if (ax == 1.0)
|
2014-08-21 06:38:39 -07:00
|
|
|
position = "bottom_right";
|
|
|
|
else
|
|
|
|
position = "bottom";
|
|
|
|
}
|
2012-10-30 06:14:45 -07:00
|
|
|
else
|
2014-08-21 06:45:01 -07:00
|
|
|
{
|
|
|
|
if (ax == 0.0)
|
|
|
|
position = "left";
|
|
|
|
else if (ax == 1.0)
|
|
|
|
position = "right";
|
|
|
|
else
|
|
|
|
position = "center";
|
|
|
|
}
|
2014-08-21 06:38:39 -07:00
|
|
|
|
2016-07-05 05:03:42 -07:00
|
|
|
return elm_widget_theme_object_set(obj, sd->notify, "notify", position, style);
|
2010-07-14 12:04:22 -07:00
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
/**
|
|
|
|
* Moves notification to orientation.
|
|
|
|
*
|
2012-10-10 17:37:26 -07:00
|
|
|
* This function moves notification to orientation
|
2011-02-08 04:08:28 -08:00
|
|
|
* according to object RTL orientation.
|
|
|
|
*
|
|
|
|
* @param obj notification object.
|
|
|
|
*
|
2016-03-04 15:42:57 -08:00
|
|
|
* @param x, y, w, h geometry of object.
|
2011-02-08 04:08:28 -08:00
|
|
|
*
|
|
|
|
* @internal
|
|
|
|
**/
|
|
|
|
static void
|
2016-03-04 15:42:57 -08:00
|
|
|
_notify_move_to_orientation(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2012-10-30 06:14:45 -07:00
|
|
|
double ax, ay;
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2012-05-03 15:44:51 -07:00
|
|
|
ELM_NOTIFY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
edje_object_size_min_get(sd->notify, &minw, &minh);
|
|
|
|
edje_object_size_min_restricted_calc(sd->notify, &minw, &minh, minw, minh);
|
|
|
|
|
2012-10-30 06:14:45 -07:00
|
|
|
ax = sd->horizontal_align;
|
|
|
|
ay = sd->vertical_align;
|
2017-06-13 03:41:15 -07:00
|
|
|
if ((efl_ui_mirrored_get(obj)) && (ax != ELM_NOTIFY_ALIGN_FILL)) ax = 1.0 - ax;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2012-10-30 06:14:45 -07:00
|
|
|
if (ax == ELM_NOTIFY_ALIGN_FILL) minw = w;
|
|
|
|
if (ay == ELM_NOTIFY_ALIGN_FILL) minh = h;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2012-10-30 06:14:45 -07:00
|
|
|
x = x + ((w - minw) * ax);
|
|
|
|
y = y + ((h - minh) * ay);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2018-11-21 07:48:30 -08:00
|
|
|
evas_object_geometry_set(sd->notify, x, y, minw, minh);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2010-07-14 12:04:22 -07:00
|
|
|
static void
|
|
|
|
_block_events_theme_apply(Evas_Object *obj)
|
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
ELM_NOTIFY_DATA_GET(obj, sd);
|
|
|
|
|
2010-07-14 12:04:22 -07:00
|
|
|
const char *style = elm_widget_style_get(obj);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(sd->block_events, "notify", "block_events", style))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2010-07-14 12:04:22 -07:00
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
2016-03-04 15:42:57 -08:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2012-05-03 15:44:51 -07:00
|
|
|
ELM_NOTIFY_DATA_GET(obj, sd);
|
|
|
|
edje_object_mirrored_set(sd->notify, rtl);
|
2016-03-04 15:42:57 -08:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
|
|
|
_notify_move_to_orientation(obj, x, y, w, h);
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:23:54 -07:00
|
|
|
static void
|
2012-05-03 15:44:51 -07:00
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
|
|
|
ELM_NOTIFY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->parent) return;
|
|
|
|
evas_object_geometry_get(sd->parent, &x, &y, &w, &h);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_isa(sd->parent, EFL_UI_WIN_CLASS))
|
2014-04-03 01:31:01 -07:00
|
|
|
{
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
}
|
2018-11-21 07:48:30 -08:00
|
|
|
evas_object_geometry_set(obj, x, y, w, h);
|
2012-05-03 15:44:51 -07:00
|
|
|
}
|
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply_Result
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_notify_efl_ui_widget_theme_apply(Eo *obj, Elm_Notify_Data *sd)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2018-11-19 20:56:37 -08:00
|
|
|
Efl_Ui_Theme_Apply_Result int_ret = EFL_UI_THEME_APPLY_RESULT_FAIL;
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
2018-11-19 20:56:37 -08:00
|
|
|
if (!int_ret) return EFL_UI_THEME_APPLY_RESULT_FAIL;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2016-07-05 05:03:42 -07:00
|
|
|
int_ret &= _notify_theme_apply(obj);
|
2012-05-03 15:44:51 -07:00
|
|
|
if (sd->block_events) _block_events_theme_apply(obj);
|
|
|
|
|
|
|
|
edje_object_scale_set
|
2018-04-05 01:47:26 -07:00
|
|
|
(sd->notify, efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2009-09-23 04:15:55 -07:00
|
|
|
_sizing_eval(obj);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2017-08-30 02:14:29 -07:00
|
|
|
/* Legacy compat. Note that notify has no text parts in the default theme... */
|
|
|
|
static void
|
|
|
|
_elm_notify_text_set(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd, const char *part, const char *label)
|
2015-05-14 19:02:47 -07:00
|
|
|
{
|
|
|
|
edje_object_part_text_set(sd->notify, part, label);
|
|
|
|
}
|
|
|
|
|
2017-08-30 02:14:29 -07:00
|
|
|
/* Legacy compat. Note that notify has no text parts in the default theme... */
|
|
|
|
static const char*
|
|
|
|
_elm_notify_text_get(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd, const char *part)
|
2015-05-14 19:02:47 -07:00
|
|
|
{
|
|
|
|
return edje_object_part_text_get(sd->notify, part);
|
|
|
|
}
|
|
|
|
|
2009-09-27 20:23:54 -07:00
|
|
|
static void
|
2012-05-03 15:44:51 -07:00
|
|
|
_calc(Evas_Object *obj)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
|
|
|
ELM_NOTIFY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
_sizing_eval(obj);
|
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
|
|
|
|
|
|
|
if (sd->content)
|
|
|
|
{
|
2016-03-04 15:42:57 -08:00
|
|
|
_notify_move_to_orientation(obj, x, y, w, h);
|
2012-05-03 15:44:51 -07:00
|
|
|
}
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:23:54 -07:00
|
|
|
static void
|
2012-05-03 15:44:51 -07:00
|
|
|
_changed_size_hints_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)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2010-06-23 10:58:08 -07:00
|
|
|
_calc(data);
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_notify_efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Notify_Data *sd, Evas_Object *sobj)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2017-08-23 04:41:37 -07:00
|
|
|
int_ret = elm_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj);
|
2014-03-24 23:25:02 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
|
|
|
if (sobj == sd->content)
|
2010-06-16 13:58:09 -07:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints_cb, obj);
|
|
|
|
sd->content = NULL;
|
2010-06-16 13:58:09 -07:00
|
|
|
}
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
return EINA_TRUE;
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2010-02-22 01:48:21 -08:00
|
|
|
static void
|
2012-05-03 15:44:51 -07:00
|
|
|
_block_area_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-02-22 01:48:21 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_NOTIFY_EVENT_BLOCK_CLICKED, NULL);
|
2010-02-22 01:48:21 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_notify_efl_gfx_entity_size_set(Eo *obj, Elm_Notify_Data *sd, Eina_Size2D sz)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2017-09-15 02:37:25 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, sz.w, sz.h))
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
return;
|
2016-03-04 15:42:57 -08:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2016-03-04 15:42:57 -08:00
|
|
|
if (!sd->parent && sd->content)
|
|
|
|
{
|
2017-09-14 20:14:32 -07:00
|
|
|
Eina_Position2D pos;
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
pos = efl_gfx_entity_position_get(obj);
|
2017-09-15 02:37:25 -07:00
|
|
|
_notify_move_to_orientation(obj, pos.x, pos.y, sz.w, sz.h);
|
2016-03-04 15:42:57 -08:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2010-08-18 12:18:42 -07:00
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_notify_efl_gfx_entity_position_set(Eo *obj, Elm_Notify_Data *sd, Eina_Position2D pos)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2017-09-14 20:14:32 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
|
2016-10-10 20:39:05 -07:00
|
|
|
return;
|
2016-03-04 15:42:57 -08:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2016-03-04 15:42:57 -08:00
|
|
|
if (!sd->parent && sd->content)
|
|
|
|
{
|
2016-10-10 20:39:05 -07:00
|
|
|
Evas_Coord w, h;
|
|
|
|
|
2016-03-04 15:42:57 -08:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
2017-09-14 20:14:32 -07:00
|
|
|
_notify_move_to_orientation(obj, pos.x, pos.y, w, h);
|
2016-03-04 15:42:57 -08:00
|
|
|
}
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
static Eina_Bool
|
2009-09-23 04:15:55 -07:00
|
|
|
_timer_cb(void *data)
|
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
|
|
|
ELM_NOTIFY_DATA_GET(obj, sd);
|
|
|
|
|
2013-01-22 21:29:31 -08:00
|
|
|
sd->timer = NULL;
|
2012-07-18 14:03:58 -07:00
|
|
|
if (!evas_object_visible_get(obj)) goto end;
|
|
|
|
|
2015-11-20 03:11:30 -08:00
|
|
|
evas_object_hide(obj);
|
notify: fix hide animation logic for popup
Summary:
When popup is timeout, notify call hide func, and send time out event to popup.
After popup receiving time out event, popup hide object again,
so hide animation doesn't show.
And notify hide function doesn't send hide signal to block events part,
(but dismiss function send it)
So add that signal.
Test Plan:
1. elementary_test -to popup
2. click first item, "popup+center+text"
3. compare time out event before this patch and after.
@fix
Reviewers: herb, singh.amitesh, Hermet, cedric, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4780
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-04-12 14:25:51 -07:00
|
|
|
sd->in_timeout = EINA_TRUE;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_NOTIFY_EVENT_TIMEOUT, NULL);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2012-07-18 14:03:58 -07:00
|
|
|
end:
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:23:54 -07:00
|
|
|
static void
|
2012-05-03 15:44:51 -07:00
|
|
|
_timer_init(Evas_Object *obj,
|
2014-03-24 23:25:02 -07:00
|
|
|
Elm_Notify_Data *sd)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(sd->timer);
|
2012-06-08 00:20:39 -07:00
|
|
|
if (sd->timeout > 0.0)
|
2012-05-03 15:44:51 -07:00
|
|
|
sd->timer = ecore_timer_add(sd->timeout, _timer_cb, obj);
|
2013-06-24 16:11:48 -07:00
|
|
|
else
|
|
|
|
sd->timer = NULL;
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2016-10-10 02:59:42 -07:00
|
|
|
static void
|
|
|
|
_elm_notify_show(Eo *obj, Elm_Notify_Data *sd)
|
2010-09-27 14:13:45 -07:00
|
|
|
{
|
2013-08-21 13:16:07 -07:00
|
|
|
sd->had_hidden = EINA_FALSE;
|
|
|
|
sd->in_timeout = EINA_FALSE;
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_TRUE);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
|
|
|
evas_object_show(sd->notify);
|
|
|
|
if (!sd->allow_events) evas_object_show(sd->block_events);
|
|
|
|
_timer_init(obj, sd);
|
2011-08-03 04:46:23 -07:00
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
2010-09-27 14:13:45 -07:00
|
|
|
}
|
|
|
|
|
2016-10-10 02:59:42 -07:00
|
|
|
static void
|
|
|
|
_elm_notify_hide(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2013-08-21 13:16:07 -07:00
|
|
|
const char *hide_signal;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2013-08-21 13:16:07 -07:00
|
|
|
if (sd->had_hidden && !sd->in_timeout)
|
|
|
|
return;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2013-08-22 07:29:35 -07:00
|
|
|
hide_signal = edje_object_data_get(sd->notify, "hide_finished_signal");
|
2016-10-10 02:59:42 -07:00
|
|
|
if (eina_streq(hide_signal, "on"))
|
2013-08-21 13:16:07 -07:00
|
|
|
{
|
|
|
|
if (!sd->in_timeout)
|
notify: fix hide animation logic for popup
Summary:
When popup is timeout, notify call hide func, and send time out event to popup.
After popup receiving time out event, popup hide object again,
so hide animation doesn't show.
And notify hide function doesn't send hide signal to block events part,
(but dismiss function send it)
So add that signal.
Test Plan:
1. elementary_test -to popup
2. click first item, "popup+center+text"
3. compare time out event before this patch and after.
@fix
Reviewers: herb, singh.amitesh, Hermet, cedric, raster, jpeg
Differential Revision: https://phab.enlightenment.org/D4780
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-04-12 14:25:51 -07:00
|
|
|
{
|
|
|
|
elm_layout_signal_emit(sd->block_events, "elm,state,hide", "elm");
|
|
|
|
edje_object_signal_emit(sd->notify, "elm,state,hide", "elm");
|
|
|
|
}
|
2013-08-21 13:16:07 -07:00
|
|
|
}
|
|
|
|
else //for backport supporting: edc without emitting hide finished signal
|
|
|
|
{
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), EINA_FALSE);
|
2013-08-21 13:16:07 -07:00
|
|
|
evas_object_hide(sd->notify);
|
|
|
|
if (sd->allow_events) evas_object_hide(sd->block_events);
|
|
|
|
}
|
2013-05-29 05:04:49 -07:00
|
|
|
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2016-10-10 02:59:42 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_notify_efl_gfx_entity_visible_set(Eo *obj, Elm_Notify_Data *sd, Eina_Bool vis)
|
2016-10-10 02:59:42 -07:00
|
|
|
{
|
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (vis) _elm_notify_show(obj, sd);
|
|
|
|
else _elm_notify_hide(obj, sd);
|
|
|
|
}
|
|
|
|
|
2009-10-22 15:10:23 -07:00
|
|
|
static void
|
2012-05-03 15:44:51 -07:00
|
|
|
_parent_del_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)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
elm elm_notify.c: Fixed parent_del routine. Remove callbacks when the
parent is deleted.
On Tue, May 22, 2012 at 4:46 PM, Sohyun Kim <anna1014.kim@samsung.com>
wrote:
>
> Hi all.
> When I use elm_notify, I got a crash in the deleting routine. (you
can test it in elementary_test > Video)
>
> When parent window of elm_notify is deleted, elm_notify set its
parent to NULL.
> However, it doesn't delete event callbacks of the parent window.
>
> In the smart_del callback of elm_notify, it tries to delete event
callbacks of parent window.
> However, its parent is already set to NULL, the deleting is skipped.
> Then the widget data gets freed.
> In this case, when other objects in the window are deleted, they can
create the parent window's event (e.g. CHANGED_SIZE_HINTS,,)
>
> Please find a patch to delete event callbacks when parent window is
deleted.
>
> Regards, Sohyun
SVN revision: 71307
2012-05-22 01:33:06 -07:00
|
|
|
elm_notify_parent_set(data, NULL);
|
2011-06-17 05:51:12 -07:00
|
|
|
evas_object_hide(data);
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-03 15:44:51 -07:00
|
|
|
_parent_hide_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)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2011-06-17 05:51:12 -07:00
|
|
|
evas_object_hide(data);
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_elm_notify_content_set(Eo *obj, Elm_Notify_Data *sd, const char *part, Evas_Object *content)
|
2011-10-28 21:32:24 -07:00
|
|
|
{
|
2014-03-24 23:25:02 -07:00
|
|
|
if (part && strcmp(part, "default")) return EINA_FALSE;
|
|
|
|
if (sd->content == content) return EINA_TRUE;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(sd->content);
|
2012-05-03 15:44:51 -07:00
|
|
|
sd->content = content;
|
2011-10-28 21:32:24 -07:00
|
|
|
|
|
|
|
if (content)
|
|
|
|
{
|
|
|
|
elm_widget_sub_object_add(obj, content);
|
2012-05-03 15:44:51 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints_cb, obj);
|
|
|
|
edje_object_part_swallow(sd->notify, "elm.swallow.content", content);
|
2011-10-28 21:32:24 -07:00
|
|
|
}
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2011-10-28 21:32:24 -07:00
|
|
|
_calc(obj);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
return EINA_TRUE;
|
2011-10-28 21:32:24 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_notify_content_get(const Eo *obj EINA_UNUSED, Elm_Notify_Data *sd, const char *part)
|
2011-10-28 21:32:24 -07:00
|
|
|
{
|
2014-03-24 23:25:02 -07:00
|
|
|
if (part && strcmp(part, "default")) return NULL;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
return sd->content;
|
2011-10-28 21:32:24 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
|
|
|
_elm_notify_content_unset(Eo *obj, Elm_Notify_Data *sd, const char *part)
|
2011-10-28 21:32:24 -07:00
|
|
|
{
|
|
|
|
Evas_Object *content;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
if (part && strcmp(part, "default")) return NULL;
|
|
|
|
if (!sd->content) return NULL;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
|
|
|
content = sd->content;
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, sd->content);
|
2012-05-03 15:44:51 -07:00
|
|
|
edje_object_part_unswallow(sd->notify, content);
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
return content;
|
2011-10-28 21:32:24 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-11-19 22:41:07 -08:00
|
|
|
_elm_notify_efl_content_content_set(Eo *obj, Elm_Notify_Data *sd, Evas_Object *content)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
2018-05-23 03:35:18 -07:00
|
|
|
return _elm_notify_content_set(obj, sd, "default", content);
|
2016-05-24 04:40:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Object*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_notify_efl_content_content_get(const Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
2018-05-23 03:35:18 -07:00
|
|
|
return _elm_notify_content_get(obj, sd, "default");
|
2016-05-24 04:40:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Object*
|
2017-11-19 22:41:07 -08:00
|
|
|
_elm_notify_efl_content_content_unset(Eo *obj, Elm_Notify_Data *sd)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
2018-05-23 03:35:18 -07:00
|
|
|
return _elm_notify_content_unset(obj, sd, "default");
|
2016-05-24 04:40:18 -07:00
|
|
|
}
|
|
|
|
|
2013-08-21 13:16:07 -07:00
|
|
|
static void
|
|
|
|
_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)
|
2013-08-21 13:16:07 -07:00
|
|
|
{
|
|
|
|
ELM_NOTIFY_DATA_GET(data, sd);
|
|
|
|
sd->had_hidden = EINA_TRUE;
|
|
|
|
evas_object_hide(sd->notify);
|
|
|
|
if (!sd->allow_events) evas_object_hide(sd->block_events);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(data, MY_CLASS), EINA_FALSE);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_NOTIFY_EVENT_DISMISSED, NULL);
|
2013-08-21 13:16:07 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_notify_efl_canvas_group_group_add(Eo *obj, Elm_Notify_Data *priv)
|
2012-05-03 15:44:51 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 22:19:19 -07:00
|
|
|
|
2012-05-03 15:44:51 -07:00
|
|
|
priv->allow_events = EINA_TRUE;
|
|
|
|
|
|
|
|
priv->notify = edje_object_add(evas_object_evas_get(obj));
|
2014-12-10 07:00:21 -08:00
|
|
|
evas_object_smart_member_add(priv->notify, obj);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2013-08-21 13:16:07 -07:00
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->notify, "elm,action,hide,finished", "elm", _hide_finished_cb, obj);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
2012-10-30 06:14:45 -07:00
|
|
|
elm_notify_align_set(obj, 0.5, 0.0);
|
2012-05-03 15:44:51 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_notify_efl_canvas_group_group_del(Eo *obj, Elm_Notify_Data *sd)
|
2012-05-03 15:44:51 -07:00
|
|
|
{
|
2013-08-21 13:16:07 -07:00
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->notify, "elm,action,hide,finished", "elm", _hide_finished_cb, obj);
|
2012-05-03 15:44:51 -07:00
|
|
|
elm_notify_parent_set(obj, NULL);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(sd->timer);
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2013-08-09 01:48:31 -07:00
|
|
|
ELM_SAFE_FREE(sd->notify, evas_object_del);
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-07-31 15:05:27 -07:00
|
|
|
}
|
|
|
|
|
2009-09-27 20:23:54 -07:00
|
|
|
EAPI Evas_Object *
|
2009-09-23 04:15:55 -07:00
|
|
|
elm_notify_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2009-09-23 04:15:55 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_notify_efl_object_constructor(Eo *obj, Elm_Notify_Data *sd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_NOTIFICATION);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2009-10-22 15:10:23 -07:00
|
|
|
EAPI void
|
2012-05-03 15:44:51 -07:00
|
|
|
elm_notify_parent_set(Evas_Object *obj,
|
|
|
|
Evas_Object *parent)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
ELM_NOTIFY_CHECK(obj);
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_parent_set(obj, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_notify_efl_ui_widget_widget_parent_set(Eo *obj, Elm_Notify_Data *sd, Evas_Object *parent)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
if (sd->parent)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints_cb, obj);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_RESIZE, _changed_size_hints_cb, obj);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_MOVE, _changed_size_hints_cb, obj);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_DEL, _parent_del_cb, obj);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->parent, EVAS_CALLBACK_HIDE, _parent_hide_cb, obj);
|
|
|
|
sd->parent = NULL;
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
2011-03-24 21:13:10 -07:00
|
|
|
|
2009-10-22 15:10:23 -07:00
|
|
|
if (parent)
|
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
sd->parent = parent;
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints_cb, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_RESIZE, _changed_size_hints_cb, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_MOVE, _changed_size_hints_cb, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_DEL, _parent_del_cb, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(parent, EVAS_CALLBACK_HIDE, _parent_hide_cb, obj);
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2009-09-23 06:05:00 -07:00
|
|
|
_calc(obj);
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2010-10-14 11:54:42 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_notify_parent_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
ELM_NOTIFY_CHECK(obj) NULL;
|
2012-11-25 22:32:53 -08:00
|
|
|
Evas_Object *ret = NULL;
|
2017-10-23 22:03:46 -07:00
|
|
|
ret = efl_ui_widget_parent_get((Eo *) obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
return ret;
|
|
|
|
}
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_notify_efl_ui_widget_widget_parent_get(const Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-24 23:25:02 -07:00
|
|
|
return sd->parent;
|
2010-10-14 11:54:42 -07:00
|
|
|
}
|
|
|
|
|
2012-10-30 06:14:45 -07:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-05-03 15:44:51 -07:00
|
|
|
elm_notify_orient_set(Evas_Object *obj,
|
|
|
|
Elm_Notify_Orient orient)
|
2009-09-23 04:15:55 -07:00
|
|
|
{
|
2012-10-30 06:44:24 -07:00
|
|
|
double horizontal = 0, vertical = 0;
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2012-10-30 06:44:24 -07:00
|
|
|
switch (orient)
|
2012-10-30 06:14:45 -07:00
|
|
|
{
|
|
|
|
case ELM_NOTIFY_ORIENT_TOP:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 0.5; vertical = 0.0;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_CENTER:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 0.5; vertical = 0.5;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_BOTTOM:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 0.5; vertical = 1.0;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_LEFT:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 0.0; vertical = 0.5;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_RIGHT:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 1.0; vertical = 0.5;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_TOP_LEFT:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 0.0; vertical = 0.0;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_TOP_RIGHT:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 1.0; vertical = 0.0;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 0.0; vertical = 1.0;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
|
2012-10-30 06:44:24 -07:00
|
|
|
horizontal = 1.0; vertical = 1.0;
|
2012-10-30 06:14:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ELM_NOTIFY_ORIENT_LAST:
|
|
|
|
break;
|
|
|
|
}
|
2012-10-30 06:44:24 -07:00
|
|
|
elm_notify_align_set(obj, horizontal, vertical);
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2012-10-30 06:14:45 -07:00
|
|
|
EINA_DEPRECATED EAPI Elm_Notify_Orient
|
2010-07-11 14:19:27 -07:00
|
|
|
elm_notify_orient_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-10-30 06:44:24 -07:00
|
|
|
Elm_Notify_Orient orient;
|
|
|
|
double horizontal, vertical;
|
|
|
|
|
|
|
|
elm_notify_align_get(obj, &horizontal, &vertical);
|
|
|
|
|
|
|
|
if ((horizontal == 0.5) && (vertical == 0.0))
|
2012-10-31 05:37:55 -07:00
|
|
|
orient = ELM_NOTIFY_ORIENT_TOP;
|
2012-10-30 06:44:24 -07:00
|
|
|
else if ((horizontal == 0.5) && (vertical == 0.5))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_CENTER;
|
|
|
|
else if ((horizontal == 0.5) && (vertical == 1.0))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_BOTTOM;
|
|
|
|
else if ((horizontal == 0.0) && (vertical == 0.5))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_LEFT;
|
|
|
|
else if ((horizontal == 1.0) && (vertical == 0.5))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_RIGHT;
|
|
|
|
else if ((horizontal == 0.0) && (vertical == 0.0))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_TOP_LEFT;
|
|
|
|
else if ((horizontal == 1.0) && (vertical == 0.0))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_TOP_RIGHT;
|
|
|
|
else if ((horizontal == 0.0) && (vertical == 1.0))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_BOTTOM_LEFT;
|
|
|
|
else if ((horizontal == 1.0) && (vertical == 1.0))
|
|
|
|
orient = ELM_NOTIFY_ORIENT_BOTTOM_RIGHT;
|
|
|
|
else
|
|
|
|
orient = ELM_NOTIFY_ORIENT_TOP;
|
2013-04-12 00:01:50 -07:00
|
|
|
|
|
|
|
return orient;
|
2010-07-11 14:19:27 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_notify_timeout_set(Eo *obj, Elm_Notify_Data *sd, double timeout)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
sd->timeout = timeout;
|
|
|
|
_timer_init(obj, sd);
|
2009-09-23 04:15:55 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static double
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_notify_timeout_get(const Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2014-03-24 23:25:02 -07:00
|
|
|
return sd->timeout;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_notify_allow_events_set(Eo *obj, Elm_Notify_Data *sd, Eina_Bool allow)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
if (allow == sd->allow_events) return;
|
|
|
|
sd->allow_events = allow;
|
2012-03-05 01:50:32 -08:00
|
|
|
if (!allow)
|
2009-10-22 15:10:23 -07:00
|
|
|
{
|
2012-05-03 15:44:51 -07:00
|
|
|
sd->block_events = elm_layout_add(obj);
|
2011-04-01 04:26:58 -07:00
|
|
|
_block_events_theme_apply(obj);
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, sd->block_events);
|
2014-12-10 07:00:21 -08:00
|
|
|
evas_object_stack_above(sd->notify, sd->block_events);
|
2012-05-03 15:44:51 -07:00
|
|
|
elm_layout_signal_callback_add
|
|
|
|
(sd->block_events, "elm,action,click", "elm",
|
|
|
|
_block_area_clicked_cb, obj);
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
|
|
|
else
|
2017-02-04 14:41:55 -08:00
|
|
|
{
|
|
|
|
evas_object_del(sd->block_events);
|
|
|
|
sd->block_events = NULL;
|
|
|
|
}
|
2009-10-22 15:10:23 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_notify_allow_events_get(const Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
|
2010-07-11 14:19:27 -07:00
|
|
|
{
|
2014-03-24 23:25:02 -07:00
|
|
|
return sd->allow_events;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:51 -07:00
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_notify_align_set(Eo *obj, Elm_Notify_Data *sd, double horizontal, double vertical)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-10-30 06:14:45 -07:00
|
|
|
sd->horizontal_align = horizontal;
|
|
|
|
sd->vertical_align = vertical;
|
|
|
|
|
|
|
|
_notify_theme_apply(obj);
|
|
|
|
_calc(obj);
|
|
|
|
}
|
|
|
|
|
2015-12-30 20:08:28 -08:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_notify_dismiss(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(sd->block_events, "elm,state,hide", "elm");
|
|
|
|
edje_object_signal_emit(sd->notify, "elm,state,hide", "elm");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_notify_align_get(const Eo *obj EINA_UNUSED, Elm_Notify_Data *sd, double *horizontal, double *vertical)
|
2012-10-30 06:14:45 -07:00
|
|
|
{
|
2013-04-12 00:01:50 -07:00
|
|
|
if (horizontal)
|
|
|
|
*horizontal = sd->horizontal_align;
|
|
|
|
if (vertical)
|
|
|
|
*vertical = sd->vertical_align;
|
2012-10-30 06:14:45 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_notify_class_constructor(Efl_Class *klass)
|
2014-03-24 23:25:02 -07: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-24 23:25:02 -07:00
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
/* Efl.Part begin */
|
|
|
|
|
2017-09-19 04:02:26 -07:00
|
|
|
ELM_PART_OVERRIDE(elm_notify, ELM_NOTIFY, Elm_Notify_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_SET(elm_notify, ELM_NOTIFY, Elm_Notify_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_GET(elm_notify, ELM_NOTIFY, Elm_Notify_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET(elm_notify, ELM_NOTIFY, Elm_Notify_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_GET(elm_notify, ELM_NOTIFY, Elm_Notify_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_UNSET(elm_notify, ELM_NOTIFY, Elm_Notify_Data)
|
2017-11-28 20:43:21 -08:00
|
|
|
ELM_PART_CONTENT_DEFAULT_GET(elm_notify, "default")
|
2017-09-25 00:12:28 -07:00
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-12-21 14:46:10 -08:00
|
|
|
_elm_notify_part_efl_ui_l10n_l10n_text_get(const Eo *obj, void *_pd EINA_UNUSED, const char **domain)
|
2017-09-25 00:12:28 -07:00
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
|
|
|
return elm_widget_part_translatable_text_get(pd->obj, pd->part, domain);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-12-21 14:46:10 -08:00
|
|
|
_elm_notify_part_efl_ui_l10n_l10n_text_set(Eo *obj, void *_pd EINA_UNUSED, const char *label, const char *domain)
|
2017-09-25 00:12:28 -07:00
|
|
|
{
|
|
|
|
Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
|
|
|
|
elm_widget_part_translatable_text_set(pd->obj, pd->part, label, domain);
|
|
|
|
}
|
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_notify_part.eo.c"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_NOTIFY_EXTRA_OPS \
|
2017-06-29 04:02:59 -07:00
|
|
|
ELM_PART_CONTENT_DEFAULT_OPS(elm_notify), \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_notify)
|
|
|
|
|
2014-03-24 23:25:02 -07:00
|
|
|
#include "elm_notify.eo.c"
|