New 1.15 API: evas.Textblock.obstacle_* functions

untested, but quite simple api, should work
This commit is contained in:
Davide Andreoli 2015-08-03 18:53:19 +02:00
parent 634c56d14c
commit 3de1d7be24
2 changed files with 49 additions and 0 deletions

View File

@ -182,6 +182,52 @@ cdef class Textblock(Object):
evas_object_textblock_style_insets_get(self.obj, &l, &r, &t, &b)
return (l, r, t, b)
def obstacle_add(self, Object obstacle):
"""
Add obstacle evas object to be observed during layout of text.
The textblock does the layout of the text according to the position
of the obstacle.
:param obstacle: An evas object to be used as an obstacle
:type obstacle: :class:`Object`
:return: ``True`` on success or ``False`` on failure
:rtype: bool
.. versionadded:: 1.15
"""
return bool(evas_object_textblock_obstacle_add(self.obj, obstacle.obj))
def obstacle_del(self, Object obstacle):
"""Removes an object from observation during text layout.
:param obstacle: An evas object to be removed as an obstacle
:type obstacle: :class:`Object`
:return: ``True`` on success or ``False`` on failure
:rtype: bool
.. versionadded:: 1.15
"""
return bool(evas_object_textblock_obstacle_del(self.obj, obstacle.obj))
def obstacles_update(self):
"""Triggers for relayout due to obstacles' state change.
The obstacles alone don't affect the layout, until this is called. Use
this after doing changes (moving, positioning etc.) in the obstacles
that you would like to be considered in the layout. For example: if you
have just repositioned the obstacles to differrent coordinates relative
to the textblock, you need to call this so it will consider this new
state and will relayout the text.
.. versionadded:: 1.15
"""
evas_object_textblock_obstacles_update(self.obj)
_object_mapping_register("Evas_Textblock", Textblock)

View File

@ -1027,6 +1027,9 @@ cdef extern from "Evas.h":
void evas_object_textblock_size_formatted_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
void evas_object_textblock_size_native_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
void evas_object_textblock_style_insets_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b)
Eina_Bool evas_object_textblock_obstacle_add(const Evas_Object *obj, Evas_Object *obstacle)
Eina_Bool evas_object_textblock_obstacle_del(const Evas_Object *obj, Evas_Object *obstacle)
Eina_Bool evas_object_textblock_obstacles_update(const Evas_Object *obj)
####################################################################