📄 uicaret.c
字号:
/*---------------------------- INCLUDE FILES --------------------------------*/
#include <pr2k.h>
#include <uiwnd.h>
#include <uicaret.h>
/*------------------------ GLOBALS (INTERNAL) -------------------------------*/
static TCaret gSystemCaret={0,0,0,0,0,0,0};
//-------------------------- function declare ---------------------------------
void _guiCaret_Draw( void );
/*------------------------- FUNCTION BODIES ---------------------------------*/
//called by rtc;
void guiCaret_Draw( void )
{
HNDL hFocusText;
if (gSystemCaret.bEnable==FALSE||gSystemCaret.bVisible==FALSE)
{
return;
}
hFocusText=guiTextEdit_QueryFocus();
if(guiControl_IsVisible(hFocusText)==FALSE)
{
return;
}
_guiCaret_Draw();
}
DLL_EXP(void) guiCaret_Create( BYTE nWidth, BYTE nHeight )
{
gSystemCaret.nWidth = nWidth;
gSystemCaret.nHeight = nHeight;
gSystemCaret.bVisible = FALSE;
gSystemCaret.bState = OFF;
gSystemCaret.bEnable=TRUE;
}
DLL_EXP(void) guiCaret_ChangeSize( BYTE nWidth, BYTE nHeight )
{
gSystemCaret.nWidth = nWidth;
gSystemCaret.nHeight = nHeight;
}
DLL_EXP(void) guiCaret_SetPos( short ixPos, short iyPos )
{
gSystemCaret.ixPos = ixPos;
gSystemCaret.iyPos = iyPos;
}
DLL_EXP(void) guiCaret_GetPos( short* ixPos, short* iyPos )
{
*ixPos = gSystemCaret.ixPos;
*iyPos = gSystemCaret.iyPos;
}
DLL_EXP(void) guiCaret_Show( void )
{
/* Caret already shown. */
if (gSystemCaret.bVisible==TRUE)
{
return;
}
/* Shows the caret. */
gSystemCaret.bState = OFF;
if(gSystemCaret.bEnable==TRUE)
{
_guiCaret_Draw();
}
gSystemCaret.bVisible = TRUE;
}
DLL_EXP(BOOL) guiCaret_Hide( void )
{
if (gSystemCaret.bVisible==FALSE)
{
return FALSE;
}
gSystemCaret.bVisible = FALSE;
if(gSystemCaret.bState==ON&&gSystemCaret.bEnable==TRUE)
{
_guiCaret_Draw();
}
return TRUE;
}
DLL_EXP(void) guiCaret_Enable( void )
{
gSystemCaret.bEnable=TRUE;
}
DLL_EXP(void) guiCaret_Disable( void )
{
if(gSystemCaret.bEnable==FALSE)
{
return;
}
gSystemCaret.bEnable=FALSE;
if(gSystemCaret.bVisible==TRUE&&gSystemCaret.bState==ON)
{
_guiCaret_Draw();
}
}
//---------------------------- internal function ------------------------------
void _guiCaret_Draw( void )
{
gSystemCaret.bState = !gSystemCaret.bState;
guiInvertRect (0, gSystemCaret.ixPos, gSystemCaret.iyPos,
(gSystemCaret.ixPos+gSystemCaret.nWidth-1), (gSystemCaret.iyPos+gSystemCaret.nHeight-1));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -