summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-05-30 10:31:19 +0300
committerDaniel Hirt <hirt.danny@gmail.com>2017-06-12 00:10:04 +0300
commit6e1b5fdd1065d0a0f3b04cd07ea069f05ec4077e (patch)
tree429b8f7167a4fe23440861630171b227e5678d31
parent4a1b42aee86b505b511ac7326176a4e7aa190c80 (diff)
downloadefl-6e1b5fdd1065d0a0f3b04cd07ea069f05ec4077e.tar.gz
Canvas layout: port part_text to efl_part
You now use the following: efl_text_set(efl_part(edje_obj, "part"), "text"); const char *text = efl_text_get(efl_part(edje_obj, "part")); The former method of edje_object_part_text_set/get is now legacy. Also, adjusted 'tests/emotion/emotion_test_main-eo.c' with this change.
-rw-r--r--src/Makefile_Edje.am4
-rw-r--r--src/lib/edje/Edje_Eo.h1
-rw-r--r--src/lib/edje/Edje_Legacy.h23
-rw-r--r--src/lib/edje/edje_object.eo19
-rw-r--r--src/lib/edje/edje_part.c2
-rw-r--r--src/lib/edje/edje_part_text.c26
-rw-r--r--src/lib/edje/edje_private.h5
-rw-r--r--src/lib/edje/edje_util.c25
-rw-r--r--src/lib/edje/efl_canvas_layout_internal_text.eo12
-rw-r--r--src/tests/emotion/emotion_test_main-eo.c10
10 files changed, 97 insertions, 30 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index ff8c41ac69..b982d1a739 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -8,6 +8,7 @@ edje_eolian_files = \
lib/edje/efl_canvas_layout_internal_table.eo \
lib/edje/efl_canvas_layout_internal_swallow.eo \
lib/edje/efl_canvas_layout_external.eo \
+ lib/edje/efl_canvas_layout_internal_text.eo \
lib/edje/edje_edit.eo
edje_eolian_type_files = \
@@ -101,7 +102,8 @@ lib/edje/edje_part_helper.h \
lib/edje/edje_part_external.c \
lib/edje/edje_part_swallow.c \
lib/edje/edje_part_table.c \
-lib/edje/edje_part_box.c
+lib/edje/edje_part_box.c \
+lib/edje/edje_part_text.c
lib_edje_libedje_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl $(EDJE_COMMON_CPPFLAGS)
lib_edje_libedje_la_LIBADD = @EDJE_LIBS@ @EDJE_LUA_LIBS@
diff --git a/src/lib/edje/Edje_Eo.h b/src/lib/edje/Edje_Eo.h
index 05982fd786..23d836646c 100644
--- a/src/lib/edje/Edje_Eo.h
+++ b/src/lib/edje/Edje_Eo.h
@@ -7,4 +7,5 @@
#include "efl_canvas_layout_internal_box.eo.h"
#include "efl_canvas_layout_internal_table.eo.h"
#include "efl_canvas_layout_internal_swallow.eo.h"
+#include "efl_canvas_layout_internal_text.eo.h"
#include "efl_canvas_layout_external.eo.h"
diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h
index 9bf6a2c273..5bdcef4db6 100644
--- a/src/lib/edje/Edje_Legacy.h
+++ b/src/lib/edje/Edje_Legacy.h
@@ -1354,8 +1354,29 @@ EAPI Eina_Bool edje_object_part_drag_page_get(const Edje_Object *obj, const char
EAPI Eina_Bool edje_object_part_drag_page(Edje_Object *obj, const char *part, double dx, double dy);
/**
- * @}
+ * @brief Sets a given text to an Edje object @c TEXT or TEXTBLOCK
+ * parts.
+ *
+ * @param[in] part The part name
+ * @param[in] text The text to set on that part
+ *
+ * @ingroup Edje_Object
+ */
+EAPI Eina_Bool edje_object_part_text_set(const Edje_Object *obj, const char *part, const char *text);
+
+/**
+ * @brief Gets the text currntly set to the given part
+ *
+ * @param[in] part The part name
+ *
+ * @return The text set on the part, @c null otherwise.
+ *
+ * @ingroup Edje_Object
*/
+EAPI const char * edje_object_part_text_get(const Edje_Object *obj, const char *part);
+/**
+ * @}
+ */
#include "edje_object.eo.legacy.h"
#include "edje_edit.eo.legacy.h"
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index 2b5851b8e6..6a0860b371 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -780,25 +780,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
data: void_ptr; [[The data associated to the callback function.]]
}
}
- @property part_text {
- set {
- [[Sets the text for an object part]]
- return: bool; [[$true on success, $false otherwise]]
- }
- get {
- [[Returns the text of the object part.
-
- This function returns the text associated to the object part.
-
- See also @.part_text.set().]]
- }
- keys {
- part: string; [[The part name]]
- }
- values {
- text: string; [[The text string]]
- }
- }
@property part_text_escaped {
set {
[[Sets the text for an object part, but converts HTML escapes to UTF8
diff --git a/src/lib/edje/edje_part.c b/src/lib/edje/edje_part.c
index deeb0d1b0a..cbfd71e243 100644
--- a/src/lib/edje/edje_part.c
+++ b/src/lib/edje/edje_part.c
@@ -9,6 +9,7 @@ PROXY_INIT(box)
PROXY_INIT(table)
PROXY_INIT(swallow)
PROXY_INIT(external)
+PROXY_INIT(text)
PROXY_INIT(other)
void
@@ -18,6 +19,7 @@ _edje_internal_proxy_shutdown(void)
_table_shutdown();
_swallow_shutdown();
_external_shutdown();
+ _text_shutdown();
_other_shutdown();
}
diff --git a/src/lib/edje/edje_part_text.c b/src/lib/edje/edje_part_text.c
new file mode 100644
index 0000000000..f591b5ae6a
--- /dev/null
+++ b/src/lib/edje/edje_part_text.c
@@ -0,0 +1,26 @@
+#include "edje_private.h"
+#include "edje_part_helper.h"
+#include "efl_canvas_layout_internal_text.eo.h"
+#define MY_CLASS EFL_CANVAS_LAYOUT_INTERNAL_TEXT_CLASS
+
+PROXY_IMPLEMENTATION(text, INTERNAL_TEXT, EINA_FALSE)
+#undef PROXY_IMPLEMENTATION
+
+EOLIAN static void
+_efl_canvas_layout_internal_text_efl_text_text_set(Eo *obj,
+ void *_pd EINA_UNUSED, const char *text)
+{
+ PROXY_DATA_GET(obj, pd);
+ _edje_efl_text_set(obj, pd->ed, pd->part, text);
+}
+
+EOLIAN static const char *
+_efl_canvas_layout_internal_text_efl_text_text_get(Eo *obj,
+ void *_pd EINA_UNUSED)
+{
+ PROXY_DATA_GET(obj, pd);
+ RETURN_VAL(_edje_efl_text_get(obj, pd->ed, pd->part));
+}
+
+#include "efl_canvas_layout_internal_text.eo.c"
+
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 8e51730627..efd6cc9074 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -3146,6 +3146,11 @@ Edje_External_Param_Type _edje_object_part_external_param_type_get(Edje *ed, con
Evas_Object *_edje_object_part_external_object_get(Edje *ed, const char *part);
Evas_Object *_edje_object_part_external_content_get(Edje *ed, const char *part, const char *content);
+/* part text */
+Eo *_edje_text_internal_proxy_get(Edje_Object *obj, Edje *ed, Edje_Real_Part *rp);
+Eina_Bool _edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text);
+const char *_edje_efl_text_get(Eo *obj, Edje *ed, const char *part);
+
void _edje_internal_proxy_shutdown(void);
// Svg loader
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index df09502066..594469e567 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -2005,8 +2005,8 @@ _edje_user_define_string(Edje *ed, const char *part, const char *raw_text, Edje_
eud->u.string.type = type;
}
-EOLIAN Eina_Bool
-_edje_object_part_text_set(Eo *obj, Edje *ed, const char *part, const char *text)
+Eina_Bool
+_edje_efl_text_set(Eo *obj, Edje *ed, const char *part, const char *text)
{
Edje_Real_Part *rp;
Eina_Bool int_ret;
@@ -2026,8 +2026,8 @@ _edje_object_part_text_set(Eo *obj, Edje *ed, const char *part, const char *text
return int_ret;
}
-EOLIAN const char *
-_edje_object_part_text_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
+const char *
+_edje_efl_text_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
{
Edje_Real_Part *rp;
@@ -3690,6 +3690,10 @@ _edje_object_efl_part_part(Eo *obj, Edje *ed, const char *part)
return _edje_swallow_internal_proxy_get(obj, ed, rp);
else if (rp->part->type == EDJE_PART_TYPE_EXTERNAL)
return _edje_external_internal_proxy_get(obj, ed, rp);
+ else if (rp->part->type == EDJE_PART_TYPE_TEXT)
+ return _edje_text_internal_proxy_get(obj, ed, rp);
+ else if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ return _edje_text_internal_proxy_get(obj, ed, rp);
else
return _edje_other_internal_proxy_get(obj, ed, rp);
}
@@ -6551,4 +6555,17 @@ edje_object_part_swallow_get(const Edje_Object *obj, const char *part)
return efl_content_get(efl_part(obj, part));
}
+EAPI Eina_Bool
+edje_object_part_text_set(const Edje_Object *obj, const char *part, const char *text)
+{
+ efl_text_set(efl_part(obj, part), text);
+ return EINA_TRUE;
+}
+
+EAPI const char *
+edje_object_part_text_get(const Edje_Object *obj, const char *part)
+{
+ return efl_text_get(efl_part(obj, part));
+}
+
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
diff --git a/src/lib/edje/efl_canvas_layout_internal_text.eo b/src/lib/edje/efl_canvas_layout_internal_text.eo
new file mode 100644
index 0000000000..fc11015d6a
--- /dev/null
+++ b/src/lib/edje/efl_canvas_layout_internal_text.eo
@@ -0,0 +1,12 @@
+class Efl.Canvas.Layout_Internal.Text (Efl.Canvas.Layout_Internal, Efl.Text)
+{
+ [[Represents a TEXT part of a layout
+
+ Its lifetime is limited to one function call only, unless an extra
+ reference is explicitely held.
+ ]]
+ data: null;
+ implements {
+ Efl.Text.text { set; get; }
+ }
+}
diff --git a/src/tests/emotion/emotion_test_main-eo.c b/src/tests/emotion/emotion_test_main-eo.c
index 528f62ccbc..0848db5fef 100644
--- a/src/tests/emotion/emotion_test_main-eo.c
+++ b/src/tests/emotion/emotion_test_main-eo.c
@@ -320,7 +320,7 @@ video_obj_time_changed(Evas_Object *obj, Evas_Object *edje)
snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i",
ph, pm, ps, pf, lh, lm, ls);
- edje_obj_part_text_set(edje, "video_progress_txt", buf);
+ efl_text_set(efl_part(edje, "video_progress_txt"), buf);
}
static void
@@ -478,7 +478,7 @@ video_obj_signal_alpha_cb(void *data, Evas_Object *o, const char *emission EINA_
alpha = 255 * y;
efl_gfx_color_set(ov, alpha, alpha, alpha, alpha);
snprintf(buf, sizeof(buf), "alpha %.0f", alpha);
- edje_obj_part_text_set(o, "video_alpha_txt", buf);
+ efl_text_set(efl_part(o, "video_alpha_txt"), buf);
}
static void
@@ -491,7 +491,7 @@ video_obj_signal_vol_cb(void *data, Evas_Object *o, const char *emission EINA_UN
efl_ui_drag_value_get(efl_part(o, source), NULL, &vol);
emotion_object_audio_volume_set(ov, vol);
snprintf(buf, sizeof(buf), "vol %.2f", vol);
- edje_obj_part_text_set(o, "video_volume_txt", buf);
+ efl_text_set(efl_part(o, "video_volume_txt"), buf);
}
static void
@@ -642,9 +642,9 @@ init_video_object(const char *module_filename, const char *filename)
edje_obj_signal_callback_add(oe, "frame_resize", "stop", video_obj_signal_frame_resize_stop_cb, oe);
edje_obj_signal_callback_add(oe, "mouse, move", "*", video_obj_signal_frame_move_cb, oe);
efl_ui_drag_value_set(efl_part(oe, "video_alpha"), 0.0, 1.0);
- edje_obj_part_text_set(oe, "video_alpha_txt", "alpha 255");
+ efl_text_set(efl_part(oe, "video_alpha_txt"), "alpha 255");
efl_ui_drag_value_set(efl_part(oe, "video_volume"), 0.0, 0.5);
- edje_obj_part_text_set(oe, "video_volume_txt", "vol 0.50");
+ efl_text_set(efl_part(oe, "video_volume_txt"), "vol 0.50");
edje_obj_signal_emit(oe, "video_state", "play");
efl_gfx_visible_set(oe, EINA_TRUE);
}