home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tv20os2.zip / demos / calendar.h < prev    next >
C/C++ Source or Header  |  1998-01-19  |  2KB  |  95 lines

  1. /*-------------------------------------------------------*/
  2. /*                                                       */
  3. /*   Calendar.h: Header file for Calendar.cpp            */
  4. /*                                                       */
  5. /*-------------------------------------------------------*/
  6. /*
  7.  *      Turbo Vision - Version 2.0
  8.  *
  9.  *      Copyright (c) 1994 by Borland International
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13.  
  14. #if !defined( __CALENDAR_H )
  15. #define __CALENDAR_H
  16.  
  17. class TCalendarView : public TView
  18. {
  19.  
  20. public:
  21.  
  22.     TCalendarView(TRect & r);
  23.     TCalendarView( StreamableInit ) : TView(streamableInit) { };
  24.     virtual void handleEvent(TEvent& event);
  25.     virtual void draw();
  26.  
  27. private:
  28.  
  29.     unsigned days, month, year;
  30.     unsigned curDay, curMonth, curYear;
  31.  
  32.     virtual const char *streamableName() const
  33.         { return name; }
  34.  
  35. protected:
  36.  
  37.     virtual void write( opstream& );
  38.     virtual void *read( ipstream& );
  39.  
  40. public:
  41.  
  42.     static const char * const name;
  43.     static TStreamable *build();
  44. };
  45.  
  46. inline ipstream& operator >> ( ipstream& is, TCalendarView& cl )
  47.     { return is >> (TStreamable&) cl; }
  48. inline ipstream& operator >> ( ipstream& is, TCalendarView*& cl )
  49.     { return is >> (void *&) cl; }
  50.  
  51. inline opstream& operator << ( opstream& os, TCalendarView& cl )
  52.     { return os << (TStreamable&) cl; }
  53. inline opstream& operator << ( opstream& os, TCalendarView* cl )
  54.     { return os << (TStreamable *) cl; }
  55.  
  56.  
  57. class TCalendarWindow : public TWindow
  58. {
  59.  
  60. public:
  61.  
  62.     TCalendarWindow();
  63.     TCalendarWindow( StreamableInit ) :
  64.         TWindow(streamableInit), TWindowInit(&TCalendarWindow::initFrame) { };
  65.  
  66. private:
  67.  
  68.     virtual const char *streamableName() const
  69.         { return name; }
  70.  
  71. protected:
  72.  
  73.     virtual void write( opstream& );
  74.     virtual void *read( ipstream& );
  75.  
  76. public:
  77.  
  78.     static const char * const name;
  79.     static TStreamable *build();
  80.  
  81. };
  82.  
  83. inline ipstream& operator >> ( ipstream& is, TCalendarWindow& cl )
  84.     { return is >> (TStreamable&) cl; }
  85. inline ipstream& operator >> ( ipstream& is, TCalendarWindow*& cl )
  86.     { return is >> (void *&) cl; }
  87.  
  88. inline opstream& operator << ( opstream& os, TCalendarWindow& cl )
  89.     { return os << (TStreamable&) cl; }
  90. inline opstream& operator << ( opstream& os, TCalendarWindow* cl )
  91.     { return os << (TStreamable *) cl; }
  92.  
  93.  
  94. #endif      // __CALENDAR_H
  95.