edje: Move some functions to Efl.Ui.Base (EO)

This introduces the new interface Efl.Ui.Base, intended to
share some APIs between Edje and Elm:
 - mirrored (rtl)
 - language
 - scale

base_scale remains in Edje.Object for now. I don't think it
applies to generic widgets.

The new interface uses eo prefix "efl_ui". It could be renamed
as Efl.Ui (no Base), or anything else. As always, I'm open to
propositions!

Ref T5315
This commit is contained in:
Jean-Philippe Andre 2017-05-31 18:33:11 +09:00
parent 20a305a85d
commit 602039cf83
8 changed files with 192 additions and 72 deletions

View File

@ -44,6 +44,7 @@ efl_eolian_files = \
lib/efl/interfaces/efl_vpath_file.eo \
lib/efl/interfaces/efl_vpath_core.eo \
lib/efl/interfaces/efl_vpath_file_core.eo \
lib/efl/interfaces/efl_ui_base.eo \
lib/efl/interfaces/efl_ui_drag.eo \
lib/efl/interfaces/efl_ui_spin.eo \
lib/efl/interfaces/efl_ui_progress.eo \

View File

@ -1019,6 +1019,91 @@ EAPI Eina_Bool edje_object_color_class_get(const Evas_Object *obj, const char *
*/
EAPI void edje_object_part_text_select_allow_set(const Edje_Object *obj, const char *part, Eina_Bool allow);
/**
* @brief Sets the RTL orientation for this object.
*
* @param[in] rtl New value of flag @c true/$false
*
* @since 1.1.0
*
* @ingroup Edje_Object
*/
EAPI void edje_object_mirrored_set(Edje_Object *obj, Eina_Bool rtl);
/**
* @brief Gets the RTL orientation for this object.
*
* You can RTL orientation explicitly with edje_object_mirrored_set.
*
* @return New value of flag @c true/$false
*
* @since 1.1.0
*
* @ingroup Edje_Object
*/
EAPI Eina_Bool edje_object_mirrored_get(const Edje_Object *obj);
/**
* @brief Sets the language for this object.
*
* @param[in] language The language value
*
* @since 1.1.0
*
* @ingroup Edje_Object
*/
EAPI void edje_object_language_set(Edje_Object *obj, const char *language);
/**
* @brief Gets the language for this object.
*
* @return The language value
*
* @since 1.1.0
*
* @ingroup Edje_Object
*/
EAPI const char *edje_object_language_get(const Edje_Object *obj);
/**
* @brief Sets the scaling factor for a given Edje object.
*
* This function sets an individual scaling factor on the obj Edje object.
* This property (or Edje's global scaling factor, when applicable), will
* affect this object's part sizes. If scale is not zero, than the individual
* scaling will override any global scaling set, for the object obj's parts.
* Put it back to zero to get the effects of the global scaling again.
*
* @warning Only parts which, at EDC level, had the @"scale" property set to
* @1, will be affected by this function. Check the complete @ref edcref
* "syntax reference" for EDC files.
*
* See also @ref edje_object_scale_get() @ref edje_scale_get() for more details
*
* @param[in] scale The scaling factor (the default value is @0.0, meaning
* individual scaling not set)
*
* @return @c true on success, @c false otherwise
*
* @ingroup Edje_Object
*/
EAPI Eina_Bool edje_object_scale_set(Edje_Object *obj, double scale);
/**
* @brief Gets a given Edje object's scaling factor.
*
* This function returns the individual scaling factor set on the obj Edje
* object.
*
* See also @ref edje_object_scale_set() for more details
*
* @return The scaling factor (the default value is @0.0, meaning individual
* scaling not set)
*
* @ingroup Edje_Object
*/
EAPI double edje_object_scale_get(const Edje_Object *obj);
/**
* @defgroup Edje_Part_Drag Edje Drag
* @ingroup Edje_Object_Part

View File

@ -96,6 +96,38 @@ edje_object_part_external_content_get(const Edje_Object *obj, const char *part,
return _edje_object_part_external_content_get(ed, part, content);
}
/* Efl.Ui.Base APIs */
EAPI void
edje_object_mirrored_set(Edje_Object *obj, Eina_Bool rtl)
{
efl_ui_mirrored_set(obj, rtl);
}
EAPI Eina_Bool edje_object_mirrored_get(const Edje_Object *obj)
{
return efl_ui_mirrored_get(obj);
}
EAPI void edje_object_language_set(Edje_Object *obj, const char *language)
{
efl_ui_language_set(obj, language);
}
EAPI const char *edje_object_language_get(const Edje_Object *obj)
{
return efl_ui_language_get(obj);
}
EAPI Eina_Bool edje_object_scale_set(Edje_Object *obj, double scale)
{
return efl_ui_scale_set(obj, scale);
}
EAPI double edje_object_scale_get(const Edje_Object *obj)
{
return efl_ui_scale_get(obj);
}
/* Legacy part drag APIs */
EAPI Edje_Drag_Dir
edje_object_part_drag_dir_get(const Evas_Object *obj, const char *part)

View File

@ -3,7 +3,7 @@ import edje_types;
// FIXME: This EO doc needs a direct link to the "edcref" doc
class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
Efl.Observer)
Efl.Observer, Efl.Ui.Base)
{
[[Edje object class]]
legacy_prefix: edje_object;
@ -11,38 +11,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
event_prefix: edje_object;
data: Edje;
methods {
@property mirrored {
set {
[[Sets the RTL orientation for this object.
@since 1.1.0]]
}
get {
[[Gets the RTL orientation for this object.
You can RTL orientation explicitly with edje_object_mirrored_set.
@since 1.1.0]]
}
values {
rtl: bool; [[New value of flag $true/$false]]
}
}
@property language {
set {
[[Sets the language for this object.
@since 1.1.0]]
}
get {
[[Gets the language for this object.
@since 1.1.0]]
}
values {
language: string; [[The language value]]
}
}
@property animation {
[[Whether this object is animating or not.
@ -136,39 +104,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
}
}
// TODO: An Efl.Ui.Base class that contains mirrored, language, scale
@property scale {
set {
[[Sets the scaling factor for a given Edje object.
This function sets an individual scaling factor on the obj
Edje object. This property (or Edje's global scaling factor, when
applicable), will affect this object's part sizes. If scale is
not zero, than the individual scaling will override any global
scaling set, for the object obj's parts. Put it back to zero to
get the effects of the global scaling again.
Warning: Only parts which, at EDC level, had the @"scale"
property set to @1, will be affected by this function. Check the
complete \@ref edcref "syntax reference" for EDC files.
See also @.scale.get()
\@ref edje_scale_get() for more details]]
return: bool; [[$true on success, $false otherwise]]
}
get {
[[Gets a given Edje object's scaling factor.
This function returns the individual scaling factor set on the
obj Edje object.
See also @.scale.set() for more details]]
}
values {
scale: double; [[The scaling factor (the default value is @0.0,
meaning individual scaling not set)]]
}
}
@property base_scale {
get {
[[Gets a given Edje object's base_scale factor.
@ -1747,6 +1682,9 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
Efl.Canvas.Object.no_render { set; }
Efl.Canvas.Object.paragraph_direction { set; }
Efl.Canvas.Group.group_calculate;
Efl.Ui.Base.mirrored { set; get; }
Efl.Ui.Base.language { set; get; }
Efl.Ui.Base.scale { set; get; }
Efl.File.file { get; set; }
Efl.File.mmap { get; set; }
Efl.Container.content_remove;

View File

@ -238,7 +238,7 @@ _edje_language_signal_emit(Edje *ed, Evas_Object *obj, char *signal)
}
EOLIAN void
_edje_object_language_set(Eo *obj, Edje *ed, const char *locale)
_edje_object_efl_ui_base_language_set(Eo *obj, Edje *ed, const char *locale)
{
const char *lookup;
char *signal;
@ -260,7 +260,7 @@ _edje_object_language_set(Eo *obj, Edje *ed, const char *locale)
}
EOLIAN const char *
_edje_object_language_get(Eo *obj EINA_UNUSED, Edje *ed)
_edje_object_efl_ui_base_language_get(Eo *obj EINA_UNUSED, Edje *ed)
{
if (!ed->language)
return _edje_language;
@ -364,7 +364,7 @@ edje_password_show_last_timeout_set(double password_show_last_timeout)
}
EOLIAN Eina_Bool
_edje_object_scale_set(Eo *obj EINA_UNUSED, Edje *ed, double scale)
_edje_object_efl_ui_base_scale_set(Eo *obj EINA_UNUSED, Edje *ed, double scale)
{
Edje *ged;
Evas_Object *o;
@ -392,7 +392,7 @@ _edje_object_scale_set(Eo *obj EINA_UNUSED, Edje *ed, double scale)
}
EOLIAN double
_edje_object_scale_get(Eo *obj EINA_UNUSED, Edje *ed)
_edje_object_efl_ui_base_scale_get(Eo *obj EINA_UNUSED, Edje *ed)
{
return TO_DOUBLE(ed->scale);
}
@ -405,7 +405,7 @@ _edje_object_base_scale_get(Eo *obj EINA_UNUSED, Edje *ed)
}
EOLIAN Eina_Bool
_edje_object_mirrored_get(Eo *obj EINA_UNUSED, Edje *ed)
_edje_object_efl_ui_base_mirrored_get(Eo *obj EINA_UNUSED, Edje *ed)
{
return ed->is_rtl;
}
@ -421,7 +421,7 @@ _edje_object_orientation_inform(Evas_Object *obj)
}
EOLIAN void
_edje_object_mirrored_set(Eo *obj, Edje *ed, Eina_Bool rtl)
_edje_object_efl_ui_base_mirrored_set(Eo *obj, Edje *ed, Eina_Bool rtl)
{
unsigned short i;

View File

@ -82,6 +82,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
#include "interfaces/efl_text_properties.eo.h"
#include "interfaces/efl_orientation.eo.h"
#include "interfaces/efl_flipable.eo.h"
#include "interfaces/efl_ui_base.eo.h"
#include "interfaces/efl_ui_drag.eo.h"
#include "interfaces/efl_ui_spin.eo.h"
#include "interfaces/efl_ui_progress.eo.h"

View File

@ -48,6 +48,7 @@
#include "interfaces/efl_animator.eo.c"
#include "interfaces/efl_orientation.eo.c"
#include "interfaces/efl_flipable.eo.c"
#include "interfaces/efl_ui_base.eo.c"
#include "interfaces/efl_ui_drag.eo.c"
#include "interfaces/efl_ui_spin.eo.c"
#include "interfaces/efl_ui_progress.eo.c"

View File

@ -0,0 +1,62 @@
/* FIXME: Any better name? Efl.Ui? Efl.Ui.Common? */
interface Efl.Ui.Base
{
[[A common interface for UI objects.]]
eo_prefix: efl_ui;
methods {
@property mirrored {
[[Whether this object should be mirrored.
If mirrored, an object is in RTL (right to left) mode instead of LTR
(left to right).
]]
set {
[[Sets the RTL orientation for this object.]]
}
get {
[[Gets the RTL orientation for this object.]]
}
values {
rtl: bool(false); [[$true for RTL, $false for LTR (default).]]
}
}
@property language {
[[The (human) language for this object.]]
set {
[[Sets the language for this object.]]
}
get {
[[Gets the language for this object.]]
}
values {
language: string; [[The current language.]]
}
}
@property scale {
[[The scaling factor of an object.
This property is an individual scaling factor on the object (Edje
or UI widget). This property (or Edje's global scaling factor, when
applicable), will affect this object's part sizes. If scale is
not zero, than the individual scaling will override any global
scaling set, for the object obj's parts. Set it back to zero to
get the effects of the global scaling again.
Warning: In Edje, only parts which, at EDC level, had the "scale"
property set to 1, will be affected by this function. Check the
complete "syntax reference" for EDC files.
]]
set {
[[Sets the scaling factor of an object.]]
return: bool; [[$true on success, $false otherwise]]
}
get {
[[Gets an object's scaling factor.]]
}
values {
scale: double(0.0); [[The scaling factor (the default value is 0.0,
meaning individual scaling is not set)]]
}
}
}
}