/***********************************************************************/ /* Copyright (C) 2002 Definitive Solutions, Inc. All Rights Reserved. */ /* THIS COMPUTER PROGRAM IS PROPRIETARY AND CONFIDENTIAL TO DEFINITIVE */ /* SOLUTIONS, INC. AND ITS LICENSORS AND CONTAINS TRADE SECRETS OF */ /* DEFINITIVE SOLUTIONS, INC. THAT ARE PROVIDED PURSUANT TO A WRITTEN */ /* AGREEMENT CONTAINING RESTRICTIONS ON USE AND DISCLOSURE. ANY USE, */ /* REPRODUCTION, OR TRANSFER EXCEPT AS PROVIDED IN SUCH AGREEMENT */ /* IS STRICTLY PROHIBITED. */ /***********************************************************************/ // Original code from msantoro@telerama.lm.com // Modified by Larry Leonard, Definitive Solutions, Inc. ///////////////////////////////////////////////////////////////////////////// // How to add this class to your application. // // Add MyButton.cpp, MyButton.h, MyButtonResource.h, MyButton.rc2, and // MyButton*.ico to your project in the usual folders. // // Add this line to the top of your RC2 file: // #include "MyButtonResource.h" // MyButton resources. // // Add this line to the end of your RC2 file: // #include "MyButton.rc2" // MyButton resources. // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MYBUTTON_H__F90A1768_7968_11D2_BC18_00805F718BD8__INCLUDED_) #define AFX_MYBUTTON_H__F90A1768_7968_11D2_BC18_00805F718BD8__INCLUDED_ #pragma once ///////////////////////////////////////////////////////////////////////////// // MyButton window // Declare the class depending on this file is in an EXE project or a DLL one. class #ifdef _WINDLL AFX_EXT_CLASS #endif MyButton : public CButton { // Construction. public: MyButton(); virtual ~MyButton(); // Operations. public: // Positioning. int SetImageOffset(int nPixels); int SetTextOffset(int nPixels); CPoint SetImagePos(CPoint pt); CPoint SetTextPos(CPoint pt); void SetTextColor(COLORREF crText); // Image. bool SetIcon(UINT uiID, int nWidth, int nHeight); void SetIcon(HICON hIcon); bool SetBitmap(UINT uiID, int nWidth, int nHeight); bool SetMaskedBitmap(UINT uiID, int nWidth, int nHeight, COLORREF crTransparentMask); bool HasImage()const; // Animation. void SetIconAnimation(UINT uiAnimatedBegIconId, UINT uiAnimatedEndIconId, UINT uiSpeedMS); // Color Tab. void SetColorTab(COLORREF crTab); // State. bool SetDefaultButton(bool bState = true); //{{AFX_VIRTUAL(MyButton) public: virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); //}}AFX_VIRTUAL // Public data. public: static const int Center; // Implementation. private: bool SetBitmapCommon(UINT nID, int nWidth, int nHeight, COLORREF crTransparentMask, bool bUseMask); void CheckPointForCentering(CPoint &pt, int nWidth, int nHeight); // Generated message map functions. protected: //{{AFX_MSG(MyButton) afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnTimer(UINT nIDEvent); //}}AFX_MSG DECLARE_MESSAGE_MAP() // Data. private: // Statics. static const int ColorTabSize; static const int FocusOffset; // Positioning. bool m_bUseOffset; CPoint m_ptImage; CPoint m_ptText; int m_nImageOffsetFromBorder; int m_nTextOffsetFromImage; // Image. HICON m_hIcon; HBITMAP m_hBitmap; HBITMAP m_hBitmapDisabled; int m_nImageWidth; int m_nImageHeight; // Animation. bool m_bMouseMoveTimerRunning; UINT m_uiCreateTimeElapsMS; UINT m_uiAnimatedBegIconId; UINT m_uiAnimatedEndIconId; UINT m_uiAnimatedCurIconId; UINT m_uiSpeedMS; // Color Tab. bool m_bColorTab; COLORREF m_crColorTab; // State. bool m_bDefault; UINT m_uiOldAction; UINT m_uiOldState; COLORREF m_crText; // Text color. }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MYBUTTON_H__F90A1768_7968_11D2_BC18_00805F718BD8__INCLUDED_)