From fee315f642e69b0fa799aab80c9103aca42e5ad9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 24 Sep 2012 16:35:38 +0200 Subject: [PATCH] *CTextBox: add option BOTTOM BOTTOM was missed --- src/gui/widget/textbox.cpp | 6 +++++- src/gui/widget/textbox.h | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index a4b182011..fc8039284 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -492,7 +492,7 @@ void CTextBox::refreshText(void) if( frameBuffer == NULL) return; - //TRACE("[CTextBox] m_nCurrentLine: %d, m_cLineArray[m_nCurrentLine]: %s\r\n",m_nCurrentLine, m_cLineArray[m_nCurrentLine].c_str()); + //TRACE("[CTextBox] m_nCurrentLine: %d, m_nNrOfLines %d, m_cLineArray[m_nCurrentLine]: %s\r\n",m_nCurrentLine, m_nNrOfLines, m_cLineArray[m_nCurrentLine].c_str()); //Paint Text Background if (m_nPaintBackground) @@ -511,6 +511,10 @@ void CTextBox::refreshText(void) if (m_nMode & TOP) // move to top of frame y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * m_nLinesPerPage) >> 1) - text_border_width; + else if (m_nMode & BOTTOM) + // move to bottom of frame + y += m_cFrameTextRel.iHeight - text_border_width - (m_nNrOfLines > 1 ? (m_nNrOfLines-1)*m_nFontTextHeight : 0) ; + //m_nFontTextHeight + text_border_width /*- ((m_cFrameTextRel.iHeight + m_nFontTextHeight*/ * m_nLinesPerPage/*) >> 1)*/; else // fit into mid of frame space y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * std::min(m_nLinesPerPage, m_nNrOfLines)) >> 1) - text_border_width; diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index 58d77df5d..b7e8c1166 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -93,9 +93,10 @@ 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 - TOP = 0x200, //paint text on top of frame - NO_AUTO_LINEBREAK = 0x80 //paint text without auto linebreak, cutting text + RIGHT = 0x80, //paint text right + TOP = 0x100, //paint text on top of frame + BOTTOM = 0x200, //paint text on bottom of frame + NO_AUTO_LINEBREAK = 0x400 //paint text without auto linebreak, cutting text }; private: