home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / pascal / rehack / window / window.hpp < prev   
Encoding:
C/C++ Source or Header  |  1993-06-27  |  2.2 KB  |  112 lines

  1. #ifndef _WINDOW_HPP
  2. #define _WINDOW_HPP
  3.  
  4. // File:        WINDOW.HPP
  5. // Path:        ...\REHACK\WINDOW\WINDOW.HPP
  6. // Version:        0.01
  7. // Author:        Pat Reilly
  8. // CIS Id:        71333,2764
  9. // Created On:    6/20/93
  10. // Modified On:    6/26/93
  11. // Description: Base window classes for REHACK; Visible,
  12. //        Window.
  13. // Tabs:        4
  14.  
  15.  
  16. #ifndef _EVENT_HPP
  17. #include "..\EVENT\EVENT.HPP"
  18. #endif
  19.  
  20. // Standard flags.
  21. //
  22. // Description
  23. //        The following are state flags used in the window classes.
  24. const dword
  25.     vfVisible            = 0x00000001UL,
  26.     vfFocused            = 0x00000002UL,
  27.     vfDisabled            = 0x00000004UL,
  28.     vfModal                = 0x00000008UL,
  29.     vfFocusable            = 0x00000010UL,
  30.     vfPassFirstClick    = 0x00000020UL,
  31.     vfFirstUserFlag        = 0x00010000UL;
  32.  
  33. // Class Visible
  34.  
  35. // Forward declaration.
  36. class Window;
  37.  
  38. class Visible
  39. {
  40. public:
  41.  
  42.     Visible(const Rect&);
  43.     virtual ~Visible();
  44.  
  45.     virtual void get(Event&);                // Retrieve next event.
  46.     virtual void handle(Event&);            // Process an event.
  47.  
  48.     Rect getLocalBounds() const;            // Bounds in *this coords.
  49.     Rect getOwnerBounds() const;            // Bounds in owner coords.
  50.     Point makePointLocal(const Point&) const;
  51.     Point makePointGlobal(const Point&) const;
  52.  
  53.     virtual void setFlag(dword,bool);    // Set instance flags.
  54.     bool getFlag(dword) const;            // Get status of an instance flag.
  55.  
  56.     bool grabFocus();
  57.     virtual bool canLoseFocus();
  58.  
  59.     Visible* nextObject() const;
  60.     Visible* prevObject() const;
  61.  
  62.     virtual word run();
  63.     void stopRunning(word);
  64.  
  65.     word eventMask;
  66.  
  67. protected:
  68.  
  69.     friend class Window;
  70.     friend void makeInc();
  71.  
  72.     Rect bounds;            // *this' bounding rect within owner.
  73.     dword flags;
  74.     Window* owner;
  75.     Visible* next;
  76.     word modalReturnValue;
  77. };
  78.  
  79. // Class Window
  80. //        Derived from Visible
  81. // Description
  82. //
  83.  
  84. class Window : public Visible
  85. {
  86. public:
  87.  
  88.     Window(const Rect&);
  89.     virtual ~Window();
  90.  
  91.     virtual void handle(Event&);
  92.  
  93.     void insert(Visible*);
  94.     void remove(Visible*);
  95.     bool moveFocusTo(Visible*);
  96.  
  97.     void forEachObject(void (*)(Visible*, void*), void*) const;
  98.     Visible* firstObjectThat(bool (*)(Visible*, void*), void*) const;
  99.     Visible* lastObjectThat(bool (*)(Visible*, void*), void*) const;
  100.  
  101.     virtual word run();
  102.  
  103. protected:
  104.  
  105.     friend void makeInc();
  106.  
  107.     Visible* bottomObject;
  108.     Visible* currentObject;
  109. };
  110.  
  111. #endif    // _WINDOW_HPP
  112.