edje: Reshuffle a bit edje_object.eo

This changes a few method names:
 - freeze -> calc_freeze
 - thaw -> calc_thaw
 - update_hints -> calc_update_hints

Otherwise this is mostly about reshuffling the EO file itself
and changing documentation.

Ref T5315
This commit is contained in:
Jean-Philippe Andre 2017-05-31 17:03:26 +09:00
parent aa5ac8eed7
commit ce0d15ecb3
6 changed files with 163 additions and 169 deletions

View File

@ -937,7 +937,7 @@ _edje_recalc_do(Edje *ed)
ed->recalc_hints = EINA_FALSE; ed->recalc_hints = EINA_FALSE;
edje_obj_size_min_calc(ed->obj, &w, &h); edje_object_size_min_calc(ed->obj, &w, &h);
efl_gfx_size_hint_restricted_min_set(ed->obj, w, h); efl_gfx_size_hint_restricted_min_set(ed->obj, w, h);
} }

View File

@ -11,22 +11,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
event_prefix: edje_object; event_prefix: edje_object;
data: Edje; data: Edje;
methods { methods {
@property update_hints {
set {
[[Edje will automatically update the size hints on itself.
By default edje doesn't set size hints on itself. With this function
call, it will do so if update is $true. Be carefully, it cost a lot to
trigger this feature as it will recalc the object every time it make
sense to be sure that's its minimal size hint is always accurate.]]
}
get {
[[Whether or not Edje will update size hints on itself.]]
}
values {
update: bool; [[Whether or not update the size hints.]]
}
}
@property mirrored { @property mirrored {
set { set {
[[Sets the RTL orientation for this object. [[Sets the RTL orientation for this object.
@ -135,24 +119,24 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
} }
} }
@property transition_duration_factor { @property transition_duration_factor {
set { [[Transition duration factor.
[[Sets transition duration factor.
This define the transition duration factor on this This defines a multiplier for the duration of transitions as they
specific object. By default all animation are run at a speed are defined in EDC. By default this factor is 1.0, which means
factor of 1.0.]] animations play at the same speed as described in EDC.
]]
set {
[[Sets transition duration factor.]]
} }
get { get {
[[Gets transition duration factor. [[Gets transition duration factor.]]
This define the transition duration factor on this
specific object. By default all animation are run at a speed
factor of 1.0.]]
} }
values { values {
scale: double; [[The transition duration factor]] scale: double(1.0); [[The transition duration factor.]]
} }
} }
// TODO: An Efl.Ui.Base class that contains mirrored, language, scale
@property scale { @property scale {
set { set {
[[Sets the scaling factor for a given Edje object. [[Sets the scaling factor for a given Edje object.
@ -199,87 +183,8 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
that means the edc file is made based on scale 1.0.]] that means the edc file is made based on scale 1.0.]]
} }
} }
@property size_min {
get {
[[Gets the minimum size specified -- as an EDC property -- for a
given Edje object
This function retrieves the obj object's minimum size values, // TODO: Legacy only. EO may rely on futures.
as declared in its EDC group definition.
Note: If the $min EDC property was not declared for obj, this
call will return the value 0, for each axis.
Note: On failure, this function will make all non-$null size
pointers' pointed variables be set to zero.
See also @.size_max.get()]]
/* FIXME-doc
* Minimum size of groups have the following syntax
* @code
* collections
* {
* group
* {
* name: "a_group";
* min: 100 100;
* }
* }
* @endcode
* where one declares a minimum size of 100 pixels both for width and
* height. Those are (hint) values which should be respected when the
* given object/group is to be controlled by a given container object
* (e.g. an Edje object being "swallowed" into a given $SWALLOW
* typed part, as in edje_object_part_swallow()). Check the complete
* \@ref edcref "syntax reference" for EDC files.
*/
}
values {
minw: int; [[Pointer to a variable where to store the minimum width]]
minh: int; [[Pointer to a variable where to store the minimum height]]
}
}
@property size_max {
get {
[[Gets the maximum size specified -- as an EDC property -- for a
given Edje object
This function retrieves the obj object's maximum size values,
as declared in its EDC group definition.
Note: If the $max EDC property was not declared for obj, this
call will return the maximum size a given Edje object may have, for
each axis.
Note: On failure, this function will make all non-$null size
pointers' pointed variables be set to zero.
See also @.size_min.get()]]
/* FIXME-doc
* Maximum size of groups have the following syntax
* @code
* collections
* {
* group
* {
* name: "a_group";
* max: 100 100;
* }
* }
* @endcode
* where one declares a maximum size of 100 pixels both for width and
* height. Those are (hint) values which should be respected when the
* given object/group is to be controlled by a given container object
* (e.g. an Edje object being "swallowed" into a given $SWALLOW
* typed part, as in edje_object_part_swallow()). Check the complete
* \@ref edcref "syntax reference" for EDC files.
*/
}
values {
maxw: int; [[Pointer to a variable where to store the maximum width]]
maxh: int; [[Pointer to a variable where to store the maximum height]]
}
}
preload { preload {
[[Preloads the images on the Edje Object in the background. [[Preloads the images on the Edje Object in the background.
@ -314,48 +219,76 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
[[The load error code.]] [[The load error code.]]
} }
} }
/* EDJE CALC APIS BEGIN ---------------------------------------------- */
@property calc_update_hints {
[[Whether this object updates its size hints automatically.
By default edje doesn't set size hints on itself. If this property
is set to $true, size hints will be updated after recalculation.
Be careful, as recalculation may happen often, enabling this
property may have a considerable performance impact as other widgets
will be notified of the size hints changes.
A layout recalculation can be triggered by @.size_min_calc(),
@.size_min_restricted_calc(), @.parts_extends_calc() or even any
other internal event.
]]
set {
[[Enable or disable auto-update of size hints.]]
legacy: edje_object_update_hints_set;
}
get {
[[Whether this object updates its size hints automatically.]]
legacy: edje_object_update_hints_get;
}
values {
update: bool(false); [[Whether or not update the size hints.]]
}
}
// FIXME: Prefix with calc_ ?
size_min_calc { size_min_calc {
[[Calculates the minimum required size for a given Edje object. [[Calculates the minimum required size for a given Edje object.
This call works exactly as edje_object_size_min_restricted_calc(), This call works exactly as edje_object_size_min_restricted_calc(),
with the last two arguments set to 0. Please refer to its with the last two arguments set to 0. Please refer to its
documentation, then.]] documentation, then.
]]
// FIXME: Return a 2D size type (no @out values)
params { params {
@out minw: int; [[Pointer to a variable where to store the minimum @out minw: int; [[The minimum required width (return value)]]
required width]] @out minh: int; [[The minimum required height (return value)]]
@out minh: int; [[Pointer to a variable where to store the minimum
required height]]
} }
} }
// FIXME: Prefix with calc_ ?
size_min_restricted_calc { size_min_restricted_calc {
[[Calculates the minimum required size for a given Edje object. [[Calculates the minimum required size for a given Edje object.
This call will trigger an internal recalculation of all parts of This call will trigger an internal recalculation of all parts of
the obj object, in order to return its minimum required the object, in order to return its minimum required dimensions for
dimensions for width and height. The user might choose to impose width and height. The user might choose to impose those minimum
those minimum sizes, making the resulting calculation to get to values sizes, making the resulting calculation to get to values equal or
equal or bigger than restrictedw and restrictedh, for width and larger than $restrictedw and $restrictedh, for width and height,
height, respectively. respectively.
Note: At the end of this call, obj won't be automatically Note: At the end of this call, the object won't be automatically
resized to new dimensions, but just return the calculated resized to the new dimensions, but just return the calculated sizes.
sizes. The caller is the one up to change its geometry or not. The caller is the one up to change its geometry or not.
Warning: Be advised that invisible parts in obj will be taken
into account in this calculation.]]
Warning: Be advised that invisible parts in the object will be taken
into account in this calculation.
]]
// FIXME: Return a 2D size type (no @out values)
params { params {
@out minw: int; [[Pointer to a variable where to store the minimum @out minw: int; [[The minimum required width (return value)]]
required width]] @out minh: int; [[The minimum required height (return value)]]
@out minh: int; [[Pointer to a variable where to store the minimum @in restrictedw: int; [[The minimum width constraint as input,
required height]] $minw can not be lower than this]]
@in restrictedw: int; [[Do not allow object's calculated (minimum) width @in restrictedh: int; [[The minimum height constraint as input,
to be less than this value]] $minh can not be lower than this]]
@in restrictedh: int; [[Do not allow object's calculated (minimum)
height to be less than this value]]
} }
} }
// FIXME: Prefix with calc_ ?
parts_extends_calc { parts_extends_calc {
[[Calculates the geometry of the region, relative to a given Edje [[Calculates the geometry of the region, relative to a given Edje
object's area, occupied by all parts in the object. object's area, occupied by all parts in the object.
@ -367,52 +300,112 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
boundaries will also be taken in account, so that x and y boundaries will also be taken in account, so that x and y
may be negative. may be negative.
Note: Use $null pointers on the geometry components you're not
interested in: they'll be ignored by the function.
Note: On failure, this function will make all non-$null geometry Note: On failure, this function will make all non-$null geometry
pointers' pointed variables be set to zero.]] pointers' pointed variables be set to zero.
]]
return: bool; [[$true on success, $false otherwise]] return: bool; [[$true on success, $false otherwise]]
/* FIXME: Return a 2D size type (no @out values) */
params { params {
@out x: int; [[A pointer to a variable where to store the parts region's @out x: int; [[The parts region's X coordinate]]
x coordinate]] @out y: int; [[The parts region's Y coordinate]]
@out y: int; [[A pointer to a variable where to store the parts region's @out w: int; [[The parts region's width]]
y coordinate]] @out h: int; [[The parts region's height]]
@out w: int; [[A pointer to a variable where to store the parts region's
width]]
@out h: int; [[A pointer to a variable where to store the parts region's
height]]
} }
} }
calc_force { calc_force {
[[Forces a Size/Geometry calculation. [[Forces a Size/Geometry calculation.
Forces the object obj to recalculation layout regardless of Forces the object to recalculate its layout regardless of
freeze/thaw.]] freeze/thaw.
See also @.calc_freeze and @.calc_thaw.
]]
} }
freeze { calc_freeze {
[[Freezes the Edje object. [[Freezes the Edje object.
This function puts all changes on hold. Successive freezes will This function puts all changes on hold. Successive freezes will
nest, requiring an equal number of thaws. nest, requiring an equal number of thaws.
See also @.thaw()]] See also @.calc_thaw()
]]
return: int; [[The frozen state or 0 on Error]] return: int; [[The frozen state or 0 on error]]
legacy: edje_object_freeze;
} }
thaw { calc_thaw {
[[Thaws the Edje object. [[Thaws the Edje object.
This function thaws the given Edje object. This function thaws the given Edje object.
Note:: If sucessives freezes were done, an equal number of Note: If sucessive freezes were done, an equal number of thaws will
thaws will be required. be required.
See also @.freeze()]] See also @.calc_freeze()
]]
return: int; [[The frozen state or 0 if the object is not frozen or on error.]]
legacy: edje_object_thaw;
}
/* EDJE CALC APIS END ------------------------------------------------ */
return: int; [[The frozen state or $0 if the object is not frozen or on error.]] /* EDJE GROUP DATA APIS BEGIN ---------------------------------------- */
@property group_size_min {
get {
[[Gets the minimum size specified -- as an EDC property -- for a
given Edje object
This function retrieves the obj object's minimum size values,
as declared in its EDC group definition. For instance, for an
Edje object of minimum size 100x100 pixels:
collections {
group {
name: "a_group";
min: 100 100;
}
}
Note: If the $min EDC property was not declared for this object,
this call will return 0x0.
Note: On failure, this function also return 0x0.
See also @.group_size_max.
]]
legacy: edje_object_size_min_get;
}
values {
minw: int; [[Pointer to a variable where to store the minimum width]]
minh: int; [[Pointer to a variable where to store the minimum height]]
}
}
@property group_size_max {
get {
[[Gets the maximum size specified -- as an EDC property -- for a
given Edje object
This function retrieves the object's maximum size values,
as declared in its EDC group definition. For instance, for an
Edje object of maximum size 100x100 pixels:
collections {
group {
name: "a_group";
max: 100 100;
}
}
Note: If the $max EDC property was not declared for the object,
this call will return the maximum size a given Edje object may
have, for each axis.
Note: On failure, this function will return 0x0.
See also @.group_size_min.
]]
legacy: edje_object_size_max_get;
}
values {
maxw: int; [[The maximum width]]
maxh: int; [[The maximum height]]
}
} }
@property group_data { @property group_data {
get { get {
@ -450,6 +443,7 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
val: string; [[The data's value string.]] val: string; [[The data's value string.]]
} }
} }
/* EDJE GROUP DATA APIS END ------------------------------------------ */
/* MESSAGE & SIGNAL APIS BEGIN --------------------------------------- */ /* MESSAGE & SIGNAL APIS BEGIN --------------------------------------- */
message_send { message_send {

View File

@ -459,7 +459,7 @@ _edje_object_group_data_get(Eo *obj EINA_UNUSED, Edje *ed, const char *key)
} }
EOLIAN int EOLIAN int
_edje_object_freeze(Eo *obj EINA_UNUSED, Edje *ed) _edje_object_calc_freeze(Eo *obj EINA_UNUSED, Edje *ed)
{ {
unsigned short i; unsigned short i;
@ -477,7 +477,7 @@ _edje_object_freeze(Eo *obj EINA_UNUSED, Edje *ed)
} }
EOLIAN int EOLIAN int
_edje_object_thaw(Eo *obj EINA_UNUSED, Edje *ed) _edje_object_calc_thaw(Eo *obj EINA_UNUSED, Edje *ed)
{ {
unsigned short i; unsigned short i;
@ -3695,7 +3695,7 @@ _edje_object_efl_part_part(Eo *obj, Edje *ed, const char *part)
} }
EOLIAN void EOLIAN void
_edje_object_size_min_get(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh) _edje_object_group_size_min_get(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh)
{ {
if ((!ed) || (!ed->collection)) if ((!ed) || (!ed->collection))
{ {
@ -3708,7 +3708,7 @@ _edje_object_size_min_get(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_
} }
EOLIAN void EOLIAN void
_edje_object_size_max_get(Eo *obj EINA_UNUSED, Edje *ed EINA_UNUSED, Evas_Coord *maxw, Evas_Coord *maxh) _edje_object_group_size_max_get(Eo *obj EINA_UNUSED, Edje *ed EINA_UNUSED, Evas_Coord *maxw, Evas_Coord *maxh)
{ {
if ((!ed) || (!ed->collection)) if ((!ed) || (!ed->collection))
{ {
@ -5376,7 +5376,7 @@ _edje_object_preload(Eo *obj, Edje *ed, Eina_Bool cancel)
} }
EOLIAN void EOLIAN void
_edje_object_update_hints_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool update) _edje_object_calc_update_hints_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool update)
{ {
if (!ed) return; if (!ed) return;
if (ed->update_hints == !!update) return; if (ed->update_hints == !!update) return;
@ -5390,7 +5390,7 @@ _edje_object_update_hints_set(Eo *obj EINA_UNUSED, Edje *ed, Eina_Bool update)
} }
EOLIAN Eina_Bool EOLIAN Eina_Bool
_edje_object_update_hints_get(Eo *obj EINA_UNUSED, Edje *ed) _edje_object_calc_update_hints_get(Eo *obj EINA_UNUSED, Edje *ed)
{ {
return ed->update_hints; return ed->update_hints;
} }

View File

@ -1139,7 +1139,7 @@ _efl_ui_image_edje_object_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd
} }
EOLIAN static void EOLIAN static void
_efl_ui_image_edje_object_size_min_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h) _efl_ui_image_edje_object_group_size_min_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h)
{ {
if (sd->edje) if (sd->edje)
edje_object_size_min_get(sd->img, w, h); edje_object_size_min_get(sd->img, w, h);
@ -1148,7 +1148,7 @@ _efl_ui_image_edje_object_size_min_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *s
} }
EOLIAN static void EOLIAN static void
_efl_ui_image_edje_object_size_max_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h) _efl_ui_image_edje_object_group_size_max_get(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h)
{ {
if (sd->edje) if (sd->edje)
edje_object_size_max_get(sd->img, w, h); edje_object_size_max_get(sd->img, w, h);

View File

@ -136,8 +136,8 @@ class Efl.Ui.Image (Elm.Widget, Efl.Ui.Clickable, Efl.Ui.Draggable,
Efl.Player.playable { get; } Efl.Player.playable { get; }
Efl.Player.play { get; set; } Efl.Player.play { get; set; }
Edje.Object.signal_emit; Edje.Object.signal_emit;
Edje.Object.size_min { get; } Edje.Object.group_size_min { get; }
Edje.Object.size_max { get; } Edje.Object.group_size_max { get; }
Edje.Object.size_min_calc; Edje.Object.size_min_calc;
Edje.Object.calc_force; Edje.Object.calc_force;
Efl.Canvas.Object.clip { set; } Efl.Canvas.Object.clip { set; }

View File

@ -353,7 +353,7 @@ video_obj_frame_resize_cb(void *data, const Efl_Event *event)
if (ratio > 0.0) iw = (ih * ratio) + 0.5; if (ratio > 0.0) iw = (ih * ratio) + 0.5;
evas_object_size_hint_min_set(event->object, iw, ih); evas_object_size_hint_min_set(event->object, iw, ih);
edje_object_part_swallow(oe, "video_swallow", event->object); edje_object_part_swallow(oe, "video_swallow", event->object);
edje_obj_size_min_calc(oe, &w, &h); edje_object_size_min_calc(oe, &w, &h);
efl_gfx_size_set(oe, w, h); efl_gfx_size_set(oe, w, h);
evas_object_size_hint_min_set(event->object, 0, 0); evas_object_size_hint_min_set(event->object, 0, 0);
edje_object_part_swallow(oe, "video_swallow", event->object); edje_object_part_swallow(oe, "video_swallow", event->object);
@ -625,7 +625,7 @@ init_video_object(const char *module_filename, const char *filename)
offset = 20 * (eina_list_count(video_objs) - 1); offset = 20 * (eina_list_count(video_objs) - 1);
efl_gfx_position_set(oe, offset, offset); efl_gfx_position_set(oe, offset, offset);
edje_obj_size_min_calc(oe, &w, &h); edje_object_size_min_calc(oe, &w, &h);
efl_gfx_size_set(oe, w, h); efl_gfx_size_set(oe, w, h);
efl_event_callback_array_add(o, emotion_object_test_callbacks(), oe); efl_event_callback_array_add(o, emotion_object_test_callbacks(), oe);