From 3784fa65709893ae9720765fb3229220e4e2bfe8 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 10 Aug 2020 22:10:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9SGUI=5FScrollBar=E4=BD=BF?= =?UTF-8?q?=E5=85=B6=E6=94=AF=E6=8C=81=E7=81=B0=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GUI/inc/SGUI_ScrollBar.h | 3 +++ GUI/src/SGUI_List.c | 3 +++ GUI/src/SGUI_ScrollBar.c | 10 +++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/GUI/inc/SGUI_ScrollBar.h b/GUI/inc/SGUI_ScrollBar.h index 45b6d2d..50010d1 100644 --- a/GUI/inc/SGUI_ScrollBar.h +++ b/GUI/inc/SGUI_ScrollBar.h @@ -20,6 +20,9 @@ typedef struct SGUI_RECT stLayout; SGUI_SIZE sMaxValue; SGUI_SCROLLBAR_DIRECTION eDirection; + SGUI_COLOR eBorderColor; + SGUI_COLOR eBackgroundColor; + SGUI_COLOR eHandleColor; }SGUI_SCROLLBAR_PARAM; typedef struct diff --git a/GUI/src/SGUI_List.c b/GUI/src/SGUI_List.c index 75c3883..582e865 100644 --- a/GUI/src/SGUI_List.c +++ b/GUI/src/SGUI_List.c @@ -73,6 +73,9 @@ void SGUI_List_Initialize(SGUI_LIST_STRUCT* pstObj, const SGUI_FONT_RES* pstFont stScrollBarParam.stLayout.iWidth = LIST_SCROLLBAR_WIDTH; stScrollBarParam.stLayout.iHeight = pstObj->stItems.stLayout.iHeight; stScrollBarParam.sMaxValue = (pstObj->stItems.iCount > pstObj->stItems.iVisibleItems)?(pstObj->stItems.iCount - pstObj->stItems.iVisibleItems):0; + stScrollBarParam.eBackgroundColor = 0x02; + stScrollBarParam.eBorderColor = 0x0F; + stScrollBarParam.eHandleColor = 0x0F; SGUI_ScrollBar_Initialize(&(pstObj->stScrollBar), &stScrollBarParam); } } diff --git a/GUI/src/SGUI_ScrollBar.c b/GUI/src/SGUI_ScrollBar.c index cefd15c..6679909 100644 --- a/GUI/src/SGUI_ScrollBar.c +++ b/GUI/src/SGUI_ScrollBar.c @@ -127,7 +127,7 @@ void SGUI_ScrollBar_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_SCROLLBAR_STRUCT* ps // Draw scroll bar edge. SGUI_Basic_DrawRectangle(pstDeviceIF, pstObj->stParam.stLayout.iX, pstObj->stParam.stLayout.iY, pstObj->stParam.stLayout.iWidth, pstObj->stParam.stLayout.iHeight, - SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR); + pstObj->stParam.eBorderColor, pstObj->stParam.eBackgroundColor); if(SGUI_SCROLLBAR_VERTICAL == pstObj->stParam.eDirection) { @@ -137,12 +137,12 @@ void SGUI_ScrollBar_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_SCROLLBAR_STRUCT* ps uiScrollBlockPos = pstObj->stParam.stLayout.iY+1+((pstObj->stParam.stLayout.iHeight-uiScrollBlockSize-2)*pstObj->stData.sValue/pstObj->stParam.sMaxValue); // Redraw process block SGUI_Basic_DrawRectangle(pstDeviceIF, pstObj->stParam.stLayout.iX+1, uiScrollBlockPos, - uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); + uiScrollBlockSize, uiScrollBlockSize, pstObj->stParam.eHandleColor, pstObj->stParam.eHandleColor); } else { SGUI_Basic_DrawRectangle(pstDeviceIF, pstObj->stParam.stLayout.iX+1, pstObj->stParam.stLayout.iY+1, - uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); + uiScrollBlockSize, uiScrollBlockSize, pstObj->stParam.eHandleColor, pstObj->stParam.eHandleColor); } } else // Horizontal @@ -153,12 +153,12 @@ void SGUI_ScrollBar_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_SCROLLBAR_STRUCT* ps uiScrollBlockPos = pstObj->stParam.stLayout.iX+1+((pstObj->stParam.stLayout.iWidth-uiScrollBlockSize-2)*pstObj->stData.sValue/pstObj->stParam.sMaxValue); // Redraw process block SGUI_Basic_DrawRectangle(pstDeviceIF, uiScrollBlockPos, pstObj->stParam.stLayout.iY+1, - uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); + uiScrollBlockSize, uiScrollBlockSize, pstObj->stParam.eHandleColor, pstObj->stParam.eHandleColor); } else { SGUI_Basic_DrawRectangle(pstDeviceIF, pstObj->stParam.stLayout.iX+1, pstObj->stParam.stLayout.iY+1, - uiScrollBlockSize, uiScrollBlockSize, SGUI_COLOR_FRGCLR, SGUI_COLOR_FRGCLR); + uiScrollBlockSize, uiScrollBlockSize, pstObj->stParam.eHandleColor, pstObj->stParam.eHandleColor); } } }