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

📄 cardwindow.h

📁 ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机理和API函数调用几乎相同。甚至可以兼容XP的程序。喜欢研究系统内核的人可以看一看。
💻 H
字号:
#ifndef CARDBOARD_INCLUDED
#define CARDBOARD_INCLUDED

#define MAXBUTTONS		32
#define MAXCARDSTACKS	32
#define MAXDROPZONES	8

#include "dropzone.h"
#include "cardlib.h"

class CardRegion;
class CardButton;

LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

class CardWindow
{
	friend class CardRegion;
	friend class CardButton;
	
	friend void RegisterCardWindow();

public:

	CardWindow();
	~CardWindow();

	//
	//	Basic windowing support
	//
	BOOL Create(HWND hwndParent, DWORD dwExStyle, DWORD dwStyle, int x, int y, int width, int height);
	BOOL Destroy();

	operator HWND() { return m_hWnd; }

	CardButton *CreateButton (int id, TCHAR *szText, UINT uStyle, bool fVisible, int x, int y, int width, int height);
	CardRegion *CreateRegion (int id, bool fVisible, int x, int y, int xoffset, int yoffset);

	CardButton *CardButtonFromId(int id);
	CardRegion *CardRegionFromId(int id);

	bool DeleteButton(CardButton *pButton);
	bool DeleteRegion(CardRegion *pRegion);
	bool DeleteAll();

	void	 SetBackColor(COLORREF cr);
	COLORREF GetBackColor();
	void	 SetBackCardIdx(UINT uBackIdx);
	UINT	 GetBackCardIdx();
	void	 SetBackImage(HBITMAP hBitmap);

	void EmptyStacks(void);
	void Redraw(void);
	void Update(void);

	bool DistributeStacks(int nIdFrom, int nNumStacks, UINT xJustify, int xSpacing, int nStartX);
	void SetResizeProc(pResizeWndProc proc);
	int  GetWidth() { return nWidth; }
	int  GetHeight() { return nHeight; }
	
	//
	//	Dropzone support
	//
	bool	  RegisterDropZone(int id, RECT *rect, pDropZoneProc proc);
	bool	  DeleteDropZone(int id);

private:

	int		  GetNumDropZones() { return nNumDropZones; }
	DropZone* GetDropZoneFromRect(RECT *rect);

	//
	//	Window procedure - don't call
	//
	   LRESULT CALLBACK WndProc    (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK CardWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam);

	//
	//	Private functions
	//
	void Paint(HDC hdc);
	void PaintCardRgn(HDC hdc, int dx, int dy, int width, int height, int sx, int sy);

	HPALETTE CreateCardPalette();

	CardButton *CardButtonFromPoint(int x, int y);
	CardRegion *CardRegionFromPoint(int x, int y);
	CardRegion *GetBestStack(int x, int y, int w, int h);

	//
	//	Private members
	//

	HWND m_hWnd;			//window handle!
	int  nWidth, nHeight;
	
	UINT	nBackCardIdx;	//all stacks share this card index by default

	HBITMAP	hbmBackImage;
	HDC		hdcBackImage;


	CardButton  * Buttons[MAXBUTTONS];
	int			  nNumButtons;

	CardRegion  * Regions[MAXCARDSTACKS];
	int			  nNumCardRegions;

	DropZone	* dropzone[MAXDROPZONES];
	int			  nNumDropZones;

	COLORREF  crBackgnd;

	pResizeWndProc  ResizeWndCallback;


};


#endif

⌨️ 快捷键说明

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