📄 gui.h
字号:
#if GUI_WINSUPPORT
const GUI_RECT* WM__pUserClipRect;
GUI_HWIN hAWin;
#endif
/* Variables in MEMDEV module (with memory devices only) */
#if GUI_SUPPORT_MEMDEV
const tLCDDEV_APIList* pDeviceAPI; /* function pointers only */
GUI_HMEM hDevData;
GUI_RECT ClipRectPrev;
#endif
/* Variables Anitaliasing module */
U8 AA_Factor;
U8 AA_HiResEnable;
};
/*********************************************************************
*
* General routines
*
**********************************************************************
*/
int GUI_Init(void);
void GUI_SetDefault(void);
GUI_DRAWMODE GUI_SetDrawMode(GUI_DRAWMODE dm);
const char * GUI_GetVersionString(void);
void GUI_SaveContext ( GUI_CONTEXT* pContext);
void GUI_RestoreContext(const GUI_CONTEXT* pContext);
/*********************************************************************
*
* Rectangle helper functions
*
***********************************************************************
*/
int GUI_RectsIntersect(const GUI_RECT* pr0, const GUI_RECT* pr1);
void GUI_MoveRect (GUI_RECT *pRect, int x, int y);
void GUI_MergeRect (GUI_RECT* pDest, const GUI_RECT* pr0, const GUI_RECT* pr1);
int GUI__IntersectRects(GUI_RECT* pDest, const GUI_RECT* pr0, const GUI_RECT* pr1);
void GUI__IntersectRect (GUI_RECT* pDest, const GUI_RECT* pr0);
void GUI__ReduceRect (GUI_RECT* pDest, const GUI_RECT *pRect, int Dist);
/*********************************************************************
*
* Misc helper functions
*
***********************************************************************
*/
int GUI__DivideRound (int a, int b);
/*********************************************************************
*
* Get / Set Attributes
*
**********************************************************************
*/
GUI_COLOR GUI_GetBkColor (void);
GUI_COLOR GUI_GetColor (void);
int GUI_GetBkColorIndex(void);
int GUI_GetColorIndex (void);
U8 GUI_GetPenSize (void);
U8 GUI_GetLineStyle (void);
U8 GUI_GetFillStyle (void);
void GUI_SetBkColor (GUI_COLOR);
void GUI_SetColor (GUI_COLOR);
void GUI_SetBkColorIndex(int Index);
void GUI_SetColorIndex(int Index);
U8 GUI_SetPenSize (U8 Size);
U8 GUI_SetPenShape (U8 Shape);
U8 GUI_SetLineStyle (U8 Style);
U8 GUI_SetFillStyle (U8 Style);
/* Get/Set Character used as decimal point (usually '.' or ',') */
char GUI_GetDecChar(void);
char GUI_SetDecChar(char c);
/*********************************************************************
*
* Color / Index related functions
*
**********************************************************************
*/
int GUI_Color2Index(GUI_COLOR color);
GUI_COLOR GUI_Color2VisColor(GUI_COLOR color);
char GUI_ColorIsAvailable(GUI_COLOR color);
GUI_COLOR GUI_Index2Color(int Index);
void GUI_InitLUT(void);
void GUI_SetLUTEntry (U8 Pos, GUI_COLOR Color);
void GUI_SetLUTColor (U8 Pos, GUI_COLOR Color);
void GUI_SetPhysColor(U8 Pos, GUI_COLOR Color);
/*********************************************************************
*
* Logging
*
**********************************************************************
*/
void GUI_Log (const char *s);
void GUI_Log1 (const char *s, int p0);
void GUI_Log2 (const char *s, int p0, int p1);
void GUI_Log3 (const char *s, int p0, int p1, int p2);
void GUI_Log4 (const char *s, int p0, int p1, int p2,int p3);
void GUI_Warn (const char *s);
void GUI_Warn1 (const char *s, int p0);
void GUI_Warn2 (const char *s, int p0, int p1);
void GUI_Warn3 (const char *s, int p0, int p1, int p2);
void GUI_Warn4 (const char *s, int p0, int p1, int p2, int p3);
void GUI_ErrorOut (const char *s);
void GUI_ErrorOut1(const char *s, int p0);
void GUI_ErrorOut2(const char *s, int p0, int p1);
void GUI_ErrorOut3(const char *s, int p0, int p1, int p2);
void GUI_ErrorOut4(const char *s, int p0, int p1, int p2, int p3);
/*********************************************************************
*
* 2d - GUI
*
**********************************************************************
*/
int GUI_BMP_Draw (const void * pBMP, int x0, int y0);
int GUI_BMP_GetXSize (const void * pBMP);
int GUI_BMP_GetYSize (const void * pBMP);
void GUI_Clear (void);
void GUI_ClearRect (int x0, int y0, int x1, int y1);
void GUI_DrawArc (int x0, int y0, int rx, int ry, int a0, int a1);
void GUI_DrawBitmap (const GUI_BITMAP* pBM, int x0, int y0);
void GUI_DrawBitmapMag (const GUI_BITMAP* pBM, int x0, int y0, int XMul, int YMul);
void GUI_DrawBitmapExp (int x0, int y0, int XSize, int YSize, int XMul, int YMul,
int BitsPerPixel, int BytesPerLine,
const U8* pData, const GUI_LOGPALETTE* pPal);
void GUI_DrawCircle (int x0, int y0, int r);
void GUI_DrawEllipse (int x0, int y0, int rx, int ry);
void GUI_DrawGraph (I16 *pay, int NumPoints, int x0, int y0);
void GUI_DrawHLine (int y0, int x0, int x1);
void GUI_DrawLine (int x0, int y0, int x1, int y1);
void GUI_DrawLineRel (int dx, int dy);
void GUI_DrawLineTo (int x, int y);
void GUI_DrawPie (int x0, int y0, int r, int a0, int a1, int Type);
void GUI_DrawPixel (int x, int y);
void GUI_DrawPoint (int x, int y);
void GUI_DrawPolygon (const GUI_POINT*, int NumPoints, int x0, int y0);
void GUI_DrawPolyLine (const GUI_POINT*, int NumPoints, int x0, int y0);
void GUI_DrawFocusRect (const GUI_RECT *pRect, int Dist);
void GUI_DrawRect (int x0, int y0, int x1, int y1);
void GUI_DrawRectEx (const GUI_RECT *pRect);
void GUI_DrawVLine (int x0, int y0, int y1);
void GUI_FillCircle (int x0, int y0, int r);
void GUI_FillEllipse (int x0, int y0, int rx, int ry);
void GUI_FillPolygon (const GUI_POINT*, int NumPoints, int x0, int y0);
void GUI_FillRect (int x0, int y0, int x1, int y1);
void GUI_FillRectEx (const GUI_RECT* pRect);
void GUI_GetClientRect (GUI_RECT* pRect);
void GUI_InvertRect (int x0, int y0, int x1, int y1);
void GUI_MoveRel (int dx, int dy);
void GUI_MoveTo (int x, int y);
/*********************************************************************
*
* Cursor routines
*
**********************************************************************
*/
typedef struct {
const GUI_BITMAP* pBitmap;
int xHot, yHot;
} GUI_CURSOR;
#if GUI_SUPPORT_CURSOR
void GUI_CURSOR_Activate(void);
void GUI_CURSOR_Deactivate(void);
void GUI_CURSOR_Hide(void);
void GUI_CURSOR_SetXor(const GUI_BITMAP* pBM, int x, int y);
void GUI_CURSOR_SetPosition(int x, int y);
void GUI_CURSOR_Select(const GUI_CURSOR* pCursor);
void GUI_CURSOR_Show(void);
#else
#define GUI_CURSOR_Show()
#define GUI_CURSOR_Clear();
#endif
extern const GUI_CURSOR GUI_CursorArrowS;
extern const GUI_CURSOR GUI_CursorArrowSI;
extern const GUI_CURSOR GUI_CursorArrowM;
extern const GUI_CURSOR GUI_CursorArrowMI;
extern const GUI_CURSOR GUI_CursorArrowL;
extern const GUI_CURSOR GUI_CursorArrowLI;
extern const GUI_CURSOR GUI_CursorCrossS;
extern const GUI_CURSOR GUI_CursorCrossSI;
extern const GUI_CURSOR GUI_CursorCrossM;
extern const GUI_CURSOR GUI_CursorCrossMI;
extern const GUI_CURSOR GUI_CursorCrossL;
extern const GUI_CURSOR GUI_CursorCrossLI;
extern const GUI_BITMAP GUI_BitmapArrowS;
extern const GUI_BITMAP GUI_BitmapArrowSI;
extern const GUI_BITMAP GUI_BitmapArrowM;
extern const GUI_BITMAP GUI_BitmapArrowMI;
extern const GUI_BITMAP GUI_BitmapArrowL;
extern const GUI_BITMAP GUI_BitmapArrowLI;
extern const GUI_BITMAP GUI_BitmapCrossS;
extern const GUI_BITMAP GUI_BitmapCrossSI;
extern const GUI_BITMAP GUI_BitmapCrossM;
extern const GUI_BITMAP GUI_BitmapCrossMI;
extern const GUI_BITMAP GUI_BitmapCrossL;
extern const GUI_BITMAP GUI_BitmapCrossLI;
/*********************************************************************
*
* Text related routines
*
**********************************************************************
*/
void GUI_DispChar (U16 c);
void GUI_DispChars (U16 c, int Cnt);
void GUI_DispCharAt(U16 c, I16P x, I16P y);
void GUI_DispString(const char GUI_FAR *s);
void GUI_DispStringAt(const char GUI_FAR *s, int x, int y);
void GUI_DispStringAtCEOL(const char GUI_FAR *s, int x, int y);
void GUI_DispStringInRect(const char GUI_FAR *s, GUI_RECT* pRect, int Flags);
void GUI_DispStringLen(const char GUI_FAR *s, int Len);
void GUI_GetTextExtend(GUI_RECT* pRect, const char* s, int Len);
int GUI_GetYAdjust(void);
int GUI_GetDispPosX(void);
int GUI_GetDispPosY(void);
const GUI_FONT* GUI_GetFont(void);
int GUI_GetCharDistX(U16 c);
int GUI_GetStringDistX(const char GUI_FAR *s);
int GUI_GetFontDistY(void);
int GUI_GetFontSizeY(void);
int GUI_GetFontSizeYOf(const GUI_FONT* pFont);
void GUI_GetFontInfo(const GUI_FONT*pFont, GUI_FONTINFO* pfi);
int GUI_GetYSizeOfFont(const GUI_FONT* pFont);
int GUI_GetYDistOfFont(const GUI_FONT* pFont);
int GUI_GetTextAlign(void);
int GUI_GetTextMode(void);
char GUI_IsInFont(const GUI_FONT*pFont, U16 c);
void GUI_ScrollWin(int Win, int xDiff, int yDiff);
int GUI_SetTextAlign(int Align);
int GUI_SetTextMode(int Mode);
int GUI_SetLBorder(int x);
void GUI_SetOrg(int x, int y);
void GUI_SetCursor(int x, int y, int xlen);
void GUI_DispFatal(char*s);
const GUI_FONT* GUI_SetFont(const GUI_FONT* pNewFont);
char GUI_GotoXY(int x, int y);
char GUI_GotoX(int x);
char GUI_GotoY(int y);
void GUI_Scroll(int x, int y);
void GUI_DispNextLine(void);
#if GUI_SUPPORT_UNICODE
void GUI_DispString_UC(const U16 GUI_FAR *s);
void GUI_UC2DB (U16 Code, U8* pOut);
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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -