home *** CD-ROM | disk | FTP | other *** search
- /*==============================================================================
- Module Name: ihandle.hpp
-
- Description:
- Header file for IHandle class and subclasses.
-
- Copyright: (C) Copyright IBM Corporation 1992
- All Rights Reserved
- Licensed Materials = Property of IBM
-
- Usage:
- This header file is #included in appliction code that needs to
- manipulate PM "handles." It provides a toolkit-independent
- declaration of such handles.
-
- Notes:
- 1. IHandleType is make a synonym for either void* (OS/2 1.3) or
- unsigned long (OS/2 2.0).
- 2. IHandles provide for automatic converstion to type
- "IHandleType." This permits use of such object wherever
- PM "handle" types are required (e.g., in place of HWND,
- HMODULE, etc.).
- 3. Use of such IHandles within ICLUI provides additional type
- safety (beyond the PM "handle" typedef synonyms) since
- each handle type (i.e., class) is unique.
-
- Related Topics:
-
- History:
- flag yymmdd who description
- ---- ------ --- -----------------------------------------------------------
- 920705 law Initial
- 920712 law Made bilingual via use of IHandleType
- 920826 love Added reference count to IPointerHandle & IBitmapHandle
- 920828 love Added ISysPointerHandle & ISysBitmapHandle
- 920902 law Add IThreadID and operator IHandleType*
- 920916 law Remove operator IHandleType*
- 920916 law Add IProcessID
- 921018 love Added copy capability to SysPointer
- ==============================================================================*/
- #if !defined( _IHANDLE_ )
- #define _IHANDLE_
-
- #if !defined( _IBASETYP_ )
- #include <ibasetyp.hpp>
- #endif
-
- /*------------------------------------------------------------------------------
- Class Name: IHandle
-
- Base Class:
-
- Description:
- Generic PM "handle" class; this class is the base for the specific
- handle subclasses.
-
- Usage:
- This class is primarily intended as sort of an "abstract base class" for
- all the concrete handle subclasses (see below). Instances of this class
- can be created, although the utility of such objects is limited (the
- ICLUI APIs all specify specific IHandle subclasses).
-
- This base class manages the unsigned long "handle" data member by:
-
- 1. Defining a constructor that accepts an unsigned long and stores
- the handle in the "handle" field.
-
- 2. Defining a user conversion operator to type "IHandleType." This
- operator permits IHandles to be utilized anywhere an "IHandleType"
- is required (typically, on OS/2 and PM system APIs).
-
- There are numerous subclasses of IHandle to represent each of the
- supported system handle types:
-
- IWindowHandle - window handle (PM type HWND)
- IAnchorBlockHandle - anchor block handle (PM type HAB)
- IModuleHandle - module handle (OS/2 type HMODULE)
- IPointerHandle - pointer handle (PM type HPOINTER)
- IStringHandle - string handle (PM type HSTR)
- ISemaphoreHandle - semaphore handle (OS/2 type HSEM)
- IPresSpaceHandle - presentation space handle (PM type HPS)
- IBitmapHandle - bitmap handle (PM type HBITMAP)
- IProfileHandle - profile file handle (PM type HINI)
- IMsgQueueHandle - message queue handle (PM type HMQ)
- IAccelTblHandle - accelerator table handle (PM type HACCEL)
- ISysPointerHandle - for predefined system icons
- ISysBitmapHandle - for predefined system bitmaps
- IThreadID - thread ID (OS/2 type TID)
- IProcessID - process ID (OS/2 type PID)
-
- Notes:
- 1. Additional IHandle subclasses will be added (for the other system
- "handle" typedefs) as they are needed.
- 2. Future functional enhancments to these classes will add wrappers for
- the system APIs that manipulate them (where such functions don't
- fit within the standard ICLUI hierarchy). For example,
- IWindowHandle might add an "isValid" member to wrap the system API
- WinIsWindow(). In some cases, these "handle" classes may become
- "real" objects; i.e., real bitmap objects (IBitmap) rather than
- simply a "bitmap handle" (IBitmapHandle).
- 3. This class and its subclasses accept the default copy constructor
- and assignment operators.
- 4. The key IHandle members (constructor and conversion operator) are
- defined as in-line so that use of IHandles in place of the system
- handle typedefs incurs no performance penalty.
-
- Related Topics:
- ------------------------------------------------------------------------------*/
- class IHandle {
-
- protected:
-
- #if ( OS2LEVEL < 200 )
- typedef void *IHandleType;
- #else
- typedef unsigned long IHandleType;
- #endif
-
- public:
-
- IHandle( IHandleType value )
- : handle( value )
- {
- }
-
- // The following should be removed. Workaround for compiler bug?
- ~IHandle() {;}
-
- operator IHandleType ( ) const
- {
- return this->handle;
- }
-
- protected:
-
- IHandleType
- handle;
- };
-
- class IWindowHandle : public IHandle {
-
- public:
-
- IWindowHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IAnchorBlockHandle : public IHandle {
-
- public:
-
- IAnchorBlockHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IModuleHandle : public IHandle {
-
- public:
-
- IModuleHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IPointerHandle : public IHandle {
-
- public:
-
- IPointerHandle( IHandleType value = 0 );
- IPointerHandle(const IPointerHandle& handle);
- ~IPointerHandle();
- IPointerHandle& operator =(const IPointerHandle& handle);
- };
-
- class ISysPointerHandle : public IPointerHandle
- {
- public:
- typedef enum
- {
- arrow,
- text, /* IBeam */
- wait, /* hourGlass */
- size,
- move,
- sizeNWSE, /* Downward-sloping, double-headed arrow pointer */
- sizeNESW, /* Upward-sloping, double-headed arrow pointer */
- sizeHorizontal,/* Horizontal, double-headed arrow pointer */
- sizeVertical, /* Vertical, double-headed arrow pointer */
- standardApp,
- information,
- question,
- error,
- warning,
- illegalOperation,
- singleFile,
- multipleFile,
- folder,
- program
- } Type;
- ISysPointerHandle(Type pointerType, Boolean makeCopy=false);
-
- };
-
- class IStringHandle : public IHandle {
-
- public:
-
- IStringHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class ISemaphoreHandle : public IHandle {
-
- public:
-
- ISemaphoreHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IPresSpaceHandle : public IHandle {
-
- public:
-
- IPresSpaceHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IBitmapHandle : public IHandle {
-
- public:
-
- IBitmapHandle( IHandleType value = 0 );
- IBitmapHandle(const IBitmapHandle& handle);
- ~IBitmapHandle();
- IBitmapHandle& operator =(const IBitmapHandle& handle);
- };
-
- class ISysBitmapHandle : public IBitmapHandle
- {
- public:
- typedef enum
- {
-
- sysMenu,
- sysMenuDepressed,
- scrollBarUpArrow,
- scrollBarUpArrowDepressed,
- scrollBarUpArrowDisabled,
- scrollBarDownArrow,
- scrollBarDownArrowDepressed,
- scrollBarDownArrowDisabled,
- scrollBarRightArrow,
- scrollBarRightArrowDepressed,
- scrollBarRightArrowDisabled,
- scrollBarLeftArrow,
- scrollBarLeftArrowDepressed,
- scrollBarLeftArrowDisabled,
- menuCheckMark,
- menuAttached, /* cascading menu mark */
- checkBoxCheck,
- comboBoxDownArrow,
- PushButtonCorners,
- minimizeButton,
- minimizeButtonDepressed,
- maximizeButton,
- maximizeButtonDepressed,
- restoreButton,
- restoreButtonDepressed,
- childSysMenu,
- childSysMenuDepressed,
- drive,
- file,
- folder,
- treePlus,
- treeMinus,
- program,
- sizeBox
- } Type;
- ISysBitmapHandle(Type bitmapType);
- ~ISysBitmapHandle() {}
-
- };
-
- class IProfileHandle : public IHandle {
-
- public:
-
- IProfileHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IMsgQueueHandle : public IHandle {
-
- public:
-
- IMsgQueueHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IAccelTblHandle : public IHandle {
-
- public:
-
- IAccelTblHandle( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
-
- class IProcAddressHandle
- {
-
- public:
- IProcAddressHandle( ICALLBACK* procedure, const IModuleHandle& modh );
-
- ~IProcAddressHandle();
-
- operator ICALLBACK* () const
- {
- return this->pAddress;
- }
-
- ICALLBACK* procedureAddress ( ) const
- {
- return this->pAddress;
- }
-
- protected:
- ICALLBACK* pAddress;
- IModuleHandle modh;
- };
-
- class IThreadID : public IHandle {
- public:
- IThreadID( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
- class IProcessID : public IHandle {
- public:
- IProcessID( IHandleType value = 0 )
- : IHandle( value )
- {
- }
- };
-
- #endif /* _IHANDLE_ */