[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LWindow



Overview:

LWindow is a PowerPlant class that defines window behavior.

Methods :

The methods in this class are:

 

LWindow()  
~LWindow()  
Activate()  
ActivateSelf()  
ApplyForeAndBackColors()  
AttemptClose()  
CalcStandardBounds()  
CalcStandardBoundsForScreen()  
ClearAttribute()  
ClickInContent()  
ClickInDrag()  
ClickInGoAway()  
ClickInGrow()  
ClickInZoom()  
CreateWindow()  
Deactivate()  
DeactivateSelf()  
DoClose()  
DoSetBounds()  
DoSetPosition()  
DoSetZoom()  
DrawSelf()  
DrawSizeBox()  
Enable()  
EstablishPort()  
ExpandSubPane()  
FetchWindowObject()  
FindCommandStatus()  
FindWindowByID()  
GetAEProperty()  
GetAEWindowAttribute()  
GetDescriptor()  
GetGlobalBounds()  
GetMacPort()  
GetMinMaxSize()  
GetStandardSize()  
GlobalToPortPoint()  
HandleAppleEvent()  
HandleClick()  
HasAttribute()  
HideSelf()  
InitWindow()  
InvalPortRect()  
InvalPortRgn()  
MakeMacWindow()  
MakeSelfSpecifier()  
MoveWindowBy()  
MoveWindowTo()  
ObeyCommand()  
PortToGlobalPoint()  
ResizeFrameBy()  
ResizeWindowBy()  
ResizeWindowTo()  
Resume()  
Select()  
SendAESetBounds()  
SendAESetPosition()  
SendAESetZoom()  
SetAEProperty()  
SetAttribute()  
SetDescriptor()  
SetForeAndBackColors()  
SetMinMaxSize()  
SetStandardSize()  
Show()  
ShowSelf()  
Suspend()  
UpdatePort()  
ValidPortRect()  
ValidPortRgn()  

Data Members:

The data members in this class are:

 

mMacWindowP  
mMinMaxSize  
mStandardSize  
mUserBounds  
mAttributes  
mForeColor  
mBackColor  
mMoveOnlyUserZoom  

Operation:

LWindow is a complex class that derives from many other classes. Many of the member functions in LWindow are for internal use only, and you shouldn't have to call them directly.

For more information on working with the LWindow class, refer to The PowerPlant Book.

Source files:

(Pane Classes)

LWindow.h

LWindow.cp

Ancestors:

LAttachable

LCommander

LModelObject

LPane

LView

LWindow()

Purpose:

The constructor creates objects from the passed-in parameters.

Access:

Public

Prototype:

LWindow();

LWindow( const SWindowInfo &inWindowInfo);

LWindow( ResIDT inWINDid,
UInt32 inAttributes,
LCommander *inSuper );

LWindow( LStream *inStream );
Parameters:

These constructors have the following parameters:

 

const   SWindowInfo&  
inWindowInfo  
The SuperView reference.  
ResIDT  
inWINDid  
The resource ID for the WIND resource.  
UInt32  
inAttributes  
The attributes for the window (see Window.h).  
LCommander*  
inSuper  
The pointer to the Supercommander.  
LStream*  
inStream  
The stream to use to create the object.  

~LWindow()

Purpose:

The destructor destroys the object.

Access:

Public

Prototype:

virtual ~LWindow();

Activate()

Purpose:

Activate a Window. This is an override of Activate() in LPane.

ActivateSelf()

Purpose:

This is called when a Window is being activated. This is an override of ActivateSelf() in LPane.

ApplyForeAndBackColors()

Purpose:

Set the foreground and background colors of the current port. The Window or one of its subpanes must already be focused. This is an override of ApplyForeAndBackColors() in LPane.

AttemptClose()

Purpose:

Try to close a Window as a result of direct user action.

Access:

Virtual, Public

Prototype:

virtual void AttemptClose();
Parameters:

None

Return:

None

CalcStandardBounds()

Purpose:

Calculate the bounds of the Window in its standard state and return whether it is in the standard state. The standard state depends on the screen containing the largest area of the Window and the current standard size.

Access:

Virtual, Public

Prototype:

virtual Boolean CalcStandardBounds(
Rect &outStdBounds) const;
Parameters:

The parameter for this method is:

 

Rect&  
outStdBounds  
The port rectangle of Window at standard size in global coordinates.  

Return:

Returns true if in the standard state, else false.

CalcStandardBoundsForScreen()

Purpose:

Calculate the bounds of the Window if it was at a standard (zoomed out) state on a Screen with the specified bounds.

Access:

Virtual, Public

Prototype:

virtual void CalcStandardBoundsForScreen(
const Rect &inScreenBounds,
Rect &outStdBounds) const;
Parameters:

The parameters for this method are:

 

Rect&  
outStdBounds  
The port rectangle of Window at standard size in global coordinates.  
const Rect&  
inScreenBounds  
Bounding box of screen in global coordinates.  

Return:

None

ClearAttribute()

Purpose:

Clear the attribute in mAttributes that is passed in to this method.

Access:

Public

Prototype:

void ClearAttribute( EWindAttr inAttribute );
Parameters:

The parameter for this method is:

 

EWindAttr  
inAttribute  
The window attributes.  

Return:

None

ClickInContent()

Purpose:

Respond to a click in the content region of a Window.

Access:

Virtual, Public

Prototype:

virtual void ClickInContent(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
The event record for the click.  

Return:

None

ClickInDrag()

Purpose:

Process a click in drag region of a Window.

Access:

Virtual, Public

Prototype:

virtual void ClickInDrag(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
The event record for the click.  

Return:

None

ClickInGoAway()

Purpose:

Handle a click inside the close box of a Window.

Access:

Virtual, Public

Prototype:

virtual void ClickInGoAway(
const EventRecord &inMacEvent)
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
The event record for the click.  

Return:

None

ClickInGrow()

Purpose:

Handle a click in the Grow box of a Window.

Access:

Virtual, Public

Prototype:

virtual void ClickInGrow(
const EventRecord &inMacEvent);
Parameters:

The parameter for this method is:

 

const   EventRecord&  
inMacEvent  
The event record for the click.  

Return:

None

ClickInZoom()

Purpose:

Handle a click inside the zoom box of a Window

Access:

Virtual, Public

Prototype:

virtual void ClickInZoom(
const EventRecord &inMacEvent,
SInt16 inZoomDirection)
Parameters:

The parameters for this method are:

 

const   EventRecord&  
inMacEvent  
The event record for the click.  
SInt16  
inZoomDirection  
The direction to zoom.  

Return:

None

CreateWindow()

Purpose:

Return a newly created Window object initialized from a PPob resource.

Access:

Static, Public

Prototype:

static Window* CreateWindow(
ResIDT inWindowID,
LCommander *inSuperCommander);
Parameters:

The parameters for this method are:

 

ResIDT  
inWindowID  
The resource ID for the window.  
LCommander*  
inSuperCommander  
The pointer to the Supercommander.  

Return:

The pointer to the Window.

Deactivate()

Purpose:

Deactivate the Window. This is an override of Deactivate() in LPane.

DeactivateSelf()

Purpose:

This is called when a Window is being deactivated. This is an override of DeactivateSelf() in LPane.

DoClose()

Purpose:

Close a Window.

Access:

Virtual, Public

Prototype:

virtual void DoClose();
Parameters:

None

Return:

None

DoSetBounds()

Purpose:

Change size and location of a Window.

Access:

Virtual, Public

Prototype:

virtual void DoSetBounds(
const Rect &inBounds );
Parameters:

The parameter for this method is:

 

const Rect&  
inBounds  
The Rect for the bounds. In global coordinates, this specifies the new size and location of the Window's port rectangle  

Return:

None

DoSetPosition()

Purpose:

Change the location of a Window.

Access:

Virtual, Public

Prototype:

virtual void DoSetPosition( Point inPosition );
Parameters:

The parameter for this method is:

 

Point  
inPosition  
The top left corner of the Window's port rectangle is placed at inPosition, which is in global coordinates.  

Return:

None

DoSetZoom()

Purpose:

Zoom window to either the Standard or User state.

Access:

Virtual, Public

Prototype:

virtual void DoSetZoom(
Boolean inZoomToStdState );
Parameters:

The parameter for this method is:

 

Boolean  
inZoomToStdState  
Indicate whether to zoom to the standard state.  

Return:

None

DrawSelf()

Purpose:

This draws the window. This is an override of DrawSelf() in LPane.

Access:

Virtual, Protected

Prototype:

virtual void DrawSelf();
Parameters:

None

Return:

None

DrawSizeBox()

Purpose:

Draw standard size box for resizable Windows.

Access:

Virtual, Protected

Prototype:

virtual void DrawSizeBox();
Parameters:

None

Return:

None

Enable()

Purpose:

Enable the Window. This is an override of Enable() in LPane.

Access:

Virtual, Public

Prototype:

virtual void Enable();
Parameters:

None

Return:

None

EstablishPort()

Purpose:

Make Window the current Port.

Access:

Public

Prototype:

virtual Boolean EstablishPort();
Parameters:

None

Return:

None

Remarks:

If you call this function directly, you should call LView::OutOfFocus() with nil, since changing the current port may invalidate the Focus.

ExpandSubPane()

Purpose:

Resize a subpane so that it is the same size as the Window, horizontally and/or vertically. This is an override of ExpandSubPane() in LView.

FetchWindowObject()

Purpose:

Return the PowerPlant Window object associated with a Mac OS WindowPtr.

Access:

Static, Public

Prototype:

static LWindow* FetchWindowObject(
WindowPtr inWindowP );
Parameters:

The parameter for this method is:

 

WindowPtr  
inWindowP  
The WindowPtr for the window.  

Return:

Returns nil if the WindowPtr is not a PowerPlant Window.

FindCommandStatus()

Purpose:

Pass back whether a Command is enabled and/or marked (in a Menu). This is an override of FindCommandStatus() in LCommander.

FindWindowByID()

Purpose:

Return the Window object with the specified Pane ID number.

This method loops through all Windows from front to back searching for the first one with the specified Pane ID. Note that it's common to use the same PPob (and WIND) resource to create multiple windows, all of which have the same Pane ID. This function returns the frontmost match, whether it is visible or not.

Access:

Static, Public

Prototype:

static LWindow* FindWindowByID(
PaneIDT inWindowID );
Parameters:

The parameter for this method is:

 

PaneIDT  
inWindowID  
The pane ID for the Window.  

Return:

Returns nil if no match found, else returns the pointer to the Window.

GetAEProperty()

Purpose:

This method returns an AppleEvent property.

Access:

Virtual, Public

Prototype:

virtual void GetAEProperty(
DescType inProperty,
const AEDesc &inRequestedType,
AEDesc &outPropertyDesc ) const;
Parameters:

The parameters for this method are:

 

DescType  
inProperty  
The descriptor type for the property.  
const AEDesc&  
inRequestedType  
The AppleEvent descriptor type.  
AEDesc&  
outPropertyDesc  
The property descriptor.  

GetAEWindowAttribute()

Purpose:

Determines the Window attribute based on the received AppleEvent.

Access:

Public

Prototype:

void GetAEWindowAttribute(
EWindAttr inAttribute,
AEDesc &outPropertyDesc ) const;
Parameters:

The parameters for this method are:

 

EWindAttr  
inAttribute  
The attributes for the Window.  
AEDesc&  
outPropertyDesc  
The property descriptor.  

Return:

None

GetDescriptor()

Purpose:

Return the title of a Window. This is an override of GetDescriptor() in LPane.

GetGlobalBounds()

Purpose:

Pass back the port rectangle of a Window in global coordinates.

Access:

Public

Prototype:

void GetGlobalBounds(
Rect &outBounds ) const;
Parameters:

The parameter for this method is:

 

Rect&  
outBounds  
The rectangle of the window in global coordinates.  

Return:

None

GetMacPort()

Purpose:

Return Toolbox GrafPort associated with a Window object. This is an override of GetMacPort() in LPane.

GetMinMaxSize()

Purpose:

This method gets the value of mMinMaxSize.

Access:

Public

Prototype:

void GetMinMaxSize( Rect &outRect) const;
Parameters:

The parameter for this method is:

 

Rect&  
outRect  
The rectangle of the window in global coordinates.  

Return:

None

GetStandardSize()

Purpose:

This method returns the value of mStandardSize in the outStdSize parameter.

Access:

Public

Prototype:

void GetStandardSize( SDimension16 &
outStdSize ) const;
Parameters:

The parameter for this method is:

 

SDimension16&  
outStdSize  
The rectangle of the window in global coordinates.  

Return:

None

GlobalToPortPoint()

Purpose:

Convert a point from global (screen) coordinates to a Window's Port coordinates. This is an override of GlobalToPortPoint() in LPane.

HandleAppleEvent()

Purpose:

This method handles an AppleEvent.

Access:

Virtual, Public

Prototype:

virtual void HandleAppleEvent(
const AppleEvent &inAppleEvent,
AppleEvent &outAEReply,
AEDesc &outResult,
long inAENumber );
Parameters:

The parameters for this method are:

 

const -AppleEvent&  
inAppleEvent  
The reference to the AppleEvent.  
AppleEvent&  
outAEReply  
The AppleEvent reply.  
AEDesc&  
outResult  
The AppleEvent result.  
long  
inAENumber  
The AppleEvent number.  

Return:

None

HandleClick()

Purpose:

Respond to a click on a Window.

The inPart parameter is the part code returned by the Toolbox FindWindow routine.

Access:

Virtual, Public

Prototype:

virtual void HandleClick(
const EventRecord &inMacEvent,
SInt16 inPart);
Parameters:

The parameters for this method are:

 

const   EventRecord&  
inMacEvent  
The reference to the event information.  
SInt16  
inPart  
The part code returned by the Toolbox FindWindow routine.  

Return:

None

HasAttribute()

Purpose:

Checks the Window to see if it has a given attribute.

Access:

Public

Prototype:

Boolean HasAttribute( EWindAttr 
inAttribute ) const;
Parameters:

The parameter for this method is:

 

EWindAttr  
inAttribute  
The Window attribute to check for.  

Return:

Returns true is the attribute is present, else false.

HideSelf()

Purpose:

Window is being made invisible. This is an override of HideSelf() in LPane.

Access:

Virtual, Protected

Prototype:

virtual void HideSelf();
Parameters:

None

Return:

None

InitWindow()

Purpose:

Private Initializer from data in a struct.

Access:

Private

Prototype:

void InitWindow(
const SWindowInfo &inWindowInfo );
Parameters:

The parameter for this method is:

 

const   SWindowInfo&  
inWindowInfo  
The Superwindow information.  

Return:

None

InvalPortRect()

Purpose:

This method calls InvalRect() to invalidate the port rectangle. This is an override of InvalPortRect() in LPane.

InvalPortRgn()

Purpose:

This method calls InvalRgn(). This is an override of InvalPortRgn() in LPane.

MakeMacWindow()

Purpose:

Make a new Mac Window from a WIND resource template.

Access:

Private

Prototype:

void MakeMacWindow( SInt16 inWINDid );
Parameters:

The parameter for this method is:

 

SInt16  
inWINDid  
The resource ID of the WIND template.  

Return:

None

MakeSelfSpecifier()

Purpose:

AppleEvent Object Model Support

Access:

Virtual, Public

Prototype:

virtual void MakeSelfSpecifier(
AEDesc &inSuperSpecifier,
AEDesc &outSelfSpecifier ) const;
Parameters:

The parameters for this method are:

 

AEDesc&  
inSuperSpecifier  
The AppleEvent super specifier.  
AEDesc&  
outSelfSpecifier  
The AppleEvent self specifier.  

Return:

None

MoveWindowBy()

Purpose:

Moves a Window.

Access:

Public

Prototype:

void MoveWindowBy(
SInt16 inHorizDelta,
SInt16 inVertDelta );
Parameters:

The parameters for this method are:

 

SInt16  
inHorizDelta  
The amount to move the window in the horizontal directions.  
SInt16  
inVertDelta  
The amount to move the window in the vertical directions.  

Return:

None

MoveWindowTo()

Purpose:

Move the top left corner of the Window's port rect to the specified location in Global coordinates.

Access:

Public

Prototype:

void MoveWindowTo(
SInt16 inHoriz,
SInt16 inVert );
Parameters:

The parameters for this method are:

 

SInt16  
inHoriz  
The horizontal place to move the window to.  
SInt16  
inVert  
The vertical place to move the window to.  

Return:

None

ObeyCommand()

Purpose:

Handle a command. This is an override of ObeyCommand() in LCommander.

PortToGlobalPoint()

Purpose:

Convert a point from Port to Global (screen) coordinates. Refer to the discussion for GlobalToPortPoint() for more comments. This is an override of PortToGlobalPoint() in LPane.

ResizeFrameBy()

Purpose:

Change the Frame size by the specified amounts. This is an override of ResizeFrameBy() in LPane.

ResizeWindowBy()

Purpose:

Change the size of a Window by the specified number of pixels.

Access:

Public

Prototype:

void ResizeWindowBy(
SInt16 inWidthDelta,
SInt16 inHeightDelta );
Parameters:

The parameters for this method are:

 

SInt16  
inWidthDelta  
The horizontal width change to resize the window by.  
SInt16  
inHeightDelta  
The vertical height change to resize the window by.  

Return:

None

ResizeWindowTo()

Purpose:

Change the size of a Window to the specified width and height (in pixels).

Access:

Public

Prototype:

void ResizeWindowTo( SInt16 inWidth, SInt16 
inHeight );
Parameters:

The parameters for this method are:

 

SInt16  
inWidth  
The horizontal width for the Window.  
SInt16  
inHeight  
The vertical height for the Window.  

Return:

None

Resume()

Purpose:

Brings the window to the front.

Access:

Virtual, Public

Prototype:

virtual void Resume();
Parameters:

None

Return:

None

Select()

Purpose:

Selects the Window.

Access:

Virtual, Public

Prototype:

virtual void Select();
Parameters:

None

Return:

None

SendAESetBounds()

Purpose:

AppleEvent for changing the size of a Window.

inBounds is the new port rectangle for the Window, in Global coordinates. Set inExecuteAE to true to actually resize the Window, false to just send the event for script recording purposes.

Access:

Public

Prototype:

virtual void SendAESetBounds(
Rect *inBounds,
Boolean inExecuteAE );
Parameters:

The parameters for this method are:

 

Rect*  
inBounds  
The new port rectangle for the Window, in Global coordinates.  
Boolean  
inExecuteAE  
Set true to actually resize the Window, false to   just send the event for script recording purposes.  

Return:

None

SendAESetPosition()

Purpose:

AppleEvent for moving a Window to a new position.

Access:

Public

Prototype:

virtual void SendAESetPosition(
Point inPosition,
Boolean inExecuteAE);
Parameters:

The parameters for this method are:

 

Point  
inPosition  
The location for the top left corner of the Window's port rectangle, in Global coordinates.  
Boolean  
inExecuteAE  
Set true to actually resize the Window, false to   just send the event for script recording purposes.  

Return:

None

Remarks:

You'll use the false value for inExecuteAE when you have already moved the window in response to tracking user actions (the Toolbox trap DragWindow moves the Window).

SendAESetZoom()

Purpose:

AppleEvent for zooming a Window.

This method figures out whether to zoom in or out based on the current window size and location

Access:

Public

Prototype:

virtual void SendAESetZoom();
Parameters:

None

Return:

None

SetAEProperty()

Purpose:

Set the AppleEvent property.

Access:

Virtual, Public

Prototype:

virtual void SetAEProperty(
DescType inProperty,
const AEDesc &inValue,
AEDesc& outAEReply );
Parameters:

The parameters for this method are:

 

DescType  
inProperty  
The property descriptor.  
const   AEDesc&  
inValue  
The AppleEvent descriptor.  
AEDesc&  
outAEReply  
The AppleEvent reply.  

Return:

None

SetAttribute()

Purpose:

Sets an attribute for the Window.

Access:

Public

Prototype:

void SetAttribute( EWindAttr inAttribute );
Parameters:

The parameter for this method is:

 

EWindAttr  
inAttribute  
The attribute for the Window.  

Return:

None

SetDescriptor()

Purpose:

Set the title of a Window. This is an override of SetDescriptor() in LPane.

SetForeAndBackColors()

Purpose:

Specify the foreground and/or background colors of a Window. This is an override of SetForeAndBackColors() in LPane.

SetMinMaxSize()

Purpose:

This is an accessor method for mMinMaxSize.

Access:

Public

Prototype:

void SetMinMaxSize( const Rect &inRect );
Parameters:

The parameter for this method is:

 

const Rect&  
inRect  
The Rect to set mMinMaxSize to.  

Return:

None

SetStandardSize()

Purpose:

Set the standard size (mStandardSize) for the Window.

Access:

Public

Prototype:

void SetStandardSize( SDimension16 inStdSize );
Parameters:

The parameter for this method is:

 

SDimension16  
inStdSize  
The Window's standard size (set the value of mStandardSize from this).  

Return:

None

Show()

Purpose:

Make a Window visible. This is an override of Show() in LPane.

ShowSelf()

Purpose:

Window is being made visible. This is an override of ShowSelf() in LPane.

Suspend()

Purpose:

This method hides the window if the windAttr_HideOnSuspend attribute is present, else it deactivates the window if it is active and suspend occurs.

Access:

Virtual, Public

Prototype:

virtual void Suspend();
Parameters:

None

Return:

None

UpdatePort()

Purpose:

Redraw invalidated area of the Window. The Mac WindowPtr maintains an update region that defines the area that needs to be redrawn. This is an override of UpdatePort() in LPane.

ValidPortRect()

Purpose:

This method calls ValidRect(). This is an override of ValidPortRect() in LPane.

ValidPortRgn()

Purpose:

This method calls ValidRect(). This is an override of ValidPortRgn() in LPane.

mMacWindowP

Purpose:

This stores the Mac OS WindowPtr.

Access:

Protected

Prototype:

WindowPtr mMacWindowP;

mMinMaxSize

Purpose:

This stores the min and max size for the Window.

Access:

Protected

Prototype:

Rect mMinMaxSize;

mStandardSize

Purpose:

This stores the standard size for the Window.

Access:

Protected

Prototype:

SDimension16 mStandardSize;

mUserBounds

Purpose:

This stores the user bounds Rect for the Window.

Access:

Protected

Prototype:

Rect mUserBounds;

mAttributes

Purpose:

This stores the attributes for the Window.

Access:

Protected

Prototype:

UInt32 mAttributes;

mForeColor

Purpose:

This stores the foreground color for the Window.

Access:

Protected

Prototype:

RGBColor mForeColor;

mBackColor

Purpose:

This stores the background color for the Window.

Access:

Protected

Prototype:

RGBColor mBackColor;

mMoveOnlyUserZoom

Purpose:

This stores information about zooming a Window that is at standard size, but is partially offscreen.

Access:

Protected

Prototype:

Boolean mMoveOnlyUserZoom;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000