home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / TUTORIAL.PAK / CPPOCF3.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  2KB  |  87 lines

  1. // ---------------------------------------------------------------------------
  2. // Copyright (C) 1994 Borland International
  3. // Simple OLE Container using OCF
  4. // ---------------------------------------------------------------------------
  5. #if !defined(CPPOCF3_H)
  6. #define CPPOCF3_H
  7.  
  8. #include <dir.h>
  9. #include "ocfhlpr.h"
  10. #include "cppocf3.rh"
  11.  
  12. //
  13. // Prototypes
  14. //
  15. bool  InitInstance(HINSTANCE, int);
  16. bool  InitFrame(HINSTANCE);
  17. bool  InitChild(HINSTANCE);
  18.  
  19.  
  20. //
  21. // Retrieve OCF Helper associated with a window
  22. //
  23. TOleWin*    GetOleWinObj(HWND hwnd);
  24.  
  25.  
  26. //
  27. // MDI Frame and MDI Child Window Callbacks
  28. //
  29. LRESULT CALLBACK _export
  30. MainWndProc(HWND hwnd, uint message, WPARAM wParam, LPARAM lParam);
  31. LRESULT CALLBACK _export
  32. ViewWndProc(HWND hwnd, uint message, WPARAM wParam, LPARAM lParam);
  33.  
  34.  
  35. //
  36. //
  37. //
  38. typedef TArray<TPoint> TPoints;
  39. typedef TArrayIterator<TPoint> TPointsIterator;
  40.  
  41.  
  42. //
  43. // Container class - holds array of points
  44. //
  45. class TLine : public TPoints {
  46.   public:
  47.     TLine(int penSize = 1, COLORREF color = RGB(0, 0, 0)) :
  48.     TPoints(10, 0, 10), PenSize(penSize), Color(color)
  49.     {}
  50.  
  51.     // The == operator must be defined for the container class, even if unused
  52.     bool operator ==(const TLine& other) const
  53.     {
  54.       return &other == this;
  55.     }
  56.  
  57.     COLORREF   Color;
  58.     int        PenSize;
  59. };
  60.  
  61.  
  62. typedef TArray<TLine> TLines;
  63. typedef TArrayIterator<TLine> TLinesIterator;
  64.  
  65.  
  66. //
  67. // Class which holds the data of the MDI Child window i.e. and array of Lines
  68. //
  69. class ViewWndData {
  70.   public:
  71.     ViewWndData() : Lines(new TLines(100, 0, 5)), IsDirty(false)
  72.     {
  73.       FileName[0] = 0;
  74.     }
  75.    ~ViewWndData()
  76.     {
  77.       delete Lines;
  78.     }
  79.  
  80.     TLines*    Lines;
  81.     bool       IsDirty;
  82.     char       FileName[MAXPATH];
  83. };
  84.  
  85.  
  86. #endif   // CPPOCF3_H
  87.