AIMP Forum

AIMP для Windows => Skin Editor / Skin Engine => Вопросы => Topic started by: baram on April 27, 2014, 05:36:05

Title: To hide the container if its children are not visible
Post by: baram on April 27, 2014, 05:36:05
I have this container hierarchy.

parent
    - child 1
    - child 2
    - ...
    - child n

I want to hide parent if all children are also non-visible

If parent have no texture, this is easy.

Because parent have no size if its children are all hidden.

But if the parent have some texture, this is very difficult.

Because the parent have minimum size same with its texture size.

There is some possible solution, but I don't think it's perfect.

(solution 1)

Making many custom providers(commutator).

By grouping two children each, the parent will be hidden if all children are also hidden.

child 1        >
child 2
                        >
child i         >            >  parent
child j
                        >
child n-1    >
child n


(solution 2)

Making a specific container to indicate parent visibility.

parent
    - indicator
    - child 1
    - ...
    - child n

The indicator's attribute are AutoHide = true, AutoHideParentSizeThreshold = parent texture's height or width.

If all children are hidden, the parent's size will be same to its texture size.

So the indicator will be hidden.

And by binding between indicator and parent, you can make parent hidden when its children are all hidden.

But this solution have serious flaw.

I can make parent hidden but can't make it visible again.

Once the parent goes hidden, the indicator's AutoHide mechanism become not working.

Even if I change child's visibility to true, the parent won't be visible again.



So I ask you, how to solve this.