efl_ui_bg: remove Efl.Ui.Bg interface and rename Efl.Ui.Bg_Widget class
Summary: Efl.Ui.Bg interface does not have any new property or method. Moreover, Efl.Ui.Bg interface is not used by widgets except Efl.Ui.Bg_Widget and Efl.Ui.Widget_Part_Bg. Consequently, Efl.Ui.Bg interface can be replaced by other interfaces. Due to Efl.Ui.Bg interface, the bg widget class name becomes Efl.UI.Bg_Widget which is not synchronized with other widget names. Therefore, to keep consistency with other widgets, it would be better to remove Efl.Ui.Bg interface and rename Efl.Ui.Bg_Widget to Efl.Ui.Bg. Reviewers: woohyun, segfaultxavi, bu5hm4n, zmike Reviewed By: segfaultxavi Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7304
This commit is contained in:
parent
ffb992cd4f
commit
0611620301
|
@ -4,7 +4,6 @@
|
|||
elm_public_eolian_files = \
|
||||
lib/elementary/efl_ui_widget.eo \
|
||||
lib/elementary/efl_ui_bg.eo \
|
||||
lib/elementary/efl_ui_bg_widget.eo \
|
||||
lib/elementary/efl_ui_button.eo \
|
||||
lib/elementary/efl_ui_calendar.eo \
|
||||
lib/elementary/efl_ui_calendar_item.eo \
|
||||
|
@ -174,7 +173,7 @@ elm_legacy_eolian_files = \
|
|||
lib/elementary/efl_ui_button_legacy.eo \
|
||||
lib/elementary/efl_ui_check_legacy.eo \
|
||||
lib/elementary/efl_ui_radio_legacy.eo \
|
||||
lib/elementary/efl_ui_bg_widget_legacy.eo \
|
||||
lib/elementary/efl_ui_bg_legacy.eo \
|
||||
lib/elementary/efl_ui_video_legacy.eo \
|
||||
lib/elementary/efl_ui_frame_legacy.eo \
|
||||
lib/elementary/efl_ui_panes_legacy.eo \
|
||||
|
@ -338,7 +337,7 @@ includesunstable_HEADERS = \
|
|||
lib/elementary/elm_widget_box.h \
|
||||
lib/elementary/elm_widget_bubble.h \
|
||||
lib/elementary/efl_ui_button_private.h \
|
||||
lib/elementary/efl_ui_bg_widget_private.h \
|
||||
lib/elementary/efl_ui_bg_private.h \
|
||||
lib/elementary/elm_widget_calendar.h \
|
||||
lib/elementary/efl_ui_calendar_private.h \
|
||||
lib/elementary/efl_ui_check_private.h \
|
||||
|
@ -686,7 +685,6 @@ lib_elementary_libelementary_la_SOURCES = \
|
|||
lib/elementary/elm_atspi_bridge.c \
|
||||
lib/elementary/efl_ui_legacy.c \
|
||||
lib/elementary/efl_ui_bg.c \
|
||||
lib/elementary/efl_ui_bg_widget.c \
|
||||
lib/elementary/elm_box.c \
|
||||
lib/elementary/elm_bubble.c \
|
||||
lib/elementary/efl_ui_button.c \
|
||||
|
|
|
@ -408,7 +408,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
|
|||
efl_ui_win_autodel_set(efl_added, EINA_TRUE),
|
||||
efl_ui_win_alpha_set(efl_added, EINA_FALSE));
|
||||
|
||||
efl_add(EFL_UI_BG_WIDGET_CLASS, win,
|
||||
efl_add(EFL_UI_BG_CLASS, win,
|
||||
efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND),
|
||||
efl_content_set(win, efl_added));
|
||||
|
||||
|
@ -419,7 +419,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
|
|||
|
||||
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
|
||||
|
||||
o_bg = efl_add(EFL_UI_BG_WIDGET_CLASS, box,
|
||||
o_bg = efl_add(EFL_UI_BG_CLASS, box,
|
||||
efl_file_set(efl_added, buf, NULL),
|
||||
efl_gfx_size_hint_weight_set(efl_added, EFL_GFX_SIZE_HINT_EXPAND, EFL_GFX_SIZE_HINT_EXPAND),
|
||||
efl_gfx_size_hint_align_set(efl_added, EFL_GFX_SIZE_HINT_FILL, EFL_GFX_SIZE_HINT_FILL),
|
||||
|
|
|
@ -135,7 +135,7 @@ test_part_background(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
content_class[9] = EFL_UI_FLIP_CLASS;
|
||||
content_class[10] = EFL_UI_PANES_CLASS;
|
||||
content_class[11] = EFL_UI_VIDEO_CLASS;
|
||||
content_class[12] = EFL_UI_BG_WIDGET_CLASS;
|
||||
content_class[12] = EFL_UI_BG_CLASS;
|
||||
content_class[13] = EFL_UI_IMAGE_CLASS;
|
||||
content_class[14] = EFL_UI_IMAGE_ZOOMABLE_CLASS;
|
||||
content_class[15] = EFL_UI_NSTATE_CLASS;
|
||||
|
|
|
@ -29,7 +29,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev)
|
|||
else
|
||||
path = "performance/background.png";
|
||||
|
||||
efl::ui::Bg_Widget bg(instantiate, win);
|
||||
efl::ui::Bg bg(instantiate, win);
|
||||
bg.scale_type_set(EFL_GFX_IMAGE_SCALE_TYPE_FILL);
|
||||
bg.file_set(path, nullptr);
|
||||
win.content_set(bg);
|
||||
|
|
|
@ -180,7 +180,6 @@ typedef Eo Efl_Ui_Focus_Manager;
|
|||
# include <efl_ui_layout_part_table.eo.h>
|
||||
# include <efl_ui_win_part.eo.h>
|
||||
# include <efl_ui_bg.eo.h>
|
||||
# include <efl_ui_bg_widget.eo.h>
|
||||
# include <efl_ui_box.eo.h>
|
||||
# include <efl_ui_box_flow.eo.h>
|
||||
# include <efl_ui_box_stack.eo.h>
|
||||
|
|
|
@ -294,7 +294,6 @@ typedef Eo Efl_Ui_Focus_Manager;
|
|||
# include <efl_ui_layout_part_table.eo.h>
|
||||
# include <efl_ui_win_part.eo.h>
|
||||
# include <efl_ui_bg.eo.h>
|
||||
# include <efl_ui_bg_widget.eo.h>
|
||||
# include <efl_ui_box.eo.h>
|
||||
# include <efl_ui_box_flow.eo.h>
|
||||
# include <efl_ui_box_stack.eo.h>
|
||||
|
|
|
@ -2,7 +2,294 @@
|
|||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#define EFL_ACCESS_OBJECT_PROTECTED
|
||||
#define ELM_LAYOUT_PROTECTED
|
||||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
#include "efl_ui_bg_private.h"
|
||||
|
||||
#define MY_CLASS EFL_UI_BG_CLASS
|
||||
#define MY_CLASS_PFX efl_ui_bg
|
||||
|
||||
#define MY_CLASS_NAME "Efl.Ui.Bg"
|
||||
|
||||
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
||||
{
|
||||
{"overlay", "elm.swallow.content"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_ui_bg_efl_object_constructor(Eo *obj, Efl_Ui_Bg_Data *pd)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "bg");
|
||||
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
||||
if (!elm_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
pd->rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj,
|
||||
efl_gfx_color_set(efl_added, 0, 0, 0, 0),
|
||||
efl_content_set(efl_part(obj, "elm.swallow.rectangle"), efl_added));
|
||||
|
||||
pd->img = efl_add(EFL_UI_IMAGE_CLASS, obj,
|
||||
efl_gfx_image_scale_type_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE),
|
||||
efl_content_set(efl_part(obj, "elm.swallow.background"), efl_added));
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj,
|
||||
efl_gfx_color_set(efl_added, 0, 0, 0, 0),
|
||||
efl_content_set(efl_part(obj, "efl.rectangle"), efl_added));
|
||||
|
||||
pd->img = efl_add(EFL_UI_IMAGE_CLASS, obj,
|
||||
efl_gfx_image_scale_type_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE),
|
||||
efl_content_set(efl_part(obj, "efl.background"), efl_added));
|
||||
}
|
||||
pd->file = NULL;
|
||||
pd->key = NULL;
|
||||
|
||||
efl_access_object_access_type_set(obj, EFL_ACCESS_TYPE_DISABLED);
|
||||
|
||||
efl_ui_widget_focus_allow_set(obj, EINA_FALSE);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_efl_object_destructor(Eo *obj, Efl_Ui_Bg_Data *sd)
|
||||
{
|
||||
ELM_SAFE_FREE(sd->file, eina_stringshare_del);
|
||||
ELM_SAFE_FREE(sd->key, eina_stringshare_del);
|
||||
|
||||
efl_destructor(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_option_set(Evas_Object *obj, Elm_Bg_Option option)
|
||||
{
|
||||
Efl_Gfx_Image_Scale_Type type;
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case ELM_BG_OPTION_CENTER:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_NONE;
|
||||
break;
|
||||
case ELM_BG_OPTION_SCALE:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE;
|
||||
break;
|
||||
case ELM_BG_OPTION_TILE:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_TILE;
|
||||
break;
|
||||
case ELM_BG_OPTION_STRETCH:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_FILL;
|
||||
break;
|
||||
case ELM_BG_OPTION_LAST:
|
||||
default:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE;
|
||||
}
|
||||
efl_gfx_image_scale_type_set(obj, type);
|
||||
}
|
||||
|
||||
EAPI Elm_Bg_Option
|
||||
elm_bg_option_get(const Evas_Object *obj)
|
||||
{
|
||||
Efl_Gfx_Image_Scale_Type type;
|
||||
Elm_Bg_Option option = ELM_BG_OPTION_LAST;
|
||||
|
||||
type = efl_gfx_image_scale_type_get(obj);
|
||||
switch (type)
|
||||
{
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_NONE:
|
||||
option = ELM_BG_OPTION_CENTER;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE:
|
||||
option = ELM_BG_OPTION_SCALE;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_TILE:
|
||||
option = ELM_BG_OPTION_TILE;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_FILL:
|
||||
option = ELM_BG_OPTION_STRETCH;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_FIT_INSIDE:
|
||||
default:
|
||||
ERR("Scale type %d cannot be converted to Elm_Bg_Option", type);
|
||||
break;
|
||||
}
|
||||
|
||||
return option;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_efl_gfx_image_scale_type_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, Efl_Gfx_Image_Scale_Type scale_type)
|
||||
{
|
||||
efl_gfx_image_scale_type_set(sd->img, scale_type);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Gfx_Image_Scale_Type
|
||||
_efl_ui_bg_efl_gfx_image_scale_type_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd)
|
||||
{
|
||||
return efl_gfx_image_scale_type_get(sd->img);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_color_set(Evas_Object *obj,
|
||||
int r,
|
||||
int g,
|
||||
int b)
|
||||
{
|
||||
int a = 255;
|
||||
EFL_UI_BG_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
// reset color
|
||||
if ((r == -1) && (g == -1) && (b == -1))
|
||||
{
|
||||
r = g = b = a = 0;
|
||||
}
|
||||
efl_gfx_color_set(sd->rect, r, g, b, a);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_efl_gfx_color_color_set(Eo *obj, Efl_Ui_Bg_Data *sd, int r, int g, int b, int a)
|
||||
{
|
||||
efl_gfx_color_set(efl_super(obj, MY_CLASS), r, g, b, a);
|
||||
efl_gfx_color_set(sd->rect, r, g, b, a);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_color_get(const Evas_Object *obj,
|
||||
int *r,
|
||||
int *g,
|
||||
int *b)
|
||||
{
|
||||
EFL_UI_BG_CHECK(obj);
|
||||
efl_gfx_color_get((Eo *) obj, r, g, b, NULL);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_efl_gfx_color_color_get(const Eo *obj, Efl_Ui_Bg_Data *sd, int *r, int *g, int *b, int *a)
|
||||
{
|
||||
if (!sd->rect)
|
||||
efl_gfx_color_get(efl_super(obj, MY_CLASS), r, g, b, a);
|
||||
else
|
||||
efl_gfx_color_get(sd->rect, r, g, b, a);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_load_size_set(Evas_Object *obj, int w, int h)
|
||||
{
|
||||
EFL_UI_BG_DATA_GET_OR_RETURN(obj, sd);
|
||||
efl_gfx_image_load_controller_load_size_set(sd->img, EINA_SIZE2D(w, h));
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_efl_gfx_image_load_controller_load_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, Eina_Size2D sz)
|
||||
{
|
||||
efl_gfx_image_load_controller_load_size_set(sd->img, sz);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Size2D
|
||||
_efl_ui_bg_efl_gfx_image_load_controller_load_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd)
|
||||
{
|
||||
return efl_gfx_image_load_controller_load_size_get(sd->img);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_bg_file_set(Eo *obj, const char *file, const char *group)
|
||||
{
|
||||
return efl_file_set((Eo *) obj, file, group);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_bg_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd, const char *file, const char *key)
|
||||
{
|
||||
eina_stringshare_replace(&sd->file, file);
|
||||
eina_stringshare_replace(&sd->key, key);
|
||||
|
||||
return efl_file_set(sd->img, file, key);
|
||||
}
|
||||
EAPI void
|
||||
elm_bg_file_get(const Eo *obj, const char **file, const char **group)
|
||||
{
|
||||
efl_file_get((Eo *) obj, file, group);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_efl_file_file_get(const Eo *obj, Efl_Ui_Bg_Data *sd, const char **file, const char **key)
|
||||
{
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
if (file) *file = sd->file;
|
||||
if (key) *key = sd->key;
|
||||
return;
|
||||
}
|
||||
|
||||
efl_file_get(sd->img, file, key);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_bg_efl_file_mmap_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd,
|
||||
const Eina_File *file, const char *key)
|
||||
{
|
||||
return efl_file_mmap_set(sd->img, file, key);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Data *sd,
|
||||
const Eina_File **file, const char **key)
|
||||
{
|
||||
efl_file_mmap_get(sd->img, file, key);
|
||||
}
|
||||
|
||||
/* Internal EO APIs and hidden overrides */
|
||||
|
||||
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
||||
|
||||
#define EFL_UI_BG_EXTRA_OPS \
|
||||
ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX)
|
||||
|
||||
#include "efl_ui_bg.eo.c"
|
||||
|
||||
|
||||
#include "efl_ui_bg_legacy.eo.h"
|
||||
|
||||
#define MY_CLASS_NAME_LEGACY "elm_bg"
|
||||
|
||||
static void
|
||||
_efl_ui_bg_legacy_class_constructor(Efl_Class *klass)
|
||||
{
|
||||
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_ui_bg_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, EFL_UI_BG_LEGACY_CLASS));
|
||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
||||
EFL_UI_BG_DATA_GET_OR_RETURN_VAL(obj, pd, obj);
|
||||
efl_gfx_entity_scale_set(pd->img, 1.0);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_bg_add(Evas_Object *parent)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||
return elm_legacy_add(EFL_UI_BG_LEGACY_CLASS, parent);
|
||||
}
|
||||
|
||||
#include "efl_ui_bg_legacy.eo.c"
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
interface Efl.Ui.Bg (Efl.Interface, Efl.Gfx.Entity, Efl.Gfx.Image, Efl.File)
|
||||
class Efl.Ui.Bg (Efl.Ui.Layout, Efl.Gfx.Color, Efl.Gfx.Image, Efl.Gfx.Image_Load_Controller)
|
||||
{
|
||||
[[The bg (background) widget is used for setting (solid) background decorations
|
||||
|
||||
in a window (unless it has transparency enabled) or on any container object. It
|
||||
works just like an image but has some properties useful for backgrounds, such as
|
||||
for a window (unless it has transparency enabled) or for any container object. It
|
||||
works just like an image, but has some properties useful for backgrounds, such as
|
||||
setting it to tiled, centered, scaled or stretched.
|
||||
]]
|
||||
legacy_prefix: elm_bg;
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.File.file { get; set; }
|
||||
Efl.File.mmap { get; set; }
|
||||
Efl.Gfx.Color.color { get; set; }
|
||||
Efl.Gfx.Image.scale_type { get; set; }
|
||||
Efl.Gfx.Image_Load_Controller.load_size { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Ui.Bg_Widget_Legacy (Efl.Ui.Bg_Widget, Efl.Ui.Legacy)
|
||||
class Efl.Ui.Bg_Legacy (Efl.Ui.Bg, Efl.Ui.Legacy)
|
||||
{
|
||||
[[The bg (background) widget is used for setting (solid) background decorations
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
/**
|
||||
* Base layout smart data extended with bg instance data.
|
||||
*/
|
||||
typedef struct _Efl_Ui_Bg_Widget_Data Efl_Ui_Bg_Widget_Data;
|
||||
struct _Efl_Ui_Bg_Widget_Data
|
||||
typedef struct _Efl_Ui_Bg_Data Efl_Ui_Bg_Data;
|
||||
struct _Efl_Ui_Bg_Data
|
||||
{
|
||||
Evas_Object *rect; /*<< Used for elm_bg_color_set(): elm.swallow.rectangle */
|
||||
Evas_Object *img; /*<< Used for elm_bg_file_set(): elm.swallow.content */
|
||||
|
@ -36,11 +36,11 @@ struct _Efl_Ui_Bg_Widget_Data
|
|||
* @}
|
||||
*/
|
||||
|
||||
#define EFL_UI_BG_WIDGET_DATA_GET(o, sd) \
|
||||
Efl_Ui_Bg_Widget_Data * sd = efl_data_scope_get(o, EFL_UI_BG_WIDGET_CLASS)
|
||||
#define EFL_UI_BG_DATA_GET(o, sd) \
|
||||
Efl_Ui_Bg_Data * sd = efl_data_scope_get(o, EFL_UI_BG_CLASS)
|
||||
|
||||
#define EFL_UI_BG_WIDGET_DATA_GET_OR_RETURN(o, ptr) \
|
||||
EFL_UI_BG_WIDGET_DATA_GET(o, ptr); \
|
||||
#define EFL_UI_BG_DATA_GET_OR_RETURN(o, ptr) \
|
||||
EFL_UI_BG_DATA_GET(o, ptr); \
|
||||
if (EINA_UNLIKELY(!ptr)) \
|
||||
{ \
|
||||
ERR("No widget data for object %p (%s)", \
|
||||
|
@ -48,8 +48,8 @@ Efl_Ui_Bg_Widget_Data * sd = efl_data_scope_get(o, EFL_UI_BG_WIDGET_CLASS)
|
|||
return; \
|
||||
}
|
||||
|
||||
#define EFL_UI_BG_WIDGET_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
|
||||
EFL_UI_BG_WIDGET_DATA_GET(o, ptr); \
|
||||
#define EFL_UI_BG_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
|
||||
EFL_UI_BG_DATA_GET(o, ptr); \
|
||||
if (EINA_UNLIKELY(!ptr)) \
|
||||
{ \
|
||||
ERR("No widget data for object %p (%s)", \
|
||||
|
@ -57,8 +57,8 @@ Efl_Ui_Bg_Widget_Data * sd = efl_data_scope_get(o, EFL_UI_BG_WIDGET_CLASS)
|
|||
return val; \
|
||||
}
|
||||
|
||||
#define EFL_UI_BG_WIDGET_CHECK(obj) \
|
||||
if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_BG_WIDGET_CLASS))) \
|
||||
#define EFL_UI_BG_CHECK(obj) \
|
||||
if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_BG_CLASS))) \
|
||||
return
|
||||
|
||||
#endif
|
|
@ -1,295 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#define EFL_ACCESS_OBJECT_PROTECTED
|
||||
#define ELM_LAYOUT_PROTECTED
|
||||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
#include "efl_ui_bg_widget_private.h"
|
||||
|
||||
#define MY_CLASS EFL_UI_BG_WIDGET_CLASS
|
||||
#define MY_CLASS_PFX efl_ui_bg_widget
|
||||
|
||||
#define MY_CLASS_NAME "Efl.Ui.Bg_Widget"
|
||||
|
||||
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
||||
{
|
||||
{"overlay", "elm.swallow.content"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_ui_bg_widget_efl_object_constructor(Eo *obj, Efl_Ui_Bg_Widget_Data *pd)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
|
||||
if (!elm_widget_theme_klass_get(obj))
|
||||
elm_widget_theme_klass_set(obj, "bg");
|
||||
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
elm_widget_sub_object_parent_add(obj);
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
||||
if (!elm_widget_theme_object_set(obj, wd->resize_obj,
|
||||
elm_widget_theme_klass_get(obj),
|
||||
elm_widget_theme_element_get(obj),
|
||||
elm_widget_theme_style_get(obj)))
|
||||
CRI("Failed to set layout!");
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
pd->rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj,
|
||||
efl_gfx_color_set(efl_added, 0, 0, 0, 0),
|
||||
efl_content_set(efl_part(obj, "elm.swallow.rectangle"), efl_added));
|
||||
|
||||
pd->img = efl_add(EFL_UI_IMAGE_CLASS, obj,
|
||||
efl_gfx_image_scale_type_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE),
|
||||
efl_content_set(efl_part(obj, "elm.swallow.background"), efl_added));
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, obj,
|
||||
efl_gfx_color_set(efl_added, 0, 0, 0, 0),
|
||||
efl_content_set(efl_part(obj, "efl.rectangle"), efl_added));
|
||||
|
||||
pd->img = efl_add(EFL_UI_IMAGE_CLASS, obj,
|
||||
efl_gfx_image_scale_type_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE),
|
||||
efl_content_set(efl_part(obj, "efl.background"), efl_added));
|
||||
}
|
||||
pd->file = NULL;
|
||||
pd->key = NULL;
|
||||
|
||||
efl_access_object_access_type_set(obj, EFL_ACCESS_TYPE_DISABLED);
|
||||
|
||||
efl_ui_widget_focus_allow_set(obj, EINA_FALSE);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_widget_efl_object_destructor(Eo *obj, Efl_Ui_Bg_Widget_Data *sd)
|
||||
{
|
||||
ELM_SAFE_FREE(sd->file, eina_stringshare_del);
|
||||
ELM_SAFE_FREE(sd->key, eina_stringshare_del);
|
||||
|
||||
efl_destructor(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_option_set(Evas_Object *obj, Elm_Bg_Option option)
|
||||
{
|
||||
Efl_Gfx_Image_Scale_Type type;
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case ELM_BG_OPTION_CENTER:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_NONE;
|
||||
break;
|
||||
case ELM_BG_OPTION_SCALE:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE;
|
||||
break;
|
||||
case ELM_BG_OPTION_TILE:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_TILE;
|
||||
break;
|
||||
case ELM_BG_OPTION_STRETCH:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_FILL;
|
||||
break;
|
||||
case ELM_BG_OPTION_LAST:
|
||||
default:
|
||||
type = EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE;
|
||||
}
|
||||
efl_gfx_image_scale_type_set(obj, type);
|
||||
}
|
||||
|
||||
EAPI Elm_Bg_Option
|
||||
elm_bg_option_get(const Evas_Object *obj)
|
||||
{
|
||||
Efl_Gfx_Image_Scale_Type type;
|
||||
Elm_Bg_Option option = ELM_BG_OPTION_LAST;
|
||||
|
||||
type = efl_gfx_image_scale_type_get(obj);
|
||||
switch (type)
|
||||
{
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_NONE:
|
||||
option = ELM_BG_OPTION_CENTER;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE:
|
||||
option = ELM_BG_OPTION_SCALE;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_TILE:
|
||||
option = ELM_BG_OPTION_TILE;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_FILL:
|
||||
option = ELM_BG_OPTION_STRETCH;
|
||||
break;
|
||||
case EFL_GFX_IMAGE_SCALE_TYPE_FIT_INSIDE:
|
||||
default:
|
||||
ERR("Scale type %d cannot be converted to Elm_Bg_Option", type);
|
||||
break;
|
||||
}
|
||||
|
||||
return option;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_widget_efl_gfx_image_scale_type_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd, Efl_Gfx_Image_Scale_Type scale_type)
|
||||
{
|
||||
efl_gfx_image_scale_type_set(sd->img, scale_type);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Gfx_Image_Scale_Type
|
||||
_efl_ui_bg_widget_efl_gfx_image_scale_type_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd)
|
||||
{
|
||||
return efl_gfx_image_scale_type_get(sd->img);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_color_set(Evas_Object *obj,
|
||||
int r,
|
||||
int g,
|
||||
int b)
|
||||
{
|
||||
int a = 255;
|
||||
EFL_UI_BG_WIDGET_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
// reset color
|
||||
if ((r == -1) && (g == -1) && (b == -1))
|
||||
{
|
||||
r = g = b = a = 0;
|
||||
}
|
||||
efl_gfx_color_set(sd->rect, r, g, b, a);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_widget_efl_gfx_color_color_set(Eo *obj, Efl_Ui_Bg_Widget_Data *sd, int r, int g, int b, int a)
|
||||
{
|
||||
efl_gfx_color_set(efl_super(obj, MY_CLASS), r, g, b, a);
|
||||
efl_gfx_color_set(sd->rect, r, g, b, a);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_color_get(const Evas_Object *obj,
|
||||
int *r,
|
||||
int *g,
|
||||
int *b)
|
||||
{
|
||||
EFL_UI_BG_WIDGET_CHECK(obj);
|
||||
efl_gfx_color_get((Eo *) obj, r, g, b, NULL);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_widget_efl_gfx_color_color_get(const Eo *obj, Efl_Ui_Bg_Widget_Data *sd, int *r, int *g, int *b, int *a)
|
||||
{
|
||||
if (!sd->rect)
|
||||
efl_gfx_color_get(efl_super(obj, MY_CLASS), r, g, b, a);
|
||||
else
|
||||
efl_gfx_color_get(sd->rect, r, g, b, a);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bg_load_size_set(Evas_Object *obj, int w, int h)
|
||||
{
|
||||
EFL_UI_BG_WIDGET_DATA_GET_OR_RETURN(obj, sd);
|
||||
efl_gfx_image_load_controller_load_size_set(sd->img, EINA_SIZE2D(w, h));
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_widget_efl_gfx_image_load_controller_load_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd, Eina_Size2D sz)
|
||||
{
|
||||
efl_gfx_image_load_controller_load_size_set(sd->img, sz);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Size2D
|
||||
_efl_ui_bg_widget_efl_gfx_image_load_controller_load_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd)
|
||||
{
|
||||
return efl_gfx_image_load_controller_load_size_get(sd->img);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_bg_file_set(Eo *obj, const char *file, const char *group)
|
||||
{
|
||||
return efl_file_set((Eo *) obj, file, group);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_bg_widget_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd, const char *file, const char *key)
|
||||
{
|
||||
eina_stringshare_replace(&sd->file, file);
|
||||
eina_stringshare_replace(&sd->key, key);
|
||||
|
||||
return efl_file_set(sd->img, file, key);
|
||||
}
|
||||
EAPI void
|
||||
elm_bg_file_get(const Eo *obj, const char **file, const char **group)
|
||||
{
|
||||
efl_file_get((Eo *) obj, file, group);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_widget_efl_file_file_get(const Eo *obj, Efl_Ui_Bg_Widget_Data *sd, const char **file, const char **key)
|
||||
{
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
if (file) *file = sd->file;
|
||||
if (key) *key = sd->key;
|
||||
return;
|
||||
}
|
||||
|
||||
efl_file_get(sd->img, file, key);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_bg_widget_efl_file_mmap_set(Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd,
|
||||
const Eina_File *file, const char *key)
|
||||
{
|
||||
return efl_file_mmap_set(sd->img, file, key);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_bg_widget_efl_file_mmap_get(const Eo *obj EINA_UNUSED, Efl_Ui_Bg_Widget_Data *sd,
|
||||
const Eina_File **file, const char **key)
|
||||
{
|
||||
efl_file_mmap_get(sd->img, file, key);
|
||||
}
|
||||
|
||||
/* Internal EO APIs and hidden overrides */
|
||||
|
||||
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
||||
|
||||
#define EFL_UI_BG_WIDGET_EXTRA_OPS \
|
||||
ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX)
|
||||
|
||||
#include "efl_ui_bg_widget.eo.c"
|
||||
|
||||
|
||||
#include "efl_ui_bg_widget_legacy.eo.h"
|
||||
|
||||
#define MY_CLASS_NAME_LEGACY "elm_bg"
|
||||
|
||||
static void
|
||||
_efl_ui_bg_widget_legacy_class_constructor(Efl_Class *klass)
|
||||
{
|
||||
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_ui_bg_widget_legacy_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, EFL_UI_BG_WIDGET_LEGACY_CLASS));
|
||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
||||
EFL_UI_BG_WIDGET_DATA_GET_OR_RETURN_VAL(obj, pd, obj);
|
||||
efl_gfx_entity_scale_set(pd->img, 1.0);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_bg_add(Evas_Object *parent)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||
return elm_legacy_add(EFL_UI_BG_WIDGET_LEGACY_CLASS, parent);
|
||||
}
|
||||
|
||||
#include "efl_ui_bg_widget_legacy.eo.c"
|
|
@ -1,19 +0,0 @@
|
|||
class Efl.Ui.Bg_Widget (Efl.Ui.Layout, Efl.Ui.Bg, Efl.Gfx.Image_Load_Controller)
|
||||
{
|
||||
[[The bg (background) widget is used for setting (solid) background decorations
|
||||
|
||||
for a window (unless it has transparency enabled) or for any container object. It
|
||||
works just like an image, but has some properties useful for backgrounds, such as
|
||||
setting it to tiled, centered, scaled or stretched.
|
||||
]]
|
||||
legacy_prefix: elm_bg;
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.File.file { get; set; }
|
||||
Efl.File.mmap { get; set; }
|
||||
Efl.Gfx.Color.color { get; set; }
|
||||
Efl.Gfx.Image.scale_type { get; set; }
|
||||
Efl.Gfx.Image_Load_Controller.load_size { get; set; }
|
||||
}
|
||||
}
|
|
@ -82,7 +82,7 @@ struct _Elm_Translate_String_Data
|
|||
* "." to "_" among the class name. */
|
||||
static const char *legacy_type_table[][2] =
|
||||
{
|
||||
{ "Efl.Ui.Bg_Widget_Legacy", "Elm_Bg" },
|
||||
{ "Efl.Ui.Bg_Legacy", "Elm_Bg" },
|
||||
{ "Efl.Ui.Button_Legacy", "Elm_Button" },
|
||||
{ "Efl.Ui.Check_Legacy", "Elm_Check" },
|
||||
{ "Efl.Ui.Clock_Legacy", "Elm_Datetime" },
|
||||
|
@ -6086,7 +6086,7 @@ _efl_ui_widget_bg_get(const Efl_Ui_Widget *obj)
|
|||
if (!bg_obj)
|
||||
{
|
||||
/* XXX const */
|
||||
bg_obj = efl_add(EFL_UI_BG_WIDGET_CLASS, (Eo *)obj);
|
||||
bg_obj = efl_add(EFL_UI_BG_CLASS, (Eo *)obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(bg_obj, NULL);
|
||||
sd->bg = bg_obj;
|
||||
efl_canvas_group_member_add((Eo *)obj, sd->bg);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Ui.Widget_Part_Bg (Efl.Ui.Widget_Part, Efl.Gfx.Color, Efl.Ui.Bg)
|
||||
class Efl.Ui.Widget_Part_Bg (Efl.Ui.Widget_Part, Efl.File, Efl.Gfx.Color, Efl.Gfx.Image)
|
||||
{
|
||||
[[Elementary widget internal part background class]]
|
||||
data: null;
|
||||
|
|
|
@ -7368,7 +7368,7 @@ _elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd)
|
|||
// Note: This code path is probably not necessary (custom legacy
|
||||
// theme but efl_add'ed window -- all efl_add'ed widgets would
|
||||
// use default theme)
|
||||
bg = efl_add(EFL_UI_BG_WIDGET_CLASS, sd->obj);
|
||||
bg = efl_add(EFL_UI_BG_CLASS, sd->obj);
|
||||
}
|
||||
wd = efl_data_scope_get(bg, EFL_UI_WIDGET_CLASS);
|
||||
if (wd)
|
||||
|
@ -7411,7 +7411,7 @@ _elm_win_standard_init(Eo *obj)
|
|||
// Note: This code path is probably not necessary (custom legacy
|
||||
// theme but efl_add'ed window -- all efl_add'ed widgets would
|
||||
// use default theme)
|
||||
bg = efl_add(EFL_UI_BG_WIDGET_CLASS, obj);
|
||||
bg = efl_add(EFL_UI_BG_CLASS, obj);
|
||||
}
|
||||
_elm_win_bg_set(sd, bg);
|
||||
}
|
||||
|
|
|
@ -165,4 +165,4 @@ EAPI Elm_Bg_Option elm_bg_option_get(const Evas_Object *obj);
|
|||
*/
|
||||
EAPI void elm_bg_load_size_set(Evas_Object *obj, int w, int h);
|
||||
|
||||
#include "efl_ui_bg_widget.eo.legacy.h"
|
||||
#include "efl_ui_bg.eo.legacy.h"
|
||||
|
|
|
@ -2,7 +2,7 @@ pub_legacy_eo_files = [
|
|||
'efl_ui_button_legacy.eo',
|
||||
'efl_ui_check_legacy.eo',
|
||||
'efl_ui_radio_legacy.eo',
|
||||
'efl_ui_bg_widget_legacy.eo',
|
||||
'efl_ui_bg_legacy.eo',
|
||||
'efl_ui_video_legacy.eo',
|
||||
'efl_ui_frame_legacy.eo',
|
||||
'efl_ui_panes_legacy.eo',
|
||||
|
@ -132,7 +132,6 @@ endforeach
|
|||
pub_eo_files = [
|
||||
'efl_ui_widget.eo',
|
||||
'efl_ui_bg.eo',
|
||||
'efl_ui_bg_widget.eo',
|
||||
'efl_ui_button.eo',
|
||||
'efl_ui_calendar.eo',
|
||||
'efl_ui_calendar_item.eo',
|
||||
|
@ -364,7 +363,7 @@ elementary_headers_unstable = [
|
|||
'elm_widget_box.h',
|
||||
'elm_widget_bubble.h',
|
||||
'efl_ui_button_private.h',
|
||||
'efl_ui_bg_widget_private.h',
|
||||
'efl_ui_bg_private.h',
|
||||
'elm_widget_calendar.h',
|
||||
'efl_ui_calendar_private.h',
|
||||
'efl_ui_check_private.h',
|
||||
|
@ -709,7 +708,6 @@ elementary_src = [
|
|||
'elm_atspi_bridge.c',
|
||||
'efl_ui_legacy.c',
|
||||
'efl_ui_bg.c',
|
||||
'efl_ui_bg_widget.c',
|
||||
'elm_box.c',
|
||||
'elm_bubble.c',
|
||||
'efl_ui_button.c',
|
||||
|
|
Loading…
Reference in New Issue