gui.h

来自「一个操作系统的源码部分」· C头文件 代码 · 共 177 行

H
177
字号

#ifndef GUI_H
#define GUI_H

#include "Queue.h"

typedef unsigned long HWND;
typedef unsigned int  HINSTANCE;
typedef unsigned long WPARAM;
typedef unsigned long LPARAM;
typedef unsigned char BOOL;
typedef unsigned long RGB;

#define FALSE 0
#define TRUE  1

#define MAX_WINSLOT 32


typedef enum{
	eWinDesktop,
	eWinTaskBar,
	eWinNormal,
}EnumWinStyle;

typedef enum{
	eWinButton,
	eWinEditBox,
	eWinLabel,
	eWinScrollBar,
	eWinFlatButton,
	eWinMenuButton,
}EnumWinChildStyle;

typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM);


//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _RECT
{
    int left;
    int top;
    int right;
    int bottom;
}RECT;

//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _POINT
{
    int x;
    int y;
}POINT;



//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _CLIPRECT
{
	  RECT rc;
		HWND hWnd;
		BOOL bExist;
}CLIPRECT;

//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _CLIPRGN
{
	  RECT rcBound;
		int  ClipNum;
		CLIPRECT ClipArray[64];
}CLIPRGN;

//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
struct tagDC{
  RECT Bounds;
	unsigned long brushColor;
	unsigned long penColor;
	unsigned long bkColor;
	unsigned long textColor;
	unsigned long* mBuf;
	BOOL          bTextTransparent;
	CLIPRGN  ecrgn;
};

typedef struct tagDC  DC;
typedef struct tagDC* HDC;

//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _RESIDUALRGN
{
	int rcNum;
	RECT rc[4];
}RESIDUALRGN;


//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _RECTRGN
{
	int rcNum;
	RECT rc[64];
}RECTRGN;

//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _WinTag
{
	RECT                 winOldRect;
	RECT                 winRect;
	//BOOL                 bActive;
	EnumWinStyle         winStyle;
	HDC                  winHDC;
	HWND                 hWnd;
	HINSTANCE            hInstance;
	HWND                 hWinPrev;
	HWND                 hWinNext;
	S_Queue*             MessageQueue;
	int (*WindowProc)    (HWND, int, WPARAM, LPARAM);
	char                 winTitle[32];

}WINSTRUCT;

//--------------------------------------------------------------------------
//
//--------------------------------------------------------------------------
typedef struct _WINSLOT
{
	WINSTRUCT          win;
	BOOL               bUsed;
}WINSLOT;


extern  WINSLOT WinArray[MAX_WINSLOT];

extern  __inline RECT  SetRect(int left,int top,int right,int bottom)
{
	RECT rc;
	rc.left=left;
	rc.top=top;
	rc.right=right;
	rc.bottom=bottom;
	return rc;
}

void InitScreen(void);
void VesaShowBmp(unsigned long FileAddr,unsigned int x , unsigned int y);
void SetWindowDC(HDC hdc,int x,int y,int w,int h,EnumWinStyle winStyle);
void HdcRefreshVramRect(HDC hdc,RECT* aRect);
void HdcShowBmp(HDC hdc,unsigned int x , unsigned int y,unsigned long FileAddr);
HWND WinCreate(int x,int y,int w,int h,HINSTANCE hInstance,WNDPROC winproc,EnumWinStyle winStyle);
int  DefWindowProc(HWND hwnd,int message, WPARAM wParam, LPARAM lParam);
void HdcOutAsc(HDC hdc,unsigned short x, unsigned short y, unsigned char ch);
void HdcFillRect(HDC hdc,int x,int y,int w,int h);
void InvalidRectToVram(HDC hdc,RECT* pInvRect);
void SetWindowDC(HDC hdc,int x,int y,int w,int h,EnumWinStyle winStyle);
void ShowWindows(HWND hWnd,BOOL bShow);
void DrawWinUpFram(HDC hdc,int x,int y,int w,int h);
HDC  CreateBmpHdc(char* bmpfilename,int w,int h,int flag);
BOOL BitBlt(HDC hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,
						HDC hdcSrc, int nXSrc,int nYSrc);


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?