2017-05-31 12:35:32 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/** Copyright. **/
|
|
|
|
/** FileName: GUI_Frame.c **/
|
|
|
|
/** Author: Polarix **/
|
|
|
|
/** Version: 1.0.0.0 **/
|
|
|
|
/** Description: Draw frames on screen. **/
|
|
|
|
/** History: **/
|
|
|
|
/** Polarix 2017/5/24 1.0.0.0 New create. **/
|
|
|
|
/*************************************************************************/
|
2017-06-02 12:33:13 +00:00
|
|
|
|
|
|
|
//=======================================================================//
|
|
|
|
//= Include files. =//
|
|
|
|
//=======================================================================//
|
2017-05-29 07:54:57 +00:00
|
|
|
#include "GUI_Frame.h"
|
|
|
|
|
2017-06-02 12:33:13 +00:00
|
|
|
//=======================================================================//
|
|
|
|
//= Function implementation. =//
|
|
|
|
//=======================================================================//
|
2017-06-07 13:50:51 +00:00
|
|
|
void GUI_Frame_DrawFullScreenFrame(GUI_BOX_FRAME_STRUCT* pstFrameData)
|
2017-05-29 07:54:57 +00:00
|
|
|
{
|
|
|
|
/*----------------------------------*/
|
|
|
|
/* Variable Declaration */
|
|
|
|
/*----------------------------------*/
|
|
|
|
uint16_t uiEdgeLayerIndex;
|
|
|
|
uint16_t uiEdgeRectanglePosX, uiEdgeRectanglePosY;
|
|
|
|
uint16_t uiEdgeRectangleWidth, uiEdgeRectangleHeight;
|
|
|
|
uint16_t uiTitleLineWidth;
|
|
|
|
RECTANGLE stTitleTextDisplayArea;
|
|
|
|
RECTANGLE stTitleTextDataArea = {0, 0, 0, 0};
|
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
/* Initialize */
|
|
|
|
/*----------------------------------*/
|
2017-06-07 13:50:51 +00:00
|
|
|
if(NULL != pstFrameData)
|
2017-05-29 07:54:57 +00:00
|
|
|
{
|
|
|
|
uiEdgeRectanglePosX = 0;
|
|
|
|
uiEdgeRectanglePosY = 0;
|
|
|
|
uiEdgeRectangleWidth = LCD_SIZE_WIDTH;
|
|
|
|
uiEdgeRectangleHeight = LCD_SIZE_HEIGHT;
|
2017-06-07 13:50:51 +00:00
|
|
|
uiTitleLineWidth = g_stFontSize[pstFrameData->Parameter.FontSize].Height+2;
|
2017-05-29 07:54:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------*/
|
|
|
|
/* Process */
|
|
|
|
/*----------------------------------*/
|
2017-06-07 13:50:51 +00:00
|
|
|
if(NULL != pstFrameData)
|
2017-05-29 07:54:57 +00:00
|
|
|
{
|
|
|
|
// Draw frame edge
|
2017-06-07 13:50:51 +00:00
|
|
|
for(uiEdgeLayerIndex = 0; uiEdgeLayerIndex<pstFrameData->Parameter.EdgeLayers; uiEdgeLayerIndex++)
|
2017-05-29 07:54:57 +00:00
|
|
|
{
|
|
|
|
GUI_Basic_DrawRectangle( uiEdgeRectanglePosX, uiEdgeRectanglePosY,
|
|
|
|
uiEdgeRectangleWidth, uiEdgeRectangleHeight,
|
|
|
|
GUI_COLOR_FRGCLR, GUI_COLOR_BKGCLR);
|
|
|
|
uiEdgeRectanglePosX += 2;
|
|
|
|
uiEdgeRectanglePosY += 2;
|
|
|
|
uiEdgeRectangleWidth -= 4;
|
|
|
|
uiEdgeRectangleHeight -= 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw Title if exist.
|
2017-06-07 13:50:51 +00:00
|
|
|
if(NULL != pstFrameData->Data.Title)
|
2017-05-29 07:54:57 +00:00
|
|
|
{
|
2017-06-07 13:50:51 +00:00
|
|
|
if(pstFrameData->Parameter.EdgeLayers > 0)
|
2017-05-29 07:54:57 +00:00
|
|
|
{
|
2017-06-07 13:50:51 +00:00
|
|
|
GUI_Basic_DrawLine((pstFrameData->Parameter.EdgeLayers*2-1), (pstFrameData->Parameter.EdgeLayers*2-1+uiTitleLineWidth),
|
|
|
|
LCD_SIZE_WIDTH-pstFrameData->Parameter.EdgeLayers*2, (pstFrameData->Parameter.EdgeLayers*2-1+uiTitleLineWidth),
|
2017-05-29 07:54:57 +00:00
|
|
|
GUI_COLOR_FRGCLR);
|
2017-06-07 13:50:51 +00:00
|
|
|
stTitleTextDisplayArea.PosX = pstFrameData->Parameter.EdgeLayers*2;
|
|
|
|
stTitleTextDisplayArea.PosY = pstFrameData->Parameter.EdgeLayers*2;
|
|
|
|
stTitleTextDisplayArea.Width = LCD_SIZE_WIDTH-pstFrameData->Parameter.EdgeLayers*4;
|
|
|
|
stTitleTextDisplayArea.Height = g_stFontSize[pstFrameData->Parameter.FontSize].Height;
|
2017-05-29 07:54:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-07 13:50:51 +00:00
|
|
|
GUI_Basic_DrawLine( 0, (pstFrameData->Parameter.EdgeLayers*2+uiTitleLineWidth),
|
|
|
|
LCD_SIZE_WIDTH-1, (pstFrameData->Parameter.EdgeLayers*2+uiTitleLineWidth),
|
2017-05-29 07:54:57 +00:00
|
|
|
GUI_COLOR_FRGCLR);
|
|
|
|
stTitleTextDisplayArea.PosX = 1;
|
|
|
|
stTitleTextDisplayArea.PosY = 1;
|
|
|
|
stTitleTextDisplayArea.Width = LCD_SIZE_WIDTH-2;
|
2017-06-07 13:50:51 +00:00
|
|
|
stTitleTextDisplayArea.Height = g_stFontSize[pstFrameData->Parameter.FontSize].Height;
|
2017-05-29 07:54:57 +00:00
|
|
|
}
|
2017-06-07 13:50:51 +00:00
|
|
|
GUI_Text_DrawSingleLineText( ENCODE(pstFrameData->Data.Title), pstFrameData->Parameter.FontSize,
|
2017-05-29 07:54:57 +00:00
|
|
|
&stTitleTextDisplayArea, &stTitleTextDataArea, GUI_DRAW_NORMAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|