| 400 | } |
| 401 | |
| 402 | void UITextView::alignFix() { |
| 403 | switch ( Font::getHorizontalAlign( getFlags() ) ) { |
| 404 | case UI_HALIGN_CENTER: |
| 405 | mRealAlignOffset.x = |
| 406 | (Float)( (Int32)( ( mSize.x - mPaddingPx.Left - mPaddingPx.Right ) * 0.5f - |
| 407 | getTextWidth() * 0.5f ) ); |
| 408 | break; |
| 409 | case UI_HALIGN_RIGHT: |
| 410 | mRealAlignOffset.x = |
| 411 | ( (Float)mSize.x - mPaddingPx.Left - mPaddingPx.Right - (Float)getTextWidth() ); |
| 412 | break; |
| 413 | case UI_HALIGN_LEFT: |
| 414 | mRealAlignOffset.x = 0; |
| 415 | break; |
| 416 | } |
| 417 | |
| 418 | switch ( Font::getVerticalAlign( getFlags() ) ) { |
| 419 | case UI_VALIGN_CENTER: { |
| 420 | Float height = mSize.y - mPaddingPx.Top - mPaddingPx.Bottom; |
| 421 | Float fontSize = mTextCache.getCharacterSize(); |
| 422 | Float lineSpacing = mTextCache.getFont()->getLineSpacing( fontSize ); |
| 423 | Float center = eefloor( ( lineSpacing - fontSize ) * 0.5f ); |
| 424 | Float textHeight = mTextCache.getTextHeight(); |
| 425 | mRealAlignOffset.y = eefloor( ( height - textHeight + center ) * 0.5f ); |
| 426 | break; |
| 427 | } |
| 428 | case UI_VALIGN_BOTTOM: |
| 429 | mRealAlignOffset.y = |
| 430 | ( (Float)mSize.y - mPaddingPx.Top - mPaddingPx.Bottom - |
| 431 | (Float)mTextCache.getFont()->getAscent( mTextCache.getCharacterSize() ) ); |
| 432 | break; |
| 433 | case UI_VALIGN_TOP: |
| 434 | mRealAlignOffset.y = 0; |
| 435 | break; |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | Uint32 UITextView::onFocusLoss() { |
| 440 | UIWidget::onFocusLoss(); |
nothing calls this directly
no test coverage detected