- if( !(Element->Flags & ELEFLAG_FIXEDSIZE) ) {
- // If the element is sized, fix its dimension(s)
- if(Element->Size)
- {
- if(Element->Flags & ELEFLAG_NOEXPAND)
- {
- Element->CachedW = Element->Size;
- Element->CachedH = Element->Size;
- }
- else {
- if( Element->Parent->Flags & ELEFLAG_VERTICAL ) {
- Element->CachedH = Element->Size;
- Element->CachedW = Element->Parent->CachedW;
- if(Element->CachedW)
- Element->CachedW -= (Element->Parent->PaddingL + Element->Parent->PaddingR);
- }
- else {
- Element->CachedW = Element->Size;
- Element->CachedH = Element->Parent->CachedH;
- if(Element->CachedH)
- Element->CachedH -= (Element->Parent->PaddingT + Element->Parent->PaddingB);
- }
- }
- }
- else {
- // Ok, so now we need to calculate the size of all child elements
- // However, if ELEFLAG_NOEXPAND is not set, we can still set one
- // dimension
- if( !(Element->Flags & ELEFLAG_NOEXPAND) ) {
- if( Element->Parent->Flags & ELEFLAG_VERTICAL ) {
- Element->CachedW = Element->Parent->CachedW;
- if(Element->CachedW)
- Element->CachedW -= (Element->Parent->PaddingL + Element->Parent->PaddingR);
- }
- else {
- Element->CachedH = Element->Parent->CachedH;
- if(Element->CachedH)
- Element->CachedH -= (Element->Parent->PaddingT + Element->Parent->PaddingB);
- }
- }
- }
+ _SysDebug(" - nChildren = %i, nFixed = %i", Element, nChildren, nFixed);
+ if( nChildren > nFixed ) {
+ if( Element->Flags & ELEFLAG_VERTICAL )
+ dynWith = Element->CachedH - Element->PaddingT
+ - Element->PaddingB;
+ else
+ dynWith = Element->CachedW - Element->PaddingL
+ - Element->PaddingR;
+ dynWith -= fixedSize;
+ if( dynWith < 0 ) return ;
+ dynWith /= nChildren - nFixed;
+ _SysDebug(" - dynWith = %i", dynWith);