#pragma once
|
#include "afxwin.h"
|
|
#define BS_NORMAL 0
|
#define BS_HOVER 1
|
#define BS_PRESS 2
|
#define BS_FOCUS 3
|
#define BS_DISABLE 4
|
|
#define BLBUTTON_MENU_ITEM_CLICKED 0x1345
|
|
typedef struct tagBLBUTTON_NMHDR
|
{
|
NMHDR nmhdr;
|
DWORD_PTR dwData;
|
DWORD_PTR dwData1;
|
DWORD_PTR dwData2;
|
} BLBUTTON_NMHDR;
|
|
class CBlButton :
|
public CButton
|
{
|
private:
|
typedef struct tagBADGE
|
{
|
COLORREF badgeBackground;
|
COLORREF badgeForeground;
|
int type; /* 0: ÎÞ,²»ÏÔʾ*/
|
int number;
|
} BADGE;
|
|
public:
|
CBlButton();
|
~CBlButton();
|
|
|
public:
|
void SetRoundWidth(int width);
|
int GetDrawState();
|
void SetFrameColor(int index, COLORREF color);
|
void SetBkgndColor(int index, COLORREF color);
|
void SetTextColor(int index, COLORREF color);
|
void SetBkgndBmp(const char* pszBmpFile);
|
void SetFaceColor(COLORREF color);
|
void SetTextColor(COLORREF color);
|
void SetBadgeNumber(int number);
|
void ShowDotBadge(BOOL bShow, COLORREF color);
|
void SetMenu(HMENU hMenu);
|
void SetCurrentMenuItem(UINT nPosition);
|
HMENU GetMenu();
|
void SetIcon(HICON hIcon, HICON hIconGray, int width);
|
|
private:
|
BOOL CustomBitBlt(HDC hDC, LPRECT lprc, CString& strBkgndBmp, int nFrame, int nAllFrame,
|
int nB0, int nB1, int nB2, int nB3, COLORREF crTransparent);
|
void CBlButton::Notify(int nCode, DWORD_PTR dwData, DWORD_PTR dwData1 = 0, DWORD_PTR dwData2 = 0);
|
|
private:
|
bool m_bHover; // ÐüÍ£
|
bool m_bSelected; // °´ÏÂ
|
BOOL m_bTracking; // ¸ú×Ù
|
int m_nState;
|
int m_nRoundWidth;
|
|
private:
|
COLORREF m_crFrame[5]; // ±ß¿òÑÕÉ«
|
COLORREF m_crBkgnd[5]; // ±³¾°ÑÕÉ«
|
COLORREF m_crText[5]; // Îı¾ÑÕÉ«
|
CString m_strBkgndBmp;
|
|
private:
|
BADGE m_badge;
|
HMENU m_hMenu;
|
HICON m_hIcon[2];
|
int m_nIconWidth;
|
|
public:
|
virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
|
virtual void PreSubclassWindow();
|
DECLARE_MESSAGE_MAP()
|
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
afx_msg void OnMouseHover(UINT nFlags, CPoint point);
|
afx_msg void OnMouseLeave();
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
afx_msg BOOL OnBnClicked();
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
};
|