home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IWINDOW.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
47KB
|
847 lines
#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. *
* *
*******************************************************************************/
#ifndef _IVBASE_
#include <ivbase.hpp>
#endif
// Forward declarations for other classes:
class IColor;
class IException;
class IHandler;
class IHandlerList;
class IRectangle;
class IString;
class IDMItemProvider;
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
#ifndef _IEVENT_
#include <ievent.hpp>
#endif
#ifndef _IHANDLE_
#include <ihandle.hpp>
#endif
#ifndef _IPOINT_
#include <ipoint.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IWindow : public IVBase {
typedef IVBase
Inherited;
/*******************************************************************************
* The IWindow class is the base window class and provides behavior common to *
* all windows. While this class contains behavior that requires the *
* existence of a presentation window, the presentation window itself must be *
* constructed by the subclass. *
* *
* *
* Example: *
* *
* The following example demonstrates the required behavior of the constructor *
* of an IWindow subclass. This particular example might be used to extend *
* the behavior of a typical static text field. *
* *
* // *
* // Constructor to create a super control *
* // *
* SuperControl::SuperControl(unsigned long ulId, *
* IWindow* pwndParent, *
* IWindow* pwndOwner, *
* const IRectangle& rectInit, *
* Style efsStyle) *
* { *
* // Create the control using a call to IWindow::create *
* IWindowHandle whSuperControl = *
* create(pwndParent->handle(), *
* WC_STATIC, 0, *
* efsStyle.asUnsignedLong(), *
* rectInit.left(), rectInit.bottom(), *
* rectInit.width(), rectInit.height(), *
* (pwndOwner==0)?0:pwndOwner->handle(), *
* HWND_TOP, ulId, 0, 0); *
* *
* if (whSuperControl == 0) *
* { *
* // indicates an error so throw an exception *
* } *
* // tell IWindow to start processing events for the window *
* startHandlingEventsFor(whSuperControl); *
* } *
* *
*******************************************************************************/
public:
/*------------------------- Constructors/Destructor ----------------------------
| There are two ways to construct an IWindow. Both constructors exist so |
| that you can create a user interface "wrapper" instance for a window of |
| unknown type, such as any window in the client area. |
| |
| You can construct an IWindow from: |
| - A control on a loaded dialog template |
| - An existing window's window handle. |
| |
| Both constructors are implemented by calling: |
| - The setAutoDestroyWindow(false) function to ensure that the window is |
| not destroyed when the IWindow is destructed. |
| - The startHandlingEventsFor function, which results in the window being |
| subclassed and added to the window list for full event processing. |
------------------------------------------------------------------------------*/
IWindow ( unsigned long id,
IWindow* parentDialog);
IWindow ( const IWindowHandle& handle);
virtual
~IWindow ( );
/*---------------------------------- Style -------------------------------------
| The following functions provide a means to set and query window styles: |
| |
| Style - Nested class that provides static members that define the set of |
| valid window styles. For example, you could define an instance |
| of the IWindow::Style class and initialize it like: |
| IWindow::Style |
| style = visible | clipChildren | saveBits; |
| An object of this type is provided when the window is created. A |
| customizable default is used if no styles are specified. Once |
| the object is constructed, you can use IWindow member functions |
| to set or query the object's style. |
| |
| The declaration of the IWindow::Style nested class is generated |
| by the INESTEDBITFLAGCLASSDEF0 macro. |
| |
| The valid window styles are: |
| noStyle - Sets all styles off. |
| visible - Causes the window to be visible. In general, controls |
| are constructed as visible and frame windows as invisible. |
| disabled - Specifies that keyboard and mouse input are no longer |
| dispatched to the window, preventing the window from |
| being used. |
| clipChildren - Excludes the area occupied by the children of the window |
| when drawing in the window. Child windows are always |
| "clipped" to their parent window. When a parent window |
| is painted, the clipChildren style controls whether the |
| invalidated region of the parent window includes the area |
| occupied by its children, thus preventing a window from |
| painting over its child windows. |
| clipSiblings - Controls which sibling window is displayed on top when |
| multiple siblings are displayed. Sibling windows are |
| windows that share the same parent window. Assign the |
| clipSiblings style to the sibling window that should be |
| displayed on top of the other siblings, in Z-order. |
| clipToParent - Allows a window to paint outside of its window boundary up |
| to the window boundary of its parent. |
| saveBits - Optimizes the painting of a window by saving the screen |
| image of the area under the window as a bit map, and then |
| using the bit map to redraw the window when necessary. |
| synchPaint - Synchronously repaints the window. Without this style, |
| painting only occurs if there are no other events waiting |
| to be processed. |
------------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF0(Style, IWindow);
static const Style
noStyle,
visible,
disabled,
clipChildren,
clipSiblings,
clipToParent,
saveBits,
synchPaint;
/*------------------------------ Related Types ---------------------------------
| The following enumeration is defined: |
| EventType - Enumeration that specifies windowing system message |
| identifiers. Valid values are: |
| command - The event type is user command. |
| systemCommand - The event type is system command. |
| help - The event type is help. |
| character - The event type is key character. |
------------------------------------------------------------------------------*/
enum EventType { command=1, systemCommand, help, character };
/*---------------------------- Window Positioning ------------------------------
| These functions are used to set and query the size and position of windows: |
| moveTo - Changes the position of the window. |
| sizeTo - Changes the size of the window. |
| moveSizeTo - Changes the position and size of the window. |
| position - Returns the window position. |
| size - Returns the size of the window in window |
| coordinates. |
| NOTE: This function returns ISize(0,0) for a |
| frame window if it is constructed using |
| the shell position and the window has not |
| been shown. |
| rect - Returns a rectangle that represents the position |
| and size of the window. |
| NOTE: This function returns IRectangle(0,0,0,0) |
| for a frame window if it is constructed |
| using the shell position and the window |
| has not been shown. |
------------------------------------------------------------------------------*/
virtual IWindow
&moveTo ( const IPoint& aPoint ),
&sizeTo ( const ISize& newSize ),
&moveSizeTo ( const IRectangle& aRectangle );
IPoint
position ( ) const;
ISize
size ( ) const;
IRectangle
rect ( ) const;
/*-------------------------------- Accessors -----------------------------------
| These functions provide a means of getting and setting the accessible |
| attributes of instances of this class: |
| enable - Enables the window to accept keyboard and mouse input. |
| disable - Prevents keyboard and mouse input from being sent to |
| the window. |
| isDisabled - Returns true if the window is not sent mouse and |
| keyboard input. |
| setFocus - Sets the input focus to the window. |
| hasFocus - Returns true if the window has the input focus. |
| setParent - Changes the window parent. |
| parent - Returns the window's parent. |
| setOwner - Changes the window owner. |
| owner - Returns the window's owner. |
| isValid - Returns true if this object represents a valid |
| Presentation Manager window. It returns false if the |
| window has yet to be created or has already been |
| destroyed. |
| isFrameWindow - Returns true if this object represents a frame window. |
| desktopWindow - Returns the instance of the object that represents the |
| system desktop window. |
| objectWindow - Returns the instance of the object that represents the |
| system object. |
| handle - Returns the window handle. |
| windowWithHandle - Static function to return the IWindow instance in the |
| current thread for the passed window handle. |
| windowWithId - Static function to return the IWindow instance in the |
| current thread for the ID and owner. |
| handleWithId - Static function to return the window handle for the |
| passed ID and owner. |
| id - Returns the window ID. |
| messageQueue - Returns the handle for the window's message queue. |
------------------------------------------------------------------------------*/
virtual IWindow
&enable ( Boolean enableWindow=true ),
&disable ( ),
&setFocus ( ),
&setParent ( const IWindow* newParent ),
&setOwner ( const IWindow* newOwner );
IWindow
*parent ( ) const,
*owner ( ) const;
Boolean
isDisabled ( ) const,
hasFocus ( ) const,
isValid ( ) const,
isFrameWindow ( ) const;
static IWindow
*desktopWindow ( ),
*objectWindow ( );
virtual IWindowHandle
handle ( ) const;
static IWindow
*windowWithHandle ( const IWindowHandle& windowHandle ),
*windowWithId ( unsigned long id,
const IWindow* owner );
static IWindowHandle
handleWithId ( unsigned long id,
const IWindowHandle& parent );
unsigned long
id ( ) const;
IMessageQueueHandle
messageQueue ( ) const;
/*------------------------- Sibling Order Enumeration --------------------------
| SiblingOrder - Enumeration that is used to specify the sibling order of |
| newly created windows. The valid values are: |
| onTopOfSiblings - New windows are created on top of their |
| sibling windows. |
| behindSiblings - New windows are created behind their |
| sibling windows. |
------------------------------------------------------------------------------*/
enum SiblingOrder {
onTopOfSiblings,
behindSiblings };
/*------------------------- Sibling Order --------------------------------------
| These functions affect the ordering of windows with their siblings. The |
| window order (or Z Order) is used when tabbing or painting sibling windows. |
| Window painting starts from the bottom sibling and proceeds to the top |
| window. Cursor tabbing occurs from the top sibling and proceeds |
| to the bottom window. |
| positionBehindSiblings - Puts this window in the order behind all its |
| sibling windows. |
| positionOnSiblings - Puts this window in the order on top of all |
| its sibling windows. |
| positionBehindSibling - Puts this window in the order behind the |
| argument sibling window. |
| setDefaultOrdering - Determines whether new windows are created on |
| top of their sibling windows or behind them. By |
| default, windows are created behind their |
| other siblings. If this function is called |
| with a value of IWindow::onTopOfSiblings, new |
| windows will be created on top of their siblings.|
| defaultOrdering - Returns the order in which new windows will be |
| created relative to their sibling windows. |
------------------------------------------------------------------------------*/
virtual IWindow
&positionBehindSiblings ( ),
&positionOnSiblings ( ),
&positionBehindSibling ( const IWindowHandle& siblingWindow);
static void
setDefaultOrdering ( SiblingOrder order);
static SiblingOrder
defaultOrdering ( );
/*----------------------------- Event Send/Post --------------------------------
| These functions provide a simplified means of sending or posting an IEvent |
| to a window: |
| postEvent - Posts an event constructed from the arguments to the window. |
| If an EventType is used, an event will be constructed with |
| the appropriate message identifier. |
| sendEvent - Sends an event constructed from the arguments to the window. |
| If an EventType is used, an event will be constructed with |
| the appropriate message identifier. |
------------------------------------------------------------------------------*/
void
postEvent ( unsigned long eventId,
const IEventParameter1 &parm1 = 0,
const IEventParameter2 &parm2 = 0 ) const,
postEvent ( const IEvent& event ) const,
postEvent ( EventType eventType,
const IEventParameter1 &parm1 = 0,
const IEventParameter2 &parm2 = 0 ) const;
IEventResult
sendEvent ( unsigned long eventId,
const IEventParameter1 &parm1 = 0,
const IEventParameter2 &parm2 = 0 ) const,
sendEvent ( const IEvent& event ) const,
sendEvent ( EventType eventType,
const IEventParameter1 &parm1 = 0,
const IEventParameter2 &parm2 = 0 ) const;
/*----------------------------- Window Painting --------------------------------
| These functions are used in displaying a window and determining the |
| visibility of a window. |
| show - Makes the window visible. |
| hide - Hides the window. |
| disableUpdate - Prevents changes to a window from being drawn on the |
| screen. This function is typically used to make a |
| series of changes to a window without displaying |
| each change as it is made. Call the show function |
| to cause changes to be drawn on the screen. Do not |
| destroy a window while it is in the update-disabled |
| state; if you do, the destroyed window is not |
| removed from the screen. |
| enableUpdate - Reverts the window from an update-disabled state to |
| a state in which changes are drawn on the screen. |
| refresh - Has the following implementations: |
| - Invalidates and redraws the entire window. If |
| the refreshChildren argument is true, the |
| children are updated as well. |
| - Invalidates and redraws a given window rectangle. |
| showSourceEmphasis - Called by a pop-up menu handler to notify the window |
| to draw pop-up menu emphasis. The default behavior |
| of IWindow is to do nothing. |
| hideSourceEmphasis - Called by a pop-up menu handler to notify the window |
| to remove pop-up menu emphasis. The default |
| behavior of IWindow is to do nothing. |
| isVisible - Returns true if the windows style is visible. |
| NOTE: A window can have a style of visible and yet |
| not be showing if it is covered by another |
| window. |
| isShowing - Returns true if any part of the window is showing. |
| NOTE: A window can be visible and yet not be showing |
| if it is covered by another window. |
| presSpace - Acquires and returns the presentation space handle |
| for the window. |
| releasePresSpace - Releases the window's presentation space handle. |
| setLayoutDistorted - Indicates that changes have occurred in the window |
| that will cause the layout of the window in a canvas |
| to be updated. |
| isLayoutDistorted - Determines whether changes have been made in a |
| window that will require updating the layout of the |
| window in a canvas. |
| setMinimumSize - Sets the minimum allowable size of the window. In |
| the library, this applies to windows on a canvas |
| only. |
| minimumSize - Returns the minimum allowable size set by the user's |
| class. |
------------------------------------------------------------------------------*/
virtual IWindow
&show ( Boolean showWindow=true ),
&hide ( ),
&enableUpdate ( Boolean enableWindow=true ),
&disableUpdate ( ),
&refresh ( Boolean refreshChildren=false ),
&refresh ( const IRectangle& invalidRectangle ),
&showSourceEmphasis ( Boolean show=true ),
&hideSourceEmphasis ( );
Boolean
isVisible ( ) const,
isShowing ( ) const;
IPresSpaceHandle
presSpace ( ) const;
void
releasePresSpace ( const IPresSpaceHandle& aPresentationSpaceHandle ) const;
enum Layout { windowCreated=1, colorChanged=2, sizeChanged=4,
minimumSizeChanged=8, childMinimumSizeChanged=16,
fontChanged=32, fontPropogated=64, layoutChanged=128,
immediateUpdate=256, childWindowCreated=512,
windowDestroyed=1024, childWindowDestroyed=2048 };
virtual IWindow
&setLayoutDistorted ( unsigned long layoutAttributeOn,
unsigned long layoutAttributeOff );
virtual Boolean
isLayoutDistorted ( unsigned long layoutAttribute ) const;
IWindow
&setMinimumSize ( const ISize& sizMin );
ISize
minimumSize ( ) const;
/*------------------------- Object Deletion ------------------------------------
| These functions provide a means of managing the window object: |
| setAutoDeleteObject - Determines whether the IWindow instance should be |
| deleted when the presentation window is destroyed. |
| The deletion will occur when the Presentation |
| Manager dispatches a destroy event to the window. |
| By default, the instance is not deleted. |
| setAutoDestroyWindow - Determines whether the presentation window should |
| be destroyed when the IWindow instance is deleted. |
| This is used in cases where an IWindow is a |
| wrapper for a presentation window whose creation |
| and destruction are handled outside the C++ object. |
| isAutoDeleteObject - Returns true if the window instance will be |
| deleted when a destroy event is dispatched to the |
| window. |
| isAutoDestroyWindow - Returns true if the presentation window will be |
| destroyed when the window instance is deleted. |
------------------------------------------------------------------------------*/
IWindow
&setAutoDeleteObject ( Boolean autoDelete=true ),
&setAutoDestroyWindow ( Boolean autoDestroy=false );
Boolean
isAutoDeleteObject ( ) const,
isAutoDestroyWindow ( ) const;
/*------------------------------ Drag/Drop Support -----------------------------
| These functions provide means of getting and setting the accessible |
| attributes of instances of this class: |
| itemProvider - Returns pointer to drag item provider for this window |
| setItemProvider - Sets pointer to drag item provider for this window. |
------------------------------------------------------------------------------*/
IDMItemProvider
*itemProvider ( ) const;
IWindow
&setItemProvider ( IDMItemProvider *dragProvider );
class ChildCursor : public IVBase {
/*******************************************************************************
* The IWindow::ChildCursor class is a nested cursor class used to iterate *
* over the children of any window. The children are accessed in Z-order, *
* from top to bottom. *
* *
* Example: *
* // Iterate over children of frame... *
* IFrameWindow *
* frame; *
* IFrameWindow::ChildCursor *
* cursor ( frame ); *
* for ( cursor.setToFirst(); cursor.isValid(); cursor.setToNext() ) *
* { // Do something with each child... *
* IWindowHandle *
* child = frame.childAt( cursor ); *
* ... *
* } *
*******************************************************************************/
public:
/*-------------------------- Constructor/Destructor ----------------------------
| You can construct objects of this class from a reference to the window |
| whose child windows will be iterated over. |
------------------------------------------------------------------------------*/
ChildCursor ( IWindow &parent );
~ChildCursor ( );
/*-------------------------------- Overrides -----------------------------------
| The nested ChildCursor class overrides the following functions to |
| provide the appropriate cursor behavior: |
| setToFirst - Resets the cursor position to the first child window (in |
| Z-order). |
| setToNext - Advances the cursor position to the next child window (in |
| Z-order). |
| isValid - Returns true if the cursor is in a valid area. |
| invalidate - Marks the cursor as invalid. |
------------------------------------------------------------------------------*/
virtual Boolean
setToFirst ( ),
setToNext ( ),
isValid ( ) const;
virtual void
invalidate ( );
private:
/*--------------------------------- Private ----------------------------------*/
friend class IWindow;
IEnumHandle
enumHandle;
IWindowHandle
windowHandle,
parentHandle;
ChildCursor
&operator = ( const ChildCursor & );
ChildCursor ( const ChildCursor & );
}; // IWindow::ChildCursor
/*------------------------------ ChildCursor Support ---------------------------
| childAt - Returns the window handle of the child window at the current |
| position of the argument cursor. |
------------------------------------------------------------------------------*/
IWindowHandle
childAt ( const ChildCursor &aCursor ) const;
/*------------------------------ Canvas Support --------------------------------
| These functions are used by the canvas classes to provide dialog-like |
| behavior (minimal implementations are provided here): |
| isTabStop - Returns true if the user can tab to the window. |
| defaultPushButton - Returns the first child window that is a default push |
| button, if one exists. |
| matchForMnemonic - Returns the first child window that uses the |
| specified character as a mnemonic. |
------------------------------------------------------------------------------*/
virtual Boolean
isTabStop ( ) const;
virtual IWindowHandle
defaultPushButton ( ) const,
matchForMnemonic ( unsigned short character ) const;
/*------------------------------ Miscellaneous ---------------------------------
| This function is used to map coordinates from one window to another: |
| mapPoint - Static function to map a point from one window's coordinate |
| space to another's, such as mapping from screen coordinates to |
| window coordinates. |
------------------------------------------------------------------------------*/
static IPoint
mapPoint ( const IPoint &aPoint,
const IWindowHandle &from,
const IWindowHandle &to );
/*------------------------------- Diagnostics ----------------------------------
| The following functions are used to output information for the window: |
| asString - Returns a string that contains the window handle and ID. |
| asDebugInfo - Returns a string that contains detailed information about |
| the window, including the information provided by asString. |
------------------------------------------------------------------------------*/
virtual IString
asString ( ) const,
asDebugInfo ( ) const;
class ExceptionFn : public IVBase {
typedef IVBase
Inherited;
/*******************************************************************************
* The IWindow::ExceptionFn nested class is used to process exceptions that *
* occur when events are dispatched by the IWindow dispatcher. *
* *
* Example: *
* *
* class MyFrameWindow : public IFrameWindow, public IWindow::ExceptionFn { *
* virtual Boolean *
* handleException (IException& exception, IEvent& event) { *
* return true; // ignore the exception and continue dispatching *
* }; *
* *
* MyFrameWindow :: MyFrameWindow () { *
* setExceptionFunction(this); *
* *
* *
*******************************************************************************/
public:
~ExceptionFn ( );
/*--------------------------- Exception Processing -----------------------------
| The following function is used to process C++ exceptions in the IWindow |
| dispatcher: |
| handleException - If an exception object is registered with IWindow, this |
| function will be called when an uncaught exception |
| occurs while dispatching events. This function should |
| return true if the exception situation was handled and |
| it is safe to continue dispatching events. If false is |
| returned, the exception will be thrown again. |
------------------------------------------------------------------------------*/
virtual Boolean
handleException ( IException& dispatcherException,
IEvent& exceptionEvent ) = 0;
}; // IWindow::ExceptionFn
/*----------------------------- Exception Processing ---------------------------
| The following functions are used to process C++ exceptions in the IWindow |
| dispatcher: |
| setExceptionFunction - Stores an IWindow::ExceptionFn object to be called |
| when an uncaught exception is detected while |
| dispatching window events. If an object has |
| already been registered, it is returned; |
| otherwise, 0 is returned. |
| exceptionFunction - Returns a pointer to the current exception |
| function, or 0 if one has not been registered. |
| handleException - Called when an exception is detected during the |
| dispatch of an event. The default behavior is to |
| determine if an IWindow::ExceptionFn object has |
| been registered and call it. Otherwise, false is |
| returned and the exception is thrown again. |
------------------------------------------------------------------------------*/
static IWindow::ExceptionFn
*setExceptionFunction ( IWindow::ExceptionFn* exceptionObject ),
*exceptionFunction ( );
virtual Boolean
handleException ( IException& dispatcherException,
IEvent& exceptionEvent );
protected:
/*------------------------------ Implementation --------------------------------
| This function provides utilities used to implement this class: |
| create - Calls the graphical presentation system to create an |
| instance of a window. |
| addHandler - Adds an instance of a handler class to the window. |
| removeHandler - Removes a previously added handler. |
| setColor - Sets the window area to the indicated color. The |
| window area is identified by a system-defined |
| presentation parameter value. |
| setStyle - Sets the window style using the masking bits defined by |
| the OS/2 Presentation Manager Toolkit. |
| color - Returns the color value of the window area, or the |
| passed default if no color for the area has been set. |
| The window area is identified by a system-defined |
| presentation parameter value. |
| style - Returns an unsigned long representing the window's |
| style, as defined by the OS/2 Presentation Manager |
| Toolkit. |
| isPrimaryWindow - Returns true if this window has no owner and the parent |
| is the desktop window. |
| windowUShort - Returns the given window word (as an unsigned short). |
| windowULong - Returns the given window word (as an unsigned long). |
| setWindowData - Sets the given window word (as an unsigned short or |
| unsigned long). The result indicates whether it was |
| successful. |
------------------------------------------------------------------------------*/
virtual IWindowHandle
create ( unsigned long id,
const char* text,
unsigned long style,
const char* windowClass,
const IWindowHandle& parent,
const IWindowHandle& owner,
const IRectangle& initRect,
const void* ctlData,
const void* presParams,
IWindow::SiblingOrder ordering = defaultOrdering());
IWindow
&addHandler ( IHandler* newHandler ),
&removeHandler ( IHandler* oldHandler );
IWindow
&setColor ( unsigned long colorArea,
const IColor& color );
virtual IWindow
&setStyle ( unsigned long style );
IColor
color ( unsigned long colorArea ) const,
color ( unsigned long colorArea,
const IColor& defaultColor ) const;
unsigned long
style ( ) const;
Boolean
isPrimaryWindow ( ) const;
unsigned short
windowUShort ( long index ) const;
unsigned long
windowULong ( long index ) const;
IWindow
&setWindowData ( long index, unsigned short ushort ),
&setWindowData ( long index, unsigned long ulong );
/*------------------------------- Constructor ----------------------------------
| Constructor used by subclasses wishing control over window creation. |
------------------------------------------------------------------------------*/
IWindow ( );
/*---------------------------------- Layout ------------------------------------
| The following function is used return the layout size: |
| calcMinimumSize - Returns the recommended minimum size for this IWindow |
| object. This size is used by the canvas layout routine. |
| A default operation returns the minimum size set by |
| users. The size is based on the text and the current |
| font setting. |
------------------------------------------------------------------------------*/
virtual ISize
calcMinimumSize ( ) const;
/*---------------------- Event Handling Implementation -------------------------
| These functions provide the implementation of the event handling mechanism: |
| startHandlingEventsFor - Starts processing events for the window. This is |
| a combination of subclassing the window procedure |
| and storing the window in the current thread's |
| collection of windows. You can only invoke this |
| function once per window, typically during |
| construction of the window. |
| addToWindowSet - Adds a window to the current thread's collection |
| of windows. A valid window handle must be |
| provided. |
| removeFromWindowSet - Removes a window from the current thread's |
| collection of windows. |
| dispatch - Dispatches events to the handlers associated with |
| a window. If the event is not processed by a |
| handler or no handlers exist for the window, |
| defaultProcedure is called to process the event. |
| defaultProcedure - Provides default processing behavior for a window |
| event. This function calls the window procedure |
| that was returned from the window subclass during |
| the call to startHandlingEventsFor. |
| deleteIsInProcess - Returns true if either the IWindow instance |
| destructor has been called or the presentation |
| window is being destroyed. |
------------------------------------------------------------------------------*/
IWindow
&startHandlingEventsFor ( const IWindowHandle& windowHandle ),
&startHandlingEventsFor ( unsigned long id,
IWindow* parentDialog);
static void
addToWindowSet ( IWindow* window,
const IWindowHandle& windowHandle ),
removeFromWindowSet ( IWindow* window );
Boolean
dispatch ( IEvent& event );
IWindow
&defaultProcedure ( IEvent& event );
Boolean
deleteIsInProcess ( ) const;
private:
/*--------------------------------- Private ----------------------------------*/
/* IWindow Flags */
enum State { autoDeleteObject=1, autoDestroyWindow=2, deleteInProcess=4,
primaryWindow=8, addedToList=16, dispatchInProcess=32,
needsDelete=64};
IWindow
&setDeleteInProcess ( ),
&cleanUp ( );
// setDefaultProcedure() is used by IFileDialog and IFontDialog
// since they can't use startHandlingEventsFor().
// These two classes are granted friendship below.
IWinProc
*setDefaultProcedure ( IWinProc *newDefProc );
static void
cleanUpHandler ( IHandler & );
IWindow ( const IWindow& );
IWindow
&operator= ( const IWindow& );
IWinProc
*pClDefWinProc;
unsigned long
wndhCl,
ulClId,
ulClState,
ulClLayoutChange;
IHandlerList*
pcolHandler;
ISize
sizClMin;
static IWindow::ExceptionFn
*pexcClCurrent;
static IWindow::SiblingOrder
siblingCreateOrder;
/* friend functions */
friend void* _System _pfnwpICWinProc ( unsigned long hwnd, unsigned long ulMsg, void* mp1, void* mp2 );
friend unsigned long const& key ( IWindow* const& pwin );
/* friend classes */
friend class IHandler;
friend class IFileDialog;
friend class IFontDialog;
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
/*----------------------------- Inline Functions -----------------------------*/
#ifndef I_NO_INLINES
#include <iwindow.inl>
#endif
#endif /* _IWINDOW_ */