- listframe: allow round borders

This commit is contained in:
svenhoefer
2016-11-07 13:45:55 +01:00
parent 664bd8dcf9
commit c7942adb8f
2 changed files with 35 additions and 23 deletions

View File

@@ -190,9 +190,11 @@ void CListFrame::initVar(void)
m_nCurrentPage = 0; m_nCurrentPage = 0;
m_nSelectedLine = 0; m_nSelectedLine = 0;
m_nBgRadius = RADIUS_NONE;
m_cFrame.iX = frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - MIN_WINDOW_WIDTH) >>1); m_cFrame.iX = frameBuffer->getScreenX() + ((frameBuffer->getScreenWidth() - MIN_WINDOW_WIDTH) >>1);
m_cFrame.iWidth = MIN_WINDOW_WIDTH;
m_cFrame.iY = frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight() - MIN_WINDOW_HEIGHT) >>1); m_cFrame.iY = frameBuffer->getScreenY() + ((frameBuffer->getScreenHeight() - MIN_WINDOW_HEIGHT) >>1);
m_cFrame.iWidth = MIN_WINDOW_WIDTH;
m_cFrame.iHeight = MIN_WINDOW_HEIGHT; m_cFrame.iHeight = MIN_WINDOW_HEIGHT;
m_nMaxHeight = MAX_WINDOW_HEIGHT; m_nMaxHeight = MAX_WINDOW_HEIGHT;
@@ -236,8 +238,8 @@ void CListFrame::initFramesRel(void)
if(m_nMode & TITLE) if(m_nMode & TITLE)
{ {
m_cFrameTitleRel.iX = 0; m_cFrameTitleRel.iX = 0;
m_cFrameTitleRel.iY = 0; m_cFrameTitleRel.iY = 0;
m_cFrameTitleRel.iHeight = m_nFontTitleHeight +2 ; m_cFrameTitleRel.iHeight = m_nFontTitleHeight +2 ;
m_cFrameTitleRel.iWidth = m_cFrame.iWidth ; m_cFrameTitleRel.iWidth = m_cFrame.iWidth ;
} }
@@ -245,44 +247,44 @@ void CListFrame::initFramesRel(void)
{ {
m_cFrameTitleRel.iX = 0; m_cFrameTitleRel.iX = 0;
m_cFrameTitleRel.iY = 0; m_cFrameTitleRel.iY = 0;
m_cFrameTitleRel.iHeight= 0; m_cFrameTitleRel.iHeight = 0;
m_cFrameTitleRel.iWidth = 0; m_cFrameTitleRel.iWidth = 0;
} }
if(m_nMode & HEADER_LINE) if(m_nMode & HEADER_LINE)
{ {
m_cFrameHeaderListRel.iX = 0; m_cFrameHeaderListRel.iX = 0;
m_cFrameHeaderListRel.iY = 0 + m_cFrameTitleRel.iHeight; m_cFrameHeaderListRel.iY = 0 + m_cFrameTitleRel.iHeight;
m_cFrameHeaderListRel.iHeight = m_nFontHeaderListHeight ; m_cFrameHeaderListRel.iHeight = m_nFontHeaderListHeight ;
} }
else else
{ {
m_cFrameHeaderListRel.iX = 0; m_cFrameHeaderListRel.iX = 0;
m_cFrameHeaderListRel.iY = 0; m_cFrameHeaderListRel.iY = 0;
m_cFrameHeaderListRel.iHeight = 0; m_cFrameHeaderListRel.iHeight = 0;
m_cFrameHeaderListRel.iWidth = 0; m_cFrameHeaderListRel.iWidth = 0;
} }
m_cFrameListRel.iX = 0; m_cFrameListRel.iX = 0;
m_cFrameListRel.iY = m_cFrameHeaderListRel.iHeight + m_cFrameTitleRel.iHeight; m_cFrameListRel.iY = m_cFrameHeaderListRel.iHeight + m_cFrameTitleRel.iHeight;
m_cFrameListRel.iHeight = m_cFrame.iHeight - m_cFrameHeaderListRel.iHeight - m_cFrameTitleRel.iHeight; m_cFrameListRel.iHeight = m_cFrame.iHeight - m_cFrameHeaderListRel.iHeight - m_cFrameTitleRel.iHeight;
if(m_nMode & SCROLL) if(m_nMode & SCROLL)
{ {
m_cFrameScrollRel.iX = m_cFrame.iWidth - SCROLL_FRAME_WIDTH; m_cFrameScrollRel.iX = m_cFrame.iWidth - SCROLL_FRAME_WIDTH;
m_cFrameScrollRel.iY = m_cFrameTitleRel.iHeight; m_cFrameScrollRel.iY = m_cFrameTitleRel.iHeight;
m_cFrameScrollRel.iWidth = SCROLL_FRAME_WIDTH; m_cFrameScrollRel.iWidth = SCROLL_FRAME_WIDTH;
m_cFrameScrollRel.iHeight = m_cFrameListRel.iHeight + m_cFrameHeaderListRel.iHeight; m_cFrameScrollRel.iHeight = m_cFrameHeaderListRel.iHeight + m_cFrameListRel.iHeight - m_nBgRadius;
} }
else else
{ {
m_cFrameScrollRel.iX = 0; m_cFrameScrollRel.iX = 0;
m_cFrameScrollRel.iY = 0; m_cFrameScrollRel.iY = 0;
m_cFrameScrollRel.iHeight = 0;
m_cFrameScrollRel.iWidth = 0; m_cFrameScrollRel.iWidth = 0;
m_cFrameScrollRel.iHeight = 0;
} }
m_cFrameListRel.iWidth = m_cFrame.iWidth - m_cFrameScrollRel.iWidth; m_cFrameListRel.iWidth = m_cFrame.iWidth - m_cFrameScrollRel.iWidth;
if(m_nMode & HEADER_LINE) if(m_nMode & HEADER_LINE)
{ {
@@ -354,7 +356,8 @@ void CListFrame::refreshTitle(void)
if( frameBuffer == NULL) return; if( frameBuffer == NULL) return;
frameBuffer->paintBoxRel(m_cFrameTitleRel.iX+m_cFrame.iX, m_cFrameTitleRel.iY+m_cFrame.iY, frameBuffer->paintBoxRel(m_cFrameTitleRel.iX+m_cFrame.iX, m_cFrameTitleRel.iY+m_cFrame.iY,
m_cFrameTitleRel.iWidth, m_cFrameTitleRel.iHeight, TITLE_BACKGROUND_COLOR); m_cFrameTitleRel.iWidth, m_cFrameTitleRel.iHeight, TITLE_BACKGROUND_COLOR,
m_nBgRadius, CORNER_TOP);
m_pcFontTitle->RenderString(m_cFrameTitleRel.iX + TEXT_BORDER_WIDTH + m_cFrame.iX, m_pcFontTitle->RenderString(m_cFrameTitleRel.iX + TEXT_BORDER_WIDTH + m_cFrame.iX,
m_cFrameTitleRel.iY + m_cFrameTitleRel.iHeight + m_cFrame.iY, m_cFrameTitleRel.iY + m_cFrameTitleRel.iHeight + m_cFrame.iY,
@@ -376,7 +379,8 @@ void CListFrame::refreshScroll(void)
if (1) if (1)
{ {
frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY,
m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, COL_MENUCONTENT_PLUS_0); m_cFrameScrollRel.iWidth, m_cFrameHeaderListRel.iHeight + m_cFrameListRel.iHeight, COL_MENUCONTENT_PLUS_0,
m_nBgRadius, CORNER_BOTTOM_RIGHT);
} }
if (m_nNrOfPages > 1) if (m_nNrOfPages > 1)
@@ -408,16 +412,17 @@ int CListFrame::paintListIcon(int x, int y, int line)
void CListFrame::refreshList(void) void CListFrame::refreshList(void)
{ {
//TRACE("[CListFrame]->refreshList: %d\r\n",m_nCurrentLine); //TRACE("[CListFrame]->refreshList: %d\r\n",m_nCurrentLine);
if( frameBuffer == NULL) return; if (frameBuffer == NULL)
frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, m_cFrameListRel.iY+m_cFrame.iY,
m_cFrameListRel.iWidth, m_cFrameListRel.iHeight, COL_MENUCONTENT_PLUS_0);
if( m_nNrOfLines <= 0)
return; return;
for(int line = m_nCurrentLine; frameBuffer->paintBoxRel(m_cFrameListRel.iX+m_cFrame.iX, m_cFrameListRel.iY+m_cFrame.iY,
line < m_nNrOfLines && line < m_nCurrentLine + m_nLinesPerPage; m_cFrameListRel.iWidth, m_cFrameListRel.iHeight, COL_MENUCONTENT_PLUS_0,
line++) m_nBgRadius, CORNER_BOTTOM_LEFT);
if (m_nNrOfLines <= 0)
return;
for (int line = m_nCurrentLine; line < m_nNrOfLines && line < m_nCurrentLine + m_nLinesPerPage; line++)
{ {
refreshLine(line); refreshLine(line);
} }

View File

@@ -104,6 +104,8 @@ class CListFrame
int m_nCurrentPage; int m_nCurrentPage;
int m_nSelectedLine; int m_nSelectedLine;
int m_nBgRadius;
bool m_showSelection; bool m_showSelection;
Font* m_pcFontTitle; Font* m_pcFontTitle;
@@ -141,6 +143,11 @@ class CListFrame
bool setTitle(char* title); bool setTitle(char* title);
bool setSelectedLine(int selection); bool setSelectedLine(int selection);
void setSelectedMarked(bool enable); void setSelectedMarked(bool enable);
void setBackGroundRadius(const int radius)
{
m_nBgRadius = radius;
initFramesRel();
};
void clearMarked() void clearMarked()
{ {
if (m_pLines) if (m_pLines)