home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / wksinst / rwcdemo.pak / RWCWND.H < prev    next >
C/C++ Source or Header  |  1991-09-09  |  3KB  |  124 lines

  1. // (C) Copyright 1991 by Borland International
  2.  
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. class TMDIChildWindow
  7. {
  8. public:
  9.     HWND hWindow;
  10.     HMENU theMenu;
  11.     char *title;
  12.     virtual char *className() const {return "TMDIChildWindow";};
  13.     TMDIChildWindow(char *aTitle);
  14.     virtual ~TMDIChildWindow();
  15.     virtual void create() {};
  16.     virtual char *getPopupTitle() { return NULL; };
  17.     virtual HMENU getPopupMenu() {return 0; };
  18.     virtual void getWindowClass(WNDCLASS *wndClass);
  19.     virtual void lButtonDown(WORD, LONG) {};
  20.     virtual void lButtonUp(WORD, LONG) {};
  21.     virtual void mouseMove(WORD, LONG) {};
  22.     virtual void rButtonDown(LONG);
  23.     virtual void paint(HDC , PAINTSTRUCT *) {};
  24.     void registerWnd();
  25.     virtual void setFocus() {};
  26.     virtual void size(WORD, LONG) {};
  27. };
  28.  
  29. class  TDocument : public TMDIChildWindow
  30. {
  31. public:
  32.     char *fileName;
  33.     BOOL isNewFile;
  34.     BOOL changed;
  35.     TDocument(char *aFileName);
  36.     ~TDocument();
  37.     virtual BOOL canClear();
  38.     virtual void clearWindow() {};
  39.     void clearModify() {};
  40.     virtual BOOL isModified() {return changed;};
  41.     virtual void newFile();
  42.     virtual void read() {};
  43.     void setFileName(char *aFileName);
  44.     virtual BOOL save();
  45.     virtual BOOL saveAs() {return 1;};
  46.     virtual void write() {};
  47. };
  48.  
  49. class TEditWindow : public TDocument
  50. {
  51. public:
  52.     HWND editor;
  53.     TEditWindow(char *AFilename);
  54.     ~TEditWindow(){};
  55.     void create();
  56.     void size(WORD, LONG);
  57.     void setFocus();
  58.     void read(){};
  59.     void write(){};
  60.     BOOL isModified(){return 0;};
  61.     void clearWindow(){};
  62.     void clearModify(){};
  63.     void doSearch(){};
  64. };
  65.  
  66. class TDragWindow : public TMDIChildWindow
  67. {
  68. public:
  69.     HDC dragDC;
  70.     int buttonDown;
  71.     TDragWindow(char *aTitle) : TMDIChildWindow(aTitle) { buttonDown = 0; };
  72.     ~TDragWindow() {};
  73.     void lButtonDown(WORD, LONG);
  74.     void lButtonUp(WORD, LONG);
  75. };
  76.  
  77. class TScribbleWindow: public TDragWindow
  78. {
  79. public:
  80.     TScribbleWindow(char *aTitle) : TDragWindow(aTitle) {};
  81.     void lButtonDown(WORD wParam, LONG lParam);
  82.     void lButtonUp(WORD wParam, LONG lParam);
  83.     void mouseMove(WORD, LONG lParam);
  84.     char *getPopupTitle() { return "Scribble"; };
  85.     HMENU getPopupMenu();
  86. };
  87.  
  88. class TGraphObject
  89. {
  90. public:
  91.     int x1, y1, x2, y2;
  92.     TGraphObject(RECT *r) { Assign(r); };
  93.     virtual void Draw(HDC){};
  94.     void DrawRect(HDC HandleDC, RECT R);
  95.     void Assign(RECT *R) {x1 = R->left;x2 = R->right;y1 = R->top;y2 = R->bottom;};
  96. };
  97.  
  98. class TRectangle : public TGraphObject
  99. {
  100. public:
  101.     TRectangle(RECT *r) :
  102.         TGraphObject(r) {};
  103.     virtual void Draw(HDC HandleDC) { Rectangle(HandleDC, x1, y1, x2, y2);};
  104. };
  105.  
  106. class TShapeWindow: public TDragWindow
  107. {
  108.     TGraphObject *currentShape;
  109.     int x, y;
  110.     int oldRop;
  111.     RECT R;
  112.  
  113. public:
  114.     TShapeWindow(char *aTitle) : TDragWindow(aTitle) {};
  115.     char *getPopupTitle() { return "Graphics"; };
  116.     HMENU getPopupMenu();
  117.     void lButtonDown(WORD wParam, LONG lParam);
  118.     void lButtonUp(WORD wParam, LONG lParam);
  119.     void mouseMove(WORD, LONG lParam);
  120.  
  121. };
  122.  
  123. long FAR PASCAL _export WndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
  124.