home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch11 / calenctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-26  |  3.2 KB  |  119 lines

  1. // CalenCtl.h : Declaration of the CCalenCtrl OLE control class.
  2.  
  3. /////////////////////////////////////////////////////////////////////////////
  4. // CCalenCtrl : See CalenCtl.cpp for implementation.
  5.  
  6. class CCalenCtrl : public COleControl
  7. {
  8.     DECLARE_DYNCREATE(CCalenCtrl)
  9.  
  10. // Constructor
  11. public:
  12.     CCalenCtrl();
  13.  
  14. // Overrides
  15.  
  16.     // Drawing function
  17.     virtual void OnDraw(
  18.                 CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
  19.  
  20.     // Persistence
  21.     virtual void DoPropExchange(CPropExchange* pPX);
  22.  
  23.     // Reset control state
  24.     virtual void OnResetState();
  25.  
  26. // Implementation
  27. protected:
  28.     ~CCalenCtrl();
  29.  
  30.     DECLARE_OLECREATE_EX(CCalenCtrl)    // Class factory and guid
  31.     DECLARE_OLETYPELIB(CCalenCtrl)      // GetTypeInfo
  32.     DECLARE_PROPPAGEIDS(CCalenCtrl)     // Property page IDs
  33.     DECLARE_OLECTLTYPE(CCalenCtrl)        // Type name and misc status
  34.  
  35. // Message maps
  36.     //{{AFX_MSG(CCalenCtrl)
  37.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  38.     //}}AFX_MSG
  39.     DECLARE_MESSAGE_MAP()
  40.  
  41. // Dispatch maps
  42.     //{{AFX_DISPATCH(CCalenCtrl)
  43.     short m_year;
  44.     afx_msg void OnYearChanged();
  45.     short m_ctrlBorderStyle;
  46.     afx_msg void OnCtrlBorderStyleChanged();
  47.     OLE_COLOR m_borderRiseColor;
  48.     afx_msg void OnBorderRiseColorChanged();
  49.     OLE_COLOR m_borderFallColor;
  50.     afx_msg void OnBorderFallColorChanged();
  51.     OLE_COLOR m_borderNormalColor;
  52.     afx_msg void OnBorderNormalColorChanged();
  53.     BOOL m_threeD;
  54.     afx_msg void OnThreeDChanged();
  55.     OLE_COLOR m_selectedDayColor;
  56.     afx_msg void OnSelectedDayColorChanged();
  57.     OLE_COLOR m_dayColor;
  58.     afx_msg void OnDayColorChanged();
  59.     short m_dayBorderStyle;
  60.     afx_msg void OnDayBorderStyleChanged();
  61.     OLE_COLOR m_dayRiseColor;
  62.     afx_msg void OnDayRiseColorChanged();
  63.     OLE_COLOR m_dayFallColor;
  64.     afx_msg void OnDayFallColorChanged();
  65.     afx_msg LPFONTDISP GetDayFont();
  66.     afx_msg void SetDayFont(LPFONTDISP newValue);
  67.     afx_msg short GetDay();
  68.     afx_msg void SetDay(short nNewValue);
  69.     afx_msg short GetMonth();
  70.     afx_msg void SetMonth(short nNewValue);
  71.     afx_msg BOOL SetDate(short month, short day, short year);
  72.     //}}AFX_DISPATCH
  73.     DECLARE_DISPATCH_MAP()
  74.  
  75.     CFontHolder m_dayFont;
  76.     short m_Day;
  77.     short m_Month;
  78.  
  79.     void DrawBorder(const CRect& rcBounds, CDC *pDC = NULL);
  80.     void DrawMonth(const CRect& rcBounds, CDC *pDC = NULL);
  81.     void DrawDaysOfWeek(const CRect& rcBounds, CDC *pDC = NULL);
  82.     void DrawDays(const CRect& rcBounds, CDC *pDC = NULL);
  83.     void DrawSelectedDay(BOOL bSelected, const CRect& rcBounds, CDC *pDC = NULL);
  84.  
  85.     short HitTest(CPoint &pt);
  86.  
  87.   afx_msg void AboutBox();
  88.  
  89. // Event maps
  90.     //{{AFX_EVENT(CCalenCtrl)
  91.     void FireSelect(short Day)
  92.         {FireEvent(eventidSelect,EVENT_PARAM(VTS_I2), Day);}
  93.     //}}AFX_EVENT
  94.     DECLARE_EVENT_MAP()
  95.  
  96. // Dispatch and event IDs
  97. public:
  98.     enum {
  99.     //{{AFX_DISP_ID(CCalenCtrl)
  100.     dispidYear = 1L,
  101.     dispidCtrlBorderStyle = 2L,
  102.     dispidBorderRiseColor = 3L,
  103.     dispidBorderFallColor = 4L,
  104.     dispidBorderNormalColor = 5L,
  105.     dispidThreeD = 6L,
  106.     dispidDayFont = 12L,
  107.     dispidDay = 13L,
  108.     dispidMonth = 14L,
  109.     dispidSelectedDayColor = 7L,
  110.     dispidDayColor = 8L,
  111.     dispidDayBorderStyle = 9L,
  112.     dispidDayRiseColor = 10L,
  113.     dispidDayFallColor = 11L,
  114.     dispidSetDate = 15L,
  115.     eventidSelect = 1L,
  116.     //}}AFX_DISP_ID
  117.     };
  118. };
  119.