📄 lguibase.h
字号:
/* Copyright (C) 2004-2005 Li Yudong*//*** This program is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#ifndef _LGUIBASE_H_#define _LGUIBASE_H_#ifdef __cplusplusextern "C" {#endif//==========================================================================// BMP //==========================================================================typedef struct tagBMPFILEHEADER{ UINT16 bfType; //file type the value is 'BM' UINT32 bfSize; //size of the file UINT16 bfReserved1; //reserved UINT16 bfReserved2; //reserved UINT32 bfOffbits; //from start position of file to the start position of image data} BMPFILEHEADER;//bmp image information headtypedef struct tagBMPINFOHEADER{ UINT32 biSize; //size of this structure ,Windows:0x28; OS/2:0x0C UINT32 biWidth; //image width(Pixel) UINT32 biHeight; //image height(Pixel) UINT16 biPlanes; //color planes,always 1 UINT16 biBitCount; //bit per point 1-->2color ;4-->16color;8-->256color;24-->true color; UINT32 biCompression; //BI_RGB/BI_RLE8/BI_RLE4; UINT32 biSizeImage; //size of image(in byte) UINT32 biXPelsPerMeter; //horizon resolution(point per meter) UINT32 biYPelsPerMeter; //vertical resolution(point per meter) UINT32 biClrUsed; //color number used indeed (if 0,color number will be set by iBitCount) UINT32 biClrImportant; //coloe number important,(if 0,means all colors in pallette are important)} BMPINFOHEADER;//==========================================================================// HDC //==========================================================================#define SYS_DEFAULT_FONT FONT_14_14//default font//#define GDI_SYS 8 /* pre-defined GDI object *///#define GDI_USR 0 /* user defined GDI object *//* Pen Styles */#define PS_NULL 0x00000010#define PS_SOLID 0x00000011#define PS_DASH 0x00000012 /* ------- */#define PS_DOT 0x00000013 /* ....... */#define PS_DASHDOT 0x00000014 /* _._._._ */#define PS_DASHDOTDOT 0x00000015 /* _.._.._ *//* Brush Styles */#define BS_NULL 0x00000020#define BS_SOLID 0x00000021#define BS_HATCHED 0x00000022#define BS_AGAINST 0x00000023/* Hatch Styles */#define HS_HORIZONTAL 0 /* ----- */#define HS_VERTICAL 1 /* ||||| */#define HS_FDIAGONAL 2 /* \\\\\ */#define HS_BDIAGONAL 3 /* ///// */#define HS_CROSS 4 /* +++++ */#define HS_DIAGCROSS 5 /* xxxxx *///System Pre-defined GDI#define WHITE_PEN 0x00000000#define LTGRAY_PEN 0x00000001#define GRAY_PEN 0x00000002#define DKGRAY_PEN 0x00000003#define BLACK_PEN 0x00000004#define NULL_PEN 0x00000005#define WHITE_BRUSH 0x00000006#define LTGRAY_BRUSH 0x00000007#define GRAY_BRUSH 0x00000008#define DKGRAY_BRUSH 0x00000009#define BLACK_BRUSH 0x0000000A#define NULL_BRUSH 0x0000000B#define FONT_16_16 0x0000000C#define FONT_14_14 0x0000000D#define FONT_12_12 0x0000000E//GDI TYPE#define GDI_PEN 0x00000000#define GDI_BRUSH 0x00000001#define GDI_FONT 0x00000002#define GDI_BITMAP 0x00000003#define GDI_RES 0x00000004//字库结构typedef struct tagFONTLIBHEADER{ int iSize; //size of this struction int iAscWidth; //width of Ascii character int iAscHeight; //height of Ascii character int iAscBytes; //bytes of a Ascii character used int iChnWidth; //width of chinese character int iChnHeight; //height of chinese character int iChnBytes; //bytes of a chinese character used int iAscOffset; //offset address of Ascii character(from the end of this structure) int iChnSymOffset; //offset address of chinese symbol (from the end of this structure) int iChnOffset; //offset address of chinese character(from the end of this structure)} FONTLIBHEADER;typedef FONTLIBHEADER* PFONTLIBHEADER;typedef unsigned int GDITYPE;typedef struct tagPEN{ GDITYPE iGdiType; int iPenStyle; // pen style int iPenWidth; // pen width COLORREF crPenColor; // pen color} PEN;typedef PEN* PPEN;typedef struct tagBRUSH{ GDITYPE iGdiType; int iBrushStyle; // brush style int iHatchStyle; // hatch style COLORREF crBrushColor; // color value} BRUSH;typedef BRUSH* PBRUSH;typedef struct tagFONT{ GDITYPE iGdiType; int iFontStyle; //font type int iOffset; //offset address in the shared memory FONTLIBHEADER FontLibHeader;//font library head structure } FONT;typedef FONT* PFONT;typedef struct tagBITMAP { GDITYPE iGdiType; // LONG bmType; //Specifies the bitmap type. This member must be zero LONG bmWidth; //Specifies the width, in pixels, of the bitmap LONG bmHeight; //Specifies the height, in pixels, of the bitmap LONG bmWidthBytes; //Specifies the number of bytes in each scan line. This value must be divisible by 2 WORD bmPlanes; //Specifies the count of color planes WORD bmBitsPixel; //Specifies the number of bits required to indicate the color of a pixel LPVOID bmBits; //Pointer to the location of the bit values for the bitmap} BITMAP; typedef BITMAP* PBITMAP; #define DC_TYPE_MEM 0x00000000 //device context type: memory#define DC_TYPE_WIN 0x00000001 //device context type: window#define DC_COORDTYPE_WINDOW 0x00000000 //device context coord type: window#define DC_COORDTYPE_CLIENT 0x00000001 //device contect coord type: clienttypedef struct tagDC{ int iType; //type(window/memory) int iCoordType; //CoordType(Window/Client); COLORREF crTextBkColor; //text background color COLORREF crTextColor; //text color BOOL isTextBkTrans; //the text is transparent ? POINT point; //current point HPEN hPen; HBRUSH hBrush; HFONT hFont; HBITMAP hBitmap; void* pData; //memory device context only HWND hWnd; //handle of window} DC;typedef DC* HDC;HDC GUIAPI GetDC( HWND hWnd);HDC GUIAPIGetWindowDC( HWND hWnd);int GUIAPI ReleaseDC( HWND hWnd, HDC hDC);HDC GUIAPICreateCompatibleDC( HDC hDCRefer);BOOL GUIAPI CreateStockObject();HGDIOBJ GUIAPI GetStockObject( int iStyle);HPEN GUIAPI CreatePen( int iPenStyle, int iWidth, COLORREF crColor);HBRUSH GUIAPI CreateSolidBrush( COLORREF crColor);HBRUSH GUIAPI CreateHatchBrush( int iStyle, COLORREF clrref);HBRUSH GUIAPI CreateAgainstBrush();HBITMAP GUIAPI CreateBitmap( char* pFile);BOOL GUIAPI SelectObject( HDC hDC, HGDIOBJ hGdiObj);void GUIAPI DeleteObject( HGDIOBJ hObject);//==========================================================================// CARET //==========================================================================BOOL GUIAPI CreateCaret ( HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight);BOOL GUIAPI DestroyCaret( HWND hWnd);UINT GUIAPI GetCaretBlinkTime( HWND hWnd);BOOL GUIAPI SetCaretBlinkTime( HWND hWnd, UINT uTime);BOOL GUIAPI ShowCaret( HWND hWnd);BOOL GUIAPI HideCaret( HWND hWnd);BOOL GUIAPISetCaretPos( HWND hWnd, int x, int y);BOOL GUIAPI ChangeCaretSize( HWND hWnd, int newWidth, int newHeight);// Get Caret PositionBOOL GUIAPI GetCaretPos( HWND hWnd, PPOINT pPt);//==========================================================================// GDI //==========================================================================COLORREF GUIAPI SetBkColor( HDC hDC, COLORREF crColor);COLORREF GUIAPI SetTextColor( HDC hDC, COLORREF crColor);COLORREF GUIAPI inline SetPixel( HDC hDC, int x, int y, COLORREF crColor);COLORREF GUIAPI inline GetPixel( HDC hDC, int x, int y);BOOL GUIAPI MoveToEx( HDC hDC, int X, int Y, LPPOINT lpPoint);BOOL GUIAPI LineTo( HDC hDC, int nXEnd, int nYEnd);BOOL GUIAPI Rectangle( HDC hDC, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);BOOL GUIAPIFillRect( HDC hDC, RECT *lprc ,HBRUSH hbr);//exclude borderBOOL GUIAPI FillRectangle( HDC hDC, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, COLORREF crColor, COLORREF crFillColor);BOOL GUIAPI Circle( HDC hDC, int xCenter, int yCenter, int radius);BOOL GUIAPI Ellipse( HDC hDC, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);BOOL GUIAPI Polyline( HDC hDC, POINT *lpPoints, int nCount);BOOL GUIAPI Polygon( HDC hDC, POINT *lpPoints, int nCount);//==========================================================================// BUTTON //==========================================================================#define BS_ANIMATIONBUTTON 0x80000000L#define BS_TEXT 0x40000000L// PushButton#define BS_BITMAP 0x20000000L// Specifies that the button displays a bitmap.#define BS_GROUP 0x10000000L// RadioBox group#define BS_TYPEMASK 0x0f000000L#define BS_PUSHBUTTON 0x00000000L#define BS_CHECKBOX 0x01000000L#define BS_AUTOCHECKBOX 0x02000000L//check state automatically toggles between checked and unchecked#define BS_RADIOBUTTON 0x03000000L#define BS_AUTORADIOBUTTON 0x04000000L//automatically sets the button's check state to checked and sets the check state for all other buttons in the same group to unchecked.#define BS_STATUSMASK 0x00f00000L#define BS_BUTTON_PRESSDOWN 0x00100000L#define BS_BUTTON_CHECKED 0x00100000L#define CHECKED 0X00000000L#define UNCHECKED 0x00000001L//==========================================================================// LISTBOX //==========================================================================#define LBS_TYPEMASK 0xf0000000L#define LBS_NOTIFY 0x10000000L#define LBS_SORT 0x20000000L#define LBS_VSCROLL 0x40000000L#define LBS_STANDARD 0x70000000L#define LBIF_NORMAL 0x00100000L#define LBIF_SELECTED 0x00200000L#define LBIF_CHECKED 0x00300000L//==========================================================================// SCROLLBAR //==========================================================================#define SB_CTL 0#define SB_HORZ 1#define SB_VERT 2#define SB_LINEUP 0x0001#define SB_LINEDOWN 0x0002#define SB_PAGEUP 0x0003#define SB_PAGEDOWN 0x0004#define SB_THUMBTRACK 0x0005#define SB_LINELEFT SB_LINEUP#define SB_LINERIGHT SB_LINEDOWN#define SIF_ALL 0x000000ff#define SIF_RANGE 0x00000001#define SIF_PAGE 0x00000002#define SIF_POS 0x00000004#define SIF_TRACKPOS 0x00000008//==========================================================================// INITGUI //==========================================================================BOOL GUIAPI InitGUIServer();BOOL GUIAPI InitGUIClient();void GUIAPI TerminateGUIServer();void GUIAPI TerminateGUIClient();//==========================================================================// MESSAGE //==========================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -