⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gui.h

📁 一个操作系统的源码部分
💻 H
字号:

#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -