home *** CD-ROM | disk | FTP | other *** search
- #ifndef _WINDOW_HPP
- #define _WINDOW_HPP
-
- // File: WINDOW.HPP
- // Path: ...\REHACK\WINDOW\WINDOW.HPP
- // Version: 0.01
- // Author: Pat Reilly
- // CIS Id: 71333,2764
- // Created On: 6/20/93
- // Modified On: 6/26/93
- // Description: Base window classes for REHACK; Visible,
- // Window.
- // Tabs: 4
-
-
- #ifndef _EVENT_HPP
- #include "..\EVENT\EVENT.HPP"
- #endif
-
- // Standard flags.
- //
- // Description
- // The following are state flags used in the window classes.
- const dword
- vfVisible = 0x00000001UL,
- vfFocused = 0x00000002UL,
- vfDisabled = 0x00000004UL,
- vfModal = 0x00000008UL,
- vfFocusable = 0x00000010UL,
- vfPassFirstClick = 0x00000020UL,
- vfFirstUserFlag = 0x00010000UL;
-
- // Class Visible
-
- // Forward declaration.
- class Window;
-
- class Visible
- {
- public:
-
- Visible(const Rect&);
- virtual ~Visible();
-
- virtual void get(Event&); // Retrieve next event.
- virtual void handle(Event&); // Process an event.
-
- Rect getLocalBounds() const; // Bounds in *this coords.
- Rect getOwnerBounds() const; // Bounds in owner coords.
- Point makePointLocal(const Point&) const;
- Point makePointGlobal(const Point&) const;
-
- virtual void setFlag(dword,bool); // Set instance flags.
- bool getFlag(dword) const; // Get status of an instance flag.
-
- bool grabFocus();
- virtual bool canLoseFocus();
-
- Visible* nextObject() const;
- Visible* prevObject() const;
-
- virtual word run();
- void stopRunning(word);
-
- word eventMask;
-
- protected:
-
- friend class Window;
- friend void makeInc();
-
- Rect bounds; // *this' bounding rect within owner.
- dword flags;
- Window* owner;
- Visible* next;
- word modalReturnValue;
- };
-
- // Class Window
- // Derived from Visible
- // Description
- //
-
- class Window : public Visible
- {
- public:
-
- Window(const Rect&);
- virtual ~Window();
-
- virtual void handle(Event&);
-
- void insert(Visible*);
- void remove(Visible*);
- bool moveFocusTo(Visible*);
-
- void forEachObject(void (*)(Visible*, void*), void*) const;
- Visible* firstObjectThat(bool (*)(Visible*, void*), void*) const;
- Visible* lastObjectThat(bool (*)(Visible*, void*), void*) const;
-
- virtual word run();
-
- protected:
-
- friend void makeInc();
-
- Visible* bottomObject;
- Visible* currentObject;
- };
-
- #endif // _WINDOW_HPP
-