123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- #ifndef BUTTON_HEAD_FILE
- #define BUTTON_HEAD_FILE
- #include "ImageEx.h"
- #include "RenderManager.h"
- #pragma once
- enum UI_BUTTON_TYPE
- {
- en_PushButton,
- en_CheckButton,
- en_RadioButton,
- en_IconButton,
- en_MenuButton
- };
- class CSkinButton : public CButton
- {
- DECLARE_DYNAMIC(CSkinButton)
-
- public:
-
- CImageEx* m_pBackImgN;
- CImageEx* m_pBackImgH;
- CImageEx* m_pBackImgD;
- CImageEx* m_pBackImgF;
-
- CImageEx* m_pCheckImgN;
- CImageEx* m_pCheckImgH;
- CImageEx* m_pCheckImgTickN;
- CImageEx* m_pCheckImgTickH;
-
- CImageEx * m_pArrowImg, * m_pIconImg;
-
-
- protected:
- BOOL m_bFocus, m_bPress, m_bHover, m_bMouseTracking;
- UI_BUTTON_TYPE m_nBtnType;
- HMENU m_hMenu;
- HDC m_hBackDC;
- HFONT m_Font;
- DWORD m_dwTextAlign;
-
- COLORREF m_colNormalText;
- COLORREF m_colSelectText;
- COLORREF m_colDisableText;
- COLORREF m_colReadOnlyText;
- BOOL m_bTransparent;
- HDC m_hParentDC;
-
- public:
-
- CSkinButton();
-
- virtual ~CSkinButton();
-
- protected:
-
- virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
-
- public:
-
- void SetButtonType(UI_BUTTON_TYPE type);
-
- void SetSize(int nWidth,int nHeight);
-
- void SetMenu(HMENU hMenu);
-
- HFONT GetCtrlFont(){return m_Font;};
-
- void CalcCenterRect(RECT& rcDest, int cx, int cy, RECT& rcCenter);
-
- void DrawParentWndBg(HWND hWnd,HDC hDC);
-
- void SetParentBack(HDC hDC){ m_bTransparent = true; m_hParentDC = hDC;}
-
- public:
-
- BOOL SetBackImage(LPCTSTR lpNormal, LPCTSTR lpHoven, LPCTSTR lpDown, LPCTSTR lpFocus,CONST LPRECT lprcNinePart=NULL);
-
- BOOL SetCheckImage(LPCTSTR lpNormal, LPCTSTR lpHoven, LPCTSTR lpTickNormal, LPCTSTR lpTickHoven);
-
- BOOL SetIconImage(LPCTSTR lpszFileName);
-
- BOOL SetMenuImage(LPCTSTR lpszFileName);
-
- public:
-
- void DrawPushButton(CDC* pDC,RECT &rcClient);
-
- void DrawCheckButton(CDC* pDC,RECT &rcClient);
-
- void DrawIConButton(CDC* pDC,RECT &rcClient);
-
- void DrawMenuButton(CDC* pDC,RECT &rcClient);
-
- protected:
-
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
-
- afx_msg LRESULT OnMouseLeave(WPARAM wparam, LPARAM lparam);
-
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
-
- afx_msg void OnDestroy();
-
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
-
- afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
-
- afx_msg void OnSetFocus(CWnd* pOldWnd);
-
- afx_msg void OnKillFocus(CWnd* pNewWnd);
-
- afx_msg void OnPaint();
-
- afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
- protected:
- DECLARE_MESSAGE_MAP()
- };
- #endif
|