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

📄 libuidk.h

📁 LibUIDK是专业开发Windows平台下图形用户界面的开发包
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef _CONTROLS_H_
#define _CONTROLS_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


//////////////////////////////////////////////////////////////////////////
// Get background of different state from parent window
#define WM_GETBKBITMAP		WM_USER+102
// The WPARAM of the WM_GETBKBITMAP
#define WG_BKBASE			0x00000001 // get base status ( no controls on it )
#define WG_BKNORMAL         0x00000002 // get normal status
#define WG_BKHIGHLIGHT		0x00000003 // get highlight status
#define WG_BKSELECTED       0x00000004 // get selected status ( push down )
#define WG_BKDISABLE		0x00000005 // get disable status


//////////////////////////////////////////////////////////////////////////
// Change skin
#define WM_CHANGESKIN       WM_USER+103

//////////////////////////////////////////////////////////////////////////
// The error code of return value by CUIWnd::GetLastCreateError()
#define E_LOADBMPB                    1		// failed to load the base image
#define E_LOADBMPN                    2		// failed to load the background image of normal status(end by _N.bmp)
#define E_LOADBMPH                    3		// failed to laod the background image of highlight status(end by _H.bmp)
#define E_LOADBMPD                    4		// failed to load the background image of disable status(end by _D.bmp)
#define E_LOADBMPS                    5		// failed to load the background image of selected status(end by _S.bmp)
#define E_LOADBMPC                    6		// failed to load the background image of checked status(end by _C.bmp)
#define E_ATTACHBMPB                  50	// failed to attach the HBITMAP of base image to CBitmap object
#define E_ATTACHBMPN                  51	// failed to attach the HBITMAP of normal image to CBitmap object
#define E_ATTACHBMPH                  52	// failed to attach the HBITMAP of highlight image to CBitmap object
#define E_ATTACHBMPD                  53	// failed to attach the HBITMAP of disable image to CBitmap object
#define E_ATTACHBMPS                  54	// failed to attach the HBITMAP of selected image to CBitmap object
#define E_ATTACHBMPC                  55	// failed to attach the HBITMAP of checked image to CBitmap object
#define E_ADJUSTCHILD                 56	// failed to adjust the child controls while change the skin
#define E_CREATECHILD                 110	// failed to create the child window 

//////////////////////////////////////////////////////////////////////////
#define E_SETUIPATH                   200   // failed to set ui path, it cause by the ui path isn't exists.

//
// type of controls
//
#define ARROW              "ARROW"
#define PUSHBUTTON         "PUSHBUTTON"
#define CHECK              "CHECK"
#define RADIO              "RADIO"
#define COMBOBOX           "COMBOBOX"
#define STATIC             "STATIC"
#define EDIT               "EDIT"
#define SLIDER             "SLIDER"

// For Win98
int BackgroundMask(CWnd *pWnd, CString szMaskBitmap, COLORREF crMask);
int BackgroundMask(CWnd *pWnd, HBITMAP hBmpMask, COLORREF crMask);
void TransparentBlt2(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, UINT crTransparent);

BOOL IsWinXPSp2ORLater();


// Controls.h : header file
//

#include <AFXCMN.H>
#include <vector>

/////////////////////////////////////////////////////////////////////////////
// CSkinButton window

class CSkinButton : public CButton
{
// Construction
public:
	CSkinButton();

// Attributes
public:
	void SetUIWndName(LPCSTR lpszUIWndName);
	void SetToolTips(LPCSTR lpszToolTips);
	
	// color of button's text
	void SetTextColor(COLORREF crN, COLORREF crH, COLORREF crS, COLORREF crD);
	void GetTextColor(COLORREF *pcrN, COLORREF *pcrH, COLORREF *pcrS, COLORREF *pcrD);
	void SetCheckedTextColor(COLORREF crCN, COLORREF crCH, COLORREF crCS, COLORREF crCD);
	void GetCheckedTextColor(COLORREF *pcrCN, COLORREF *pcrCH, COLORREF *pcrCS, COLORREF *pcrCD);

	// font of button's text
	void SetTextFont(CFont *pFontN, CFont *pFontH, CFont *pFontS, CFont *pFontD);
	void GetTextFont(CFont **pFontN, CFont **pFontH, CFont **pFontS, CFont **pFontD);
	void SetCheckedTextFont(CFont *pFontCN, CFont *pFontCH, CFont *pFontCS, CFont *pFontCD);
	void GetCheckedTextFont(CFont **pFontCN, CFont **pFontCH, CFont **pFontCS, CFont **pFontCD);

	// offset of button's text
	void SetTextOffsetHor(int nHOffsetN, int nHOffsetH, int nHOffsetS, int nHOffsetD);
	void GetTextOffsetHor(int *pnHOffsetN, int *pnHOffsetH, int *pnHOffsetS, int *pnHOffsetD);
	void SetTextOffsetVer(int nVOffsetN, int nVOffsetH, int nVOffsetS, int nVOffsetD);
	void GetTextOffsetVer(int *pnVOffsetN, int *pnVOffsetH, int *pnVOffsetS, int *pnVOffsetD);
	void SetCheckedTextOffsetHor(int nHOffsetCN, int nHOffsetCH, int nHOffsetCS, int nHOffsetCD);
	void GetCheckedTextOffsetHor(int *pnHOffsetCN, int *pnHOffsetCH, int *pnHOffsetCS, int *pnHOffsetCD);
	void SetCheckedTextOffsetVer(int nVOffsetCN, int nVOffsetCH, int nVOffsetCS, int nVOffsetCD);
	void GetCheckedTextOffsetVer(int *pnVOffsetCN, int *pnVOffsetCH, int *pnVOffsetCS, int *pnVOffsetCD);

	// bitmap and checked bitmap
	void SetBitmap(HBITMAP hbmpN, HBITMAP hbmpH, HBITMAP hbmpS, HBITMAP hbmpD);
	void SetCheckedBitmap(HBITMAP hbmpCN, HBITMAP hbmpCH, HBITMAP hbmpCS, HBITMAP hbmpCD);

	// mask bitmap for checked and uncheck status
	int SetMaskBitmap(LPCSTR lpszMaskN, LPCSTR lpszMaskH, LPCSTR lpszMaskS, LPCSTR lpszMaskD);
	int SetCheckedMaskBitmap(LPCSTR lpszMaskCN, LPCSTR lpszMaskCH, LPCSTR lpszMaskCS, LPCSTR lpszMaskCD);

// Operations
public:

protected:
	BOOL InitProperties();
	int InitBitmaps();

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSkinButton)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSkinButton();

	// Generated message map functions
protected:
	//{{AFX_MSG(CSkinButton)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnPaint();
	afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
	afx_msg UINT OnGetDlgCode();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	//}}AFX_MSG
	afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnSetCheck(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnSetState(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnEnable(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()

protected:
	CString m_strUIWndName;
	CString m_strUIPath;

	CFont m_FontN;
	CFont m_FontH;
	CFont m_FontS;
	CFont m_FontD;
	CFont m_FontCN;
	CFont m_FontCH;
	CFont m_FontCS;
	CFont m_FontCD;

	COLORREF m_crN;
	COLORREF m_crH;
	COLORREF m_crS;
	COLORREF m_crD;
	COLORREF m_crCN;
	COLORREF m_crCH;
	COLORREF m_crCS;
	COLORREF m_crCD;

	UINT m_uHorAligN;
	UINT m_uHorAligH;
	UINT m_uHorAligS;
	UINT m_uHorAligD;
	UINT m_uVerAligN;
	UINT m_uVerAligH;
	UINT m_uVerAligS;
	UINT m_uVerAligD;
	UINT m_uHorAligCN;
	UINT m_uHorAligCH;
	UINT m_uHorAligCS;
	UINT m_uHorAligCD;
	UINT m_uVerAligCN;
	UINT m_uVerAligCH;
	UINT m_uVerAligCS;
	UINT m_uVerAligCD;

	int m_nHorAlignModeN;
	int m_nHorAlignModeH;
	int m_nHorAlignModeS;
	int m_nHorAlignModeD;
	int m_nHorAlignModeCN;
	int m_nHorAlignModeCH;
	int m_nHorAlignModeCS;
	int m_nHorAlignModeCD;
	int m_nVerAlignModeN;
	int m_nVerAlignModeH;
	int m_nVerAlignModeS;
	int m_nVerAlignModeD;
	int m_nVerAlignModeCN;
	int m_nVerAlignModeCH;
	int m_nVerAlignModeCS;
	int m_nVerAlignModeCD;

	BOOL m_bTabStop;

	int m_nWidth;	// the width of the background bitmap
	int m_nHeight;	// the height of the background bitmap
	BOOL m_bIsMouseOver;
	BOOL m_bCapture;

	HBITMAP m_hbmpN;
	HBITMAP m_hbmpH;
	HBITMAP m_hbmpS;
	HBITMAP m_hbmpD;
	// the status ( normal, highlight, selected and disable ) when check for the check box and radio box
	HBITMAP m_hbmpCN;
	HBITMAP m_hbmpCH;
	HBITMAP m_hbmpCS;
	HBITMAP m_hbmpCD;

	// the mask bitmap
	HBITMAP m_hbmpMask[4];
	HBITMAP m_hbmpCheckedMask[4];

	// for tool tip
	CToolTipCtrl m_wndToolTip;
};

/////////////////////////////////////////////////////////////////////////////
// CComboEdit window

class CComboEdit : public CEdit
{
// Construction
public:
	CComboEdit();

// Attributes
public:
	void SetDeflateRight(int nDeflate);

protected:
	int InitProperties();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CComboEdit)
	protected:
	virtual void PreSubclassWindow();
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CComboEdit();

	// Generated message map functions
protected:
	//{{AFX_MSG(CComboEdit)
	afx_msg void OnPaint();
	afx_msg void OnChange();
	afx_msg LRESULT OnSetSel(WPARAM wParam, LPARAM lParam);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

protected:
	HBITMAP m_hbmpBkN;
	HBITMAP m_hbmpBkH;
	HBITMAP m_hbmpBkS;
	HBITMAP m_hbmpBkD;
	int m_nDeflateRight;
};

/////////////////////////////////////////////////////////////////////////////
// CSkinComboBox window

class CSkinComboBox : public CComboBox
{
// Construction
public:
	CSkinComboBox();

// Attributes
public:
	void SetUIWndName(LPCSTR lpszUIWndName);

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSkinComboBox)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSkinComboBox();

	// Generated message map functions
protected:
	//{{AFX_MSG(CSkinComboBox)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnPaint();
	afx_msg void OnCloseup();
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
	afx_msg UINT OnGetDlgCode();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//}}AFX_MSG
	afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()

public:
	void SetBitmap(HBITMAP hbmpN, HBITMAP hbmpH, HBITMAP hbmpS, HBITMAP hbmpD);
	int SubBitmap(const HBITMAP hSrcBmp, HBITMAP &hDstBmp, int nX, int nY, int nWidth, int nHeight);
	int InitBitmaps();
	BOOL InitProperties();
	CComboEdit m_ctrlEdit;
protected:
	HBRUSH m_brushN;
	HBRUSH m_brushH;
	HBRUSH m_brushS;
	HBRUSH m_brushD;
	HBITMAP m_hbmpBKN;

⌨️ 快捷键说明

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