Page MenuHomePhabricator

efl_ui_relative_layout: introduce new relative container
AcceptedPublic

Authored by YOhoho on Fri, Dec 28, 12:11 AM.

Details

Summary

Efl.Ui.Relative_Layout is a container which allows you to position and size with
relation to each other.
it is possible to position and size using relation like edje even though
you don't know a edc script.
Position and size can be changed dynamically using widget APIs.

@feature

ref T5487
Depends on D7409

Test Plan

make check
examples
elementary_test -to 'efl.ui.relative_layout'

Diff Detail

Repository
rEFL core/efl
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8971
Build 7792: arc lint + arc unit
YOhoho created this revision.Fri, Dec 28, 12:11 AM
YOhoho requested review of this revision.Fri, Dec 28, 12:11 AM
YOhoho added a comment.EditedFri, Dec 28, 12:26 AM

TODO

  1. implement margin.
  2. add more examples.
  3. add more tests.
  4. enhance documentations.
  5. implement a chain dependency check.(efl_ui_relative_example02)
  6. implement scale.

Class Diagram


Testcase


Interesting :D

Could you move the definition of struct Efl.Ui.Relative_Params to efl_ui_relative.eo file?

src/lib/elementary/efl_ui_relative.eo
1 ↗(On Diff #18132)

Could you define struct Efl.Ui.Relative_Params here? (instead of in efl_ui_relative.h)

Otherwise, Relative_Params cannot be set with values by C# application.

cedric added a subscriber: segfaultxavi.

I am not to sure of the name of this new class as it doesn't express in the name the fact that it is a container. Also, and it is something that I am sure @segfaultxavi will point out, it is lacking a lot of documentation :-)

YOhoho updated this revision to Diff 18252.Sun, Jan 6, 11:54 PM
  1. Rename Efl_Ui_Relative_Param -> Efl_Ui_Relative_Relation and integrate rel1 and rel2.
  2. (API) Rename rel1 -> left, rel2 -> right for intuitive names.
  3. Add Get method for properies.
  4. Update Class Diagram (check above comment)
YOhoho updated this revision to Diff 18253.Mon, Jan 7, 2:02 AM
YOhoho retitled this revision from efl_ui_relative: introduce new relative container to efl_ui_relative_layout: introduce new relative container.
YOhoho edited the summary of this revision. (Show Details)

Rename to Efl.Ui.Relative_Layout

YOhoho added a comment.Mon, Jan 7, 2:40 AM

I am not to sure of the name of this new class as it doesn't express in the name the fact that it is a container. Also, and it is something that I am sure @segfaultxavi will point out, it is lacking a lot of documentation :-)

Yes, documentation is in progress. i'll enhance it after adding more testcase and examples.
BTW, i am not sure that there isn't structural holes. :|

segfaultxavi requested changes to this revision.Mon, Jan 7, 9:32 AM

OK, I'll wait for the new docs before reviewing. I am rejecting this version so we do not forget and this patch gets merged without documentation :)

This revision now requires changes to proceed.Mon, Jan 7, 9:32 AM
YOhoho updated this revision to Diff 18259.Mon, Jan 7, 5:57 PM

implement margin

YOhoho updated this revision to Diff 18275.Wed, Jan 9, 4:03 AM
  1. add elementary_test example.
  2. rename to left, right, top, bottom.
  3. remove register api. (when a child have relation, it is registered)

I want overload relation_#direction# apis. for example,

  1. relation_left_set(Eo *obj, Eo *child, Eo *target) to set only to.
  2. relation_left_set(Eo *obj, Eo *child, double relative) to set only relative.
  3. relation_left_set(Eo *obj, Eo *child, Eo *target, double relative) to set both to and relative.

However, EO doesn't support method overloading. so there are xxx_to, xxx_relative apis.

YOhoho updated this revision to Diff 18276.EditedWed, Jan 9, 4:05 AM

update a meson build file

YOhoho edited the test plan for this revision. (Show Details)Wed, Jan 9, 4:33 AM
  1. add elementary_test example.
  2. rename to left, right, top, bottom.
  3. remove register api. (when a child have relation, it is registered)

    I want overload relation_#direction# apis. for example,
  4. relation_left_set(Eo *obj, Eo *child, Eo *target) to set only to.
  5. relation_left_set(Eo *obj, Eo *child, double relative) to set only relative.
  6. relation_left_set(Eo *obj, Eo *child, Eo *target, double relative) to set both to and relative.

    However, EO doesn't support method overloading. so there are xxx_to, xxx_relative apis.

Don't we have a way to define a default value here ? I would think that in C, if you pass NULL or 0.0, it would just work. In C# and other language, it could just use the default value. So something like :

relation_left_set(Eo *obj, Eo *child, Eo *target, double relative);

Would just work for all case.

YOhoho added a comment.Wed, Jan 9, 8:20 PM

@cedric
Agreed.

relation_left_set(Eo *obj, Eo *child, Eo *target, double relative);

Would cover all cases passing NULL.

When widget have a relation, default relation is set as

left.to = parent;
left.relative = 0.0;
right.to = parent;
right.relative = 1.0;
top.to = parent;
top.relative = 0.0;
bottom.to = parent;
bottom.relative = 1.0;

It is same to Edje.

YOhoho updated this revision to Diff 18310.Wed, Jan 9, 8:24 PM

Rebase and remove relation_dir_to_set, relation_dir_relative_set apis.

YOhoho updated this revision to Diff 18384.Sun, Jan 13, 10:13 PM
  1. rebase
  2. refactoring
  3. add more tests
  4. implement chain relation (efl_ui_relative_layout_example_02)
YOhoho updated this revision to Diff 18397.Mon, Jan 14, 3:50 AM

@segfaultxavi

Add documentations.

segfaultxavi accepted this revision.Mon, Jan 14, 8:58 AM

Nice docs! I am approving, but only documentation-wise :)

This revision is now accepted and ready to land.Mon, Jan 14, 8:58 AM
YOhoho updated this revision to Diff 18415.Tue, Jan 15, 12:47 AM

Remove resize object. it is unnecessary.

YOhoho updated this revision to Diff 18452.Wed, Jan 16, 12:39 AM

optimize chain_calc

YOhoho updated this revision to Diff 18453.Wed, Jan 16, 12:46 AM

Remove resize object again. :(

YOhoho updated this revision to Diff 18649.Sun, Jan 20, 5:49 PM

Rename Calc_Params to Calc.
Optimize chain weight calculation ( O(n^2) -> O(nlog n) )
Add testcase for chain relation.

YOhoho updated this revision to Diff 18650.Sun, Jan 20, 7:19 PM

Fix margin calculation

I think its now ready to land.
I'm waiting for review.
Please check updated class diagram and testcases in my previous comment.