Efl interfaces: Add text interface and start using it.

This commit is contained in:
Tom Hacohen 2014-07-24 17:42:09 +01:00
parent 69219fe1e2
commit fe374084ed
9 changed files with 80 additions and 30 deletions

View File

@ -3,6 +3,8 @@ BUILT_SOURCES += \
lib/efl/interfaces/efl_file.eo.h \
lib/efl/interfaces/efl_image.eo.c \
lib/efl/interfaces/efl_image.eo.h \
lib/efl/interfaces/efl_text.eo.c \
lib/efl/interfaces/efl_text.eo.h \
lib/efl/interfaces/efl_text_properties.eo.c \
lib/efl/interfaces/efl_text_properties.eo.h
@ -10,6 +12,7 @@ efleolianfilesdir = $(datadir)/eolian/include/efl-@VMAJ@
efleolianfiles_DATA = \
lib/efl/interfaces/efl_file.eo \
lib/efl/interfaces/efl_image.eo \
lib/efl/interfaces/efl_text.eo \
lib/efl/interfaces/efl_text_properties.eo
EXTRA_DIST += \
@ -34,4 +37,5 @@ installed_eflinterfacesdir = $(includedir)/efl-@VMAJ@/interfaces
nodist_installed_eflinterfaces_DATA = \
lib/efl/interfaces/efl_file.eo.h \
lib/efl/interfaces/efl_image.eo.h \
lib/efl/interfaces/efl_text.eo.h \
lib/efl/interfaces/efl_text_properties.eo.h

View File

@ -5,6 +5,7 @@ if HAVE_CXX11
generated_efl_cxx_bindings = \
lib/efl/interfaces/efl_file.eo.hh \
lib/efl/interfaces/efl_image.eo.hh \
lib/efl/interfaces/efl_text.eo.hh \
lib/efl/interfaces/efl_text_properties.eo.hh
lib/efl/Efl.hh: $(generated_efl_cxx_bindings)

View File

@ -100,7 +100,7 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
eo_do(ep->object,
evas_obj_text_ellipsis_set(chosen_desc->text.min_x ? -1 : params->type.text.ellipsis),
efl_text_properties_font_set(font, size),
evas_obj_text_set(text),
efl_text_set(text),
evas_obj_size_set(sw, sh));
return text;
@ -295,7 +295,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
if (ep->part->scale) evas_obj_scale_set(TO_DOUBLE(sc));
efl_text_properties_font_set(font, size);
evas_obj_text_set(text));
efl_text_set(text));
part_get_geometry(ep, &tw, &th);
/* Find the wanted font size */
@ -335,7 +335,7 @@ _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep,
if (ep->part->scale) evas_obj_scale_set(TO_DOUBLE(sc));
efl_text_properties_font_set(font, size);
evas_obj_text_set(text));
efl_text_set(text));
part_get_geometry(ep, &tw, &th);
/* only grow the font size if we didn't already reach the max size
@ -479,7 +479,7 @@ arrange_text:
if (ep->part->scale) evas_obj_scale_set(TO_DOUBLE(sc));
efl_text_properties_font_set(font, size),
evas_obj_text_set(text));
efl_text_set(text));
part_get_geometry(ep, &tw, &th);
/* filters */

View File

@ -6,6 +6,7 @@
/* Interfaces */
#include "interfaces/efl_file.eo.h"
#include "interfaces/efl_image.eo.h"
#include "interfaces/efl_text.eo.h"
#include "interfaces/efl_text_properties.eo.h"
#endif

View File

@ -6,4 +6,5 @@
#include "interfaces/efl_file.eo.c"
#include "interfaces/efl_image.eo.c"
#include "interfaces/efl_text.eo.c"
#include "interfaces/efl_text_properties.eo.c"

View File

@ -0,0 +1,27 @@
interface Efl.Text {
legacy_prefix: null;
properties {
text {
set {
/*@
Sets the text string to be displayed by the given text object.
@see evas_object_text_text_get() */
}
get {
/*@
Retrieves the text string currently being displayed by the given
text object.
@return The text string currently being displayed on it.
@note Do not free() the return value.
@see evas_object_text_text_set() */
}
values {
const(char)* text; /*@ Text string to display on it. */
}
}
}
}

View File

@ -1471,6 +1471,30 @@ EAPI Eina_Bool evas_object_image_smooth_scale_get(const Eo *obj);
*/
EAPI Evas_Object *evas_object_text_add(Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
/**
*
* Sets the text string to be displayed by the given text object.
*
* @see evas_object_text_text_get()
*
* @param[in] text Text string to display on it.
*/
EAPI void evas_object_text_text_set(Eo *obj, const char *text);
/**
*
* Retrieves the text string currently being displayed by the given
* text object.
*
* @return The text string currently being displayed on it.
*
* @note Do not free() the return value.
*
* @see evas_object_text_text_set()
*
*/
EAPI const char *evas_object_text_text_get(const Eo *obj);
#include "canvas/evas_text.eo.legacy.h"
/**

View File

@ -962,12 +962,12 @@ _evas_text_eo_base_dbg_info_get(Eo *eo_obj, Evas_Text_Data *o EINA_UNUSED, Eo_Db
eo_do(eo_obj, text = efl_text_properties_font_source_get());
EO_DBG_INFO_APPEND(group, "Font source", EINA_VALUE_TYPE_STRING, text);
eo_do(eo_obj, text = evas_obj_text_get());
eo_do(eo_obj, text = efl_text_get());
EO_DBG_INFO_APPEND(group, "Text", EINA_VALUE_TYPE_STRING, text);
}
EOLIAN static void
_evas_text_text_set(Eo *eo_obj, Evas_Text_Data *o, const char *_text)
_evas_text_efl_text_text_set(Eo *eo_obj, Evas_Text_Data *o, const char *_text)
{
int is, was, len;
Eina_Unicode *text;
@ -1022,7 +1022,7 @@ _evas_text_bidi_delimiters_get(Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o)
}
EOLIAN static const char*
_evas_text_text_get(Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o)
_evas_text_efl_text_text_get(Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o)
{
return o->cur.utf8_text;
}
@ -2501,4 +2501,16 @@ evas_object_text_font_get(const Eo *obj, const char **font, Evas_Font_Size *size
eo_do((Eo *) obj, efl_text_properties_font_get(font, size));
}
EAPI void
evas_object_text_text_set(Eo *obj, const char *text)
{
eo_do((Eo *) obj, efl_text_set(text));
}
EAPI const char *
evas_object_text_text_get(const Eo *obj)
{
return eo_do((Eo *) obj, efl_text_get());
}
#include "canvas/evas_text.eo.c"

View File

@ -1,4 +1,4 @@
class Evas.Text (Evas.Object, Efl.Text_Properties)
class Evas.Text (Evas.Object, Efl.Text, Efl.Text_Properties)
{
legacy_prefix: evas_object_text;
eo_prefix: evas_obj_text;
@ -122,28 +122,6 @@ class Evas.Text (Evas.Object, Efl.Text_Properties)
int a; /*@ The alpha component of the given color. */
}
}
text {
set {
/*@
Sets the text string to be displayed by the given text object.
@see evas_object_text_text_get() */
}
get {
/*@
Retrieves the text string currently being displayed by the given
text object.
@return The text string currently being displayed on it.
@note Do not free() the return value.
@see evas_object_text_text_set() */
}
values {
const(char)* text; /*@ Text string to display on it. */
}
}
glow2_color {
set {
/*@
@ -385,6 +363,8 @@ class Evas.Text (Evas.Object, Efl.Text_Properties)
Eo.Base.destructor;
Eo.Base.dbg_info_get;
Evas.Object.size.set;
Efl.Text.text.set;
Efl.Text.text.get;
Efl.Text_Properties.font.get;
Efl.Text_Properties.font.set;
Efl.Text_Properties.font_source.get;