EditWithButton.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. //DISCLAIMER:
  3. //The code in this project is Copyright (C) 2006 by Gautam Jain. You have the right to
  4. //use and distribute the code in any way you see fit as long as this paragraph is included
  5. //with the distribution. No warranties or claims are made as to the validity of the
  6. //information and code contained herein, so use it at your own risk.
  7. // CEditWithButton
  8. class CEditWithButton : public CEdit
  9. {
  10. DECLARE_DYNAMIC(CEditWithButton)
  11. protected:
  12. CBitmap m_bmpEmptyEdit;
  13. CBitmap m_bmpFilledEdit;
  14. CSize m_sizeEmptyBitmap;
  15. CSize m_sizeFilledBitmap;
  16. CRect m_rcEditArea;
  17. CRect m_rcBorder;
  18. CRect m_rcButtonArea;
  19. BOOL m_bButtonExistsAlways;
  20. UINT m_iButtonClickedMessageId;
  21. public:
  22. BOOL SetBitmaps(UINT iEmptyEdit, UINT iFilledEdit);
  23. void SetButtonArea(CRect rcButtonArea);
  24. BOOL SetBorder(CRect rcEditArea);
  25. void SetButtonExistsAlways(BOOL bButtonExistsAlways);
  26. CEditWithButton();
  27. virtual ~CEditWithButton();
  28. virtual void PreSubclassWindow( );
  29. virtual BOOL PreTranslateMessage(MSG* pMsg);
  30. protected:
  31. void ResizeWindow();
  32. DECLARE_MESSAGE_MAP()
  33. public:
  34. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  35. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  36. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  37. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  38. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  39. afx_msg void OnSize(UINT nType, int cx, int cy);
  40. afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam); // Maps to WM_SETFONT
  41. };