////////////////////////////////////////////////////////////////////////////////////////////////////
// ����: ClassXP
// �汾: 0.32
// ����: 2003-3-10
// ˵��: 
//       һ�����
//           ClassXP ��һ��Ϊ Windows 98/ME/2000/XP ϵͳ����ƵĿؼ�����⡣ʹ�� ClassXP �ܷdz���
//       ���ٵذ�Ӧ�ó���������ó� Windows XP �ķ��
//
//       ����ʹ�÷���
//           ClassXP ��������Ϊ Win32SDK/C�����ʹ�� C++ �����֯���뽫��ʹ��д�Ѷȴ�󽵵ͣ����ǿ�
//       �ǵ��� C ��ʹ���Լ�Ч�����⣬ClassXP ʹ���˷� OOP �ı�����ԣ������� OOP ��˼ά��������ˣ�
//       ClassXP ��Դ�������ֱ���� Visual C++ �� Win32SDK �� MFC �ȹ�����ʹ�á�ClassXP �ڱ�д������
//       ʹ�õı��뻷���� Visual Studio .NET 2002 �� Visual C++ 6.0�����������ַ�ʽ����:
//
//       1.��̬���ӿⷽʽ
//         (1).�� Visual C++ �н����յĶ�̬���ӿ⹤�̣��� ClassXP.c �� ClassXP.h �ļ����뵽�����С�
//         (2).�����������ɶ�̬���ӿ⣬���е������� ClassXP()���������е�������ʹ�á�
//
//       2.Դ���뷽ʽ
//         (1).�� Visual C++ �Ĺ����м��� ClassXP.c �� ClassXP.h �ļ���
//         (2).��Ҫʹ�� ClassXP() �������ļ��м��롺#include "ClassXP.h"����Ȼ���ڵ�������
//
//       ����ע������
//
//       1.ClassXP ʹ���� Windows �е�һЩ�����ԣ���Ҫ�� Windows 98 �������ϰ汾�в���ʹ�á�
//       2.Ŀǰֻ�ܽ� PushButton��CheckBox��EditBox �� ComboBox ����Ϊ ClassXP �����Щ��û���õ�
//         ͼƬ��ȫ�����Ǹ�Ч�� GDI �������ģ�����Ȥ�Ļ�����Դ���롭��
//
////////////////////////////////////////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////////////////////////////////
// ����Ԥ����
#pragma once
#ifdef _USRDLL
// ����Ϊ���ӷ�ʽ��ָ������Ϊ��̬���ӿ�
#define CXP_DLLMODE
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////


#if !defined(AFX_CLASSXP_H__F89F6F21_1CEF_11D9_AF5C_0050BAB04A6A__INCLUDED_)
#define AFX_CLASSXP_H__F89F6F21_1CEF_11D9_AF5C_0050BAB04A6A__INCLUDED_



#include <Windows.h>

////////////////////////////////////////////////////////////////////////////////////////////////////
// �궨��

// ��������
#define CXPT_UNKNOWN		-1	// ���ܴ���������
#define CXPT_PUSHBUTTON		0	// ��ť
#define CXPT_CHECKBOX		1	// ��ѡ��
#define CXPT_RADIOBOX		2	// ��ѡ��
#define CXPT_GROUPBOX		3	// �鴰��
#define CXPT_STATEBOX	    4	// ˵����
#define CXPT_EDITBOX		5	// �༭��
#define CXPT_COMBOBOX		6	// ��Ͽ�
#define CXPT_LISTBOX		7	// ���
#define CXPT_SCROLLBOX		8	// ������
#define CXPT_DIALOG		    9	// ��������

#define CXPT_SPINBOX			10				// ��ת�ؼ�
#define CXPT_MONTHCAL			11				// ����
#define CXPT_PROGRESS			12				// ������
#define CXPT_TRACKBAR			13				// ׷����
#define CXPT_DATETIME           14				// ʱ��


// ����״̬
#define CXPS_DISABLED		0x00000001L		// ����״̬
#define CXPS_PRESSED		0x00000002L		// ����״̬
#define CXPS_HOTLIGHT		0x00000004L		// ����״̬ (����ڸô�����)
#define CXPS_FOCUS			0x00000008L		// ���м������뽹��
#define CXPS_DEFAULT		0x00000010L		// Ĭ��״̬ (���ڰ�ť)
#define CXPS_CHECKED		0x00000020L		// ѡ��״̬ (���ڸ�ѡ��)
#define CXPS_INDETERMINATE	0x00000040L		// δȷ��״̬ (���ڸ�ѡ��)
#define CXPS_READONLY		0x00000080L		// ֻ��״̬ (���ڱ༭��)
#define CXPS_NOPAINT		0x00000100L		// ��Ч��״̬
#define CXPS_PAINT		    0x00000200L		// ��Ч��״̬
#define CXPS_HORIZON		0x00000400L		// ���ھ���ˮƽ���� (����������ת�ؼ�)
#define CXPS_VERTICAL		0x00000800L		// ���ھ��д�ֱ���� (����������ת�ؼ�)



////////////////////////////////////////////////////////////////////////////////////////////////////
// �궨��

// ��������
/*
#define CXPT_UNKNOWN			-1				// ���ܴ���������
#define CXPT_PUSHBUTTON			0				// ��ť
#define CXPT_CHECKBOX			1				// ��ѡ��
#define CXPT_RADIOBOX			2				// ��ѡ��
#define CXPT_EDITBOX			3				// �༭��
#define CXPT_COMBOBOX			4				// ��Ͽ�
#define CXPT_SPINBOX			5				// ��ת�ؼ�
#define CXPT_SCROLLBAR			6				// ������
#define CXPT_MONTHCAL			7				// ����
#define CXPT_TABCONTROL			8				// TAB �ؼ�
#define CXPT_PROGRESS			9				// ������
#define CXPT_TRACKBAR			10				// ׷����

// ͨ�ô���״̬
#define CXPS_DISABLED			0x00000001L		// ����״̬
#define CXPS_PRESSED			0x00000002L		// ����״̬
#define CXPS_HOTLIGHT			0x00000004L		// ����״̬ (����ڸô�����)
#define CXPS_NCHOTLIGHT			0x00000008L		// �ǿͻ�������״̬ (��������ڹ�������)
#define CXPS_FOCUS				0x00000010L		// ���м������뽹��
#define CXPS_HORIZON			0x00000020L		// ���ھ���ˮƽ���� (����������ת�ؼ�)
*/
// ��ť����ѡ��״̬
#define CXPB_DEFAULT			0x00010000L		// Ĭ��״̬
#define CXPB_CHECKED			0x00020000L		// ѡ��״̬
#define CXPB_INDETERMINATE		0x00040000L		// δȷ��״̬

// �༭��״̬
#define CXPE_LEFTSPIN			0x00010000L		// �������ת�ؼ�
#define CXPE_RIGHTSPIN			0x00020000L		// �ұ�����ת�ؼ�
#define CXPE_READONLY			0x10000000L		// ֻ��״̬

// ����������ת�ؼ�״̬
#define CXPU_UPPART				0x00010000L		// ��������/���������
#define CXPU_MIDDLEPART			0x00020000L		// ���λ���м����� (������)
#define CXPU_DOWNPART			0x00040000L		// ��������/��������
#define CXPU_ALIGNLEFT			0x00100000L		// λ�ڱ༭�����
#define CXPU_ALIGNRIGHT			0x00200000L		// λ�ڱ༭���ұ�

// Thumb ��ͷ״̬��������ת�ؼ��������򡢹�����
#define CXPH_LARGEARROW			0x01000000L		// ��ļ�ͷ��־
#define CXPH_DROPHANDLE			0x02000000L		// �������м�Ĺ�����ʹ�õ��ж���־
#define CXPH_SMALLARROW			0x04000000L		// С�ļ�ͷ��־
#define CXPH_LEFTWARDS			0x08000000L		// ��ͷ����
#define CXPH_UPWARDS			0x10000000L		// ��ͷ����
#define CXPH_RIGHTWARDS			0x20000000L		// ��ͷ����
#define CXPH_DOWNWARDS			0x40000000L		// ��ͷ����
#define CXPH_HASFRAME			0x80000000L		// �������
#define CXPH_AREA  			    0x00100000L		// ���������������

// ���ñ�־
/*
#define CXPC_CALLCOMMON			0x00010000L		// ���� ClasssifyMsgXP() ȡ�ú�̵��ñ�־
#define CXPC_PRECALLWNDPROC		0x00020000L		// �ڻ���֮ǰ���� CallWindowProc()
#define CXPC_PRECALLDEFPROC		0x00040000L		// �ڻ���֮ǰ���� DefWindowProc()
#define CXPC_DRAWCLASSXP		0x00080000L		// ���� ClassXP ���
#define CXPC_CALLWNDPROC		0x00100000L		// �ڻ���֮����� CallWindowProc()
#define CXPC_CALLDEFPROC		0x00200000L		// �ڻ���֮����� DefWindowProc()
#define CXPC_RETURNVALUE		0x00800000L		// ����һ�� 16 λ����ֵ (����Ϊ LRESULT)
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" BOOL WINAPI ClassXP(HWND hWnd = NULL, BOOL bEnable = TRUE);
#else // __cplusplus
BOOL WINAPI ClassXP(HWND hWnd, BOOL bEnable);
#endif // __cplusplus
// ����: ���û�ȡ�� ClassXP ���
// ����:
//       hWnd		ָ��Ҫ���û�ȡ�����ڵľ�������Ϊ NULL ��Ӱ�쵱ǰ�̵߳����д���
//       bEnable	ָ�����û�ȡ�� ClassXP ��� TRUE ��ʾ���ã�FALSE ��ʾȡ��
//
// ����: TRUE ��ʾ�ɹ���FALSE ��ʾʧ��
////////////////////////////////////////////////////////////////////////////////////////////////////

// ǿ��ʹ�� C ���Է�ʽ����
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
////////////////////////////////////////////////////////////////////////////////////////////////////

// ���ô���״̬
#define CXPM_SETSTATE(Data, Mask, IsSet)	((IsSet) ? (Data |= Mask) : (Data &= ~Mask))
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
// SCROLLXP �ṹ�����еĴ��붼��Χ������ṹ����д��
typedef struct tagSCROLLXP
{
	RECT m_ThumbRect;
	RECT m_ThumbRectOld;
	RECT m_BottomArrowRect;
	RECT m_TopArrowRect;
	RECT m_LeftArrowRect;
	RECT m_RightArrowRect;
	RECT m_SizeArea;
    RECT m_AreaRect ;
	BOOL m_bMouseDownArrowForback;  //����
    BOOL m_bMouseDownArrowForwad;   //����
	BOOL m_bMouseDown;
	POINT m_MouseDownPoint;
	UINT m_MouseDownTime;
	BOOL m_bDragging;  //�����϶�
	UINT m_nThumbTrackPos;
}
SCROLLXP, * PSCROLLXP;

////////////////////////////////////////////////////////////////////////////////////////////////////
// CLASSXP �ṹ�����еĴ��붼��Χ������ṹ����д��
typedef struct tagCLASSXP
{
	HWND hWnd;					// ���ھ��
	DWORD dwType;				// ���ڵ�����
	DWORD dwState;				// ���ڵ�״̬
	WNDPROC wpPrev;				// ���໯֮ǰ�Ĵ��ڻص�������ַ
	HRGN  hRgn;                 // Բ�δ�����
	HICON hIconDisabled;         //��ֹʱ��ͼ��
	void  *pData;
	struct tagCLASSXP * pNext;	// ָ����һ�� CLASSXP �ṹ��������õ��������ṹ
}
CLASSXP, * PCLASSXP;
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
// MEMDCXP �ṹ��Ϊ�˷���ʹ���ڴ�����豸���������
typedef struct tagMEMDCXP
{
	HWND hWnd;					// ���ھ�����������
	HDC hDC;					// �����豸�������������
	HDC hMemDC;					// �����ڴ�����豸�������������
	BOOL bTransfer;				// �Ƿ�Ҫ���� hDC �� hMemDC �䴫�����ݣ��������
	HBITMAP hBitmap;			// λͼ�����������������
}
MEMDCXP, * LPMEMDCXP;
////////////////////////////////////////////////////////////////////////////////////////////////////




////////////////////////////////////////////////////////////////////////////////////////////////////
// ��������
PCLASSXP WINAPI CreateClassXP(HWND hWnd);
PCLASSXP WINAPI DeleteClassXP(HWND hWnd);
PCLASSXP WINAPI GetClassXP(HWND hWnd);

DWORD WINAPI GetWindowTypeXP(HWND hWnd);
HDC WINAPI GetMemDCXP(LPMEMDCXP pMdcxp);
VOID WINAPI ReleaseMemDCXP(LPMEMDCXP pMdcxp);
VOID WINAPI GradientRectXP(HDC hDC, LPRECT pRect,COLORREF crColor[4]);
//VOID WINAPI DrawDropGripXP(HDC hDC, LPRECT pRect, COLORREF crColor[4], DWORD crBack);
VOID WINAPI GradientRectXP2(HDC hdc, const RECT &rt,COLORREF crColor[], int fillType);

BOOL CALLBACK EnumWndProcXP(HWND hWnd, LPARAM lParam);
LRESULT CALLBACK HookProcXP(int iCode, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WindowProcXP(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

//VOID WINAPI DrawPushButtonXP(PCLASSXP pCxp);
//VOID WINAPI DrawCheckBoxXP(PCLASSXP pCxp);
//VOID WINAPI DrawRadioBoxXP(PCLASSXP pCxp);
//VOID WINAPI DrawEditBoxXP(PCLASSXP pCxp);
//VOID WINAPI DrawComboBoxXP(PCLASSXP pCxp);
//VOID WINAPI DrawListBoxXP(PCLASSXP pCxp);
//VOID WINAPI DrawScrollBoxXP(PCLASSXP pCxp);

////////////////////////////////////////////////////////////////////////////////////////////////////

#include "DialogXP.H"
#include "ButtonXP.H"
#include "EditXP.H"
#include "ComboXP.H"
#include "ScrollXP.H"
#include "SpinXP.H"

////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif // __cplusplus
////////////////////////////////////////////////////////////////////////////////////////////////////


#endif // !defined(AFX_CALSSXP_H__F89F6F21_1CEF_11D9_AF5C_0050BAB04A6A__INCLUDED_)