106 lines
3.8 KiB
C++
106 lines
3.8 KiB
C++
#if !defined(AFX_MYB_H__3832DDEF_0C12_11D5_B6BE_00E07D8144D0__INCLUDED_)
|
||
#define AFX_MYB_H__3832DDEF_0C12_11D5_B6BE_00E07D8144D0__INCLUDED_
|
||
|
||
#if _MSC_VER > 1000
|
||
#pragma once
|
||
#endif // _MSC_VER > 1000
|
||
// CxSkinButton.h : header file
|
||
/** 15/03/2001 v1.00
|
||
* first release (c) davide pizzolato
|
||
** 29/03/2001 v1.10
|
||
* - mouse tracking (thanks to Milan(dot)Gardian(at)LEIBINGER(dot)com)
|
||
** 02/04/2001 v1.20
|
||
* - new CreateRgnFromBitmap
|
||
** 14/04/2001 v1.21
|
||
* - OnMouseLeave cast fixed
|
||
* - Over bitmap consistency check
|
||
** 25/04/2001 v1.30
|
||
* - ExtCreateRegion replacement (thanks to Fable(at)aramszu(dot)net)
|
||
** 24/06/2001 v1.40
|
||
* - check & radio button add on
|
||
* - added "focus" bitmap
|
||
* - fixed CreateRgnFromBitmap bug
|
||
* - fixed shortcut bug
|
||
** 27/10/2001 v1.41
|
||
* - fixed memory leakage in CreateRgnFromBitmap
|
||
** 07/07/2008 v1.50
|
||
* - fixed memory leaks using SelectObject and GetDC (thanks to sachelis and Bernd Giesen)
|
||
* - added SetToolTipColor (thanks to Mykel)
|
||
*/
|
||
|
||
#define WM_CXSHADE_RADIO WM_USER+0x100
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
// CxSkinButton window
|
||
class CxSkinButton : public CButton
|
||
{
|
||
// Construction
|
||
public:
|
||
CxSkinButton();
|
||
|
||
// Attributes
|
||
private:
|
||
|
||
// Operations
|
||
public:
|
||
// Overrides
|
||
// ClassWizard generated virtual function overrides
|
||
//{{AFX_VIRTUAL(CxSkinButton)
|
||
public:
|
||
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||
protected:
|
||
virtual void PreSubclassWindow();
|
||
//}}AFX_VIRTUAL
|
||
// Implementation
|
||
public:
|
||
void SetToolTipText(CString s);
|
||
void SetToolTipColor(COLORREF crText, COLORREF crBkgnd);
|
||
COLORREF SetTextColor(COLORREF new_color);
|
||
void SetSkin(UINT normal,UINT down, UINT over=0, UINT disabled=0, UINT focus=0,UINT mask=0,
|
||
short drawmode=1,short border=1,short margin=4);
|
||
void SetSkinJpg( UINT normal, UINT down, UINT over=0, UINT disabled=0 );
|
||
void LoadJpg( CxImage& xImage, UINT uiResourceId ) { xImage.LoadResource( FindResource( NULL, MAKEINTRESOURCE( uiResourceId ), L"JPG" ), CXIMAGE_FORMAT_JPG ); }
|
||
virtual ~CxSkinButton();
|
||
// Generated message map functions
|
||
protected:
|
||
bool m_Checked; //radio & check buttons
|
||
DWORD m_Style; //radio & check buttons
|
||
bool m_tracking;
|
||
bool m_button_down;
|
||
void RelayEvent(UINT message, WPARAM wParam, LPARAM lParam);
|
||
CToolTipCtrl m_tooltip;
|
||
CBitmap m_bNormal,m_bDown,m_bDisabled,m_bMask,m_bOver,m_bFocus; //skin bitmaps
|
||
|
||
CxImage m_xNormal,m_xDown,m_xOver,m_xDisabled; // <20>⺻ 4<><34><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||
enum{ FORMAT_BMP = 0, FORMAT_JPG };
|
||
DWORD m_dwFormat;
|
||
|
||
short m_FocusRectMargin; //dotted margin offset
|
||
COLORREF m_TextColor; //button text color
|
||
HRGN hClipRgn; //clipping region
|
||
BOOL m_Border; //0=flat; 1=3D;
|
||
short m_DrawMode; //0=normal; 1=stretch; 2=tiled;
|
||
HRGN CreateRgnFromBitmap(HBITMAP hBmp, COLORREF color);
|
||
void FillWithBitmap(CDC* dc, HBITMAP hbmp, RECT r);
|
||
void DrawBitmap(CDC* dc, HBITMAP hbmp, RECT r, int DrawMode);
|
||
int GetBitmapWidth (HBITMAP hBitmap);
|
||
int GetBitmapHeight (HBITMAP hBitmap);
|
||
//{{AFX_MSG(CxSkinButton)
|
||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||
afx_msg BOOL OnClicked();
|
||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||
//}}AFX_MSG
|
||
afx_msg LRESULT OnMouseLeave(WPARAM, LPARAM);
|
||
afx_msg LRESULT OnRadioInfo(WPARAM, LPARAM);
|
||
afx_msg LRESULT OnBMSetCheck(WPARAM, LPARAM);
|
||
afx_msg LRESULT OnBMGetCheck(WPARAM, LPARAM);
|
||
DECLARE_MESSAGE_MAP()
|
||
};
|
||
/////////////////////////////////////////////////////////////////////////////
|
||
//{{AFX_INSERT_LOCATION}}
|
||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||
#endif // !defined(AFX_MYB_H__3832DDEF_0C12_11D5_B6BE_00E07D8144D0__INCLUDED_)
|