Page MenuHomePhabricator

efl.pack_table
Closed, ResolvedPublic

Description

| |interface Efl.Pack_Table @beta
|├ (P) table_position
|├ (P) table_size
|├ (P) table_columns
|├ (P) table_rows
|├ (M) pack_table
|├ (M) table_contents_get
|├ (M) table_content_get
bu5hm4n created this task.May 3 2019, 12:02 PM
bu5hm4n triaged this task as TODO priority.
bu5hm4n added a subtask: T7861: efl.pack.
bu5hm4n moved this task from Backlog to Trivial on the efl: api board.May 6 2019, 10:16 AM
zmike added a comment.May 31 2019, 6:14 AM

Didn't table_direction get removed?

segfaultxavi updated the task description. (Show Details)May 31 2019, 6:32 AM

Yeah, I didn't update this description. Done now.

zmike added a comment.Jun 12 2019, 5:55 AM

What about renaming table_size to something more like table_geometry? When I see size, I immediately think canvas/pixel size, which is not quite right.

geometry reminds me of rectangles, squares or circles...
table_size is redundant anyway, since it has the same info as table_columns and table_rows. Maybe we can just remove it...

zmike added a comment.Jun 14 2019, 6:59 AM

This is a good point. Let's cut it.

When you say "Let us cut it"... who exactly is us? ?

zmike added a comment.Jun 14 2019, 9:04 AM

Future me.

Looking at this again, it seems like this is somewhat similar to how on gfx.entity objects we have position, size, and geometry. It's nice to be able to set/access both axes in one call, so I think we should leave it.

I agree it is convenient to be able to access both axes at the same time. Let's leave table_size, but we still need a new name for it, though.

Furthermore, table_position is a property with only getter. Shouldn't this be a method then? or do we turn it into a r/w property and allow changing object's position?

I am not very happy with content_get and contents_get, but I see their value. They need better docs and maybe a different name.

zmike added a comment.Jun 18 2019, 9:16 AM

Maybe table_cell instead of position? Feels weird if that has a setter since then there's pack and table_cell_get. Isn't there some kind of interface for calling on packed subobjects for things like this? Maybe there should be one?

I think I like table_cell_content_get for getting the object at x,y position too...

Allow me to summarize these interfaces because I am loosing perspective. Efl.Pack_Table and Efl.Pack_Linear are the interfaces to handle 2D and 1D arrangements of widgets, respectively. The important thing here is that they are consistent, I think.

This is their current state, and some name changes I propose:

Efl.Pack_LinearDescriptionEfl.Pack_Table Current nameEfl.Pack_Table Suggested new names
pack_begin, pack_endAdds subobj at absolute positionN/A
pack_before, pack_afterAdds subobj relative to existing oneN/A
pack_atAdds subobj at given indextable_packtable_pack_at
pack_content_getRetrieves subobj at given indextable_content_get
pack_index_getRetrieve a subobj's indextable_positiontable_position_get, table_coords_get
N/ARetrieve ALL subobjs at given indextable_contents_get

I don't think I want to introduce cell, because it has not been used anywhere else. I think position or coords are easily understood as the 2D versions of index.
Also, table_pack is missing an at at the end, for consistency.

What do you think?

zmike added a comment.Jun 19 2019, 6:41 AM

This chart https://i.imgur.com/QONVIyz.gif

My concern with using position or coords in this context is that the first impression is that it somehow affects the position of the table object. I realize this can be clarified with docs, but I think we should try to keep terms contextualized.

I like big charts and I cannot lie.

You have a point there. Howe about cell_position_get or cell_coords_get ?
(We then use the table prefix for things that affect the whole table and cell for things that affect a single cell)

This is a rather useless API anyway... the user added the thing to the table, why should it be asking now for its position?

zmike added a comment.Jun 19 2019, 9:32 AM

It's used in the code now, so there must be a reason for it...probably.

I really just don't like using those terms in any capacity here, so I'm only okay with that if we absolutely can't think of something better.

cell_column_get and cell_row_get are my last offer.

zmike added a comment.Jun 20 2019, 7:11 AM

But those are for the individual properties and we're talking about the combined property...

Exactly. Right now there's only the combined property and we cannot find a good name for it, so I propose to split it. The separate properties are hopefully easier to name.

YOhoho added a subscriber: YOhoho.Jul 8 2019, 3:30 AM

I think pack_table is okay. _table is postfix of pack like _at, _begin, _after.

To split properties is find to me. we can also provide setter method. (cell_column_set, cell_row_set)

And we have content_iterate to iterate over packed subobjects in Efl.Container. but i'm not sure table_content_iterate(table_cell_content_iterate) is good name to retrieve ALL subobjs at given index.

@YOhoho

I think your research of other platforms could be very useful for this discussion :)
Can you share the results of research ?

How to add child to 2D Container

GridLayout, TableLayout(Android)Note
addView(View child)In the case of TableLayout, TableRow tr = new TableRow(this); tr.addView(label); tableLayout.addView(tr);
addView(View child, int index)
addView(View child, int width, int height)width and height are gfx sizes
addView(View child, LayoutParams params)
addView(View child, int index, LayoutParams params)
Grid(WPF)
SetColumn(UIElement element, int value)
SetColumnSpan(UIElement element, int value)
SetRow(UIElement element, int value)
SetRowSpan(UIElement element, int value)
Efl.Ui.Table
bool PackTable(Efl.Gfx.IEntity subobj, int col, int row, int colspan, int rowspan);

How to access child by column and row

GridLayout(Android)TableLayout(Android)
View getChildAt(int index)TableRow row = (TableRow)tableLayout.getChildAt(i); Button button = (Button)row.getChildAt(j);
Grid(WPF)
no APIs. you can use Children property. e.g. grid.Children.Cast<UIElement>().Where(i => Grid.GetRow(i) == 0);
Efl.Ui.Table
Eina.Iterator<Efl.Gfx.IEntity> GetTableContents(int col, int row, bool below);
Efl.Gfx.IEntity GetTableContent(int col, int row);

How to get column and row properties of child

GridLayout(Android)TableLayout(Android)
no APIs (i can't find)TableRow row = (TableRow)tableLayout.getChildAt(i); TableRow.LayoutParams param= (TableRow.LayoutParams) row.getLayoutParams(); param.column;
Grid(WPF)
int GetColumn(UIElement element)
int GetColumnSpan(UIElement element)
int GetRow(UIElement element)
int GetRowSpan(UIElement element)
Efl.Ui.Table
bool GetTablePosition(Efl.Gfx.IEntity subobj, out int col, out int row, out int colspan, out int rowspan)

==>

Efl.Ui.Table (@segfaultxavi's suggestion)
bool GetCellColumn(Efl.Gfx.IEntity subobj, out int col, out int colspan)
bool GetCellRow(Efl.Gfx.IEntity subobj, out int row, out int rowspan)

+

Efl.Ui.Table (my suggestion)
bool SetCellColumn(Efl.Gfx.IEntity subobj, int col, int colspan)
bool SetCellRow(Efl.Gfx.IEntity subobj, int row, int rowspan)

I think the separated property getter/setter are also useful, because EFL doesn't have common property struct(like LayoutParams in android).

zmike added a comment.Aug 29 2019, 7:09 AM

Is this done?

Besides the examples not working (T8182) I think the API is sound now.

zmike moved this task from Trivial to Stabilized on the efl: api board.Aug 29 2019, 7:45 AM