📄 gui.h
字号:
U16 GUI_DB2UC (U8 Byte0, U8 Byte1);
#endif
/*************************************************************************************************************
* GUISTR.C String functions. --字符串函数
*************************************************************************************************************/
void GUI_DispStringHCenterAt(const char GUI_FAR *s, int x, int y);
/*************************************************************************************************************
* GUIVAL.C
*************************************************************************************************************/
void GUI_AddHex(U32 v, U8 Len, char**ps);
void GUI_AddDec(I32 v, U8 Len, char**ps);
void GUI_AddDecMin(I32 v, char**ps);
void GUI_AddDecShift(I32 v, U8 Len, U8 Shift, char**ps);
void GUI_DispBin (U32 v, U8 Len);
void GUI_DispBinAt(U32 v, I16P x, I16P y, U8 Len);
void GUI_DispCEOL (void);
void GUI_DispDec (I32 v, U8 Len);
void GUI_DispDecMin(I32 v);
void GUI_DispDecAt (I32 v, I16P x, I16P y, U8 Len);
void GUI_DispDecShift(I32 v, U8 Len, U8 Shift);
void GUI_DispDecSpace(I32 v, U8 MaxDigits);
void GUI_DispHex (U32 v, U8 Len);
void GUI_DispHexAt(U32 v, I16P x, I16P y, U8 Len);
void GUI_DispSDec(I32 v, U8 Len);
void GUI_DispSDecShift(I32 v, U8 Len, U8 Shift);
int GUI_Long2Len(I32 v);
/*************************************************************************************************************
* GUIVALF.C
* Routines to display floating point values. These routines use the routines defined in the module GUIVAL.C
* as base routines.
*************************************************************************************************************/
void GUI_DispFloat (float v, char Len);
void GUI_DispFloatFix (float v, char Len, char Fract);
void GUI_DispFloatMin (float v, char Fract);
void GUI_DispSFloatFix(float v, char Len, char Fract);
void GUI_DispSFloatMin(float v, char Fract);
/*************************************************************************************************************
* Dynamic memory management--动态存储管理
*************************************************************************************************************/
#if !defined(GUI_ALLOC_ALLOC)
void GUI_ALLOC_Init(void);
void *GUI_ALLOC_h2p (GUI_HMEM hMem);
void GUI_ALLOC_Free (GUI_HMEM hMem);
void GUI_ALLOC_FreePtr (GUI_HMEM *phMem);
GUI_HMEM GUI_ALLOC_Alloc(int size);
/* diagnostics */
int GUI_ALLOC_GetUsed(void);
int GUI_ALLOC_GetNumFreeBytes(void);
int GUI_ALLOC_GetMaxSize(void);
/* macros */
#define GUI_ALLOC_ALLOC(size) GUI_ALLOC_Alloc(size)
#define GUI_ALLOC_H2P(h) GUI_ALLOC_h2p(h)
#define GUI_ALLOC_FREE(handle) GUI_ALLOC_Free(handle)
#define GUI_ALLOC_LOCK(handle) GUI_ALLOC_h2p(handle)
#define GUI_ALLOC_UNLOCK(handle)
#endif
/*************************************************************************************************************
* Memory device: GUI_MEMDEV--存储器驱动
*************************************************************************************************************/
#define GUI_MEMDEV_HASTRANS 0
#define GUI_MEMDEV_NOTRANS (1<<0)
#if GUI_SUPPORT_MEMDEV
typedef GUI_HMEM GUI_MEMDEV_Handle;
typedef void GUI_CALLBACK_VOID_P(void* p);
typedef struct
{
GUI_RECT rView, rPrev;
char FirstCall;
} GUI_AUTODEV;
typedef struct
{
char DrawFixed;
} GUI_AUTODEV_INFO;
int GUI_MEMDEV_CreateAuto(GUI_AUTODEV * pAutoDev);
void GUI_MEMDEV_DeleteAuto(GUI_AUTODEV * pAutoDev);
int GUI_MEMDEV_DrawAuto (GUI_AUTODEV * pAutoDev, GUI_AUTODEV_INFO * pAutoDevInfo, GUI_CALLBACK_VOID_P * pfDraw, void * pData);
/* Create a memory device which is compatible to the selected LCD */
GUI_MEMDEV_Handle GUI_MEMDEV_Create ( int x0, int y0, int XSize, int YSize);
GUI_MEMDEV_Handle GUI_MEMDEV_CreateEx( int x0, int y0, int XSize, int YSize, int Flags);
void GUI_MEMDEV_Clear (GUI_MEMDEV_Handle hMem);
void GUI_MEMDEV_CopyFromLCD (GUI_MEMDEV_Handle hMem);
void GUI_MEMDEV_CopyFromLCDAA (GUI_MEMDEV_Handle hMem);
void GUI_MEMDEV_CopyToLCD (GUI_MEMDEV_Handle hMem);
void GUI_MEMDEV_CopyToLCDAA (GUI_MEMDEV_Handle hMem);
void GUI_MEMDEV_CopyToLCDAt (GUI_MEMDEV_Handle hMem, int x, int y);
int GUI_MEMDEV_CompareWithLCD(GUI_MEMDEV_Handle hMem, int*px, int*py, int *pExp, int*pAct);
void GUI_MEMDEV_Delete (GUI_MEMDEV_Handle MemDev);
int GUI_MEMDEV_GetYSize (GUI_MEMDEV_Handle hMem);
void GUI_MEMDEV_ReduceYSize (GUI_MEMDEV_Handle hMem, int YSize);
void GUI_MEMDEV_Select (GUI_MEMDEV_Handle hMem); /* Select (activate) a particular memory device. */
void GUI_MEMDEV_SetOrg (GUI_MEMDEV_Handle hMem, int x0, int y0);
void GUI_SelectLCD(void);
unsigned int GUI_SelLCD(unsigned int Index);
int GUI_MEMDEV_Draw(GUI_RECT* pRect, GUI_CALLBACK_VOID_P* pfDraw, void* pData, int MemSize, int Flags);
#else
#define GUI_SelectLCD()
#endif
/*************************************************************************************************************
* Measure device: GUI_MEASDEV
*************************************************************************************************************/
typedef GUI_HMEM GUI_MEASDEV_Handle;
GUI_MEASDEV_Handle GUI_MEASDEV_Create (void);
void GUI_MEASDEV_Delete (GUI_MEASDEV_Handle hMemDev);
void GUI_MEASDEV_Select (GUI_MEASDEV_Handle hMem);
void GUI_MEASDEV_GetRect(GUI_MEASDEV_Handle hMem, GUI_RECT *pRect);
void GUI_MEASDEV_ClearRect(GUI_MEASDEV_Handle hMem);
/*************************************************************************************************************
* Polygon helpers--多边形函数
*************************************************************************************************************/
void GUI_RotatePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, float Angle);
void GUI_MagnifyPolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, int Mag);
void GUI_EnlargePolygon(GUI_POINT* pDest, const GUI_POINT* pSrc, int NumPoints, int Len);
/*************************************************************************************************************
* Streamed bitmap--位图
*************************************************************************************************************/
typedef void GUI_CALLBACK_VOID_U8_P(U8 Data, void* p);
void GUI_DrawStreamedBitmap(const GUI_BITMAP_STREAM *pBitmapStream, int x, int y);
void GUI_StreamBMP (GUI_RECT* pRect, GUI_CALLBACK_VOID_U8_P* pfStream, void*p);
/*************************************************************************************************************
* Time / execution related routines--时间/执行相关程序
*************************************************************************************************************/
void GUI_Delay (int Period);
int GUI_GetTime(void);
int GUI_Exec(void); /* Execute all jobs ... Return 0 if nothing was done. */
int GUI_Exec1(void); /* Execute one job ... Return 0 if nothing was done. */
/*************************************************************************************************************
* MessageBox--消息框
*************************************************************************************************************/
int GUI_MessageBox(const char* sMessage, const char*sCaption, int Flags);
#define GUI_MESSAGEBOX_CF_MOVEABLE (1<<4)
#define GUI_MB_OK 20
#define GUI_MB_WARNING 21
/*************************************************************************************************************
* GUI_TIMER module--定时器模块
*************************************************************************************************************/
typedef struct GUI_TIMER_Message GUI_TIMER_MESSAGE;
struct GUI_TIMER_Message
{
GUI_TIMER_TIME Time;
U32 Context;
};
typedef GUI_HMEM GUI_TIMER_Handle;
typedef void GUI_TIMER_CALLBACK(/*const*/ GUI_TIMER_MESSAGE *pTM);
GUI_TIMER_Handle GUI_TIMER_Create(GUI_TIMER_CALLBACK* cb, int Time, U32 Context, int Flags);
void GUI_TIMER_Delete(GUI_TIMER_Handle pObj);
/* Methods changing properties */
void GUI_TIMER_SetPeriod (GUI_TIMER_Handle hObj, GUI_TIMER_TIME Period);
void GUI_TIMER_SetTime (GUI_TIMER_Handle hObj, GUI_TIMER_TIME Period);
void GUI_TIMER_SetDelay (GUI_TIMER_Handle hObj, GUI_TIMER_TIME Delay);
void GUI_TIMER_Restart (GUI_TIMER_Handle hObj);
int GUI_TIMER_Exec(void);
/*************************************************************************************************************
* Anti Aliasing--抗锯齿
*************************************************************************************************************/
void GUI_AA_DisableHiRes (void);
void GUI_AA_EnableHiRes (void);
int GUI_AA_GetFactor (void);
void GUI_AA_SetFactor (int Factor);
void GUI_AA_DrawArc (int x0, int y0, int rx, int ry, int a0, int a1);
void GUI_AA_DrawLine (int x0, int y0, int x1, int y1);
void GUI_AA_DrawPolyOutline(const GUI_POINT* pSrc, int NumPoints, int Thickness, int x, int y);
void GUI_AA_FillCircle (int x0, int y0, int r);
void GUI_AA_FillPolygon (GUI_POINT* pPoints, int NumPoints, int x0, int y0);
/* Defines for compatibility with older versins--兼容旧版本 */
#if GUI_COMPATIBLE_MODE
#define GUI_DrawArcAA GUI_AA_DrawArc
#define GUI_DrawPolyOutlineAA GUI_AA_DrawPolyOutline
#define GUI_FillCircleAA GUI_AA_FillCircle
#define GUI_FillPolygonAA GUI_AA_FillPolygon
#define GUI_MEMDEV_Load()
#endif
/*************************************************************************************************************
* Keyboard--键盘函数
*************************************************************************************************************/
int GUI_GetKey(void);
int GUI_WaitKey(void);
void GUI_StoreKey(int c);
void GUI_ClearKeyBuffer(void);
void GUI_StoreKeyMsg(int Key, int Pressed);
void GUI_SendKeyMsg (int Key, int Pressed);
int GUI_PollKeyMsg(void);
/*************************************************************************************************************
* HID
*************************************************************************************************************/
typedef struct
{
int x,y;
unsigned char Pressed;
} GUI_HID_STATE;
void GUI_HID_StoreState(const GUI_HID_STATE *pState);
int GUI_HID_GetState(GUI_HID_STATE *pState);
/*************************************************************************************************************
* Mouse, generic--通用鼠标驱动
*************************************************************************************************************/
void GUI_MOUSE_StoreState(const GUI_HID_STATE *pState);
/*************************************************************************************************************
* Mouse, PS2 driver--PS2鼠标驱动
*************************************************************************************************************/
void GUI_MOUSE_DRIVER_PS2_Init(void); /* optional */
void GUI_MOUSE_DRIVER_PS2_OnRx(unsigned char Data);
/*************************************************************************************************************
* TOUCH screen, generic (any kind of hardware)--通用触摸屏驱动(任何一种硬件)
*************************************************************************************************************/
int GUI_TOUCH_GetState(GUI_HID_STATE *pState);
void GUI_TOUCH_StoreState(int x, int y);
/*************************************************************************************************************
* TOUCH screen, analog driver--触摸屏模拟驱动
*************************************************************************************************************/
void GUI_TOUCH_Exec(void);
int GUI_TOUCH_Calibrate(int Coord, int Log0, int Log1, int Phys0, int Phys1);
void GUI_TOUCH_SetDefaultCalibration(void);
int GUI_TOUCH_GetxPhys(void); /* for diagnostics only */
int GUI_TOUCH_GetyPhys(void); /* for diagnostics only */
/*************************************************************************************************************
* TOUCH imports
* Please note: The following functions are required by the module. They need to be part of your application
* software (or rather, part of the hardware-layer of your software). If you do not like the names of these
* routines, you may rename them easily by defining them in the Configuration file GUITouch.conf.h
* Example: #define TOUCH_X_MeasureY HARDWARE_ReadY
* This will rename the routine TOUCH_X_MeasureY into HARDWARE_ReadY.
*************************************************************************************************************/
void TOUCH_X_ActivateX(void);
void TOUCH_X_ActivateY(void);
void TOUCH_X_Disable(void);
int TOUCH_X_MeasureX(void);
int TOUCH_X_MeasureY(void);
/*************************************************************************************************************
* Constants for fonts and bitmaps--字体和位图的常数
*************************************************************************************************************/
#define GUI_COMPRESS_RLE4 0
#define GUI_COMPRESS_RLE8 0
#define GUI_DRAW_RLE4 LCD_DrawBitmap_RLE4 /* Function pointer ! */
#define GUI_DRAW_RLE8 LCD_DrawBitmap_RLE8 /* Function pointer ! */
/*************************************************************************************************************
* Heap public--公共堆
* The main reason why the heap is declared public here is that an application can perform additional error
* checking on pointers. The variable itself is defined in the allocation module and will only be linke if
* required.
*************************************************************************************************************/
typedef union
{
int aintHeap[GUI_ALLOC_SIZE/4]; /* required for proper alignement */
U8 abHeap[GUI_ALLOC_SIZE];
} GUI_HEAP;
extern GUI_HEAP GUI_Heap; /* Public for debugging only */
/*************************************************************************************************************
* Defines for constants--定义常数
*************************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -