2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
2010-01-26 00:17:26 -08:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2010-01-26 00:17:26 -08:00
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:05:33 -07:00
|
|
|
#include "elm_widget_mapbuf.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_container.h"
|
2016-05-17 05:16:27 -07:00
|
|
|
#include "elm_mapbuf.eo.h"
|
2010-01-26 00:17:26 -08: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_mapbuf_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_MAPBUF_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Mapbuf"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_mapbuf"
|
2010-01-26 00:17:26 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
2015-12-23 20:46:17 -08:00
|
|
|
Evas_Coord minw = 0, minh = 0;
|
2010-03-09 08:46:13 -08:00
|
|
|
Evas_Coord maxw = -1, maxh = -1;
|
2012-05-03 15:44:46 -07:00
|
|
|
|
|
|
|
ELM_MAPBUF_DATA_GET(obj, sd);
|
|
|
|
if (sd->content)
|
2010-01-26 00:17:26 -08:00
|
|
|
{
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(sd->content, &minw, &minh);
|
2012-05-03 15:44:46 -07:00
|
|
|
evas_object_size_hint_max_get(sd->content, &maxw, &maxh);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
|
|
|
}
|
|
|
|
|
2018-11-19 20:56:37 -08:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply_Result
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_mapbuf_efl_ui_widget_theme_apply(Eo *obj, Elm_Mapbuf_Data *sd EINA_UNUSED)
|
2012-05-03 15:44:46 -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:46 -07:00
|
|
|
|
|
|
|
_sizing_eval(obj);
|
|
|
|
|
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;
|
2012-05-03 15:44:46 -07:00
|
|
|
}
|
|
|
|
|
2010-01-26 00:17:26 -08:00
|
|
|
static void
|
2012-05-03 15:44:46 -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)
|
2010-01-26 00:17:26 -08:00
|
|
|
{
|
|
|
|
_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
2013-11-22 02:48:24 -08:00
|
|
|
static void
|
2016-05-24 04:40:18 -07:00
|
|
|
_elm_mapbuf_content_unset_internal(Elm_Mapbuf_Data *sd, Evas_Object *obj,
|
|
|
|
Evas_Object *content)
|
2013-11-22 02:48:24 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
evas_object_data_del(content, "_elm_leaveme");
|
|
|
|
evas_object_smart_member_del(content);
|
|
|
|
evas_object_clip_unset(content);
|
|
|
|
evas_object_color_set(wd->resize_obj, 0, 0, 0, 0);
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints_cb,
|
|
|
|
obj);
|
|
|
|
sd->content = NULL;
|
|
|
|
_sizing_eval(obj);
|
|
|
|
ELM_SAFE_FREE(sd->idler, ecore_idler_del);
|
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_mapbuf_efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Mapbuf_Data *sd, Evas_Object *sobj)
|
2010-01-26 00:17:26 -08: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:15:53 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-05-03 15:44:46 -07:00
|
|
|
|
|
|
|
if (sobj == sd->content)
|
2016-05-24 04:40:18 -07:00
|
|
|
_elm_mapbuf_content_unset_internal(sd, (Evas_Object *)obj, sobj);
|
2014-03-24 23:15:53 -07:00
|
|
|
return EINA_TRUE;
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(Evas_Object *obj)
|
2010-01-26 00:17:26 -08:00
|
|
|
{
|
2012-05-03 15:44:46 -07:00
|
|
|
ELM_MAPBUF_DATA_GET(obj, sd);
|
2013-10-05 01:14:52 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2012-11-28 22:51:30 -08:00
|
|
|
if (!sd->content) return;
|
2013-12-20 03:15:16 -08:00
|
|
|
if (sd->enabled && !evas_object_visible_get(obj)) return;
|
2013-09-27 05:52:10 -07:00
|
|
|
|
2013-09-29 02:57:10 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
2013-12-20 04:08:24 -08:00
|
|
|
int i;
|
2012-11-28 22:51:30 -08:00
|
|
|
evas_object_geometry_get(wd->resize_obj, &x, &y, &w, &h);
|
2013-09-27 05:52:10 -07:00
|
|
|
|
2013-09-29 02:57:10 -07:00
|
|
|
if (sd->enabled)
|
2012-11-28 22:51:30 -08:00
|
|
|
{
|
2014-02-03 17:21:04 -08:00
|
|
|
if (!sd->map) sd->map = evas_map_new(4);
|
|
|
|
evas_map_util_points_populate_from_geometry(sd->map, x, y, w, h, 0);
|
2013-12-20 04:08:24 -08:00
|
|
|
for (i = 0; i < (int)(sizeof(sd->colors)/sizeof(sd->colors[0])); i++)
|
|
|
|
{
|
2014-02-03 17:21:04 -08:00
|
|
|
evas_map_point_color_set(sd->map, i, sd->colors[i].r,
|
|
|
|
sd->colors[i].g, sd->colors[i].b,
|
|
|
|
sd->colors[i].a);
|
2013-12-20 04:08:24 -08:00
|
|
|
}
|
|
|
|
|
2014-02-03 17:21:04 -08:00
|
|
|
evas_map_smooth_set(sd->map, sd->smooth);
|
|
|
|
evas_map_alpha_set(sd->map, sd->alpha);
|
|
|
|
evas_object_map_set(sd->content, sd->map);
|
2013-09-29 02:57:10 -07:00
|
|
|
evas_object_map_enable_set(sd->content, EINA_TRUE);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
2013-09-29 02:57:10 -07:00
|
|
|
else
|
|
|
|
evas_object_move(sd->content, x, y);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
|
|
|
|
2013-04-09 05:01:42 -07:00
|
|
|
static void
|
2014-03-24 23:15:53 -07:00
|
|
|
_mapbuf_auto_eval(Evas_Object *obj, Elm_Mapbuf_Data *sd)
|
2013-04-09 05:01:42 -07:00
|
|
|
{
|
|
|
|
Eina_Bool vis;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Coord vx, vy, vw, vh;
|
|
|
|
Eina_Bool on = EINA_FALSE;
|
2013-04-22 00:56:40 -07:00
|
|
|
|
|
|
|
if (!sd->automode) return ;
|
2013-04-09 05:01:42 -07:00
|
|
|
vis = evas_object_visible_get(obj);
|
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
2013-04-21 22:04:01 -07:00
|
|
|
evas_output_viewport_get(evas_object_evas_get(obj), &vx, &vy, &vw, &vh);
|
2013-04-09 05:01:42 -07:00
|
|
|
if ((vis) && (ELM_RECTS_INTERSECT(x, y, w, h, vx, vy, vw, vh)))
|
|
|
|
on = EINA_TRUE;
|
|
|
|
elm_mapbuf_enabled_set(obj, on);
|
|
|
|
}
|
|
|
|
|
2013-04-22 00:56:40 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_mapbuf_move_end(void *data)
|
|
|
|
{
|
2014-03-24 23:15:53 -07:00
|
|
|
Elm_Mapbuf_Data *sd = data;
|
2013-04-22 00:56:40 -07:00
|
|
|
|
|
|
|
elm_mapbuf_smooth_set(sd->self, sd->smooth_saved);
|
|
|
|
sd->idler = NULL;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-03-24 23:15:53 -07:00
|
|
|
_mapbuf_auto_smooth(Evas_Object *obj EINA_UNUSED, Elm_Mapbuf_Data *sd)
|
2013-04-22 00:56:40 -07:00
|
|
|
{
|
|
|
|
if (!sd->automode) return ;
|
|
|
|
if (!sd->idler) sd->idler = ecore_idler_add(_mapbuf_move_end, sd);
|
|
|
|
sd->smooth = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_mapbuf_efl_gfx_entity_position_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Position2D pos)
|
2010-01-26 00:17:26 -08: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;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
_mapbuf_auto_eval(obj, sd);
|
|
|
|
_mapbuf_auto_smooth(obj, sd);
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_mapbuf_efl_gfx_entity_size_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Size2D sz)
|
2011-04-01 04:26:58 -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;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2017-09-15 02:37:25 -07:00
|
|
|
if (sd->content)
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(sd->content, sz);
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
_mapbuf_auto_eval(obj, sd);
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2013-04-09 05:01:42 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_mapbuf_efl_gfx_entity_visible_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Bool vis)
|
2013-04-09 05:01:42 -07:00
|
|
|
{
|
2016-10-10 02:59:42 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
|
|
|
|
return;
|
2013-04-09 05:01:42 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis);
|
2013-04-09 05:01:42 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
_mapbuf_auto_eval(obj, sd);
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_elm_mapbuf_content_set(Eo *obj, Elm_Mapbuf_Data *sd, const char *part, Evas_Object *content)
|
2011-10-28 21:32:24 -07:00
|
|
|
{
|
2014-03-24 23:15:53 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
if (part && strcmp(part, "default")) return EINA_FALSE;
|
|
|
|
if (sd->content == content) return EINA_TRUE;
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(sd->content);
|
2012-05-03 15:44:46 -07:00
|
|
|
sd->content = content;
|
|
|
|
|
2011-10-28 21:32:24 -07:00
|
|
|
if (content)
|
|
|
|
{
|
|
|
|
evas_object_data_set(content, "_elm_leaveme", (void *)1);
|
2012-02-08 01:02:57 -08:00
|
|
|
elm_widget_sub_object_add(obj, content);
|
2011-10-28 21:32:24 -07:00
|
|
|
evas_object_smart_member_add(content, obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_clip_set(content, wd->resize_obj);
|
2012-05-03 15:44:46 -07:00
|
|
|
evas_object_color_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, 255, 255, 255, 255);
|
2012-05-03 15:44:46 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints_cb, obj);
|
2011-10-28 21:32:24 -07:00
|
|
|
}
|
|
|
|
else
|
2012-11-25 22:32:53 -08:00
|
|
|
evas_object_color_set(wd->resize_obj, 0, 0, 0, 0);
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2011-10-28 21:32:24 -07:00
|
|
|
_sizing_eval(obj);
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2014-03-24 23:15:53 -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_mapbuf_content_get(const Eo *obj EINA_UNUSED, Elm_Mapbuf_Data *sd, const char *part)
|
2011-10-28 21:32:24 -07:00
|
|
|
{
|
2014-03-24 23:15:53 -07:00
|
|
|
if (part && strcmp(part, "default")) return NULL;
|
|
|
|
return sd->content;
|
2011-10-28 21:32:24 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
|
|
|
_elm_mapbuf_content_unset(Eo *obj, Elm_Mapbuf_Data *sd, const char *part)
|
2011-10-28 21:32:24 -07:00
|
|
|
{
|
|
|
|
Evas_Object *content;
|
2014-03-24 23:15:53 -07:00
|
|
|
if (part && strcmp(part, "default")) return NULL;
|
|
|
|
if (!sd->content) return NULL;
|
2012-05-03 15:44:46 -07:00
|
|
|
|
|
|
|
content = sd->content;
|
2016-05-29 17:47:39 -07:00
|
|
|
_elm_widget_sub_object_redirect_to_top(obj, content);
|
2016-05-24 04:40:18 -07:00
|
|
|
_elm_mapbuf_content_unset_internal(sd, obj, content);
|
2014-03-24 23:15:53 -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_mapbuf_efl_content_content_set(Eo *obj, Elm_Mapbuf_Data *sd, Evas_Object *content)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
|
|
|
return _elm_mapbuf_content_set(obj, sd, NULL, content);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Object*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_mapbuf_efl_content_content_get(const Eo *obj, Elm_Mapbuf_Data *sd)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
|
|
|
return _elm_mapbuf_content_get(obj, sd, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Object*
|
2017-11-19 22:41:07 -08:00
|
|
|
_elm_mapbuf_efl_content_content_unset(Eo *obj, Elm_Mapbuf_Data *sd)
|
2016-05-24 04:40:18 -07:00
|
|
|
{
|
|
|
|
return _elm_mapbuf_content_unset(obj, sd, NULL);
|
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_mapbuf_efl_canvas_group_group_del(Eo *obj, Elm_Mapbuf_Data *priv)
|
2014-02-03 17:21:04 -08:00
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(priv->idler, ecore_idler_del);
|
|
|
|
ELM_SAFE_FREE(priv->map, evas_map_free);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2014-02-03 17:21:04 -08:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_mapbuf_efl_canvas_group_group_add(Eo *obj, Elm_Mapbuf_Data *priv)
|
2012-05-03 15:44:46 -07:00
|
|
|
{
|
2013-02-16 05:39:59 -08:00
|
|
|
Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(obj));
|
2013-12-20 04:08:24 -08:00
|
|
|
int i;
|
|
|
|
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, rect);
|
2012-05-03 15:44:46 -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
|
|
|
|
2013-02-16 05:39:59 -08:00
|
|
|
evas_object_static_clip_set(rect, EINA_TRUE);
|
|
|
|
evas_object_pass_events_set(rect, EINA_TRUE);
|
|
|
|
evas_object_color_set(rect, 0, 0, 0, 0);
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2013-12-20 04:08:24 -08:00
|
|
|
for (i = 0; i < (int)(sizeof(priv->colors)/sizeof(priv->colors[0])); i++)
|
|
|
|
{
|
|
|
|
priv->colors[i].r = 255;
|
|
|
|
priv->colors[i].g = 255;
|
|
|
|
priv->colors[i].b = 255;
|
|
|
|
priv->colors[i].a = 255;
|
|
|
|
}
|
|
|
|
|
2013-04-22 00:56:40 -07:00
|
|
|
priv->self = obj;
|
2012-11-26 23:48:16 -08:00
|
|
|
priv->alpha = EINA_TRUE;
|
|
|
|
priv->smooth = EINA_TRUE;
|
2012-05-03 15:44:46 -07:00
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
|
|
|
|
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2010-01-26 00:17:26 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_mapbuf_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:44:46 -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
|
|
|
}
|
2010-01-26 00:17:26 -08:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_mapbuf_efl_object_constructor(Eo *obj, Elm_Mapbuf_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_IMAGE_MAP);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2014-03-24 23:15:53 -07:00
|
|
|
_internal_enable_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Bool enabled)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:46 -07:00
|
|
|
if (sd->enabled == enabled) return;
|
|
|
|
sd->enabled = enabled;
|
|
|
|
|
2013-09-27 05:55:59 -07:00
|
|
|
if (!sd->enabled && sd->content)
|
|
|
|
{
|
|
|
|
evas_object_map_set(sd->content, NULL);
|
|
|
|
evas_object_map_enable_set(sd->content, EINA_FALSE);
|
|
|
|
}
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2013-04-22 00:56:40 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_mapbuf_enabled_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Bool enabled)
|
2013-04-22 00:56:40 -07:00
|
|
|
{
|
|
|
|
_internal_enable_set(obj, sd, enabled);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_mapbuf_enabled_get(const Eo *obj EINA_UNUSED, Elm_Mapbuf_Data *sd)
|
2010-01-26 00:17:26 -08:00
|
|
|
{
|
2014-03-24 23:15:53 -07:00
|
|
|
return sd->enabled;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_mapbuf_smooth_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Bool smooth)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:46 -07:00
|
|
|
if (sd->smooth == smooth) return;
|
|
|
|
sd->smooth = smooth;
|
2013-04-22 00:56:40 -07:00
|
|
|
sd->smooth_saved = smooth;
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_mapbuf_smooth_get(const Eo *obj EINA_UNUSED, Elm_Mapbuf_Data *sd)
|
2010-01-26 00:17:26 -08:00
|
|
|
{
|
2014-03-24 23:15:53 -07:00
|
|
|
return sd->smooth;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:44:46 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_mapbuf_alpha_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Bool alpha)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:44:46 -07:00
|
|
|
if (sd->alpha == alpha) return;
|
|
|
|
sd->alpha = alpha;
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_mapbuf_alpha_get(const Eo *obj EINA_UNUSED, Elm_Mapbuf_Data *sd)
|
2013-04-09 05:01:42 -07:00
|
|
|
{
|
2014-03-24 23:15:53 -07:00
|
|
|
return sd->alpha;
|
2013-04-09 05:01:42 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_mapbuf_auto_set(Eo *obj, Elm_Mapbuf_Data *sd, Eina_Bool on)
|
2013-04-09 05:01:42 -07:00
|
|
|
{
|
|
|
|
if (sd->automode == on) return;
|
|
|
|
sd->automode = on;
|
|
|
|
if (on)
|
|
|
|
{
|
2013-04-22 00:56:40 -07:00
|
|
|
_mapbuf_auto_eval(obj, sd);
|
2013-04-09 05:01:42 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-29 05:04:07 -07:00
|
|
|
ELM_SAFE_FREE(sd->idler, ecore_idler_del);
|
2013-04-22 00:56:40 -07:00
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
_internal_enable_set(obj, sd, EINA_FALSE);
|
2013-04-09 05:01:42 -07:00
|
|
|
}
|
2013-09-29 02:57:10 -07:00
|
|
|
_configure(obj);
|
2013-04-09 05:01:42 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_mapbuf_auto_get(const Eo *obj EINA_UNUSED, Elm_Mapbuf_Data *sd)
|
2013-04-09 05:01:42 -07:00
|
|
|
{
|
2014-03-24 23:15:53 -07:00
|
|
|
return sd->automode;
|
2013-04-09 05:01:42 -07:00
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_mapbuf_point_color_get(const Eo *obj EINA_UNUSED, Elm_Mapbuf_Data *sd, int idx, int *r, int *g, int *b, int *a)
|
2013-04-09 05:01:42 -07:00
|
|
|
{
|
2014-01-10 00:54:51 -08:00
|
|
|
if ((idx < 0) || (idx >= 4))
|
|
|
|
{
|
|
|
|
ERR("idx value should be 0 ~ 4");
|
|
|
|
return;
|
|
|
|
}
|
2013-12-20 04:08:24 -08:00
|
|
|
*r = sd->colors[idx].r;
|
|
|
|
*g = sd->colors[idx].g;
|
|
|
|
*b = sd->colors[idx].b;
|
|
|
|
*a =sd->colors[idx].a;
|
|
|
|
}
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_mapbuf_point_color_set(Eo *obj EINA_UNUSED, Elm_Mapbuf_Data *sd, int idx, int r, int g, int b, int a)
|
2013-12-20 04:08:24 -08:00
|
|
|
{
|
2014-01-10 00:54:51 -08:00
|
|
|
if ((idx < 0) || (idx >= 4))
|
|
|
|
{
|
|
|
|
ERR("idx value should be 0 ~ 4");
|
|
|
|
return;
|
|
|
|
}
|
2013-12-20 04:08:24 -08:00
|
|
|
sd->colors[idx].r = r;
|
|
|
|
sd->colors[idx].g = g;
|
|
|
|
sd->colors[idx].b = b;
|
|
|
|
sd->colors[idx].a = a;
|
|
|
|
|
|
|
|
_configure(obj);
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_mapbuf_class_constructor(Efl_Class *klass)
|
2014-03-24 23:15:53 -07:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2010-01-26 00:17:26 -08:00
|
|
|
}
|
2014-03-24 23:15:53 -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_mapbuf, ELM_MAPBUF, Elm_Mapbuf_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET(elm_mapbuf, ELM_MAPBUF, Elm_Mapbuf_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_GET(elm_mapbuf, ELM_MAPBUF, Elm_Mapbuf_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_UNSET(elm_mapbuf, ELM_MAPBUF, Elm_Mapbuf_Data)
|
2017-11-28 20:43:21 -08:00
|
|
|
ELM_PART_CONTENT_DEFAULT_GET(elm_mapbuf, "default")
|
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_mapbuf_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_MAPBUF_EXTRA_OPS \
|
2017-06-29 04:02:59 -07:00
|
|
|
ELM_PART_CONTENT_DEFAULT_OPS(elm_mapbuf), \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_mapbuf)
|
|
|
|
|
2014-03-24 23:15:53 -07:00
|
|
|
#include "elm_mapbuf.eo.c"
|