home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IWINDOW_
- #define _IWINDOW_
- /*******************************************************************************
- * FILE NAME: iwindow.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * IWindow - Abstract base class for all GUI window classes. *
- * *
- * COPYRIGHT: *
- * Licensed Materials - Property of IBM *
- * (C) Copyright IBM Corporation 1992, 1993 *
- * All Rights Reserved *
- * US Government Users Restricted Rights - Use, duplication, or disclosure *
- * restricted by GSA ADP Schedule Contract with IBM Corp. *
- * *
- *$Log: R:/IBMCLASS/IBASEAPP/VCS/IWINDOW.HPV $
- //
- // Rev 1.9 26 Oct 1992 10:48:26 nunn
- // Kevin's changes for 10/26
-
- Miscellaneous improvements.
- *******************************************************************************/
- #ifndef _IVBASE_
- #include <ivbase.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IWindow;
- class IHandler;
- class IPoint;
- class ISize;
- class IRectangle;
- class IString;
- class IColor;
- class IEvent;
- class ILHandlerSet;
- class IBITFLAG;
- #if !defined( _IBITFLAG_ )
- #include <ibitflag.hpp>
- #endif
- class IHandle;
- #if !defined( _IHANDLE_ )
- #include <ihandle.hpp>
- #endif
-
- class IWindow : public IVBase {
- /*******************************************************************************
- * The IWindow class is an abstract base class and has common functions to *
- * operate on a window and to define event handlers. *
- *******************************************************************************/
- typedef IVBase Inherited;
- public:
- /*-------------------------------- STYLES --------------------------------------
- | These style objects provide means of setting the window style of instance |
- | of this class: |
- | IWindow::noStyle - all styles set off |
- | IWindow::visible - window is visible |
- | IWindow::disabled - window is disabled |
- | IWindow::clipChildren - area occupied by the children of the window is |
- | to be excluded when drawing in the window |
- | IWindow::clipSiblings - area occupied by the siblings of the window is |
- | to be excluded when drawing in the window |
- | IWindow::parentClip - control how the window is clipped when a drawing |
- | action taken place in the window |
- | IWindow::saveBits - screen image of the area under the window be saved |
- | when the window is made visible |
- | IWindow::synchPaint - window is synchorously repainted |
- ------------------------------------------------------------------------------*/
- INESTEDBITFLAGCLASSDEF0(Style, IWindow);
- static const Style
- noStyle,
- visible,
- disabled,
- clipChildren,
- clipSiblings,
- parentClip,
- saveBits,
- synchPaint;
-
- /*-------------------------------- ACCESSORS -----------------------------------
- | These functions provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | color - Returns the window's attribute color |
- | disable - disables the window |
- | enable - enables the window |
- | grabPresSpace - gets the window presentation space handle |
- | handle - returns the window handle |
- | hide - hides the window |
- | id - returns the window ID. |
- | moveSizeTo - moves and sizes the window |
- | moveTo - moves the window |
- | position - returns the window position or location |
- | rect - returns the window rectangle value |
- | releasePresSpace - releases the window presentation space handle |
- | setColor - sets the window's attribute color |
- | setFocus - gives the window input focus |
- | show - shows the window |
- | size - returns the window size |
- | sizeTo - sizes the window |
- ------------------------------------------------------------------------------*/
- virtual void
- disable(),
- enable(Boolean enableWindow=true);
-
- virtual const IWindowHandle
- &handle() const;
-
- unsigned long
- id() const;
-
- ISize
- size() const;
-
- IPoint
- position() const;
-
- IRectangle
- rect() const;
-
- IPresSpaceHandle
- grabPresSpace() const;
-
- IWindow
- &hide(),
- &moveSizeTo(const IRectangle& newRect),
- &moveTo(const IPoint& newPosition),
- &releasePresSpace(const IPresSpaceHandle& hps) const,
- &setFocus(),
- &show(Boolean showWindow=true),
- &sizeTo(const ISize& newSize);
-
- enum Attribute
- {foreground, background, hiliteFgnd, hiliteBgnd, disableFgnd, diableBgnd,
- border, active, inactive, shadow, activeTextFgnd, activeTextBgnd,
- inactiveTextFgnd, inactiveTextBgnd };
-
- IWindow
- &setColor(Attribute value, const IColor& color);
-
- IColor
- color(Attribute value) const;
-
- /*-------------------------------- TESTING -----------------------------------
- | These functions provide means of testing the attributes of instances of |
- | this class: |
- | isDisable - Queries if the window is disabled |
- | isFocus - Queries if the window has the focus |
- | isShowing - Queries if the window is showing |
- | isValid - Queries if the window handle is valid |
- | isVisible - Queries if the window is visible |
- ------------------------------------------------------------------------------*/
- Boolean
- isDisabled() const,
- isFocus() const,
- isShowing() const,
- isValid() const,
- isVisible() const;
-
- /*----------------------------- WINDOW PAINTING -------------------------------
- | These functions provide means of update the window: |
- repaint - 1. Invalidates and redraws the entire window
- 2. Invalidates and redraws a given window rectangle
- update - Forces the update of the window and its children
- ------------------------------------------------------------------------------*/
- IWindow
- &repaint(),
- &repaint(const IRectangle& invalidRect),
- &update();
-
- /*----------------------------- PARENT/OWNER -----------------------------------
- | These function provide means of update the window: |
- | setParent - Changes the window parent |
- | setOwner - Changes the window owner |
- | parent - Returns the window's parent |
- | owner - Returns the window's owner |
- ------------------------------------------------------------------------------*/
- IWindow
- &setParent(const IWindow* newParent),
- &setOwner(const IWindow* newOwner);
-
- const IWindow
- *parent() const,
- *owner() const;
-
- /*-------------------------- STATIC OBJECT -------------------------------------
- | These functions provide means of getting instances of window object: |
- | desktopWindow - Returns the instance of object representing the |
- | system desktop window |
- | objectWindow - Returns the instance of object representing the |
- | system object |
- ------------------------------------------------------------------------------*/
- static const IWindow
- *desktopWindow(),
- *objectWindow();
-
- /*------------------------- OBJECT DELETION ------------------------------------
- | These functions provide means of managing the window object: |
- | setAutoDelete - Causes the instance of this class to destruct when the |
- | window handle is destroyed |
- | setNoAutoDelete - Sets the state to prevent setAutoDelete function |
- ------------------------------------------------------------------------------*/
- IWindow
- &setAutoDelete(),
- &setNoAutoDelete();
-
- /*------------------------- EVENT HANDLER ------------------------------------
- | These functions provide means of managing handlers of instances of this |
- | class: |
- | addHandler - Adds an instance of handler class to the window |
- | removeHandler - Removes a previously added handler |
- | dispatch - Event dispatching functions |
- | defaultProcedure - Invokes the subclassed default window procedure |
- ------------------------------------------------------------------------------*/
- IWindow
- &addHandler(IHandler* newHandler),
- &removeHandler(IHandler* oldHandler);
-
- Boolean
- dispatch(IEvent& event);
-
- IWindow
- &defaultProcedure(IEvent& evt);
-
- /*------------------------- POP-UP VISUAL CUE ----------------------------------
- | These functions provide means for derived window subclasses to implement |
- | the following: |
- | drawPopUpMenuEmphasis - Draws pop-up menu's owner visual cue when menu |
- | is shown |
- | erasePopUpMenuEmphasis - Erases the pop-up menu's owner visual cue |
- ------------------------------------------------------------------------------*/
- virtual void
- drawPopUpMenuEmphasis() {;}
-
- virtual void
- erasePopUpMenuEmphasis() {;}
-
- /*--------------------------- OBSELETE FUNCTION --------------------------------
- | These functions are obselete: |
- | ungrabPresSpace - see releasePresSpace |
- | startHandlingEvent - see similar function with one argument |
- ------------------------------------------------------------------------------*/
- IWindow& ungrabPresSpace(IPresSpaceHandle hps) const
- { releasePresSpace(hps);
- return (IWindow&)this; }
- IWindow& startHandlingEvent(IWindowHandle windowHandle, void* windowPtr)
- { return startHandlingEvent(windowHandle); }
-
- protected:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are one way to construct instances of this class: |
- | 1. default |
- | this initialize the object |
- ------------------------------------------------------------------------------*/
- IWindow();
-
- virtual
- ~IWindow();
-
- /*------------------------ STYLE IMPLEMENTATION --------------------------------
- | These functions are used to implement window style operations. |
- | style - Returns an unsigned long masking bits representing the window's |
- | style as defined by OS/2 Presentation Manager toolkit. |
- | setStyle - Sets the window style using the masking bits defined by |
- | OS/2 Presentation Manager toolkit. |
- ------------------------------------------------------------------------------*/
- unsigned long
- style() const;
- virtual void setStyle(unsigned long style);
-
- /*----------------------- EVENT HANDLING IMPLEMENTATION ------------------------
- | There functions provide means to handle events of instances of this class: |
- | startHandlingEvent - Starts processing events for the window. Typically, |
- | an application does not need to invoke this function. |
- | handleEvent - Processes default window destroy event. Typically, |
- | derived classes override this function to dispatch |
- | event handling functions specific to this window |
- | class. Note that events are only dispatched to this |
- | virtual function, if no action is taken by handler |
- | associated to the window. |
- ------------------------------------------------------------------------------*/
- IWindow
- &startHandlingEvent(IWindowHandle windowHandle);
-
- virtual Boolean
- handleWindowEvent(IEvent& evevt);
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- static unsigned long
- convertRGBAttribute(Attribute value);
- IWindow(const IWindow&);
- IWindow&
- operator= (const IWindow&);
- IWINCALLBACK*
- pClDefWinProc;
- IWindowHandle
- wndhCl;
- unsigned long
- ulClFlag;
- ILHandlerSet*
- pcolLHandler;
- };
- #endif /* _IWINDOW_ */