diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 76112732f..33b226f24 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -501,6 +501,7 @@ void CTextBox::refreshText(void) if( m_nNrOfLines <= 0) return; + int y = m_cFrameTextRel.iY + text_border_width; int i; @@ -518,8 +519,14 @@ void CTextBox::refreshText(void) { //calculate centered xpos - if( m_nMode & CENTER ) + if( m_nMode & CENTER ){ x_center = (m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], true))>>1; + } + else if ( m_nMode & RIGHT ){ + x_center = (m_cFrameTextRel.iWidth - m_pcFontText->getRenderWidth(m_cLineArray[i], true)); + if ( m_nMode & SCROLL ) + x_center -= SCROLL_FRAME_WIDTH; + } m_pcFontText->RenderString(m_cFrameTextRel.iX + text_border_width + x_center+m_cFrame.iX, y+m_cFrame.iY, m_cFrameTextRel.iWidth, m_cLineArray[i].c_str(), diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index de5f60416..d12c05c67 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -93,6 +93,7 @@ class CTextBox AUTO_HIGH = 0x02, //auto adapt frame height to max height, text is painted with auto linebreak SCROLL = 0x04, //frame box contains scrollbars on long text CENTER = 0x40, //paint text centered + RIGHT = 0x100, //paint text right NO_AUTO_LINEBREAK = 0x80 //paint text without auto linebreak, cutting text };