mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
*CTextbox: add text align option RIGHT
This supports paint of text on the right side of frame and also considers scroll bar width.
This commit is contained in:
@@ -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(),
|
||||
|
Reference in New Issue
Block a user