home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 29 Fixes_o
/
29-Fixes_o.zip
/
bet2f1.zip
/
iswp.hpp
< prev
next >
Wrap
Text File
|
1995-05-04
|
11KB
|
238 lines
#ifndef _ISWP_
#define _ISWP_
/*******************************************************************************
* FILE NAME: iswp.hpp *
* *
* DESCRIPTION: *
* This file contains the declaration(s) of the class(es): *
* ISWP - Wrapper for PM SWP (set window position) structure. *
* ISWPArray - Array of ISWP stuctures. *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1994 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or *
* disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IBASE_
#include <ibase.hpp>
#endif
#ifndef _IHANDLE_
#include <ihandle.hpp>
#endif
class IPoint;
class ISize;
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class ISWP : public IBase {
typedef IBase
Inherited;
/*******************************************************************************
* The ISWP class is a wrapper for the Presentation Manager Toolkit window *
* position structure. This class provides member functions to access and set *
* the various elements of this structure. *
* *
* The structure contains the following elements: *
* flags - A set of window size/move flags. The flags are defined by the *
* Toolkit SWP_* constants. *
* position - A window position represented by an IPoint. *
* size - A window size represented by an ISize. *
* behind - The window handle that identifies the window behind which to *
* place the window associated with this structure. *
* hwnd - The window handle of the window associated with this structure. *
* *
* This class provides member functions to get and set the position and size. *
* It provides accessors to get the hwnd as an IWindowHandle and to return *
* the flags as an unsigned long. *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| You can create an ISWP object using a default constructor or fron another |
| ISWP object. The default constructor sets all fields to 0. |
------------------------------------------------------------------------------*/
ISWP ( );
ISWP ( const ISWP& original );
~ISWP ( );
ISWP
&operator= (const ISWP& original);
/*-------------------------------- Accessors -----------------------------------
| The following functions are used to get and set the accessible attributes |
| of instances of this class: |
| windowHandle - Returns the handle of the associated window. |
| position - Returns the window position stored in this object. |
| setPosition - Sets the window position. |
| size - Returns the window size stored in this object. |
| setSize - Sets the window size. |
------------------------------------------------------------------------------*/
IWindowHandle
windowHandle ( ) const;
IPoint
position ( ) const;
ISWP
&setPosition ( const IPoint &aPoint );
ISize
size ( ) const;
ISWP
&setSize ( const ISize &aSize );
/*----------------------------- Flags Accessors --------------------------------
| The following are portable accessors to the flags in the SWP/WINDOWPOS |
| structures. Windows and PM interpret the bits differently. |
| flags - returns a reference to the raw unsigned flag word. |
| isMove - true if window is being moved. |
| isSize - true if window is being resized. |
| isShow - true if the window is being shown. |
| isHide - true if the window is being hidden. |
| isZOrder - true if the Z-order is being changed. |
| setMove - enables or disables the flag to move the window. |
| setSizeFlag - enables or disables the flag to resize the window. |
| setShow - enables or disables the flag to show the window. |
| setHide - enables or disables the flag to hide the window. |
| setZOrder- enables or disables the flag to change the window Z-order. |
| setNoAdjust - enables or disables sending of WM_ADJUSTWINDOWPOS / |
| WM_NCCALCSIZE messages |
------------------------------------------------------------------------------*/
unsigned long
&flags ( );
Boolean
isMove( ) const,
isSize( ) const,
isShow( ) const,
isHide( ) const,
isZOrder( ) const;
ISWP
&setMove ( Boolean enable = true ),
&setSizeFlag ( Boolean enable = true ),
&setShow ( Boolean enable = true ),
&setHide ( Boolean enable = true ),
&setZOrder ( Boolean enable = true ),
&setNoAdjust ( Boolean enable = true );
#ifdef IC_PM
/*----------------------------------- Data -------------------------------------
| The data members must exactly match the layout of the Presentation Manager |
| SWP structure. |
| fl - Flags. |
| cy - Width. |
| cx - Height. |
| x - The X-coordinate position. |
| y - The Y-coordinate position. |
| behind - Handle for the "behind" window. |
| hwnd - Handle for this window. |
| ulReserved1 - Reserved. |
| ulReserved2 - Reserved. |
------------------------------------------------------------------------------*/
unsigned long
fl;
long
cy,
cx,
y,
x;
IWindowHandle
behind,
hwnd;
unsigned long
ulReserved1,
ulReserved2;
#endif //IC_PM
#ifdef IC_WIN
/*----------------------------------- Data -------------------------------------
| The data members must exactly match the layout of the Windows |
| WINDOWPOS structure. Field names are the same as the PM version above, |
| however, for ease in implementing this class. |
| hwnd - (hwnd) Handle for this window. |
| behind - (hwndInsertAfter) Handle for the "behind" window. |
| x - (x) The X-coordinate position. |
| y - (y) The Y-coordinate position. |
| cx - (cx) Height. |
| cy - (cy) Width. |
| fl - (flags) Flags. |
------------------------------------------------------------------------------*/
IWindowHandle
hwnd,
behind;
long
x,
y,
cx,
cy;
unsigned long
fl;
#endif //IC_WIN
};
class ISWPArray : public IBase {
typedef IBase
Inherited;
/*******************************************************************************
* The ISWPArray class serves as a wrapper for an array of Presentation *
* Manager Toolkit SWP structures. This class treats those structures as ISWP *
* objects. *
* *
* It provides functions to access a given element of the array and to locate *
* the element that corresponds to a given window ID. *
*******************************************************************************/
public:
/*------------------------------- Constructor ----------------------------------
| You can construct an object of this class from a pointer to an ISWP object |
| (presumed to be the first element of the array) and a dimension (the number |
| of elements of the array). Typically, the ISWP* argument is created by |
| casting a Presentation Manager PSWP pointer. |
------------------------------------------------------------------------------*/
ISWPArray ( ISWP *array, unsigned dimension );
/*-------------------------------- Accessors -----------------------------------
| These functions provide a means of getting the accessible attributes of |
| instances of this class: |
| size - Returns the dimension of the array. |
| operator [] - Returns a reference to the nth element of the array. |
| indexOf - Returns a reference to the element that corresponds to a |
| window with the argument window ID value. |
------------------------------------------------------------------------------*/
unsigned
size ( ) const;
ISWP
&operator [] ( unsigned index );
unsigned
indexOf ( unsigned long id ) const;
private: /*------------------------ PRIVATE ----------------------------------*/
ISWP
*p;
unsigned
dim;
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
/*--------------------------------- INLINES ----------------------------------*/
#ifndef I_NO_INLINES
#include <iswp.inl>
#endif
#endif // _ISWP_