float ETextBox::GetMinHeight() { if (_nFontSize<=0 || _cText == NULL || strcmp(_cText,"") == 0) { _fTextHeight = 0; } else { _fTextHeight = _lpFont->getMultilineHeight(_cText,0,GetInnerWidth(),0,_nTextStyle,0,_nFontSize); _fTextWidth = _lpFont->getMultilineWidth(_cText,0,GetInnerWidth(),0,_nTextStyle,0,_nFontSize); } _minInnerHeight = _fTextHeight; return EBox::GetMinHeight(); }
void EBox::UpdateChild() { // Repositionnement des box filles Coord innersize = Coord(GetInnerWidth(),GetInnerHeight()); Coord startpos = GetPos() + GetLeftTopMargin(); Coord pos = startpos; // preparation pour la mise en forme gestion LAYOUT + LMAMYOUTDIRPOLICY if (_nNumMaximizeChild == 0) { if (_layoutType == VERTICAL) { if (_vPolicy == VCENTER) { pos.y += (innersize.y - _fChildMinHeight)/2; } else if (_vPolicy == DOWN) { pos.y = pos.y +innersize.y - _fChildMinHeight; } } else { if (_hPolicy == HCENTER) { pos.x += (innersize.x - _fChildMinWidth)/2; } else if (_hPolicy == RIGHT) { pos.x = pos.x + innersize.x - _fChildMinWidth; } } } // mise a jour des position des enfants dans le sens du layout float childWidth, childHeight; EBox *child; for (int i=0; i<_vChilds.size(); i++) { child = _vChilds[i]; childWidth = child->GetWidth(); childHeight = child->GetHeight(); if (_layoutType == VERTICAL) { if (_hPolicy == HCENTER) { pos.x = startpos.x + (innersize.x - childWidth)/2; } else if (_hPolicy == RIGHT) { pos.x = startpos.x + (innersize.x - childWidth); } } else { if (_vPolicy == VCENTER) { pos.y = startpos.y + (innersize.y - childHeight)/2; } else if (_vPolicy == DOWN) { pos.y = startpos.y + (innersize.y - childHeight); } } child->Move(pos); if (_layoutType == VERTICAL) { pos.y += childHeight; } else { pos.x += childWidth; } } }
int UI::Element::GetInnerRight() const { return GetInnerLeft() + GetInnerWidth() - 1; }