aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-11 12:11:39 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2019-02-11 12:34:12 +0100
commit1b568327c4feca6ac79863551abf1507bb090c55 (patch)
tree76d2ed617f688e12a956c55d511d874296dab014
parentbuild: next attempt to fix build race condition (diff)
downloadefl-1b568327c4feca6ac79863551abf1507bb090c55.tar.gz
efl_gfx_color_class: make this a mixin and move color_class_code here
Summary: color_class_code seems to only have been added to efl_gfx_color in order to share the hex conversion code, but this is trivial to do when it's in another class and makes the api more sensible ref https://phab.enlightenment.org/T7559 Reviewers: segfaultxavi, bu5hm4n, cedric Reviewed By: segfaultxavi Subscribers: #reviewers, #committers Tags: #efl_api Maniphest Tasks: https://phab.enlightenment.org/T7559 Differential Revision: https://phab.enlightenment.org/D7898
-rw-r--r--src/lib/edje/edje_main.c6
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color.c14
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color.eo19
-rw-r--r--src/lib/efl/interfaces/efl_gfx_color_class.eo53
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c1
6 files changed, 59 insertions, 36 deletions
diff --git a/src/lib/edje/edje_main.c b/src/lib/edje/edje_main.c
index 1417309250..dc2c35cba5 100644
--- a/src/lib/edje/edje_main.c
+++ b/src/lib/edje/edje_main.c
@@ -84,7 +84,7 @@ edje_init(void)
_edje_scale = FROM_DOUBLE(1.0);
_edje_global_obj = efl_add(EDJE_GLOBAL_CLASS, efl_main_loop_get());
EINA_SAFETY_ON_TRUE_GOTO(!_edje_global_obj, shutdown_efreet);
- EINA_SAFETY_ON_TRUE_GOTO(!efl_loop_register(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj), shutdown_efreet);
+ EINA_SAFETY_ON_TRUE_GOTO(!efl_loop_register(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_MIXIN, _edje_global_obj), shutdown_efreet);
EINA_SAFETY_ON_TRUE_GOTO(!efl_loop_register(efl_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj), shutdown_efreet);
EINA_SAFETY_ON_TRUE_GOTO(!efl_loop_register(efl_main_loop_get(), EFL_GFX_SIZE_CLASS_INTERFACE, _edje_global_obj), shutdown_efreet);
@@ -154,7 +154,7 @@ shutdown_all:
_edje_edd_shutdown();
if (_edje_global_obj)
{
- efl_loop_unregister(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj);
+ efl_loop_unregister(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_MIXIN, _edje_global_obj);
efl_loop_unregister(efl_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj);
efl_loop_unregister(efl_main_loop_get(), EFL_GFX_SIZE_CLASS_INTERFACE, _edje_global_obj);
efl_del(_edje_global_obj);
@@ -213,7 +213,7 @@ _edje_shutdown_core(void)
_edje_text_class_hash_free();
_edje_size_class_hash_free();
_edje_edd_shutdown();
- efl_loop_unregister(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj);
+ efl_loop_unregister(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_MIXIN, _edje_global_obj);
efl_loop_unregister(efl_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj);
efl_loop_unregister(efl_main_loop_get(), EFL_GFX_SIZE_CLASS_INTERFACE, _edje_global_obj);
efl_del(_edje_global_obj);
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 6b7cf50ffc..3721d28bdf 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2486,7 +2486,7 @@ static inline Edje_Global *
_edje_global(void)
{
#ifndef NDEBUG
- return efl_provider_find(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE);
+ return efl_provider_find(efl_main_loop_get(), EFL_GFX_COLOR_CLASS_MIXIN);
#else
extern Edje_Global *_edje_global_obj;
return _edje_global_obj;
diff --git a/src/lib/efl/interfaces/efl_gfx_color.c b/src/lib/efl/interfaces/efl_gfx_color.c
index 54c4df868f..92c1f07483 100644
--- a/src/lib/efl/interfaces/efl_gfx_color.c
+++ b/src/lib/efl/interfaces/efl_gfx_color.c
@@ -117,8 +117,8 @@ _efl_gfx_color_color_code_get(const Eo *obj, void *_pd EINA_UNUSED)
return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
}
-EOLIAN static void
-_efl_gfx_color_color_class_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *color_class,
+EOLIAN static Eina_Bool
+_efl_gfx_color_class_color_class_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *color_class,
Efl_Gfx_Color_Class_Layer layer, const char *colorcode)
{
int len;
@@ -127,17 +127,19 @@ _efl_gfx_color_color_class_code_set(Eo *obj, void *_pd EINA_UNUSED, const char *
len = _format_clean_param(colorcode);
_format_color_parse(colorcode, len, &r, &g, &b, &a);
- efl_gfx_color_class_set(obj, color_class, layer, r, g, b, a);
+ return efl_gfx_color_class_set(obj, color_class, layer, r, g, b, a);
}
EOLIAN static const char *
-_efl_gfx_color_color_class_code_get(const Eo *obj EINA_UNUSED, void *pd EINA_UNUSED,
+_efl_gfx_color_class_color_class_code_get(const Eo *obj EINA_UNUSED, void *pd EINA_UNUSED,
const char *color_class, Efl_Gfx_Color_Class_Layer layer)
{
int r, g, b, a;
- efl_gfx_color_class_get(obj, color_class, layer, &r, &g, &b, &a);
- return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
+ if (efl_gfx_color_class_get(obj, color_class, layer, &r, &g, &b, &a))
+ return eina_slstr_printf("#%02X%02X%02X%02X", r, g, b, a);
+ return NULL;
}
#include "interfaces/efl_gfx_color.eo.c"
+#include "interfaces/efl_gfx_color_class.eo.c"
diff --git a/src/lib/efl/interfaces/efl_gfx_color.eo b/src/lib/efl/interfaces/efl_gfx_color.eo
index 6e1aa2b260..d3c41e1e31 100644
--- a/src/lib/efl/interfaces/efl_gfx_color.eo
+++ b/src/lib/efl/interfaces/efl_gfx_color.eo
@@ -58,24 +58,5 @@ mixin Efl.Gfx.Color
colorcode: string; [[the hex color code.]]
}
}
- @property color_class_code {
- set {
- [[Set the color class color of given Evas Object to the given hex color code(#RRGGBBAA).
- e.g. efl_gfx_color_class_code_set(obj, "color_class_name", layer, "#FFCCAACC");
- ]]
- }
- get {
- [[Get hex color class code of given Evas Object.
- This returns a short lived hex color class code string.
- ]]
- }
- keys {
- color_class: string; [[The name of color class]]
- layer: Efl.Gfx.Color_Class_Layer @optional; [[The layer to set the color]]
- }
- values {
- colorcode: string; [[the hex color code.]]
- }
- }
}
}
diff --git a/src/lib/efl/interfaces/efl_gfx_color_class.eo b/src/lib/efl/interfaces/efl_gfx_color_class.eo
index f0d4dcb866..990835dfce 100644
--- a/src/lib/efl/interfaces/efl_gfx_color_class.eo
+++ b/src/lib/efl/interfaces/efl_gfx_color_class.eo
@@ -1,10 +1,11 @@
import efl_gfx_types;
-interface Efl.Gfx.Color_Class
+mixin Efl.Gfx.Color_Class
{
- [[Efl Gfx Color Class interface]]
+ [[Efl Gfx Color Class mixin class]]
+ data: null;
methods {
- @property color_class {
+ @property color_class @pure_virtual {
set {
[[Set the color of color class.
@@ -46,7 +47,47 @@ interface Efl.Gfx.Color_Class
a: int; [[The alpha value]]
}
}
- @property color_class_description {
+ @property color_class_code {
+ set {
+ [[Set the hex color string of color class.
+
+ This function sets the color values for a color class. This will
+ cause all edje parts in the specified object that have the specified
+ color class to have their colors multiplied by these values.
+
+ The first color is the object, the second is the text outline, and
+ the third is the text shadow. (Note that the second two only apply
+ to text parts).
+
+ Setting color emits a signal "color_class,set" with source being
+ the given color.
+
+ Note: These color values are expected to be premultiplied by the alpha.]]
+ return: bool; [[$true if setting the color succeeded, $false otherwise]]
+ }
+ get {
+ [[Get the hex color string of color class.
+
+ This function gets the color values for a color class. If no explicit
+ object color is set, then global values will be used.
+
+ The first color is the object, the second is the text outline, and
+ the third is the text shadow. (Note that the second two only apply
+ to text parts).
+
+ Returns NULL if the color class cannot be fetched.
+
+ Note: These color values are expected to be premultiplied by $a.]]
+ }
+ keys {
+ color_class: string; [[The name of color class]]
+ layer: Efl.Gfx.Color_Class_Layer @optional; [[The layer to set the color]]
+ }
+ values {
+ colorcode: string; [[the hex color code.]]
+ }
+ }
+ @property color_class_description @pure_virtual {
get {
[[Get the description of a color class.
@@ -59,7 +100,7 @@ interface Efl.Gfx.Color_Class
description: string; [[The description of the target color class or $null if not found]]
}
}
- color_class_del {
+ color_class_del @pure_virtual {
[[Delete the color class.
This function deletes any values for the specified color class.
@@ -73,7 +114,7 @@ interface Efl.Gfx.Color_Class
@in color_class: string; [[The name of color_class]]
}
}
- color_class_clear {
+ color_class_clear @pure_virtual {
[[Delete all color classes defined in object level.
This function deletes any color classes defined in object level.
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index 4e2490a6c7..0ede9908f8 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -35,7 +35,6 @@
#include "interfaces/efl_gfx_fill.eo.c"
#include "interfaces/efl_gfx_view.eo.c"
-#include "interfaces/efl_gfx_color_class.eo.c"
#include "interfaces/efl_gfx_text_class.eo.c"
#include "interfaces/efl_gfx_size_class.eo.c"