Led.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #if !defined(AFX_LED_H__BABC9426_EF66_49D5_B54F_EA10DD7A0344__INCLUDED_)
  2. #define AFX_LED_H__BABC9426_EF66_49D5_B54F_EA10DD7A0344__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // Led.h : header file
  7. //
  8. #define LED_SIZE 16 // Led are 16 X 16 pixels
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CLed window
  11. class CLed : public CStatic
  12. {
  13. protected:
  14. int m_nLedColor, m_nLedMode, m_nLedShape;
  15. DWORD m_dwPingTimeout;
  16. BOOL m_bPingEnabled;
  17. CBitmap m_LedBitmap;
  18. public:
  19. enum {
  20. LED_ROUND = 0, // Circle starts at row 0
  21. LED_SQUARE = LED_SIZE * 4, // squares start at row 4
  22. };
  23. enum {
  24. LED_COLOR_RED = 0 * LED_SIZE, // Row 0
  25. LED_COLOR_GREEN = 1 * LED_SIZE, // Row 1
  26. LED_COLOR_YELLOW = 2 * LED_SIZE, // Row 2
  27. LED_COLOR_BLUE = 3 * LED_SIZE, // Row 3
  28. };
  29. enum {
  30. LED_ON = 0, // Column 0
  31. LED_OFF = 1, // Column 1
  32. LED_DISABLED = 2, // Column 2
  33. };
  34. // Construction
  35. public:
  36. CLed();
  37. // Attributes
  38. public:
  39. // Operations
  40. public:
  41. void SetLed(int nLedColor, int nMode, int nShape);
  42. int GetLedMode(){return m_nLedMode;}
  43. void Ping(DWORD dwTimeout = 1000);
  44. // Overrides
  45. // ClassWizard generated virtual function overrides
  46. //{{AFX_VIRTUAL(CLed)
  47. //}}AFX_VIRTUAL
  48. // Implementation
  49. public:
  50. void DrawLed( CDC *pDC, int nLEDColor, int nMode, int nShape );
  51. virtual ~CLed();
  52. // Generated message map functions
  53. protected:
  54. //{{AFX_MSG(CLed)
  55. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  56. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  57. afx_msg void OnPaint();
  58. afx_msg void OnTimer(UINT nIDEvent);
  59. //}}AFX_MSG
  60. DECLARE_MESSAGE_MAP()
  61. };
  62. /////////////////////////////////////////////////////////////////////////////
  63. //{{AFX_INSERT_LOCATION}}
  64. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  65. #endif // !defined(AFX_LED_H__BABC9426_EF66_49D5_B54F_EA10DD7A0344__INCLUDED_)